mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-28 19:54:44 +02:00
Changed experience storage from integers to floats
This will make sure no experience is lost when the server has high skill modifiers configured, or when low amounts of experience are being shared.
This commit is contained in:
@ -62,7 +62,7 @@ public final class Motd {
|
||||
* @param player Target player
|
||||
*/
|
||||
public static void displayXpPerks(Player player) {
|
||||
int perkAmount = PerksUtils.handleXpPerks(player, 1);
|
||||
float perkAmount = PerksUtils.handleXpPerks(player, 1);
|
||||
|
||||
if (perkAmount > 1) {
|
||||
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Perks.xp.name"), LocaleLoader.getString("Perks.xp.desc", perkAmount)));
|
||||
|
@ -43,7 +43,7 @@ public final class PerksUtils {
|
||||
return ticks;
|
||||
}
|
||||
|
||||
public static int handleXpPerks(Player player, int xp) {
|
||||
public static float handleXpPerks(Player player, float xp) {
|
||||
if (Permissions.quadrupleXp(player)) {
|
||||
xp *= 4;
|
||||
}
|
||||
|
@ -211,12 +211,12 @@ public class SkillUtils {
|
||||
*/
|
||||
public static void xpCheckSkill(SkillType skillType, Player player, PlayerProfile profile) {
|
||||
int skillups = 0;
|
||||
int xpRemoved = 0;
|
||||
float xpRemoved = 0;
|
||||
|
||||
if (profile.getSkillXpLevel(skillType) >= profile.getXpToLevel(skillType)) {
|
||||
if (profile.getSkillXpLevelRaw(skillType) >= profile.getXpToLevel(skillType)) {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
while (profile.getSkillXpLevel(skillType) >= profile.getXpToLevel(skillType)) {
|
||||
while (profile.getSkillXpLevelRaw(skillType) >= profile.getXpToLevel(skillType)) {
|
||||
if ((skillType.getMaxLevel() >= profile.getSkillLevel(skillType) + 1) && (Config.getInstance().getPowerLevelCap() >= mcMMOPlayer.getPowerLevel() + 1)) {
|
||||
int xp = profile.getXpToLevel(skillType);
|
||||
xpRemoved += xp;
|
||||
@ -235,7 +235,7 @@ public class SkillUtils {
|
||||
|
||||
if (eventToFire.isCancelled()) {
|
||||
profile.modifySkill(skillType, profile.getSkillLevel(skillType) - skillups);
|
||||
profile.setSkillXpLevel(skillType, profile.getSkillXpLevel(skillType) + xpRemoved);
|
||||
profile.setSkillXpLevel(skillType, profile.getSkillXpLevelRaw(skillType) + xpRemoved);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user