mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-06-24 13:54:51 +02:00
Fix for kicking offline players
https://github.com/BentoBoxWorld/BentoBox/issues/1950
This commit is contained in:
parent
fd44e03b7b
commit
4e8ca6d22c
|
@ -577,17 +577,17 @@ public class PlayersManager {
|
|||
plugin.getVault().ifPresent(vault -> vault.withdraw(target, vault.getBalance(target), world));
|
||||
}
|
||||
// Reset the health
|
||||
if (plugin.getIWM().isOnLeaveResetHealth(world)) {
|
||||
if (plugin.getIWM().isOnLeaveResetHealth(world) && target.isPlayer()) {
|
||||
Util.resetHealth(target.getPlayer());
|
||||
}
|
||||
|
||||
// Reset the hunger
|
||||
if (plugin.getIWM().isOnLeaveResetHunger(world)) {
|
||||
if (plugin.getIWM().isOnLeaveResetHunger(world) && target.isPlayer()) {
|
||||
target.getPlayer().setFoodLevel(20);
|
||||
}
|
||||
|
||||
// Reset the XP
|
||||
if (plugin.getIWM().isOnLeaveResetXP(world)) {
|
||||
if (plugin.getIWM().isOnLeaveResetXP(world) && target.isPlayer()) {
|
||||
target.getPlayer().setTotalExperience(0);
|
||||
}
|
||||
// Save player
|
||||
|
|
|
@ -169,6 +169,7 @@ public class PlayersManagerTest {
|
|||
when(user.getPlayer()).thenReturn(p);
|
||||
when(user.getName()).thenReturn("tastybento");
|
||||
when(user.isOnline()).thenReturn(true);
|
||||
when(user.isPlayer()).thenReturn(true);
|
||||
User.setPlugin(plugin);
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user