From bc9a4bca417a2245cb8303099cc45b8a10d22496 Mon Sep 17 00:00:00 2001 From: Shevchik Date: Wed, 11 Dec 2013 15:51:34 +0400 Subject: [PATCH] Unsit player on move --- src/com/cnaude/chairs/EventListener.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/com/cnaude/chairs/EventListener.java b/src/com/cnaude/chairs/EventListener.java index a2a6541..0b2f3a7 100644 --- a/src/com/cnaude/chairs/EventListener.java +++ b/src/com/cnaude/chairs/EventListener.java @@ -15,6 +15,7 @@ import org.bukkit.event.block.Action; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.material.Stairs; import org.bukkit.material.Step; @@ -47,7 +48,7 @@ public class EventListener implements Listener { } } - @EventHandler(priority=EventPriority.MONITOR,ignoreCancelled=true) + @EventHandler(priority=EventPriority.HIGHEST,ignoreCancelled=true) public void onBlockBreak(BlockBreakEvent event) { Block b = event.getBlock(); @@ -57,6 +58,16 @@ public class EventListener implements Listener { plugin.unSitPlayer(player,false); } } + + @EventHandler(priority=EventPriority.MONITOR,ignoreCancelled=true) + public void onPlayerMove(PlayerMoveEvent event) + { + Player player = event.getPlayer(); + if (plugin.sit.containsKey(player.getName())) + { + plugin.unSitPlayer(player,false); + } + } @EventHandler public void onPlayerInteract(PlayerInteractEvent event) {