From 9a65621f684792f94f902e1eea461bad0551337a Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 13 Feb 2019 22:43:34 -0800 Subject: [PATCH] new config system pt 2 --- .../main/java/com/gmail/nossr50/core/McmmoCore.java | 3 +++ .../gmail/nossr50/core/config/AdvancedConfig.java | 12 ++++++------ .../com/gmail/nossr50/core/skills/SubSkillType.java | 10 +++++----- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/core/src/main/java/com/gmail/nossr50/core/McmmoCore.java b/core/src/main/java/com/gmail/nossr50/core/McmmoCore.java index 56d16772c..0acce0851 100644 --- a/core/src/main/java/com/gmail/nossr50/core/McmmoCore.java +++ b/core/src/main/java/com/gmail/nossr50/core/McmmoCore.java @@ -18,6 +18,7 @@ public class McmmoCore { private static EventCommander eventCommander; private static Logger logger; private static Platform platform; + private static boolean retroModeEnabled; //Why do all these things need to be here? Sigh... private static DatabaseManager databaseManager; @@ -61,4 +62,6 @@ public class McmmoCore { public static UpgradeManager getUpgradeManager() { return upgradeManager; } public static FormulaManager getFormulaManager() { return formulaManager; } + + public static boolean isRetroModeEnabled() { return retroModeEnabled; } } diff --git a/core/src/main/java/com/gmail/nossr50/core/config/AdvancedConfig.java b/core/src/main/java/com/gmail/nossr50/core/config/AdvancedConfig.java index e1741c63a..43c3d46a5 100644 --- a/core/src/main/java/com/gmail/nossr50/core/config/AdvancedConfig.java +++ b/core/src/main/java/com/gmail/nossr50/core/config/AdvancedConfig.java @@ -436,7 +436,7 @@ public class AdvancedConfig extends ConfigurableLoader { * @return the level at which abilities stop increasing in length */ public int getAbilityLengthCap() { - if(!mcMMO.isRetroModeEnabled()) + if(!McmmoCore.isRetroModeEnabled()) return getIntValue(SKILLS, GENERAL, ABILITY, LENGTH, STANDARD, CAP_LEVEL); else return getIntValue(SKILLS, GENERAL, ABILITY, LENGTH, RETRO_MODE, CAP_LEVEL); @@ -448,7 +448,7 @@ public class AdvancedConfig extends ConfigurableLoader { * @return the number of levels required per ability length increase */ public int getAbilityLength() { - if(!mcMMO.isRetroModeEnabled()) + if(!McmmoCore.isRetroModeEnabled()) return getIntValue(SKILLS, GENERAL, ABILITY, LENGTH, STANDARD, INCREASE_LEVEL); else return getIntValue(SKILLS, GENERAL, ABILITY, LENGTH, RETRO_MODE, INCREASE_LEVEL); @@ -464,10 +464,10 @@ public class AdvancedConfig extends ConfigurableLoader { * @return the level at which this skills max benefits will be reached on the curve */ public int getMaxBonusLevel(SubSkillType subSkillType) { - if(!mcMMO.isRetroModeEnabled()) - - String[] keyPath = {subSkillType.getAdvConfigAddress(), MAX_BONUS_LEVEL}; - return mcMMO.isRetroModeEnabled() ? getIntValue(keyPath+ RETRO_MODE) : getIntValue(keyPath+ STANDARD); + if(!McmmoCore.isRetroModeEnabled()) + return getIntValue(subSkillType.getAdvConfigAddress(), MAX_BONUS_LEVEL, STANDARD); + else + return getIntValue(subSkillType.getAdvConfigAddress(), MAX_BONUS_LEVEL, RETRO_MODE); } public int getMaxBonusLevel(AbstractSubSkill abstractSubSkill) { diff --git a/core/src/main/java/com/gmail/nossr50/core/skills/SubSkillType.java b/core/src/main/java/com/gmail/nossr50/core/skills/SubSkillType.java index e4c5b5da2..d9ee1f3a0 100644 --- a/core/src/main/java/com/gmail/nossr50/core/skills/SubSkillType.java +++ b/core/src/main/java/com/gmail/nossr50/core/skills/SubSkillType.java @@ -1,7 +1,7 @@ package com.gmail.nossr50.core.skills; -import com.gmail.nossr50.locale.LocaleLoader; -import com.gmail.nossr50.util.StringUtils; +import com.gmail.nossr50.core.locale.LocaleLoader; +import com.gmail.nossr50.core.util.StringUtils; public enum SubSkillType { /* !! Warning -- Do not let subskills share a name with any existing PrimarySkillType as it will clash with the static import !! */ @@ -136,8 +136,8 @@ public enum SubSkillType { * * @return the root address for this skill in advanced.yml */ - public String getAdvConfigAddress() { - return "Skills." + StringUtils.getCapitalized(getParentSkill().toString()) + "." + getConfigName(toString()); + public String[] getAdvConfigAddress() { + return new String[] {"Skills", StringUtils.getCapitalized(getParentSkill().toString()), getConfigName(toString())}; } /** @@ -146,7 +146,7 @@ public enum SubSkillType { * @return the root address for this skill in rankskills.yml */ public String getRankConfigAddress() { - return StringUtils.getCapitalized(getParentSkill().toString()) + "." + getConfigName(toString()); + //return StringUtils.getCapitalized(getParentSkill().toString()) + "." + getConfigName(toString()); } /**