mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 14:46:46 +01:00
2.1.53 - Fixed critical XP bug
This commit is contained in:
parent
f61917e8fe
commit
cdf6e607de
@ -1,3 +1,6 @@
|
|||||||
|
Version 2.1.53
|
||||||
|
Fixed a critical bug where players earned too much XP
|
||||||
|
|
||||||
Version 2.1.52
|
Version 2.1.52
|
||||||
Updated Japanese locale (thanks snake0053)
|
Updated Japanese locale (thanks snake0053)
|
||||||
Added a toggle for the early game XP boost to experience.yml 'EarlyGameBoost.Enabled'
|
Added a toggle for the early game XP boost to experience.yml 'EarlyGameBoost.Enabled'
|
||||||
|
2
pom.xml
2
pom.xml
@ -2,7 +2,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||||
<artifactId>mcMMO</artifactId>
|
<artifactId>mcMMO</artifactId>
|
||||||
<version>2.1.52</version>
|
<version>2.1.53</version>
|
||||||
<name>mcMMO</name>
|
<name>mcMMO</name>
|
||||||
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
||||||
<scm>
|
<scm>
|
||||||
|
@ -97,19 +97,17 @@ public class SelfListener implements Listener {
|
|||||||
|
|
||||||
if(ExperienceConfig.getInstance().isEarlyGameBoostEnabled())
|
if(ExperienceConfig.getInstance().isEarlyGameBoostEnabled())
|
||||||
{
|
{
|
||||||
int earlyLevelBonusXPCap = (int) (ExperienceConfig.getInstance().getEarlyGameBoostMultiplier() * Config.getInstance().getLevelCap(event.getSkill()));
|
|
||||||
|
|
||||||
int earlyGameBonusXP = 0;
|
int earlyGameBonusXP = 0;
|
||||||
|
|
||||||
//Give some bonus XP for low levels
|
//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);
|
earlyGameBonusXP += (mcMMOPlayer.getXpToLevel(primarySkillType) * 0.05);
|
||||||
event.setRawXpGained(event.getRawXpGained() + earlyGameBonusXP);
|
event.setRawXpGained(event.getRawXpGained() + earlyGameBonusXP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int threshold = ExperienceConfig.getInstance().getDiminishedReturnsThreshold(primarySkillType);
|
int threshold = ExperienceConfig.getInstance().getDiminishedReturnsThreshold(primarySkillType);
|
||||||
|
|
||||||
if (threshold <= 0 || !ExperienceConfig.getInstance().getDiminishedReturnsEnabled()) {
|
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.blockmeta.chunkmeta.ChunkManagerFactory;
|
||||||
import com.gmail.nossr50.util.commands.CommandRegistrationManager;
|
import com.gmail.nossr50.util.commands.CommandRegistrationManager;
|
||||||
import com.gmail.nossr50.util.experience.FormulaManager;
|
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.player.UserManager;
|
||||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
@ -73,6 +74,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
private static HolidayManager holidayManager;
|
private static HolidayManager holidayManager;
|
||||||
private static UpgradeManager upgradeManager;
|
private static UpgradeManager upgradeManager;
|
||||||
private static MaterialMapStore materialMapStore;
|
private static MaterialMapStore materialMapStore;
|
||||||
|
private static PlayerLevelUtils playerLevelUtils;
|
||||||
|
|
||||||
/* Blacklist */
|
/* Blacklist */
|
||||||
private static WorldBlacklist worldBlacklist;
|
private static WorldBlacklist worldBlacklist;
|
||||||
@ -248,10 +250,17 @@ public class mcMMO extends JavaPlugin {
|
|||||||
//Init Material Maps
|
//Init Material Maps
|
||||||
materialMapStore = new MaterialMapStore();
|
materialMapStore = new MaterialMapStore();
|
||||||
|
|
||||||
|
//Init player level values
|
||||||
|
playerLevelUtils = new PlayerLevelUtils();
|
||||||
|
|
||||||
//Init the blacklist
|
//Init the blacklist
|
||||||
worldBlacklist = new WorldBlacklist(this);
|
worldBlacklist = new WorldBlacklist(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static PlayerLevelUtils getPlayerLevelUtils() {
|
||||||
|
return playerLevelUtils;
|
||||||
|
}
|
||||||
|
|
||||||
public static MaterialMapStore getMaterialMapStore() {
|
public static MaterialMapStore getMaterialMapStore() {
|
||||||
return materialMapStore;
|
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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user