Fixes EXP reset for players onJoin and onLeave (#2286)

The total experience does not reset player collected exp. This fixes that, as it will set level to 0 and progress in towards next level to 0
This commit is contained in:
BONNe 2024-01-31 05:32:13 +02:00 committed by GitHub
parent c9b7074e79
commit 6bf12d5e20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 16 additions and 0 deletions

View File

@ -109,6 +109,10 @@ public class AdminDeleteCommand extends ConfirmableCommand {
// Reset the XP
if (getIWM().isOnLeaveResetXP(getWorld())) {
// Player collected XP (displayed)
target.getPlayer().setLevel(0);
target.getPlayer().setExp(0);
// Player total XP (not displayed)
target.getPlayer().setTotalExperience(0);
}

View File

@ -218,6 +218,10 @@ public class IslandTeamInviteAcceptCommand extends ConfirmableCommand {
// Reset the XP
if (getIWM().isOnJoinResetXP(getWorld())) {
// Player collected XP (displayed)
user.getPlayer().setLevel(0);
user.getPlayer().setExp(0);
// Player total XP (not displayed)
user.getPlayer().setTotalExperience(0);
}

View File

@ -1177,6 +1177,10 @@ public class IslandsManager {
// Reset the XP
if (plugin.getIWM().isOnJoinResetXP(world)) {
// Player collected XP (displayed)
user.getPlayer().setLevel(0);
user.getPlayer().setExp(0);
// Player total XP (not displayed)
user.getPlayer().setTotalExperience(0);
}

View File

@ -489,6 +489,10 @@ public class PlayersManager {
// Reset the XP
if (plugin.getIWM().isOnLeaveResetXP(world) && target.isPlayer()) {
// Player collected XP (displayed)
target.getPlayer().setLevel(0);
target.getPlayer().setExp(0);
// Player total XP (not displayed)
target.getPlayer().setTotalExperience(0);
}
// Save player