diff --git a/src/com/cnaude/chairs/Chairs.java b/src/com/cnaude/chairs/Chairs.java index a6b8676..beaf273 100644 --- a/src/com/cnaude/chairs/Chairs.java +++ b/src/com/cnaude/chairs/Chairs.java @@ -113,15 +113,22 @@ public class Chairs extends JavaPlugin { } } - public HashMap sit = new HashMap(); - public HashMap sitblock = new HashMap(); - public HashMap sitblockbr = new HashMap(); + protected HashMap sit = new HashMap(); + protected HashMap sitblock = new HashMap(); + protected HashMap sitblockbr = new HashMap(); + protected HashMap sitstopteleportloc = new HashMap(); + protected void ejectPlayer(Player player) + { + player.eject(); + unSit(player); + } protected void unSit(Player player) { if (sit.containsKey(player.getName())) { sit.get(player.getName()).remove(); sitblock.remove(sitblockbr.get(player.getName())); sitblockbr.remove(player.getName()); + sitstopteleportloc.remove(player.getName()); sit.remove(player.getName()); if (notifyplayer && !msgStanding.isEmpty()) { player.sendMessage(msgStanding); diff --git a/src/com/cnaude/chairs/EventListener.java b/src/com/cnaude/chairs/EventListener.java index 1ae8f31..9f87b50 100644 --- a/src/com/cnaude/chairs/EventListener.java +++ b/src/com/cnaude/chairs/EventListener.java @@ -60,8 +60,7 @@ public class EventListener implements Listener { Player player = event.getPlayer(); if (plugin.sit.containsKey(player.getName())) { - player.eject(); - plugin.unSit(player); + plugin.ejectPlayer(player); } } @@ -71,10 +70,8 @@ public class EventListener implements Listener { Block b = event.getBlock(); if (plugin.sitblock.containsKey(b)) { - String playername = plugin.sitblock.get(b); - Player player = Bukkit.getPlayerExact(playername); - player.eject(); - plugin.unSit(player); + Player player = Bukkit.getPlayerExact(plugin.sitblock.get(b)); + plugin.ejectPlayer(player); } } diff --git a/src/com/cnaude/chairs/PacketListener.java b/src/com/cnaude/chairs/PacketListener.java index 482813c..027a4ea 100644 --- a/src/com/cnaude/chairs/PacketListener.java +++ b/src/com/cnaude/chairs/PacketListener.java @@ -41,8 +41,7 @@ public class PacketListener { //just eject player if he is sitting on chair if (pluginInstance.sit.containsKey(player.getName())) { - player.eject(); - pluginInstance.unSit(player); + pluginInstance.ejectPlayer(player); } } } diff --git a/target/Chairs.jar b/target/Chairs.jar index 40e3624..ff4bceb 100644 Binary files a/target/Chairs.jar and b/target/Chairs.jar differ