diff --git a/src/com/cnaude/chairs/Chairs.java b/src/com/cnaude/chairs/Chairs.java index cc01a30..a6b8676 100644 --- a/src/com/cnaude/chairs/Chairs.java +++ b/src/com/cnaude/chairs/Chairs.java @@ -39,9 +39,6 @@ public class Chairs extends JavaPlugin { public int sitEffectInterval; private File pluginFolder; private File configFile; - public HashMap sit = new HashMap(); - public HashMap sitblock = new HashMap(); - public HashMap sitblockbr = new HashMap(); public static final String PLUGIN_NAME = "Chairs"; public static final String LOG_HEADER = "[" + PLUGIN_NAME + "]"; static final Logger log = Bukkit.getLogger(); @@ -116,8 +113,20 @@ public class Chairs extends JavaPlugin { } } - public boolean isProtocolLibLoaded() { - return (getServer().getPluginManager().getPlugin("ProtocolLib") != null); + public HashMap sit = new HashMap(); + public HashMap sitblock = new HashMap(); + public HashMap sitblockbr = new HashMap(); + 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()); + sit.remove(player.getName()); + if (notifyplayer && !msgStanding.isEmpty()) { + player.sendMessage(msgStanding); + } + } } public void loadConfig() { diff --git a/src/com/cnaude/chairs/EventListener.java b/src/com/cnaude/chairs/EventListener.java index 7fbfc0f..7d3bdd4 100644 --- a/src/com/cnaude/chairs/EventListener.java +++ b/src/com/cnaude/chairs/EventListener.java @@ -48,20 +48,11 @@ public class EventListener implements Listener { return true; } } else if (plugin.sit.containsKey(player.getName())) { - unSit(player); + plugin.unSit(player); } return false; } - private void unSit(Player player) { - plugin.sit.get(player.getName()).remove(); - plugin.sitblock.remove(plugin.sitblockbr.get(player.getName())); - plugin.sitblockbr.remove(player.getName()); - plugin.sit.remove(player.getName()); - if (plugin.notifyplayer && !plugin.msgStanding.isEmpty()) { - player.sendMessage(plugin.msgStanding); - } - } @EventHandler(priority=EventPriority.MONITOR,ignoreCancelled=true) public void onPlayerQuit(PlayerQuitEvent event) @@ -70,7 +61,7 @@ public class EventListener implements Listener { if (plugin.sit.containsKey(player.getName())) { player.eject(); - unSit(player); + plugin.unSit(player); } } @@ -83,7 +74,7 @@ public class EventListener implements Listener { String playername = plugin.sitblock.get(b); Player player = Bukkit.getPlayerExact(playername); player.eject(); - unSit(player); + plugin.unSit(player); } } diff --git a/src/com/cnaude/chairs/PacketListener.java b/src/com/cnaude/chairs/PacketListener.java index 2ddefd3..482813c 100644 --- a/src/com/cnaude/chairs/PacketListener.java +++ b/src/com/cnaude/chairs/PacketListener.java @@ -42,7 +42,7 @@ public class PacketListener { if (pluginInstance.sit.containsKey(player.getName())) { player.eject(); - unSit(player); + pluginInstance.unSit(player); } } } @@ -51,18 +51,7 @@ public class PacketListener { } - private void unSit(Player player) { - if (pluginInstance.sit.containsKey(player.getName())) - { - pluginInstance.sit.get(player.getName()).remove(); - pluginInstance.sitblock.remove(pluginInstance.sitblockbr.get(player.getName())); - pluginInstance.sitblockbr.remove(player.getName()); - pluginInstance.sit.remove(player.getName()); - if (pluginInstance.notifyplayer && !pluginInstance.msgStanding.isEmpty()) { - player.sendMessage(pluginInstance.msgStanding); - } - } - } + } diff --git a/target/Chairs.jar b/target/Chairs.jar index 20d11ba..2071de9 100644 Binary files a/target/Chairs.jar and b/target/Chairs.jar differ