Add and wire up Early Game Boost settings

This commit is contained in:
nossr50 2019-05-07 00:09:31 -07:00
parent 8033bc577c
commit c968b9f94a
13 changed files with 52 additions and 26 deletions

View File

@ -1,7 +1,6 @@
package com.gmail.nossr50.api; package com.gmail.nossr50.api;
import com.gmail.nossr50.api.exceptions.*; import com.gmail.nossr50.api.exceptions.*;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.experience.FormulaType; import com.gmail.nossr50.datatypes.experience.FormulaType;
import com.gmail.nossr50.datatypes.experience.XPGainReason; import com.gmail.nossr50.datatypes.experience.XPGainReason;
import com.gmail.nossr50.datatypes.experience.XPGainSource; import com.gmail.nossr50.datatypes.experience.XPGainSource;

View File

@ -1,7 +1,6 @@
package com.gmail.nossr50.commands; package com.gmail.nossr50.commands;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;

View File

@ -118,9 +118,6 @@ public class ExperienceConfig extends ConfigValidated {
return reason; return reason;
} }
public boolean isEarlyGameBoostEnabled() { return config.getBoolean("EarlyGameBoost.Enabled", true); }
public double getEarlyGameBoostMultiplier() { return config.getDouble("EarlyGameBoost.MaxLevelMultiplier", 0.05D); }
/* /*
* FORMULA SETTINGS * FORMULA SETTINGS
*/ */

View File

@ -0,0 +1,29 @@
package com.gmail.nossr50.config.hocon.playerleveling;
import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
@ConfigSerializable
public class ConfigLevelEarlyGameBoost {
public static final boolean EARLY_GAME_BOOST_DEFAULT = true;
public static final double BOOST_MULTIPLIER_DEFAULT = 0.05D;
@Setting(value = "Enabled", comment = "If set to true, the early game XP boost will be applied." +
"\nDefault value: "+EARLY_GAME_BOOST_DEFAULT)
private boolean enableEarlyGameBoost = EARLY_GAME_BOOST_DEFAULT;
@Setting(value = "Max-Level-Percentage", comment = "This value is multiplied by a skills level cap to see determine when to stop giving a boost." +
"\nLevels in mcMMO are not capped by default, so if the skill has no set level cap it will instead use the value 100 or 1000 (if in RetroMode)" +
"\nWith default settings, this will result in the first 5 levels (or 50 in Retro) being boosted" +
"\nDefault value: "+BOOST_MULTIPLIER_DEFAULT)
private double earlyGameBoostMultiplier = BOOST_MULTIPLIER_DEFAULT;
public double getEarlyGameBoostMultiplier() {
return earlyGameBoostMultiplier;
}
public boolean isEnableEarlyGameBoost() {
return enableEarlyGameBoost;
}
}

View File

