new config system pt 2

This commit is contained in:
nossr50 2019-02-13 22:43:34 -08:00
parent 9a91daf910
commit 9a65621f68
3 changed files with 14 additions and 11 deletions

View File

@ -18,6 +18,7 @@ public class McmmoCore {
private static EventCommander eventCommander; private static EventCommander eventCommander;
private static Logger logger; private static Logger logger;
private static Platform platform; private static Platform platform;
private static boolean retroModeEnabled;
//Why do all these things need to be here? Sigh... //Why do all these things need to be here? Sigh...
private static DatabaseManager databaseManager; private static DatabaseManager databaseManager;
@ -61,4 +62,6 @@ public class McmmoCore {
public static UpgradeManager getUpgradeManager() { return upgradeManager; } public static UpgradeManager getUpgradeManager() { return upgradeManager; }
public static FormulaManager getFormulaManager() { return formulaManager; } public static FormulaManager getFormulaManager() { return formulaManager; }
public static boolean isRetroModeEnabled() { return retroModeEnabled; }
} }

View File

@ -436,7 +436,7 @@ public class AdvancedConfig extends ConfigurableLoader {
* @return the level at which abilities stop increasing in length * @return the level at which abilities stop increasing in length
*/ */
public int getAbilityLengthCap() { public int getAbilityLengthCap() {
if(!mcMMO.isRetroModeEnabled()) if(!McmmoCore.isRetroModeEnabled())
return getIntValue(SKILLS, GENERAL, ABILITY, LENGTH, STANDARD, CAP_LEVEL); return getIntValue(SKILLS, GENERAL, ABILITY, LENGTH, STANDARD, CAP_LEVEL);
else else
return getIntValue(SKILLS, GENERAL, ABILITY, LENGTH, RETRO_MODE, CAP_LEVEL); 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 * @return the number of levels required per ability length increase
*/ */
public int getAbilityLength() { public int getAbilityLength() {
if(!mcMMO.isRetroModeEnabled()) if(!McmmoCore.isRetroModeEnabled())
return getIntValue(SKILLS, GENERAL, ABILITY, LENGTH, STANDARD, INCREASE_LEVEL); return getIntValue(SKILLS, GENERAL, ABILITY, LENGTH, STANDARD, INCREASE_LEVEL);
else else
return getIntValue(SKILLS, GENERAL, ABILITY, LENGTH, RETRO_MODE, INCREASE_LEVEL); 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 * @return the level at which this skills max benefits will be reached on the curve
*/ */
public int getMaxBonusLevel(SubSkillType subSkillType) { public int getMaxBonusLevel(SubSkillType subSkillType) {
if(!mcMMO.isRetroModeEnabled()) if(!McmmoCore.isRetroModeEnabled())
return getIntValue(subSkillType.getAdvConfigAddress(), MAX_BONUS_LEVEL, STANDARD);
String[] keyPath = {subSkillType.getAdvConfigAddress(), MAX_BONUS_LEVEL}; else
return mcMMO.isRetroModeEnabled() ? getIntValue(keyPath+ RETRO_MODE) : getIntValue(keyPath+ STANDARD); return getIntValue(subSkillType.getAdvConfigAddress(), MAX_BONUS_LEVEL, RETRO_MODE);
} }
public int getMaxBonusLevel(AbstractSubSkill abstractSubSkill) { public int getMaxBonusLevel(AbstractSubSkill abstractSubSkill) {

View File

@ -1,7 +1,7 @@
package com.gmail.nossr50.core.skills; package com.gmail.nossr50.core.skills;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.core.locale.LocaleLoader;
import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.core.util.StringUtils;
public enum SubSkillType { public enum SubSkillType {
/* !! Warning -- Do not let subskills share a name with any existing PrimarySkillType as it will clash with the static import !! */ /* !! 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 * @return the root address for this skill in advanced.yml
*/ */
public String getAdvConfigAddress() { public String[] getAdvConfigAddress() {
return "Skills." + StringUtils.getCapitalized(getParentSkill().toString()) + "." + getConfigName(toString()); 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 * @return the root address for this skill in rankskills.yml
*/ */
public String getRankConfigAddress() { public String getRankConfigAddress() {
return StringUtils.getCapitalized(getParentSkill().toString()) + "." + getConfigName(toString()); //return StringUtils.getCapitalized(getParentSkill().toString()) + "." + getConfigName(toString());
} }
/** /**