diff options
author | KHobbits <rob@khobbits.co.uk> | 2012-08-28 02:24:01 +0100 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2012-08-28 02:24:01 +0100 |
commit | e666c27d96d5c3a6c44d34cb590eccd1ac9a45d5 (patch) | |
tree | c3d24b2261f7b8add84a7aeaccf64b32de61a4c4 | |
parent | 56cfc47ef6049a6396bb89d70e19f7cb40fa5f1c (diff) | |
download | Essentials-e666c27d96d5c3a6c44d34cb590eccd1ac9a45d5.tar Essentials-e666c27d96d5c3a6c44d34cb590eccd1ac9a45d5.tar.gz Essentials-e666c27d96d5c3a6c44d34cb590eccd1ac9a45d5.tar.lz Essentials-e666c27d96d5c3a6c44d34cb590eccd1ac9a45d5.tar.xz Essentials-e666c27d96d5c3a6c44d34cb590eccd1ac9a45d5.zip |
Disable AFK when player damages entity.
-rw-r--r-- | Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java index 1a0820105..c7f7cf051 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java @@ -68,17 +68,21 @@ public class EssentialsEntityListener implements Listener } } } - else if (eDefend instanceof Ageable && eAttack instanceof Player) + else if (eAttack instanceof Player) { - final Player player = (Player)eAttack; - final ItemStack hand = player.getItemInHand(); - if (hand != null && hand.getType() == Material.MILK_BUCKET) + final User player = ess.getUser(eAttack); + player.updateActivity(true); + if (eDefend instanceof Ageable) { - ((Ageable)eDefend).setBaby(); - hand.setType(Material.BUCKET); - player.setItemInHand(hand); - player.updateInventory(); - event.setCancelled(true); + final ItemStack hand = player.getItemInHand(); + if (hand != null && hand.getType() == Material.MILK_BUCKET) + { + ((Ageable)eDefend).setBaby(); + hand.setType(Material.BUCKET); + player.setItemInHand(hand); + player.updateInventory(); + event.setCancelled(true); + } } } } |