@ -20,6 +20,10 @@ public class ConfigLeveling {
@Setting(value = "General", comment = "Settings for player leveling that don't fall into other categories") @Setting(value = "General", comment = "Settings for player leveling that don't fall into other categories")
private ConfigSectionLevelingGeneral configSectionLevelingGeneral = new ConfigSectionLevelingGeneral(); private ConfigSectionLevelingGeneral configSectionLevelingGeneral = new ConfigSectionLevelingGeneral();
@Setting(value = "Early-Game-Boost", comment = "mcMMO incorporates an early game XP boost to get players to the first abilities in each skill faster." +
"\nUsing default settings, players will reach level 5 (or 50 in RetroMode) much faster than they normally would.")
private ConfigLevelEarlyGameBoost earlyGameBoost = new ConfigLevelEarlyGameBoost();
@Setting(value = "Experience-Formula") @Setting(value = "Experience-Formula")
private ConfigExperienceFormula configExperienceFormula = new ConfigExperienceFormula(); private ConfigExperienceFormula configExperienceFormula = new ConfigExperienceFormula();
@ -27,6 +31,18 @@ public class ConfigLeveling {
* GETTER BOILERPLATE * GETTER BOILERPLATE
*/ */
public double getEarlyGameBoostMultiplier() {
return earlyGameBoost.getEarlyGameBoostMultiplier();
}
public boolean isEnableEarlyGameBoost() {
return earlyGameBoost.isEnableEarlyGameBoost();
}
public ConfigLevelEarlyGameBoost getEarlyGameBoost() {
return earlyGameBoost;
}
public ConfigSectionLevelCaps getConfigSectionLevelCaps() { public ConfigSectionLevelCaps getConfigSectionLevelCaps() {
return configSectionLevelCaps; return configSectionLevelCaps;
} }

View File

@ -1,6 +1,5 @@
package com.gmail.nossr50.datatypes.player; package com.gmail.nossr50.datatypes.player;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.MobHealthbarType; import com.gmail.nossr50.datatypes.MobHealthbarType;
import com.gmail.nossr50.datatypes.experience.FormulaType; import com.gmail.nossr50.datatypes.experience.FormulaType;
import com.gmail.nossr50.datatypes.experience.SkillXpGain; import com.gmail.nossr50.datatypes.experience.SkillXpGain;

View File

@ -88,7 +88,7 @@ public class SelfListener implements Listener {
return; return;
} }
if(ExperienceConfig.getInstance().isEarlyGameBoostEnabled()) if(mcMMO.getConfigManager().getConfigLeveling().isEnableEarlyGameBoost())
{ {
int earlyGameBonusXP = 0; int earlyGameBonusXP = 0;

View File

@ -9,12 +9,7 @@ import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.HashMap; import java.util.*;
import java.util.Locale;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
import java.util.logging.Level; import java.util.logging.Level;
public final class LocaleLoader { public final class LocaleLoader {

View File

@ -1,8 +1,6 @@
package com.gmail.nossr50.runnables.database; package com.gmail.nossr50.runnables.database;
import com.gmail.nossr50.config.HiddenConfig;
import com.gmail.nossr50.database.DatabaseManager; import com.gmail.nossr50.database.DatabaseManager;
import com.gmail.nossr50.datatypes.database.UpgradeType;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.uuid.UUIDFetcher; import com.gmail.nossr50.util.uuid.UUIDFetcher;
@ -98,7 +96,7 @@ public class UUIDUpdateAsyncTask extends BukkitRunnable {
} }
if (fetchedUUIDs.size() == 0 || mcMMO.getDatabaseManager().saveUserUUIDs(fetchedUUIDs)) { if (fetchedUUIDs.size() == 0 || mcMMO.getDatabaseManager().saveUserUUIDs(fetchedUUIDs)) {
mcMMO.getUpgradeManager().setUpgradeCompleted(UpgradeType.ADD_UUIDS); //mcMMO.getUpgradeManager().setUpgradeCompleted(UpgradeType.ADD_UUIDS);
plugin.getLogger().info("UUID upgrade completed!"); plugin.getLogger().info("UUID upgrade completed!");
} }
} }

View File

@ -1,8 +1,6 @@
package com.gmail.nossr50.skills.excavation; package com.gmail.nossr50.skills.excavation;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.config.treasure.ExcavationTreasureConfig; import com.gmail.nossr50.config.treasure.ExcavationTreasureConfig;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure; import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.StringUtils;

View File

@ -1,7 +1,5 @@
package com.gmail.nossr50.skills.mining; package com.gmail.nossr50.skills.mining;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.ItemUtils; import com.gmail.nossr50.util.ItemUtils;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;

View File

@ -1,8 +1,6 @@
package com.gmail.nossr50.skills.woodcutting; package com.gmail.nossr50.skills.woodcutting;
import com.gmail.nossr50.config.MainConfig; import com.gmail.nossr50.config.MainConfig;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.BlockUtils; import com.gmail.nossr50.util.BlockUtils;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;

View File

@ -1,8 +1,8 @@
package com.gmail.nossr50.util.player; package com.gmail.nossr50.util.player;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.mcMMO;
import java.util.HashMap; import java.util.HashMap;
@ -19,14 +19,14 @@ public class PlayerLevelUtils {
{ {
for(PrimarySkillType primarySkillType : PrimarySkillType.values()) for(PrimarySkillType primarySkillType : PrimarySkillType.values())
{ {
int levelCap = Config.getInstance().getLevelCap(primarySkillType); int levelCap = mcMMO.getConfigManager().getConfigLeveling().getLevelCap(primarySkillType);
int cap; int cap;
if(levelCap == Integer.MAX_VALUE || levelCap <= 0) if(levelCap == Integer.MAX_VALUE || levelCap <= 0)
{ {
cap = Config.getInstance().getIsRetroMode() ? 50 : 5; cap = mcMMO.isRetroModeEnabled() ? 50 : 5;
} else { } else {
cap = (int) (levelCap * ExperienceConfig.getInstance().getEarlyGameBoostMultiplier()); cap = (int) (levelCap * mcMMO.getConfigManager().getConfigLeveling().getEarlyGameBoostMultiplier());
} }
earlyGameBoostCutoffs.put(primarySkillType, cap); earlyGameBoostCutoffs.put(primarySkillType, cap);