diff --git a/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java b/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java index b9e32ef72..5870110e2 100644 --- a/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java +++ b/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java @@ -115,57 +115,6 @@ public class ExperienceConfig extends ConfigValidated { public List validateKeys() { List reason = new ArrayList<>(); - /* - * FORMULA SETTINGS - */ - - /* Global modifier */ - if (getExperienceGainsGlobalMultiplier() <= 0) { - reason.add(EXPERIENCE_FORMULA + "." + MULTIPLIER + "." + GLOBAL + " should be greater than 0!"); - } - - /* PVP modifier */ - if (getPlayerVersusPlayerXP() < 0) { - reason.add(EXPERIENCE_FORMULA + "." + MULTIPLIER + "." + PVP + " should be at least 0!"); - } - - /* Spawned Mob modifier */ - if (getSpawnedMobXpMultiplier() < 0) { - reason.add(EXPERIENCE_FORMULA + "." + MOBSPAWNERS + "." + MULTIPLIER + " should be at least 0!"); - } - - /* Bred Mob modifier */ - if (getBredMobXpMultiplier() < 0) { - reason.add(EXPERIENCE_FORMULA + "." + BREEDING + "." + MULTIPLIER + " should be at least 0!"); - } - - /* Conversion */ - if (getExpModifier() <= 0) { - reason.add(CONVERSION + "." + EXP + MODIFIER + " should be greater than 0!"); - } - - /* - * XP SETTINGS - */ - /* Combat XP Multipliers */ - if (getAnimalsXP() < 0) { - reason.add(EXPERIENCE + "." + COMBAT + "." + MULTIPLIER + "." + ANIMALS + " should be at least 0!"); - } - - /* Repair */ - if (getRepairXPBase() <= 0) { - reason.add(EXPERIENCE + "." + REPAIR + "." + BASE1 + " should be greater than 0!"); - } - - /* Taming */ - if (getTamingXP(EntityType.WOLF) <= 0) { - reason.add(EXPERIENCE + "." + TAMING + "." + ANIMAL_TAMING + "." + WOLF + " should be greater than 0!"); - } - - if (getTamingXP(EntityType.OCELOT) <= 0) { - reason.add(EXPERIENCE + "." + TAMING + "." + ANIMAL_TAMING + "." + OCELOT + " should be greater than 0!"); - } - return reason; } @@ -173,11 +122,6 @@ public class ExperienceConfig extends ConfigValidated { * FORMULA SETTINGS */ - /* Curve settings */ - public boolean getCumulativeCurveEnabled() { - return getBooleanValue(EXPERIENCE_FORMULA, CUMULATIVE + CURVE); - } - /* Global modifier */ public double getExperienceGainsGlobalMultiplier() { return getDoubleValue(EXPERIENCE_FORMULA, MULTIPLIER, GLOBAL); diff --git a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperience.java b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperience.java index bc4a6a898..a9517b114 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperience.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperience.java @@ -191,4 +191,16 @@ public class ConfigExperience { public int getShakeXP() { return experienceFishing.getShakeXP(); } + + public double getMobSpawnerXPMult() { + return experienceCombat.getMobSpawnerXPMult(); + } + + public double getPVPXPMult() { + return experienceCombat.getPVPXPMult(); + } + + public double getAnimalsXPMult() { + return experienceCombat.getAnimalsXPMult(); + } } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceCombat.java b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceCombat.java index 536c66cb4..5db45474a 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceCombat.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceCombat.java @@ -9,12 +9,13 @@ import java.util.HashMap; public class ConfigExperienceCombat { private static final HashMap COMBAT_EXPERIENCE_DEFAULT; + private static final HashMap SPECIAL_COMBAT_EXPERIENCE_DEFAULT; private static final boolean PVP_XP_ENABLED_DEFAULT = false; static { COMBAT_EXPERIENCE_DEFAULT = new HashMap<>(); - COMBAT_EXPERIENCE_DEFAULT.put("animals", 1.0D); //TODO: this seems like a dumb config option + COMBAT_EXPERIENCE_DEFAULT.put("creeper", 4.0D); COMBAT_EXPERIENCE_DEFAULT.put("cat", 1.0D); COMBAT_EXPERIENCE_DEFAULT.put("fox", 1.0D); @@ -72,11 +73,20 @@ public class ConfigExperienceCombat { COMBAT_EXPERIENCE_DEFAULT.put("drowned", 1.0D); COMBAT_EXPERIENCE_DEFAULT.put("dolphin", 1.0D); COMBAT_EXPERIENCE_DEFAULT.put("phantom", 4.0D); + + //SPECIAL + SPECIAL_COMBAT_EXPERIENCE_DEFAULT = new HashMap<>(); + SPECIAL_COMBAT_EXPERIENCE_DEFAULT.put("animals", 1.0D); //TODO: this seems like a dumb config option + SPECIAL_COMBAT_EXPERIENCE_DEFAULT.put("mobspawners", 0.0D); + SPECIAL_COMBAT_EXPERIENCE_DEFAULT.put("pvp", 1.0D); } @Setting(value = "Combat-XP-Multipliers") private HashMap combatExperienceMap = COMBAT_EXPERIENCE_DEFAULT; + @Setting(value = "Special-Combat-XP-Multipliers") + private HashMap specialCombatExperienceMap = COMBAT_EXPERIENCE_DEFAULT; + @Setting(value = "PVP-XP", comment = "If true, players will gain XP from PVP interactions." + "\nBe careful turning this on as this can potentially allow for unwanted behaviour from players." + "\nDefault value: " + PVP_XP_ENABLED_DEFAULT) @@ -89,4 +99,16 @@ public class ConfigExperienceCombat { public HashMap getCombatExperienceMap() { return combatExperienceMap; } + + public double getMobSpawnerXPMult() { + return specialCombatExperienceMap.get("mobspawners"); + } + + public double getPVPXPMult() { + return specialCombatExperienceMap.get("pvp"); + } + + public double getAnimalsXPMult() { + return specialCombatExperienceMap.get("animals"); + } } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigExperienceFormula.java b/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigExperienceFormula.java index 082862567..77fbf8f3c 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigExperienceFormula.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigExperienceFormula.java @@ -7,6 +7,8 @@ import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; @ConfigSerializable public class ConfigExperienceFormula { + public static final boolean CUMULATIVE_CURVE_DEFAULT = false; + @Setting(value = "Player-XP-Formula-Type", comment = "Determines which formula is used to determine XP needed to level" + "\nDefault value: LINEAR") private FormulaType formulaType = FormulaType.LINEAR; @@ -19,6 +21,9 @@ public class ConfigExperienceFormula { "\nEXPONENTIAL Formula: multiplier * level ^ exponent + base") private ConfigExperienceFormulaExponential configExperienceFormulaExponential = new ConfigExperienceFormulaExponential(); + @Setting(value = "Use-Cumulative-XP-Curve", comment = "") + private boolean cumulativeCurveEnabled = CUMULATIVE_CURVE_DEFAULT; + public FormulaType getFormulaType() { return formulaType; } @@ -27,6 +32,10 @@ public class ConfigExperienceFormula { return configExperienceFormulaLinear; } + public boolean isCumulativeCurveEnabled() { + return cumulativeCurveEnabled; + } + public ConfigExperienceFormulaExponential getConfigExperienceFormulaExponential() { return configExperienceFormulaExponential; } diff --git a/src/main/java/com/gmail/nossr50/datatypes/player/PlayerProfile.java b/src/main/java/com/gmail/nossr50/datatypes/player/PlayerProfile.java index 921fbe1cc..87a86cbce 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/player/PlayerProfile.java +++ b/src/main/java/com/gmail/nossr50/datatypes/player/PlayerProfile.java @@ -390,7 +390,7 @@ public class PlayerProfile { * @return the total amount of Xp until next level */ public int getXpToLevel(PrimarySkillType primarySkillType) { - int level = (ExperienceConfig.getInstance().getCumulativeCurveEnabled()) ? UserManager.getPlayer(playerName).getPowerLevel() : skills.get(primarySkillType); + int level = (mcMMO.getConfigManager().getConfigLeveling().getConfigExperienceFormula().isCumulativeCurveEnabled()) ? UserManager.getPlayer(playerName).getPowerLevel() : skills.get(primarySkillType); FormulaType formulaType = mcMMO.getConfigManager().getConfigLeveling().getFormulaType(); return mcMMO.getFormulaManager().getCachedXpToLevel(level, formulaType);