diff --git a/src/main/java/com/gmail/nossr50/config/Config.java b/src/main/java/com/gmail/nossr50/config/Config.java index edcc96908..5dbcd539e 100644 --- a/src/main/java/com/gmail/nossr50/config/Config.java +++ b/src/main/java/com/gmail/nossr50/config/Config.java @@ -246,13 +246,7 @@ public class Config extends AutoUpdateConfigLoader { /* General Settings */ //Retro mode will default the value to true if the config file doesn't contain the entry (server is from a previous mcMMO install) - public boolean getIsRetroMode() { return config.getBoolean("General.RetroMode", true); } - - //XP needed to level is multiplied by this when using classic mode - public int getClassicModeXPFormulaFactor() { return config.getInt("General.Skill_Scaling.RetroMode_XP_Formula_Factor", 1); } - - //Level requirements for subskills is multiplied by this when using classic mode - public int getClassicModeLevelReqFactor() { return config.getInt("General.Skill_Scaling.RetroMode_LevelReq_Factor", 10); } + public boolean getIsRetroMode() { return config.getBoolean("General.RetroMode.Enabled", true); } public String getLocale() { return config.getString("General.Locale", "en_us"); } public boolean getMOTDEnabled() { return config.getBoolean("General.MOTD_Enabled", true); } diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 96cd81ad2..c7969f296 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -89,7 +89,7 @@ public class mcMMO extends JavaPlugin { // XP Event Check private boolean xpEventEnabled; - private boolean UseOldLevelScalingEnabled; + private boolean isRetroModeEnabled; /* Metadata Values */ public final static String entityMetadataKey = "mcMMO: Spawned Entity"; @@ -138,6 +138,9 @@ public class mcMMO extends JavaPlugin { return; } + //Store this value so other plugins can check it + isRetroModeEnabled = Config.getInstance().getIsRetroMode(); + if (getServer().getName().equals("Cauldron") || getServer().getName().equals("MCPC+")) { checkModConfigs(); } @@ -533,4 +536,14 @@ public class mcMMO extends JavaPlugin { InputStream in = getResource(fileName); return in == null ? null : new InputStreamReader(in, Charsets.UTF_8); } + + /** + * Checks if this plugin is using retro mode + * Retro mode is a 0-1000 skill system + * Standard mode is scaled for 1-100 + * @return true if retro mode is enabled + */ + public boolean isRetroModeEnabled() { + return isRetroModeEnabled; + } } diff --git a/src/main/java/com/gmail/nossr50/util/experience/FormulaManager.java b/src/main/java/com/gmail/nossr50/util/experience/FormulaManager.java index 3b02a3be3..ad2145f05 100644 --- a/src/main/java/com/gmail/nossr50/util/experience/FormulaManager.java +++ b/src/main/java/com/gmail/nossr50/util/experience/FormulaManager.java @@ -21,13 +21,11 @@ public class FormulaManager { private FormulaType previousFormula; //Used for XP formula scaling - private boolean classicModeEnabled; - private int classicModeXPFormulaFactor; + private boolean retroModeEnabled; public FormulaManager() { /* Setting for Classic Mode (Scales a lot of stuff up by * 10) */ - classicModeEnabled = Config.getInstance().getIsRetroMode(); - classicModeXPFormulaFactor = Config.getInstance().getClassicModeXPFormulaFactor(); + retroModeEnabled = Config.getInstance().getIsRetroMode(); loadFormula(); } @@ -111,8 +109,11 @@ public class FormulaManager { public int getCachedXpToLevel(int level, FormulaType formulaType) { int experience; - //If we're in classic we use the XP factor from config settings - int skillSystemMultiplier = classicModeEnabled ? classicModeXPFormulaFactor : 10; + /** + * Retro mode XP requirements are the default requirements + * Standard mode XP requirements are multiplied by a factor of 10 + */ + int xpNeededMultiplier = retroModeEnabled ? 1 : 10; if (formulaType == FormulaType.UNKNOWN) { formulaType = FormulaType.LINEAR; @@ -125,7 +126,7 @@ public class FormulaManager { switch (formulaType) { case LINEAR: if (!experienceNeededLinear.containsKey(level)) { - experience = (int) Math.floor( skillSystemMultiplier * (base + level * multiplier)); + experience = (int) Math.floor( xpNeededMultiplier * (base + level * multiplier)); experienceNeededLinear.put(level, experience); } @@ -133,7 +134,7 @@ public class FormulaManager { case EXPONENTIAL: if (!experienceNeededExponential.containsKey(level)) { - experience = (int) Math.floor( skillSystemMultiplier * (multiplier * Math.pow(level, exponent) + base)); + experience = (int) Math.floor( xpNeededMultiplier * (multiplier * Math.pow(level, exponent) + base)); experienceNeededExponential.put(level, experience); } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 169304803..e1802b2ce 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -8,17 +8,11 @@ # Settings for mcMMO in general ### General: - Skill_Scaling: # Turning this on will scale mcMMO around 1-1000 with default scaling factor # Everything in your config related to skill level requirements, skill level bonuses, etc will be multiplied by 10 when this mode is on # This change is purely cosmetic, it retains the old feel of mcMMO where you could level up thousands of times - RetroMode: true - Skill_Scaling: - # This is the value that is skill level requirements are multiplied by in Retro Mode (Default is 10) - RetroMode_LevelReq_Factor: 10 - # This is the value that the xp required to level is multiplied by when in Retro mode - # Default is 1 - RetroMode_XP_Formula_Factor: 1 + RetroMode: + Enabled: true Locale: en_US MOTD_Enabled: true # Send a message to the player when his profile was successfully loaded