Refactoring to make my life easier

This commit is contained in:
nossr50
2018-12-29 05:24:55 -08:00
parent 35368db05d
commit 0d260a74c9
126 changed files with 1471 additions and 1408 deletions

View File

@ -10,7 +10,7 @@ import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.experience.FormulaType;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.gmail.nossr50.datatypes.skills.PrimarySkill;
public class FormulaManager {
private static File formulaFile = new File(mcMMO.getFlatFileDirectory() + "formula.yml");
@ -68,15 +68,15 @@ public class FormulaManager {
* Calculate how many levels a player should have using
* the new formula type.
*
* @param skillType skill where new levels and experience are calculated for
* @param primarySkill skill where new levels and experience are calculated for
* @param experience total amount of experience
* @param formulaType The new {@link FormulaType}
* @return the amount of levels and experience
*/
public int[] calculateNewLevel(SkillType skillType, int experience, FormulaType formulaType) {
public int[] calculateNewLevel(PrimarySkill primarySkill, int experience, FormulaType formulaType) {
int newLevel = 0;
int remainder = 0;
int maxLevel = Config.getInstance().getLevelCap(skillType);
int maxLevel = Config.getInstance().getLevelCap(primarySkill);
while (experience > 0 && newLevel < maxLevel) {
int experienceToNextLevel = getCachedXpToLevel(newLevel, formulaType);