Don't close inventories every plugin disable, just our own.

This commit is contained in:
KHobbits 2013-03-19 21:05:12 +00:00
parent a5ec8b9cbb
commit 61b115ceac
2 changed files with 22 additions and 21 deletions

View File

@ -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)

View File

@ -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)