diff options
-rw-r--r-- | Essentials/src/com/earth2me/essentials/Essentials.java | 21 | ||||
-rw-r--r-- | Essentials/src/com/earth2me/essentials/EssentialsPluginListener.java | 22 |
2 files changed, 22 insertions, 21 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java index a0b01f5a2..1b462d474 100644 --- a/Essentials/src/com/earth2me/essentials/Essentials.java +++ b/Essentials/src/com/earth2me/essentials/Essentials.java @@ -291,6 +291,7 @@ public class Essentials extends JavaPlugin implements IEssentials p.sendMessage(_("unvanishedReload")); } } + cleanupOpenInventories(); i18n.onDisable(); Economy.setEss(null); Trade.closeLog(); @@ -456,6 +457,26 @@ public class Essentials extends JavaPlugin implements IEssentials return true; } } + + public void cleanupOpenInventories() + { + for (Player player : getServer().getOnlinePlayers()) + { + User user = getUser(player); + if (user.isRecipeSee()) + { + user.getPlayer().getOpenInventory().getTopInventory().clear(); + user.getPlayer().getOpenInventory().close(); + user.setRecipeSee(false); + } + if (user.isInvSee() || user.isEnderSee()) + { + user.getPlayer().getOpenInventory().close(); + user.setInvSee(false); + user.setEnderSee(false); + } + } + } @Override public void showError(final CommandSender sender, final Throwable exception, final String commandLabel) diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPluginListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPluginListener.java index 1cb89d532..c25233bcc 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsPluginListener.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsPluginListener.java @@ -31,27 +31,7 @@ public class EssentialsPluginListener implements Listener, IConf { ess.getLogger().log(Level.INFO, "Payment method found (" + ess.getPaymentMethod().getMethod().getLongName() + " version: " + ess.getPaymentMethod().getMethod().getVersion() + ")"); } - } - - @EventHandler(priority = EventPriority.NORMAL) - public void cleanupOpenInventories(final PluginDisableEvent event) - { - for (Player player : ess.getServer().getOnlinePlayers()) - { - User user = ess.getUser(player); - if (user.isRecipeSee()) - { - user.getPlayer().getOpenInventory().getTopInventory().clear(); - user.getPlayer().getOpenInventory().close(); - user.setRecipeSee(false); - } - if (user.isInvSee()) - { - user.getPlayer().getOpenInventory().close(); - user.setInvSee(false); - } - } - } + } @EventHandler(priority = EventPriority.MONITOR) public void onPluginDisable(final PluginDisableEvent event) |