mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-23 09:37:50 +01:00
Don't close inventories every plugin disable, just our own.
This commit is contained in:
parent
a5ec8b9cbb
commit
61b115ceac
@ -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)
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user