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 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; }
}

View File

@ -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) {

View File

@ -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());
}
/**