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();
|
experience += event.getExperience();
|
||||||
|
|
||||||
int level = getLevel(), oldLevel = level, needed;
|
int oldLevel = level, needed;
|
||||||
boolean check = false;
|
|
||||||
while (experience >= (needed = getLevelUpExperience())) {
|
while (experience >= (needed = getLevelUpExperience())) {
|
||||||
|
|
||||||
if (hasReachedMaxLevel()) {
|
if (hasReachedMaxLevel()) {
|
||||||
@ -437,10 +436,9 @@ public class PlayerData extends OfflinePlayerData {
|
|||||||
|
|
||||||
experience -= needed;
|
experience -= needed;
|
||||||
level = getLevel() + 1;
|
level = getLevel() + 1;
|
||||||
check = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check) {
|
if (level > oldLevel) {
|
||||||
Bukkit.getPluginManager().callEvent(new PlayerLevelUpEvent(this, null, oldLevel, level));
|
Bukkit.getPluginManager().callEvent(new PlayerLevelUpEvent(this, null, oldLevel, level));
|
||||||
new ConfigMessage("level-up").addPlaceholders("level", "" + level).send(player);
|
new ConfigMessage("level-up").addPlaceholders("level", "" + level).send(player);
|
||||||
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 1);
|
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user