mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-09-29 23:27:30 +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));
|
plugin.getVault().ifPresent(vault -> vault.withdraw(target, vault.getBalance(target), world));
|
||||||
}
|
}
|
||||||
// Reset the health
|
// Reset the health
|
||||||
if (plugin.getIWM().isOnLeaveResetHealth(world)) {
|
if (plugin.getIWM().isOnLeaveResetHealth(world) && target.isPlayer()) {
|
||||||
Util.resetHealth(target.getPlayer());
|
Util.resetHealth(target.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset the hunger
|
// Reset the hunger
|
||||||
if (plugin.getIWM().isOnLeaveResetHunger(world)) {
|
if (plugin.getIWM().isOnLeaveResetHunger(world) && target.isPlayer()) {
|
||||||
target.getPlayer().setFoodLevel(20);
|
target.getPlayer().setFoodLevel(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset the XP
|
// Reset the XP
|
||||||
if (plugin.getIWM().isOnLeaveResetXP(world)) {
|
if (plugin.getIWM().isOnLeaveResetXP(world) && target.isPlayer()) {
|
||||||
target.getPlayer().setTotalExperience(0);
|
target.getPlayer().setTotalExperience(0);
|
||||||
}
|
}
|
||||||
// Save player
|
// Save player
|
||||||
|
@ -169,6 +169,7 @@ public class PlayersManagerTest {
|
|||||||
when(user.getPlayer()).thenReturn(p);
|
when(user.getPlayer()).thenReturn(p);
|
||||||
when(user.getName()).thenReturn("tastybento");
|
when(user.getName()).thenReturn("tastybento");
|
||||||
when(user.isOnline()).thenReturn(true);
|
when(user.isOnline()).thenReturn(true);
|
||||||
|
when(user.isPlayer()).thenReturn(true);
|
||||||
User.setPlugin(plugin);
|
User.setPlugin(plugin);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user