diff options
-rw-r--r-- | Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java index bb58067bc..9bfc15eea 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java @@ -170,12 +170,18 @@ public class EssentialsEntityListener implements Listener @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onFoodLevelChange(final FoodLevelChangeEvent event) { - if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled()) + if (event.getEntity() instanceof Player) { - final Player player = (Player)event.getEntity(); - player.setFoodLevel(20); - player.setSaturation(10); - event.setCancelled(true); + final User user = ess.getUser(event.getEntity()); + if (user.isGodModeEnabled()) + { + if (user.isGodModeEnabledRaw()) + { + user.setFoodLevel(20); + user.setSaturation(10); + } + event.setCancelled(true); + } } } @@ -200,8 +206,9 @@ public class EssentialsEntityListener implements Listener } } } + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) - public void onEntityShootBow (EntityShootBowEvent event) + public void onEntityShootBow(EntityShootBowEvent event) { if (event.getEntity() instanceof Player) { |