diff --git a/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java b/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java index a4f8784ec..832a7f738 100644 --- a/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java +++ b/src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java @@ -160,14 +160,6 @@ public class ExperienceConfig extends ConfigValidated { /* * XP SETTINGS */ - - /* Alchemy */ - for (PotionStage potionStage : PotionStage.values()) { - if (getPotionXP(potionStage) < 0) { - reason.add(EXPERIENCE + "." + ALCHEMY + "." + POTION_STAGE + potionStage.toNumerical() + " should be at least 0!"); - } - } - /* Archery */ if (getArcheryDistanceMultiplier() < 0) { reason.add(EXPERIENCE + "." + ARCHERY + "." + DISTANCE + MULTIPLIER + " should be at least 0!"); @@ -387,11 +379,6 @@ public class ExperienceConfig extends ConfigValidated { return BarStyle.SOLID; } - /* Alchemy */ - public double getPotionXP(PotionStage stage) { - return getDoubleValue(EXPERIENCE, ALCHEMY, POTION_STAGE + stage.toNumerical()); - } - /* Archery */ public double getArcheryDistanceMultiplier() { return getDoubleValue(EXPERIENCE, ARCHERY, DISTANCE + MULTIPLIER); diff --git a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperience.java b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperience.java index a91260418..9d3337983 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperience.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperience.java @@ -136,8 +136,8 @@ public class ConfigExperience { return experienceAlchemy.getStageFourPotionXP(); } - public int getStageFivePotionXP() { - return experienceAlchemy.getStageFivePotionXP(); + public int getPotionXPByStage(int potionStage) { + return experienceAlchemy.getPotionXPByStage(potionStage); } public boolean isPvpXPEnabled() { diff --git a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceAlchemy.java b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceAlchemy.java index c60585bc9..823fe63a4 100644 --- a/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceAlchemy.java +++ b/src/main/java/com/gmail/nossr50/config/hocon/experience/ConfigExperienceAlchemy.java @@ -46,10 +46,27 @@ public class ConfigExperienceAlchemy { return alchemyXPMap.get("Stage-Four-Potion"); } - public int getStageFivePotionXP() + /*public int getStageFivePotionXP() { //This is purposely zero to prevent an exploit return 0; + }*/ + + public int getPotionXPByStage(int potionStage) + { + switch(potionStage) + { + case 1: + return getStageOnePotionXP(); + case 2: + return getStageTwoPotionXP(); + case 3: + return getStageThreePotionXP(); + case 4: + return getStageFourPotionXP(); + default: + return 0; //Zero XP is intentional to prevent some infinite loop XP exploit + } } } \ No newline at end of file diff --git a/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyManager.java b/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyManager.java index ee19cbcc1..92cd46330 100644 --- a/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyManager.java +++ b/src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyManager.java @@ -8,6 +8,7 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage; +import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.skills.SkillManager; import com.gmail.nossr50.util.StringUtils; import com.gmail.nossr50.util.skills.RankUtils; @@ -53,6 +54,7 @@ public class AlchemyManager extends SkillManager { } public void handlePotionBrewSuccesses(PotionStage potionStage, int amount) { - applyXpGain((float) (ExperienceConfig.getInstance().getPotionXP(potionStage) * amount), XPGainReason.PVE, XPGainSource.PASSIVE); + //TODO: This code disturbs me + applyXpGain((float) (mcMMO.getConfigManager().getConfigExperience().getExperienceAlchemy().getPotionXPByStage(potionStage.toNumerical()) * amount), XPGainReason.PVE, XPGainSource.PASSIVE); } } \ No newline at end of file