diff --git a/src/main/java/com/gmail/nossr50/api/ExperienceAPI.java b/src/main/java/com/gmail/nossr50/api/ExperienceAPI.java index 217ad41d6..b091ccfe9 100644 --- a/src/main/java/com/gmail/nossr50/api/ExperienceAPI.java +++ b/src/main/java/com/gmail/nossr50/api/ExperienceAPI.java @@ -1018,7 +1018,7 @@ public final class ExperienceAPI { * @throws InvalidFormulaTypeException if the given formulaType is not valid */ public static int getXpNeededToLevel(int level) { - return mcMMO.getFormulaManager().getCachedXpToLevel(level, ExperienceConfig.getInstance().getFormulaType()); + return mcMMO.getFormulaManager().getCachedXpToLevel(level, mcMMO.getConfigManager().getConfigLeveling().getFormulaType()); } /** 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 646612f34..96227e87b 100644 --- a/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java +++ b/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java @@ -189,20 +189,7 @@ public class ExperienceConfig extends ConfigValidated { * FORMULA SETTINGS */ - public boolean isEndermanEndermiteFarmingPrevented() { - return getBooleanValue(EXPLOIT_FIX, ENDERMAN_ENDERMITE_FARMS); - } - - public boolean isPistonExploitPrevented() { return getBooleanValue(EXPLOIT_FIX, PISTONS); } - -/* public boolean isFishingExploitingPrevented() { return config.getBoolean("ExploitFix.Fishing", true); } - public boolean isAcrobaticsExploitingPrevented() { return config.getBoolean("ExploitFix.Acrobatics", true); }*/ - /* Curve settings */ - public FormulaType getFormulaType() { - return FormulaType.getFormulaType(getStringValue(EXPERIENCE_FORMULA, CURVE)); - } - public boolean getCumulativeCurveEnabled() { return getBooleanValue(EXPERIENCE_FORMULA, CUMULATIVE + CURVE); } diff --git a/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigLeveling.java b/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigLeveling.java index ec6b38495..cd7dbc249 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigLeveling.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigLeveling.java @@ -1,5 +1,6 @@ package com.gmail.nossr50.config.hocon.playerleveling; +import com.gmail.nossr50.datatypes.experience.FormulaType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import ninja.leaping.configurate.objectmapping.Setting; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; @@ -31,6 +32,22 @@ public class ConfigLeveling { return configSectionLevelingGeneral; } + public int getStartingLevel() { + return configSectionLevelingGeneral.getStartingLevel(); + } + + public ConfigSectionLevelScaling getConfigSectionLevelScaling() { + return configSectionLevelingGeneral.getConfigSectionLevelScaling(); + } + + public FormulaType getFormulaType() { + return configSectionLevelingGeneral.getFormulaType(); + } + + public boolean isRetroModeEnabled() { + return getConfigSectionLevelScaling().isRetroModeEnabled(); + } + /* * HELPER METHODS */ diff --git a/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigSectionLevelingGeneral.java b/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigSectionLevelingGeneral.java index e951f6878..4e568acbb 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigSectionLevelingGeneral.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/playerleveling/ConfigSectionLevelingGeneral.java @@ -1,5 +1,6 @@ package com.gmail.nossr50.config.hocon.playerleveling; +import com.gmail.nossr50.datatypes.experience.FormulaType; import ninja.leaping.configurate.objectmapping.Setting; import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable; @@ -33,6 +34,10 @@ public class ConfigSectionLevelingGeneral { "\nDefault value: "+STARTING_LEVEL_DEFAULT) private int startingLevel = STARTING_LEVEL_DEFAULT; + @Setting(value = "Player-XP-Formula", comment = "Determines which formula is used to determine XP needed to level" + + "\nDefault value: LINEAR") + private FormulaType formulaType = FormulaType.LINEAR; + /* * GETTER BOILERPLATE */ @@ -44,4 +49,8 @@ public class ConfigSectionLevelingGeneral { public ConfigSectionLevelScaling getConfigSectionLevelScaling() { return configSectionLevelScaling; } + + public FormulaType getFormulaType() { + return formulaType; + } } 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 ac3aa093c..d79544c32 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/player/PlayerProfile.java +++ b/src/main/java/com/gmail/nossr50/datatypes/player/PlayerProfile.java @@ -393,7 +393,7 @@ public class PlayerProfile { */ public int getXpToLevel(PrimarySkillType primarySkillType) { int level = (ExperienceConfig.getInstance().getCumulativeCurveEnabled()) ? UserManager.getPlayer(playerName).getPowerLevel() : skills.get(primarySkillType); - FormulaType formulaType = ExperienceConfig.getInstance().getFormulaType(); + FormulaType formulaType = mcMMO.getConfigManager().getConfigLeveling().getFormulaType(); return mcMMO.getFormulaManager().getCachedXpToLevel(level, formulaType); }