mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-25 02:04:44 +02:00
2.1.53 - Fixed critical XP bug
This commit is contained in:
@ -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()) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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<PrimarySkillType, Integer> 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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user