mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-26 01:51:42 +01:00
Apply patch "Fixed exp for 1.8" from Spigot-Essentials, fixes #3
This commit is contained in:
parent
8e2ffe08f8
commit
3634cab1a5
@ -36,14 +36,16 @@ public class SetExpFix {
|
||||
return getExpAtLevel(player.getLevel());
|
||||
}
|
||||
|
||||
//new Exp Math from 1.8
|
||||
public static int getExpAtLevel(final int level) {
|
||||
if (level > 29) {
|
||||
return 62 + (level - 30) * 7;
|
||||
if (level <= 15) {
|
||||
return (2 * level) + 7;
|
||||
}
|
||||
if (level > 15) {
|
||||
return 17 + (level - 15) * 3;
|
||||
if ((level >= 16) && (level <= 30)) {
|
||||
return (5 * level) - 38;
|
||||
}
|
||||
return 17;
|
||||
return (9 * level) - 158;
|
||||
|
||||
}
|
||||
|
||||
public static int getExpToLevel(final int level) {
|
||||
@ -63,7 +65,7 @@ public class SetExpFix {
|
||||
//This method is required because the bukkit player.getTotalExperience() method, shows exp that has been 'spent'.
|
||||
//Without this people would be able to use exp and then still sell it.
|
||||
public static int getTotalExperience(final Player player) {
|
||||
int exp = Math.round(getExpAtLevel(player) * player.getExp());
|
||||
int exp = (int) Math.round(getExpAtLevel(player) * player.getExp());
|
||||
int currentLevel = player.getLevel();
|
||||
|
||||
while (currentLevel > 0) {
|
||||
@ -77,8 +79,8 @@ public class SetExpFix {
|
||||
}
|
||||
|
||||
public static int getExpUntilNextLevel(final Player player) {
|
||||
int exp = Math.round(getExpAtLevel(player) * player.getExp());
|
||||
int exp = (int) Math.round(getExpAtLevel(player) * player.getExp());
|
||||
int nextLevel = player.getLevel();
|
||||
return getExpAtLevel(nextLevel) - exp;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user