summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java22
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);
+ }
}
}
}