mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
Add delegates to player level conf and wire up xp formula setting
This commit is contained in:
parent
ba8b73ad4d
commit
e8ea502f77
@ -1018,7 +1018,7 @@ public final class ExperienceAPI {
|
||||
* @throws InvalidFormulaTypeException if the given formulaType is not valid
|
||||
*/
|
||||
public static int getXpNeededToLevel(int level) {
|
||||
return mcMMO.getFormulaManager().getCachedXpToLevel(level, ExperienceConfig.getInstance().getFormulaType());
|
||||
return mcMMO.getFormulaManager().getCachedXpToLevel(level, mcMMO.getConfigManager().getConfigLeveling().getFormulaType());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -189,20 +189,7 @@ public class ExperienceConfig extends ConfigValidated {
|
||||
* FORMULA SETTINGS
|
||||
*/
|
||||
|
||||
public boolean isEndermanEndermiteFarmingPrevented() {
|
||||
return getBooleanValue(EXPLOIT_FIX, ENDERMAN_ENDERMITE_FARMS);
|
||||
}
|
||||
|
||||
public boolean isPistonExploitPrevented() { return getBooleanValue(EXPLOIT_FIX, PISTONS); }
|
||||
|
||||
/* public boolean isFishingExploitingPrevented() { return config.getBoolean("ExploitFix.Fishing", true); }
|
||||
public boolean isAcrobaticsExploitingPrevented() { return config.getBoolean("ExploitFix.Acrobatics", true); }*/
|
||||
|
||||
/* Curve settings */
|
||||
public FormulaType getFormulaType() {
|
||||
return FormulaType.getFormulaType(getStringValue(EXPERIENCE_FORMULA, CURVE));
|
||||
}
|
||||
|
||||
public boolean getCumulativeCurveEnabled() {
|
||||
return getBooleanValue(EXPERIENCE_FORMULA, CUMULATIVE + CURVE);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.gmail.nossr50.config.hocon.playerleveling;
|
||||
|
||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import ninja.leaping.configurate.objectmapping.Setting;
|
||||
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||
@ -31,6 +32,22 @@ public class ConfigLeveling {
|
||||
return configSectionLevelingGeneral;
|
||||
}
|
||||
|
||||
public int getStartingLevel() {
|
||||
return configSectionLevelingGeneral.getStartingLevel();
|
||||
}
|
||||
|
||||
public ConfigSectionLevelScaling getConfigSectionLevelScaling() {
|
||||
return configSectionLevelingGeneral.getConfigSectionLevelScaling();
|
||||
}
|
||||
|
||||
public FormulaType getFormulaType() {
|
||||
return configSectionLevelingGeneral.getFormulaType();
|
||||
}
|
||||
|
||||
public boolean isRetroModeEnabled() {
|
||||
return getConfigSectionLevelScaling().isRetroModeEnabled();
|
||||
}
|
||||
|
||||
/*
|
||||
* HELPER METHODS
|
||||
*/
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.gmail.nossr50.config.hocon.playerleveling;
|
||||
|
||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||
import ninja.leaping.configurate.objectmapping.Setting;
|
||||
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
|
||||
|
||||
@ -33,6 +34,10 @@ public class ConfigSectionLevelingGeneral {
|
||||
"\nDefault value: "+STARTING_LEVEL_DEFAULT)
|
||||
private int startingLevel = STARTING_LEVEL_DEFAULT;
|
||||
|
||||
@Setting(value = "Player-XP-Formula", comment = "Determines which formula is used to determine XP needed to level" +
|
||||
"\nDefault value: LINEAR")
|
||||
private FormulaType formulaType = FormulaType.LINEAR;
|
||||
|
||||
/*
|
||||
* GETTER BOILERPLATE
|
||||
*/
|
||||
@ -44,4 +49,8 @@ public class ConfigSectionLevelingGeneral {
|
||||
public ConfigSectionLevelScaling getConfigSectionLevelScaling() {
|
||||
return configSectionLevelScaling;
|
||||
}
|
||||
|
||||
public FormulaType getFormulaType() {
|
||||
return formulaType;
|
||||
}
|
||||
}
|
||||
|
@ -393,7 +393,7 @@ public class PlayerProfile {
|
||||
*/
|
||||
public int getXpToLevel(PrimarySkillType primarySkillType) {
|
||||
int level = (ExperienceConfig.getInstance().getCumulativeCurveEnabled()) ? UserManager.getPlayer(playerName).getPowerLevel() : skills.get(primarySkillType);
|
||||
FormulaType formulaType = ExperienceConfig.getInstance().getFormulaType();
|
||||
FormulaType formulaType = mcMMO.getConfigManager().getConfigLeveling().getFormulaType();
|
||||
|
||||
return mcMMO.getFormulaManager().getCachedXpToLevel(level, formulaType);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user