forked from Upstream/mmocore
!Fixed leveling issue
This commit is contained in:
parent
c1e3b6942c
commit
00571e12fe
@ -426,8 +426,7 @@ public class PlayerData extends OfflinePlayerData {
|
||||
|
||||
experience += event.getExperience();
|
||||
|
||||
int level = getLevel(), oldLevel = level, needed;
|
||||
boolean check = false;
|
||||
int oldLevel = level, needed;
|
||||
while (experience >= (needed = getLevelUpExperience())) {
|
||||
|
||||
if (hasReachedMaxLevel()) {
|
||||
@ -437,10 +436,9 @@ public class PlayerData extends OfflinePlayerData {
|
||||
|
||||
experience -= needed;
|
||||
level = getLevel() + 1;
|
||||
check = true;
|
||||
}
|
||||
|
||||
if (check) {
|
||||
if (level > oldLevel) {
|
||||
Bukkit.getPluginManager().callEvent(new PlayerLevelUpEvent(this, null, oldLevel, level));
|
||||
new ConfigMessage("level-up").addPlaceholders("level", "" + level).send(player);
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 1);
|
||||
|
Loading…
Reference in New Issue
Block a user