Unsit player on move

This commit is contained in:
Shevchik 2013-12-11 15:51:34 +04:00
parent 7dedc538a9
commit bc9a4bca41

View File

@ -15,6 +15,7 @@ import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.material.Stairs; import org.bukkit.material.Stairs;
import org.bukkit.material.Step; 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) public void onBlockBreak(BlockBreakEvent event)
{ {
Block b = event.getBlock(); Block b = event.getBlock();
@ -57,6 +58,16 @@ public class EventListener implements Listener {
plugin.unSitPlayer(player,false); 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 @EventHandler
public void onPlayerInteract(PlayerInteractEvent event) { public void onPlayerInteract(PlayerInteractEvent event) {