diff --git a/Changelog.txt b/Changelog.txt
index 04813f919..7381773fd 100644
--- a/Changelog.txt
+++ b/Changelog.txt
@@ -1,3 +1,6 @@
+Version 2.1.53
+ Fixed a critical bug where players earned too much XP
+
Version 2.1.52
Updated Japanese locale (thanks snake0053)
Added a toggle for the early game XP boost to experience.yml 'EarlyGameBoost.Enabled'
diff --git a/pom.xml b/pom.xml
index 8cc6521d2..4dff07d21 100755
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
4.0.0
com.gmail.nossr50.mcMMO
mcMMO
- 2.1.52
+ 2.1.53
mcMMO
https://github.com/mcMMO-Dev/mcMMO
diff --git a/src/main/java/com/gmail/nossr50/listeners/SelfListener.java b/src/main/java/com/gmail/nossr50/listeners/SelfListener.java
index 6c19dbc28..492bd7cee 100644
--- a/src/main/java/com/gmail/nossr50/listeners/SelfListener.java
+++ b/src/main/java/com/gmail/nossr50/listeners/SelfListener.java
@@ -97,19 +97,17 @@ public class SelfListener implements Listener {
if(ExperienceConfig.getInstance().isEarlyGameBoostEnabled())
{
- int earlyLevelBonusXPCap = (int) (ExperienceConfig.getInstance().getEarlyGameBoostMultiplier() * Config.getInstance().getLevelCap(event.getSkill()));
int earlyGameBonusXP = 0;
//Give some bonus XP for low levels
- if(mcMMOPlayer.getSkillLevel(primarySkillType) < earlyLevelBonusXPCap)
+ if(mcMMOPlayer.getSkillLevel(primarySkillType) <= mcMMO.getPlayerLevelUtils().getEarlyGameCutoff(primarySkillType))
{
earlyGameBonusXP += (mcMMOPlayer.getXpToLevel(primarySkillType) * 0.05);
event.setRawXpGained(event.getRawXpGained() + earlyGameBonusXP);
}
}
-
int threshold = ExperienceConfig.getInstance().getDiminishedReturnsThreshold(primarySkillType);
if (threshold <= 0 || !ExperienceConfig.getInstance().getDiminishedReturnsEnabled()) {
diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java
index 9b39ecd60..8362e13ff 100644
--- a/src/main/java/com/gmail/nossr50/mcMMO.java
+++ b/src/main/java/com/gmail/nossr50/mcMMO.java
@@ -39,6 +39,7 @@ import com.gmail.nossr50.util.blockmeta.chunkmeta.ChunkManager;
import com.gmail.nossr50.util.blockmeta.chunkmeta.ChunkManagerFactory;
import com.gmail.nossr50.util.commands.CommandRegistrationManager;
import com.gmail.nossr50.util.experience.FormulaManager;
+import com.gmail.nossr50.util.player.PlayerLevelUtils;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import com.gmail.nossr50.util.skills.RankUtils;
@@ -73,6 +74,7 @@ public class mcMMO extends JavaPlugin {
private static HolidayManager holidayManager;
private static UpgradeManager upgradeManager;
private static MaterialMapStore materialMapStore;
+ private static PlayerLevelUtils playerLevelUtils;
/* Blacklist */
private static WorldBlacklist worldBlacklist;
@@ -248,10 +250,17 @@ public class mcMMO extends JavaPlugin {
//Init Material Maps
materialMapStore = new MaterialMapStore();
+ //Init player level values
+ playerLevelUtils = new PlayerLevelUtils();
+
//Init the blacklist
worldBlacklist = new WorldBlacklist(this);
}
+ public static PlayerLevelUtils getPlayerLevelUtils() {
+ return playerLevelUtils;
+ }
+
public static MaterialMapStore getMaterialMapStore() {
return materialMapStore;
}
diff --git a/src/main/java/com/gmail/nossr50/util/player/PlayerLevelUtils.java b/src/main/java/com/gmail/nossr50/util/player/PlayerLevelUtils.java
new file mode 100644
index 000000000..ec022c424
--- /dev/null
+++ b/src/main/java/com/gmail/nossr50/util/player/PlayerLevelUtils.java
@@ -0,0 +1,40 @@
+package com.gmail.nossr50.util.player;
+
+import com.gmail.nossr50.config.Config;
+import com.gmail.nossr50.config.experience.ExperienceConfig;
+import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
+
+import java.util.HashMap;
+
+public class PlayerLevelUtils {
+ HashMap earlyGameBoostCutoffs;
+
+ public PlayerLevelUtils()
+ {
+ earlyGameBoostCutoffs = new HashMap<>();
+ calculateEarlyGameBoostCutoffs();
+ }
+
+ private void calculateEarlyGameBoostCutoffs()
+ {
+ for(PrimarySkillType primarySkillType : PrimarySkillType.values())
+ {
+ int levelCap = Config.getInstance().getLevelCap(primarySkillType);
+ int cap;
+
+ if(levelCap == Integer.MAX_VALUE || levelCap <= 0)
+ {
+ cap = Config.getInstance().getIsRetroMode() ? 50 : 5;
+ } else {
+ cap = (int) (levelCap * ExperienceConfig.getInstance().getEarlyGameBoostMultiplier());
+ }
+
+ earlyGameBoostCutoffs.put(primarySkillType, cap);
+ }
+ }
+
+ public int getEarlyGameCutoff(PrimarySkillType primarySkillType)
+ {
+ return earlyGameBoostCutoffs.get(primarySkillType);
+ }
+}