From b60363b6bd916f1c209e2fbe3bdb8c0585e08c9c Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sun, 25 Mar 2012 16:30:22 +0100 Subject: [PATCH] Reduce amount of move event calls being processed. --- .../earth2me/essentials/EssentialsPlayerListener.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java index d6757f025..cbd4cebce 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java @@ -75,6 +75,13 @@ public class EssentialsPlayerListener implements Listener @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void onPlayerMove(final PlayerMoveEvent event) { + if (event.getFrom().getBlockX() == event.getTo().getBlockX() + && event.getFrom().getBlockZ() == event.getTo().getBlockZ() + && event.getFrom().getBlockY() == event.getTo().getBlockY()) + { + return; + } + final User user = ess.getUser(event.getPlayer()); if (user.isAfk() && ess.getSettings().getFreezeAfkPlayers()) @@ -399,13 +406,14 @@ public class EssentialsPlayerListener implements Listener } } } + @EventHandler(priority = EventPriority.MONITOR) public void onInventoryCloseEvent(final InventoryCloseEvent event) { if (event.getView().getTopInventory().getType() == InventoryType.PLAYER) { final User user = ess.getUser(event.getPlayer()); - user.setInvSee(false); + user.setInvSee(false); } } }