mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
Update classes to use DSM over CM
This commit is contained in:
parent
80163c0d8f
commit
2c8b8658a3
@ -195,7 +195,7 @@ public final class ExperienceAPI {
|
||||
* @throws InvalidXPGainReasonException if the given xpGainReason is not valid
|
||||
*/
|
||||
public static void addMultipliedXP(Player player, String skillType, int XP, String xpGainReason) {
|
||||
getPlayer(player).applyXpGain(getSkillType(skillType), (int) (XP * mcMMO.getConfigManager().getExperienceMapManager().getGlobalXpMult()), getXPGainReason(xpGainReason), XPGainSource.CUSTOM);
|
||||
getPlayer(player).applyXpGain(getSkillType(skillType), (int) (XP * mcMMO.getDynamicSettingsManager().getExperienceMapManager().getGlobalXpMult()), getXPGainReason(xpGainReason), XPGainSource.CUSTOM);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -211,7 +211,7 @@ public final class ExperienceAPI {
|
||||
*/
|
||||
@Deprecated
|
||||
public static void addMultipliedXPOffline(String playerName, String skillType, int XP) {
|
||||
addOfflineXP(playerName, getSkillType(skillType), (int) (XP * mcMMO.getConfigManager().getExperienceMapManager().getGlobalXpMult()));
|
||||
addOfflineXP(playerName, getSkillType(skillType), (int) (XP * mcMMO.getDynamicSettingsManager().getExperienceMapManager().getGlobalXpMult()));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -262,11 +262,11 @@ public final class ExperienceAPI {
|
||||
PrimarySkillType skill = getSkillType(skillType);
|
||||
|
||||
if (isUnshared) {
|
||||
getPlayer(player).beginUnsharedXpGain(skill, (int) (XP / skill.getXpModifier() * mcMMO.getConfigManager().getExperienceMapManager().getGlobalXpMult()), getXPGainReason(xpGainReason), XPGainSource.CUSTOM);
|
||||
getPlayer(player).beginUnsharedXpGain(skill, (int) (XP / skill.getXpModifier() * mcMMO.getDynamicSettingsManager().getExperienceMapManager().getGlobalXpMult()), getXPGainReason(xpGainReason), XPGainSource.CUSTOM);
|
||||
return;
|
||||
}
|
||||
|
||||
getPlayer(player).applyXpGain(skill, (int) (XP / skill.getXpModifier() * mcMMO.getConfigManager().getExperienceMapManager().getGlobalXpMult()), getXPGainReason(xpGainReason), XPGainSource.CUSTOM);
|
||||
getPlayer(player).applyXpGain(skill, (int) (XP / skill.getXpModifier() * mcMMO.getDynamicSettingsManager().getExperienceMapManager().getGlobalXpMult()), getXPGainReason(xpGainReason), XPGainSource.CUSTOM);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -284,7 +284,7 @@ public final class ExperienceAPI {
|
||||
public static void addModifiedXPOffline(String playerName, String skillType, int XP) {
|
||||
PrimarySkillType skill = getSkillType(skillType);
|
||||
|
||||
addOfflineXP(playerName, skill, (int) (XP / skill.getXpModifier() * mcMMO.getConfigManager().getExperienceMapManager().getGlobalXpMult()));
|
||||
addOfflineXP(playerName, skill, (int) (XP / skill.getXpModifier() * mcMMO.getDynamicSettingsManager().getExperienceMapManager().getGlobalXpMult()));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1000,8 +1000,8 @@ public final class ExperienceAPI {
|
||||
public static void addXpFromBlocks(ArrayList<BlockState> blockStates, McMMOPlayer mcMMOPlayer) {
|
||||
for (BlockState bs : blockStates) {
|
||||
for (PrimarySkillType skillType : PrimarySkillType.values()) {
|
||||
if (mcMMO.getConfigManager().getExperienceMapManager().getBlockBreakXpValue(skillType, bs.getType()) > 0) {
|
||||
mcMMOPlayer.applyXpGain(skillType, mcMMO.getConfigManager().getExperienceMapManager().getBlockBreakXpValue(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
||||
if (mcMMO.getDynamicSettingsManager().getExperienceMapManager().getBlockBreakXpValue(skillType, bs.getType()) > 0) {
|
||||
mcMMOPlayer.applyXpGain(skillType, mcMMO.getDynamicSettingsManager().getExperienceMapManager().getBlockBreakXpValue(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1016,8 +1016,8 @@ public final class ExperienceAPI {
|
||||
*/
|
||||
public static void addXpFromBlocksBySkill(ArrayList<BlockState> blockStates, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType) {
|
||||
for (BlockState bs : blockStates) {
|
||||
if (mcMMO.getConfigManager().getExperienceMapManager().getBlockBreakXpValue(skillType, bs.getType()) > 0) {
|
||||
mcMMOPlayer.applyXpGain(skillType, mcMMO.getConfigManager().getExperienceMapManager().getBlockBreakXpValue(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
||||
if (mcMMO.getDynamicSettingsManager().getExperienceMapManager().getBlockBreakXpValue(skillType, bs.getType()) > 0) {
|
||||
mcMMOPlayer.applyXpGain(skillType, mcMMO.getDynamicSettingsManager().getExperienceMapManager().getBlockBreakXpValue(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1030,8 +1030,8 @@ public final class ExperienceAPI {
|
||||
*/
|
||||
public static void addXpFromBlock(BlockState blockState, McMMOPlayer mcMMOPlayer) {
|
||||
for (PrimarySkillType skillType : PrimarySkillType.values()) {
|
||||
if (mcMMO.getConfigManager().getExperienceMapManager().getBlockBreakXpValue(skillType, blockState.getType()) > 0) {
|
||||
mcMMOPlayer.applyXpGain(skillType, mcMMO.getConfigManager().getExperienceMapManager().getBlockBreakXpValue(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
||||
if (mcMMO.getDynamicSettingsManager().getExperienceMapManager().getBlockBreakXpValue(skillType, blockState.getType()) > 0) {
|
||||
mcMMOPlayer.applyXpGain(skillType, mcMMO.getDynamicSettingsManager().getExperienceMapManager().getBlockBreakXpValue(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1044,8 +1044,8 @@ public final class ExperienceAPI {
|
||||
* @param skillType target primary skill
|
||||
*/
|
||||
public static void addXpFromBlockBySkill(BlockState blockState, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType) {
|
||||
if (mcMMO.getConfigManager().getExperienceMapManager().getBlockBreakXpValue(skillType, blockState.getType()) > 0) {
|
||||
mcMMOPlayer.applyXpGain(skillType, mcMMO.getConfigManager().getExperienceMapManager().getBlockBreakXpValue(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
||||
if (mcMMO.getDynamicSettingsManager().getExperienceMapManager().getBlockBreakXpValue(skillType, blockState.getType()) > 0) {
|
||||
mcMMOPlayer.applyXpGain(skillType, mcMMO.getDynamicSettingsManager().getExperienceMapManager().getBlockBreakXpValue(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class XprateCommand implements TabExecutor {
|
||||
private final double ORIGINAL_XP_RATE = mcMMO.getConfigManager().getExperienceMapManager().getGlobalXpMult();
|
||||
private final double ORIGINAL_XP_RATE = mcMMO.getDynamicSettingsManager().getExperienceMapManager().getGlobalXpMult();
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@ -48,7 +48,7 @@ public class XprateCommand implements TabExecutor {
|
||||
mcMMO.p.toggleXpEventEnabled();
|
||||
}
|
||||
|
||||
mcMMO.getConfigManager().getExperienceMapManager().resetGlobalXpMult();
|
||||
mcMMO.getDynamicSettingsManager().getExperienceMapManager().resetGlobalXpMult();
|
||||
return true;
|
||||
|
||||
case 2:
|
||||
@ -76,7 +76,7 @@ public class XprateCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
mcMMO.getConfigManager().getExperienceMapManager().setGlobalXpMult(newXpRate);
|
||||
mcMMO.getDynamicSettingsManager().getExperienceMapManager().setGlobalXpMult(newXpRate);
|
||||
|
||||
if (mcMMO.p.isXPEventEnabled()) {
|
||||
if (AdvancedConfig.getInstance().useTitlesForXPEvent()) {
|
||||
|
@ -143,11 +143,6 @@ public class AdvancedConfig extends ConfigValidated {
|
||||
return mcMMO.getConfigManager().getAdvancedConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unload() {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
/**
|
||||
* The version of this config
|
||||
*
|
||||
|
@ -18,7 +18,7 @@ import java.util.List;
|
||||
/**
|
||||
* Handles loading and cacheing configuration settings from a configurable compatible config file
|
||||
*/
|
||||
public abstract class Config implements VersionedConfig, Unload {
|
||||
public abstract class Config implements VersionedConfig {
|
||||
|
||||
public static final String HOCON_FILE_EXTENSION = ".conf";
|
||||
public final File DIRECTORY_DATA_FOLDER; //Directory that the file is in
|
||||
@ -95,18 +95,9 @@ public abstract class Config implements VersionedConfig, Unload {
|
||||
}
|
||||
|
||||
//Cleanup and backup registers
|
||||
registerUnload();
|
||||
registerFileBackup();
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers with the config managers unloader
|
||||
* The unloader runs when the plugin gets disabled which cleans up registries to make reloading safe
|
||||
*/
|
||||
private void registerUnload() {
|
||||
mcMMO.getConfigManager().registerUnloadable(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers with the config managers file list
|
||||
* Used for backing up configs with our zip library
|
||||
|
@ -39,11 +39,6 @@ public class CoreSkillsConfig extends Config {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unload() {
|
||||
//Nothing to do
|
||||
}
|
||||
|
||||
/*
|
||||
* Skill Settings
|
||||
*/
|
||||
|
@ -218,11 +218,6 @@ public class MainConfig extends ConfigValidated {
|
||||
return mcMMO.getConfigManager().getMainConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unload() {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
/**
|
||||
* The version of this config
|
||||
*
|
||||
|
@ -33,11 +33,6 @@ public class RankConfig extends ConfigValidated {
|
||||
return mcMMO.getConfigManager().getRankConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unload() {
|
||||
//Do nothing
|
||||
}
|
||||
|
||||
/**
|
||||
* The version of this config
|
||||
*
|
||||
|
@ -34,11 +34,6 @@ public class SoundConfig extends ConfigValidated {
|
||||
return mcMMO.getConfigManager().getSoundConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unload() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* The version of this config
|
||||
*
|
||||
|
@ -106,11 +106,6 @@ public class ExperienceConfig extends ConfigValidated {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unload() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> validateKeys() {
|
||||
List<String> reason = new ArrayList<>();
|
||||
|
@ -14,7 +14,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class ExcavationTreasureConfig extends Config implements UnsafeValueValidation, Registers {
|
||||
public class ExcavationTreasureConfig extends Config implements UnsafeValueValidation {
|
||||
public static final String EXCAVATION = "Archaeology";
|
||||
public static final String AMOUNT = "Amount";
|
||||
public static final String XP = "XP";
|
||||
@ -26,7 +26,6 @@ public class ExcavationTreasureConfig extends Config implements UnsafeValueValid
|
||||
|
||||
public ExcavationTreasureConfig() {
|
||||
super("excavation_drops", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, false, true, false);
|
||||
register();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -42,115 +41,6 @@ public class ExcavationTreasureConfig extends Config implements UnsafeValueValid
|
||||
return mcMMO.getConfigManager().getExcavationTreasureConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register stuff
|
||||
*/
|
||||
@Override
|
||||
public void register() {
|
||||
ConfigurationNode excavationTreasureNode = getUserRootNode().getNode(EXCAVATION);
|
||||
|
||||
if (excavationTreasureNode == null) {
|
||||
mcMMO.p.getLogger().info("Excavation treasures in treasures config not defined");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
for (ConfigurationNode treasureNode : excavationTreasureNode.getChildrenList()) {
|
||||
|
||||
String treasureName = treasureNode.getString();
|
||||
//Treasure Material Definition
|
||||
Material treasureMaterial = Material.matchMaterial(treasureName.toUpperCase());
|
||||
|
||||
if (treasureMaterial != null) {
|
||||
ConfigurationNode currentTreasure = excavationTreasureNode.getNode(treasureName);
|
||||
|
||||
//TODO: Rewrite the entire treasure system because it sucks
|
||||
|
||||
/*
|
||||
* TREASURE PARAMETERS
|
||||
*/
|
||||
int amount = currentTreasure.getNode(AMOUNT).getInt();
|
||||
int xp = currentTreasure.getNode(XP).getInt();
|
||||
double dropChance = currentTreasure.getNode(DROP_CHANCE).getDouble();
|
||||
int dropLevel = currentTreasure.getNode(DROP_LEVEL).getInt();
|
||||
String customName = null;
|
||||
|
||||
/*
|
||||
* PARAMETER INIT
|
||||
*/
|
||||
|
||||
ArrayList<String> dropsFrom = new ArrayList(currentTreasure.getNode("Drops_From").getList(TypeToken.of(String.class)));
|
||||
|
||||
//VALIDATE AMOUNT
|
||||
if (amount <= 0) {
|
||||
mcMMO.p.getLogger().severe("Excavation Treasure named " + treasureName + " in the config has an amount of 0 or below, is this intentional?");
|
||||
mcMMO.p.getLogger().severe("Skipping " + treasureName + " for being invalid");
|
||||
continue;
|
||||
}
|
||||
|
||||
//VALIDATE XP
|
||||
if (xp <= 0) {
|
||||
mcMMO.p.getLogger().info("Excavation Treasure named " + treasureName + " in the config has xp set to 0 or below, is this intentional?");
|
||||
xp = 0;
|
||||
}
|
||||
|
||||
//VALIDATE DROP CHANCE
|
||||
if (dropChance <= 0) {
|
||||
mcMMO.p.getLogger().severe("Excavation Treasure named " + treasureName + " in the config has a drop chance of 0 or below, is this intentional?");
|
||||
mcMMO.p.getLogger().severe("Skipping " + treasureName + " for being invalid");
|
||||
continue;
|
||||
}
|
||||
|
||||
//VALIDATE DROP LEVEL
|
||||
if (dropLevel < 0) {
|
||||
mcMMO.p.getLogger().info("Excavation Treasure named " + treasureName + " in the config has a drop level below 0, is this intentional?");
|
||||
dropLevel = 0;
|
||||
}
|
||||
|
||||
//VALIDATE DROP SOURCES
|
||||
if (dropsFrom == null || dropsFrom.isEmpty()) {
|
||||
mcMMO.p.getLogger().severe("Excavation Treasure named " + treasureName + " in the config has no drop targets, which would make it impossible to obtain, is this intentional?");
|
||||
mcMMO.p.getLogger().severe("Skipping " + treasureName + " for being invalid");
|
||||
continue;
|
||||
}
|
||||
|
||||
/* OPTIONAL PARAMETERS */
|
||||
|
||||
//Custom Name
|
||||
|
||||
if (currentTreasure.getNode(CUSTOM_NAME) != null && !currentTreasure.getNode(CUSTOM_NAME).getString().equalsIgnoreCase("ChangeMe")) {
|
||||
customName = currentTreasure.getNode(CUSTOM_NAME).getString();
|
||||
}
|
||||
|
||||
/*
|
||||
* REGISTER TREASURE
|
||||
*/
|
||||
|
||||
ExcavationTreasure excavationTreasure = TreasureFactory.makeExcavationTreasure(treasureMaterial, amount, xp, dropChance, dropLevel, customName, currentTreasure.getNode(LORE));
|
||||
|
||||
/*
|
||||
* Add to map
|
||||
*/
|
||||
for (String dropBlock : dropsFrom) {
|
||||
excavationMap.computeIfAbsent(dropBlock, k -> new ArrayList<>());
|
||||
|
||||
excavationMap.get(dropBlock).add(excavationTreasure);
|
||||
}
|
||||
|
||||
} else {
|
||||
mcMMO.p.getLogger().severe("Excavation Treasure Config - Material named " + treasureName + " does not match any known material.");
|
||||
}
|
||||
}
|
||||
} catch (ObjectMappingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unload() {
|
||||
excavationMap.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> validateKeys() {
|
||||
return null;
|
||||
|
@ -20,7 +20,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class FishingTreasureConfig extends Config implements UnsafeValueValidation, Registers {
|
||||
public class FishingTreasureConfig extends Config implements UnsafeValueValidation {
|
||||
public static final String PLAYER = "PLAYER";
|
||||
public static final String INVENTORY = "INVENTORY";
|
||||
public static final String WHOLE_STACKS = "Whole_Stacks";
|
||||
@ -45,7 +45,6 @@ public class FishingTreasureConfig extends Config implements UnsafeValueValidati
|
||||
|
||||
public FishingTreasureConfig() {
|
||||
super("fishing_drops", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, false, true, false);
|
||||
register();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -61,121 +60,6 @@ public class FishingTreasureConfig extends Config implements UnsafeValueValidati
|
||||
return mcMMO.getConfigManager().getFishingTreasureConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register stuff
|
||||
*/
|
||||
@Override
|
||||
public void register() {
|
||||
/* FISHING TREASURES */
|
||||
|
||||
ConfigurationNode fishingTreasureNode = getUserRootNode().getNode(FISHING);
|
||||
|
||||
if (fishingTreasureNode == null) {
|
||||
mcMMO.p.getLogger().info("Fishing treasures in treasures config not defined");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Initialize fishing HashMap
|
||||
for (Rarity rarity : Rarity.values()) {
|
||||
if (!fishingRewards.containsKey(rarity)) {
|
||||
fishingRewards.put(rarity, (new ArrayList<>()));
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
for (ConfigurationNode treasureNode : fishingTreasureNode.getChildrenList()) {
|
||||
|
||||
String treasureName = treasureNode.getString();
|
||||
//Treasure Material Definition
|
||||
Material treasureMaterial = Material.matchMaterial(treasureName.toUpperCase());
|
||||
|
||||
if (treasureMaterial != null) {
|
||||
ConfigurationNode currentTreasure = fishingTreasureNode.getNode(treasureName);
|
||||
|
||||
//TODO: Rewrite the entire treasure system because it sucks
|
||||
|
||||
/*
|
||||
* TREASURE PARAMETERS
|
||||
*/
|
||||
int amount = currentTreasure.getNode(AMOUNT).getInt();
|
||||
int xp = currentTreasure.getNode(XP).getInt();
|
||||
String customName = null;
|
||||
|
||||
/*
|
||||
* PARAMETER INIT
|
||||
*/
|
||||
|
||||
ArrayList<String> dropsFrom = new ArrayList(currentTreasure.getNode(DROPS_FROM).getList(TypeToken.of(String.class)));
|
||||
|
||||
//VALIDATE AMOUNT
|
||||
if (amount <= 0) {
|
||||
mcMMO.p.getLogger().severe("Excavation Treasure named " + treasureName + " in the config has an amount of 0 or below, is this intentional?");
|
||||
mcMMO.p.getLogger().severe("Skipping " + treasureName + " for being invalid");
|
||||
continue;
|
||||
}
|
||||
|
||||
//VALIDATE XP
|
||||
if (xp <= 0) {
|
||||
mcMMO.p.getLogger().info("Excavation Treasure named " + treasureName + " in the config has xp set to 0 or below, is this intentional?");
|
||||
xp = 0;
|
||||
}
|
||||
|
||||
//VALIDATE DROP SOURCES
|
||||
if (dropsFrom == null || dropsFrom.isEmpty()) {
|
||||
mcMMO.p.getLogger().severe("Excavation Treasure named " + treasureName + " in the config has no drop targets, which would make it impossible to obtain, is this intentional?");
|
||||
mcMMO.p.getLogger().severe("Skipping " + treasureName + " for being invalid");
|
||||
continue;
|
||||
}
|
||||
|
||||
/* OPTIONAL PARAMETERS */
|
||||
|
||||
//Custom Name
|
||||
|
||||
if (currentTreasure.getNode(CUSTOM_NAME) != null && !currentTreasure.getNode(CUSTOM_NAME).getString().equalsIgnoreCase("ChangeMe")) {
|
||||
customName = currentTreasure.getNode(CUSTOM_NAME).getString();
|
||||
}
|
||||
|
||||
/*
|
||||
* REGISTER TREASURE
|
||||
*/
|
||||
|
||||
FishingTreasure fishingTreasure = TreasureFactory.makeFishingTreasure(treasureMaterial, amount, xp, customName, currentTreasure.getNode(LORE));
|
||||
|
||||
/*
|
||||
* Add to map
|
||||
*/
|
||||
|
||||
String configRarity = currentTreasure.getNode(RARITY).getString();
|
||||
|
||||
for (Rarity rarity : Rarity.values()) {
|
||||
if (rarity.toString().equalsIgnoreCase(configRarity)) {
|
||||
/*if(fishingRewards.get(rarity) == null)
|
||||
fishingRewards.put(rarity, new ArrayList<>());*/
|
||||
|
||||
fishingRewards.get(rarity).add(fishingTreasure);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
mcMMO.p.getLogger().severe("Excavation Treasure Config - Material named " + treasureName + " does not match any known material.");
|
||||
}
|
||||
}
|
||||
} catch (ObjectMappingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
//Shake
|
||||
for (EntityType entity : EntityType.values()) {
|
||||
if (entity.isAlive()) {
|
||||
loadShake(entity);
|
||||
}
|
||||
}
|
||||
|
||||
//Enchantments
|
||||
loadEnchantments();
|
||||
}
|
||||
|
||||
private void loadShake(EntityType entityType) {
|
||||
ConfigurationNode shakeTreasureNode = getUserRootNode().getNode(SHAKE, entityType.toString());
|
||||
|
||||
@ -306,13 +190,6 @@ public class FishingTreasureConfig extends Config implements UnsafeValueValidati
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unload() {
|
||||
shakeMap.clear();
|
||||
fishingRewards.clear();
|
||||
fishingEnchantments.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> validateKeys() {
|
||||
// Validate all the settings!
|
||||
|
@ -16,7 +16,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class HerbalismTreasureConfig extends Config implements UnsafeValueValidation, Registers {
|
||||
public class HerbalismTreasureConfig extends Config implements UnsafeValueValidation {
|
||||
public static final String HYLIAN_LUCK = "Hylian_Luck";
|
||||
public static final String AMOUNT = "Amount";
|
||||
public static final String XP = "XP";
|
||||
@ -29,7 +29,6 @@ public class HerbalismTreasureConfig extends Config implements UnsafeValueValida
|
||||
|
||||
public HerbalismTreasureConfig() {
|
||||
super("hylian_luck_drops", mcMMO.p.getDataFolder().getAbsoluteFile(), ConfigConstants.RELATIVE_PATH_CONFIG_DIR, true, false, true, false);
|
||||
register();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -45,141 +44,6 @@ public class HerbalismTreasureConfig extends Config implements UnsafeValueValida
|
||||
return mcMMO.getConfigManager().getHerbalismTreasureConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register stuff
|
||||
*/
|
||||
@Override
|
||||
public void register() {
|
||||
ConfigurationNode herbalismTreasureNode = getUserRootNode().getNode(HYLIAN_LUCK);
|
||||
|
||||
if (herbalismTreasureNode == null) {
|
||||
mcMMO.p.getLogger().info("Excavation treasures in treasures config not defined");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
for (ConfigurationNode treasureNode : herbalismTreasureNode.getChildrenList()) {
|
||||
|
||||
String treasureName = treasureNode.getString();
|
||||
//Treasure Material Definition
|
||||
Material treasureMaterial = Material.matchMaterial(treasureName.toUpperCase());
|
||||
|
||||
if (treasureMaterial != null) {
|
||||
ConfigurationNode currentTreasure = herbalismTreasureNode.getNode(treasureName);
|
||||
|
||||
//TODO: Rewrite the entire treasure system because it sucks
|
||||
|
||||
/*
|
||||
* TREASURE PARAMETERS
|
||||
*/
|
||||
int amount = currentTreasure.getNode(AMOUNT).getInt();
|
||||
int xp = currentTreasure.getNode(XP).getInt();
|
||||
double dropChance = currentTreasure.getNode(DROP_CHANCE).getDouble();
|
||||
int dropLevel = currentTreasure.getNode(DROP_LEVEL).getInt();
|
||||
String customName = null;
|
||||
|
||||
/*
|
||||
* PARAMETER INIT
|
||||
*/
|
||||
|
||||
ArrayList<String> dropsFrom = new ArrayList(currentTreasure.getNode("Drops_From").getList(TypeToken.of(String.class)));
|
||||
|
||||
//VALIDATE AMOUNT
|
||||
if (amount <= 0) {
|
||||
mcMMO.p.getLogger().severe("Herbalism Hylian Luck Treasure named " + treasureName + " in the config has an amount of 0 or below, is this intentional?");
|
||||
mcMMO.p.getLogger().severe("Skipping " + treasureName + " for being invalid");
|
||||
continue;
|
||||
}
|
||||
|
||||
//VALIDATE XP
|
||||
if (xp <= 0) {
|
||||
mcMMO.p.getLogger().info("Herbalism Hylian Luck Treasure named " + treasureName + " in the config has xp set to 0 or below, is this intentional?");
|
||||
xp = 0;
|
||||
}
|
||||
|
||||
//VALIDATE DROP CHANCE
|
||||
if (dropChance <= 0) {
|
||||
mcMMO.p.getLogger().severe("Herbalism Hylian Luck Treasure named " + treasureName + " in the config has a drop chance of 0 or below, is this intentional?");
|
||||
mcMMO.p.getLogger().severe("Skipping " + treasureName + " for being invalid");
|
||||
continue;
|
||||
}
|
||||
|
||||
//VALIDATE DROP LEVEL
|
||||
if (dropLevel < 0) {
|
||||
mcMMO.p.getLogger().info("Herbalism Hylian Luck Treasure named " + treasureName + " in the config has a drop level below 0, is this intentional?");
|
||||
dropLevel = 0;
|
||||
}
|
||||
|
||||
//VALIDATE DROP SOURCES
|
||||
if (dropsFrom == null || dropsFrom.isEmpty()) {
|
||||
mcMMO.p.getLogger().severe("Herbalism Hylian Luck Treasure named " + treasureName + " in the config has no drop targets, which would make it impossible to obtain, is this intentional?");
|
||||
mcMMO.p.getLogger().severe("Skipping " + treasureName + " for being invalid");
|
||||
continue;
|
||||
}
|
||||
|
||||
/* OPTIONAL PARAMETERS */
|
||||
|
||||
//Custom Name
|
||||
|
||||
if (currentTreasure.getNode(CUSTOM_NAME) != null && !currentTreasure.getNode(CUSTOM_NAME).getString().equalsIgnoreCase("ChangeMe")) {
|
||||
customName = currentTreasure.getNode(CUSTOM_NAME).getString();
|
||||
}
|
||||
|
||||
/*
|
||||
* REGISTER TREASURE
|
||||
*/
|
||||
|
||||
HylianTreasure hylianTreasure = TreasureFactory.makeHylianTreasure(treasureMaterial, amount, xp, dropChance, dropLevel, customName, currentTreasure.getNode(LORE));
|
||||
|
||||
/*
|
||||
* Add to map
|
||||
*/
|
||||
for (String dropBlock : dropsFrom) {
|
||||
if (dropBlock.equals("Bushes")) {
|
||||
addHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.FERN), hylianTreasure);
|
||||
addHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.TALL_GRASS), hylianTreasure);
|
||||
for (Material species : Tag.SAPLINGS.getValues())
|
||||
addHylianTreasure(StringUtils.getFriendlyConfigMaterialString(species), hylianTreasure);
|
||||
|
||||
addHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.DEAD_BUSH), hylianTreasure);
|
||||
continue;
|
||||
}
|
||||
if (dropBlock.equals("Flowers")) {
|
||||
addHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.POPPY), hylianTreasure);
|
||||
addHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.DANDELION), hylianTreasure);
|
||||
addHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.BLUE_ORCHID), hylianTreasure);
|
||||
addHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.ALLIUM), hylianTreasure);
|
||||
addHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.AZURE_BLUET), hylianTreasure);
|
||||
addHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.ORANGE_TULIP), hylianTreasure);
|
||||
addHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.PINK_TULIP), hylianTreasure);
|
||||
addHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.RED_TULIP), hylianTreasure);
|
||||
addHylianTreasure(StringUtils.getFriendlyConfigMaterialString(Material.WHITE_TULIP), hylianTreasure);
|
||||
continue;
|
||||
}
|
||||
if (dropBlock.equals("Pots")) {
|
||||
for (Material species : Tag.FLOWER_POTS.getValues())
|
||||
addHylianTreasure(StringUtils.getFriendlyConfigMaterialString(species), hylianTreasure);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
addHylianTreasure(dropBlock, hylianTreasure);
|
||||
}
|
||||
|
||||
} else {
|
||||
mcMMO.p.getLogger().severe("Excavation Treasure Config - Material named " + treasureName + " does not match any known material.");
|
||||
}
|
||||
}
|
||||
} catch (ObjectMappingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unload() {
|
||||
hylianMap.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> validateKeys() {
|
||||
return null;
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.gmail.nossr50.core;
|
||||
|
||||
import com.gmail.nossr50.config.Unload;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.bukkit.Material;
|
||||
|
||||
@ -10,7 +9,7 @@ import java.util.List;
|
||||
/**
|
||||
* Manages a collection of whitelisted materials for Double Drops
|
||||
*/
|
||||
public class BonusDropManager implements Unload {
|
||||
public class BonusDropManager {
|
||||
|
||||
private HashMap<Material, Boolean> bonusDropWhitelist;
|
||||
|
||||
@ -23,7 +22,6 @@ public class BonusDropManager implements Unload {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unload() {
|
||||
bonusDropWhitelist.clear();
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.gmail.nossr50.core;
|
||||
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
/**
|
||||
* This is a convenience class which stores the string representations of our metadata keys
|
||||
*/
|
||||
@ -26,4 +28,7 @@ public class MetadataConstants {
|
||||
public final static String GREEN_THUMB_METAKEY = "mcMMO: Green Thumb";
|
||||
public final static String DATABASE_PROCESSING_COMMAND_METAKEY = "mcMMO: Processing Database Command";
|
||||
public final static String BRED_ANIMAL_TRACKING_METAKEY = "mcMMO: Bred Animal";
|
||||
|
||||
public static FixedMetadataValue metadataValue; //Gains value in onEnable
|
||||
|
||||
}
|
||||
|
@ -775,7 +775,7 @@ public class McMMOPlayer {
|
||||
return 0;
|
||||
}
|
||||
|
||||
xp = (float) (xp / primarySkillType.getXpModifier() * mcMMO.getConfigManager().getExperienceMapManager().getGlobalXpMult());
|
||||
xp = (float) (xp / primarySkillType.getXpModifier() * mcMMO.getDynamicSettingsManager().getExperienceMapManager().getGlobalXpMult());
|
||||
|
||||
//Multiply by the players personal XP rate
|
||||
return xp * personalXPModifiers.get(primarySkillType);
|
||||
|
@ -63,7 +63,7 @@ public class BlockListener implements Listener {
|
||||
if (is.getAmount() <= 0)
|
||||
continue;
|
||||
|
||||
if (!mcMMO.getConfigManager().getBonusDropManager().isBonusDropWhitelisted(is.getType()))
|
||||
if (!mcMMO.getDynamicSettingsManager().getBonusDropManager().isBonusDropWhitelisted(is.getType()))
|
||||
continue;
|
||||
|
||||
//TODO: Should just store the amount of drops in the metadata itself and use a loop
|
||||
|
@ -57,7 +57,7 @@ public class EntityListener implements Listener {
|
||||
//Transfer metadata keys from mob-spawned mobs to new mobs
|
||||
if (event.getEntity().getMetadata(MetadataConstants.UNNATURAL_MOB_METAKEY) != null || event.getEntity().getMetadata(MetadataConstants.UNNATURAL_MOB_METAKEY).size() >= 1) {
|
||||
for (Entity entity : event.getTransformedEntities()) {
|
||||
entity.setMetadata(MetadataConstants.UNNATURAL_MOB_METAKEY, mcMMO.metadataValue);
|
||||
entity.setMetadata(MetadataConstants.UNNATURAL_MOB_METAKEY, MetadataConstants.metadataValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -70,7 +70,7 @@ public class EntityListener implements Listener {
|
||||
//Prevent entities from giving XP if they target endermite
|
||||
if (event.getTarget() instanceof Endermite) {
|
||||
if (event.getEntity().getMetadata(MetadataConstants.UNNATURAL_MOB_METAKEY) == null || event.getEntity().getMetadata(MetadataConstants.UNNATURAL_MOB_METAKEY).size() <= 0)
|
||||
event.getEntity().setMetadata(MetadataConstants.UNNATURAL_MOB_METAKEY, mcMMO.metadataValue);
|
||||
event.getEntity().setMetadata(MetadataConstants.UNNATURAL_MOB_METAKEY, MetadataConstants.metadataValue);
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ public class EntityListener implements Listener {
|
||||
ItemStack bow = event.getBow();
|
||||
|
||||
if (bow != null && bow.containsEnchantment(Enchantment.ARROW_INFINITE)) {
|
||||
projectile.setMetadata(MetadataConstants.INFINITE_ARROW_METAKEY, mcMMO.metadataValue);
|
||||
projectile.setMetadata(MetadataConstants.INFINITE_ARROW_METAKEY, MetadataConstants.metadataValue);
|
||||
}
|
||||
|
||||
projectile.setMetadata(MetadataConstants.BOW_FORCE_METAKEY, new FixedMetadataValue(plugin, Math.min(event.getForce() * AdvancedConfig.getInstance().getForceMultiplier(), 1.0)));
|
||||
@ -161,7 +161,7 @@ public class EntityListener implements Listener {
|
||||
|
||||
if (mcMMO.getPlaceStore().isTrue(block) && !isTracked) {
|
||||
mcMMO.getPlaceStore().setFalse(block);
|
||||
entity.setMetadata(MetadataConstants.UNNATURAL_MOB_METAKEY, mcMMO.metadataValue);
|
||||
entity.setMetadata(MetadataConstants.UNNATURAL_MOB_METAKEY, MetadataConstants.metadataValue);
|
||||
} else if (isTracked) {
|
||||
mcMMO.getPlaceStore().setTrue(block);
|
||||
}
|
||||
@ -618,18 +618,18 @@ public class EntityListener implements Listener {
|
||||
case SPAWNER:
|
||||
case SPAWNER_EGG:
|
||||
if (mcMMO.getConfigManager().getConfigExploitPrevention().doSpawnedEntitiesGiveModifiedXP()) {
|
||||
entity.setMetadata(MetadataConstants.UNNATURAL_MOB_METAKEY, mcMMO.metadataValue);
|
||||
entity.setMetadata(MetadataConstants.UNNATURAL_MOB_METAKEY, MetadataConstants.metadataValue);
|
||||
|
||||
Entity passenger = entity.getPassenger();
|
||||
|
||||
if (passenger != null) {
|
||||
passenger.setMetadata(MetadataConstants.UNNATURAL_MOB_METAKEY, mcMMO.metadataValue);
|
||||
passenger.setMetadata(MetadataConstants.UNNATURAL_MOB_METAKEY, MetadataConstants.metadataValue);
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
case BREEDING:
|
||||
entity.setMetadata(MetadataConstants.BRED_ANIMAL_TRACKING_METAKEY, mcMMO.metadataValue);
|
||||
entity.setMetadata(MetadataConstants.BRED_ANIMAL_TRACKING_METAKEY, MetadataConstants.metadataValue);
|
||||
return;
|
||||
|
||||
default:
|
||||
@ -869,7 +869,7 @@ public class EntityListener implements Listener {
|
||||
}
|
||||
|
||||
if (mcMMO.getConfigManager().getConfigExploitPrevention().doTamedEntitiesGiveXP())
|
||||
entity.setMetadata(MetadataConstants.UNNATURAL_MOB_METAKEY, mcMMO.metadataValue);
|
||||
entity.setMetadata(MetadataConstants.UNNATURAL_MOB_METAKEY, MetadataConstants.metadataValue);
|
||||
|
||||
//Profile not loaded
|
||||
//TODO: Redundant
|
||||
@ -953,7 +953,7 @@ public class EntityListener implements Listener {
|
||||
return;
|
||||
|
||||
if (event.getEntity().hasMetadata(MetadataConstants.UNNATURAL_MOB_METAKEY)) {
|
||||
event.getPigZombie().setMetadata(MetadataConstants.UNNATURAL_MOB_METAKEY, mcMMO.metadataValue);
|
||||
event.getPigZombie().setMetadata(MetadataConstants.UNNATURAL_MOB_METAKEY, MetadataConstants.metadataValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ public class PlayerListener implements Listener {
|
||||
ItemStack dropStack = drop.getItemStack();
|
||||
|
||||
if (ItemUtils.isSharable(dropStack)) {
|
||||
drop.setMetadata(MetadataConstants.DROPPED_ITEM_TRACKING_METAKEY, mcMMO.metadataValue);
|
||||
drop.setMetadata(MetadataConstants.DROPPED_ITEM_TRACKING_METAKEY, MetadataConstants.metadataValue);
|
||||
}
|
||||
|
||||
SkillUtils.removeAbilityBuff(dropStack);
|
||||
@ -520,7 +520,7 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
|
||||
if (plugin.isXPEventEnabled()) {
|
||||
player.sendMessage(LocaleLoader.getString("XPRate.Event", mcMMO.getConfigManager().getExperienceMapManager().getGlobalXpMult()));
|
||||
player.sendMessage(LocaleLoader.getString("XPRate.Event", mcMMO.getDynamicSettingsManager().getExperienceMapManager().getGlobalXpMult()));
|
||||
}
|
||||
|
||||
//TODO: Remove this warning
|
||||
|
@ -119,7 +119,7 @@ public class SelfListener implements Listener {
|
||||
|
||||
float guaranteedMinimum = ExperienceConfig.getInstance().getDiminishedReturnsCap() * rawXp;
|
||||
|
||||
float modifiedThreshold = (float) (threshold / primarySkillType.getXpModifier() * mcMMO.getConfigManager().getExperienceMapManager().getGlobalXpMult());
|
||||
float modifiedThreshold = (float) (threshold / primarySkillType.getXpModifier() * mcMMO.getDynamicSettingsManager().getExperienceMapManager().getGlobalXpMult());
|
||||
float difference = (mcMMOPlayer.getProfile().getRegisteredXpGain(primarySkillType) - modifiedThreshold) / modifiedThreshold;
|
||||
|
||||
if (difference > 0) {
|
||||
|
@ -11,6 +11,7 @@ import com.gmail.nossr50.config.hocon.party.ConfigSectionPartyLevel;
|
||||
import com.gmail.nossr50.config.hocon.playerleveling.ConfigLeveling;
|
||||
import com.gmail.nossr50.config.hocon.scoreboard.ConfigScoreboard;
|
||||
import com.gmail.nossr50.core.DynamicSettingsManager;
|
||||
import com.gmail.nossr50.core.MetadataConstants;
|
||||
import com.gmail.nossr50.database.DatabaseManager;
|
||||
import com.gmail.nossr50.database.DatabaseManagerFactory;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
@ -55,7 +56,6 @@ public class mcMMO extends JavaPlugin {
|
||||
public static mcMMO p;
|
||||
// Jar Stuff
|
||||
public static File mcMMOFile;
|
||||
public static FixedMetadataValue metadataValue;
|
||||
/* Managers */
|
||||
private static ChunkManager placeStore;
|
||||
private static ConfigManager configManager;
|
||||
@ -92,7 +92,7 @@ public class mcMMO extends JavaPlugin {
|
||||
/*getLogger().info(Bukkit.getBukkitVersion());
|
||||
getLogger().info(Bukkit.getVersion());*/
|
||||
|
||||
metadataValue = new FixedMetadataValue(this, true);
|
||||
MetadataConstants.metadataValue = new FixedMetadataValue(this, true);
|
||||
|
||||
PluginManager pluginManager = getServer().getPluginManager();
|
||||
healthBarPluginEnabled = pluginManager.getPlugin("HealthBar") != null;
|
||||
|
@ -24,7 +24,7 @@ public class Excavation {
|
||||
}
|
||||
|
||||
protected static int getBlockXP(BlockState blockState) {
|
||||
int xp = mcMMO.getConfigManager().getExperienceMapManager().getExcavationXp(blockState.getType());
|
||||
int xp = mcMMO.getDynamicSettingsManager().getExperienceMapManager().getExcavationXp(blockState.getType());
|
||||
|
||||
return xp;
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ public class FishingManager extends SkillManager {
|
||||
if (fishHook.getMetadata(MetadataConstants.FISH_HOOK_REF_METAKEY).size() > 0)
|
||||
return;
|
||||
|
||||
fishHook.setMetadata(MetadataConstants.FISH_HOOK_REF_METAKEY, mcMMO.metadataValue);
|
||||
fishHook.setMetadata(MetadataConstants.FISH_HOOK_REF_METAKEY, MetadataConstants.metadataValue);
|
||||
fishHookSpawnTimestamp = System.currentTimeMillis();
|
||||
fishingRodCastTimestamp = System.currentTimeMillis();
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ public class HerbalismManager extends SkillManager {
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
xp = mcMMO.getConfigManager().getExperienceMapManager().getHerbalismXp(blockState.getType());
|
||||
xp = mcMMO.getDynamicSettingsManager().getExperienceMapManager().getHerbalismXp(blockState.getType());
|
||||
|
||||
if (!oneBlockPlant) {
|
||||
//Kelp is actually two blocks mixed together
|
||||
|
@ -32,7 +32,7 @@ public class Mining {
|
||||
* @param blockState The {@link BlockState} to check ability activation for
|
||||
*/
|
||||
public static int getBlockXp(BlockState blockState) {
|
||||
int xp = mcMMO.getConfigManager().getExperienceMapManager().getMiningXp(blockState.getType());
|
||||
int xp = mcMMO.getDynamicSettingsManager().getExperienceMapManager().getMiningXp(blockState.getType());
|
||||
|
||||
return xp;
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ public class TamingManager extends SkillManager {
|
||||
* @param entity The LivingEntity to award XP for
|
||||
*/
|
||||
public void awardTamingXP(LivingEntity entity) {
|
||||
applyXpGain(mcMMO.getConfigManager().getExperienceMapManager().getTamingXp(entity.getType()), XPGainReason.PVE);
|
||||
applyXpGain(mcMMO.getDynamicSettingsManager().getExperienceMapManager().getTamingXp(entity.getType()), XPGainReason.PVE);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -308,7 +308,7 @@ public class TamingManager extends SkillManager {
|
||||
continue;
|
||||
}
|
||||
|
||||
entity.setMetadata(MetadataConstants.UNNATURAL_MOB_METAKEY, mcMMO.metadataValue);
|
||||
entity.setMetadata(MetadataConstants.UNNATURAL_MOB_METAKEY, MetadataConstants.metadataValue);
|
||||
((Tameable) entity).setOwner(player);
|
||||
entity.setRemoveWhenFarAway(false);
|
||||
|
||||
|
@ -43,7 +43,7 @@ public final class Woodcutting {
|
||||
return mcMMO.getModManager().getBlock(blockState).getXpGain();
|
||||
}*/
|
||||
|
||||
return mcMMO.getConfigManager().getExperienceMapManager().getWoodcuttingXp(blockState.getType());
|
||||
return mcMMO.getDynamicSettingsManager().getExperienceMapManager().getWoodcuttingXp(blockState.getType());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -42,7 +42,7 @@ public final class BlockUtils {
|
||||
* @return true if the player succeeded in the check
|
||||
*/
|
||||
public static boolean checkDoubleDrops(Player player, BlockState blockState, SubSkillType subSkillType) {
|
||||
if (mcMMO.getConfigManager().isBonusDropsEnabled(blockState.getType()) && Permissions.isSubSkillEnabled(player, subSkillType)) {
|
||||
if (mcMMO.getDynamicSettingsManager().isBonusDropsEnabled(blockState.getType()) && Permissions.isSubSkillEnabled(player, subSkillType)) {
|
||||
return RandomChanceUtil.checkRandomChanceExecutionSuccess(new RandomChanceSkill(player, subSkillType, true));
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ public final class BlockUtils {
|
||||
* @return true if the block should affected by Green Terra, false otherwise
|
||||
*/
|
||||
public static boolean affectedByGreenTerra(BlockState blockState) {
|
||||
return mcMMO.getConfigManager().getExperienceMapManager().hasHerbalismXp(blockState.getType());
|
||||
return mcMMO.getDynamicSettingsManager().getExperienceMapManager().hasHerbalismXp(blockState.getType());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -139,7 +139,7 @@ public final class BlockUtils {
|
||||
* @return true if the block should affected by Green Terra, false otherwise
|
||||
*/
|
||||
public static boolean affectedByGreenTerra(Material material) {
|
||||
return mcMMO.getConfigManager().getExperienceMapManager().hasHerbalismXp(material);
|
||||
return mcMMO.getDynamicSettingsManager().getExperienceMapManager().hasHerbalismXp(material);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -150,7 +150,7 @@ public final class BlockUtils {
|
||||
* otherwise
|
||||
*/
|
||||
public static Boolean affectedBySuperBreaker(BlockState blockState) {
|
||||
if (mcMMO.getConfigManager().getExperienceMapManager().hasMiningXp(blockState.getType()))
|
||||
if (mcMMO.getDynamicSettingsManager().getExperienceMapManager().hasMiningXp(blockState.getType()))
|
||||
return true;
|
||||
|
||||
return isMineable(blockState);
|
||||
@ -164,7 +164,7 @@ public final class BlockUtils {
|
||||
* otherwise
|
||||
*/
|
||||
public static Boolean affectedBySuperBreaker(Material material) {
|
||||
if (mcMMO.getConfigManager().getExperienceMapManager().hasMiningXp(material))
|
||||
if (mcMMO.getDynamicSettingsManager().getExperienceMapManager().hasMiningXp(material))
|
||||
return true;
|
||||
|
||||
return isMineable(material);
|
||||
@ -215,7 +215,7 @@ public final class BlockUtils {
|
||||
* otherwise
|
||||
*/
|
||||
public static boolean affectedByGigaDrillBreaker(Material material) {
|
||||
if (mcMMO.getConfigManager().getExperienceMapManager().hasExcavationXp(material))
|
||||
if (mcMMO.getDynamicSettingsManager().getExperienceMapManager().hasExcavationXp(material))
|
||||
return true;
|
||||
|
||||
return isDiggable(material);
|
||||
@ -229,7 +229,7 @@ public final class BlockUtils {
|
||||
* otherwise
|
||||
*/
|
||||
public static boolean affectedByGigaDrillBreaker(BlockState blockState) {
|
||||
if (mcMMO.getConfigManager().getExperienceMapManager().hasExcavationXp(blockState.getType()))
|
||||
if (mcMMO.getDynamicSettingsManager().getExperienceMapManager().hasExcavationXp(blockState.getType()))
|
||||
return true;
|
||||
|
||||
return isDiggable(blockState);
|
||||
@ -281,7 +281,7 @@ public final class BlockUtils {
|
||||
* @return true if the block is a log, false otherwise
|
||||
*/
|
||||
public static boolean isLog(BlockState blockState) {
|
||||
if (mcMMO.getConfigManager().getExperienceMapManager().hasWoodcuttingXp(blockState.getType()))
|
||||
if (mcMMO.getDynamicSettingsManager().getExperienceMapManager().hasWoodcuttingXp(blockState.getType()))
|
||||
return true;
|
||||
|
||||
return isLoggingRelated(blockState);
|
||||
@ -295,7 +295,7 @@ public final class BlockUtils {
|
||||
* @return true if the block is a log, false otherwise
|
||||
*/
|
||||
public static boolean isLog(Material material) {
|
||||
if (mcMMO.getConfigManager().getExperienceMapManager().hasWoodcuttingXp(material))
|
||||
if (mcMMO.getDynamicSettingsManager().getExperienceMapManager().hasWoodcuttingXp(material))
|
||||
return true;
|
||||
|
||||
return isLoggingRelated(material);
|
||||
|
@ -33,7 +33,7 @@ public class RandomChanceSkill implements RandomChanceExecution {
|
||||
|
||||
public RandomChanceSkill(Player player, SubSkillType subSkillType, boolean hasCap) {
|
||||
if (hasCap)
|
||||
this.probabilityCap = mcMMO.getConfigManager().getSkillMaxChance(subSkillType);
|
||||
this.probabilityCap = mcMMO.getDynamicSettingsManager().getSkillMaxChance(subSkillType);
|
||||
else
|
||||
this.probabilityCap = RandomChanceUtil.LINEAR_CURVE_VAR;
|
||||
|
||||
@ -86,7 +86,7 @@ public class RandomChanceSkill implements RandomChanceExecution {
|
||||
* @return the maximum bonus from skill level for this skill
|
||||
*/
|
||||
public double getMaximumBonusLevelCap() {
|
||||
return mcMMO.getConfigManager().getSkillMaxBonusLevel(subSkillType);
|
||||
return mcMMO.getDynamicSettingsManager().getSkillMaxBonusLevel(subSkillType);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -438,7 +438,7 @@ public final class CombatUtils {
|
||||
return;
|
||||
}
|
||||
|
||||
target.setMetadata(MetadataConstants.CUSTOM_DAMAGE_METAKEY, mcMMO.metadataValue);
|
||||
target.setMetadata(MetadataConstants.CUSTOM_DAMAGE_METAKEY, MetadataConstants.metadataValue);
|
||||
target.damage(damage, attacker);
|
||||
|
||||
// //IFrame storage
|
||||
|
Loading…
Reference in New Issue
Block a user