mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-28 03:34:43 +02:00
Refactoring to make my life easier
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user