mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 04:20:41 +00:00
Don't close inventories every plugin disable, just our own.
This commit is contained in:
parent
a5ec8b9cbb
commit
61b115ceac
2 changed files with 22 additions and 21 deletions
|
@ -291,6 +291,7 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||||
p.sendMessage(_("unvanishedReload"));
|
p.sendMessage(_("unvanishedReload"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cleanupOpenInventories();
|
||||||
i18n.onDisable();
|
i18n.onDisable();
|
||||||
Economy.setEss(null);
|
Economy.setEss(null);
|
||||||
Trade.closeLog();
|
Trade.closeLog();
|
||||||
|
@ -457,6 +458,26 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
@Override
|
||||||
public void showError(final CommandSender sender, final Throwable exception, final String commandLabel)
|
public void showError(final CommandSender sender, final Throwable exception, final String commandLabel)
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,26 +33,6 @@ public class EssentialsPluginListener implements Listener, IConf
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@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)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPluginDisable(final PluginDisableEvent event)
|
public void onPluginDisable(final PluginDisableEvent event)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue