Added extra cleanup for FriendsGUI and AddFriendPage
This commit is contained in:
parent
5c2ade8270
commit
cb96124feb
@ -20,6 +20,7 @@ import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
public class AddFriendPage implements Listener
|
||||
@ -91,6 +92,15 @@ public class AddFriendPage implements Listener
|
||||
_currentInventory.clear();
|
||||
HandlerList.unregisterAll(this);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
if (event.getPlayer() == _player)
|
||||
{
|
||||
unregisterListener();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent event)
|
||||
|
@ -18,6 +18,7 @@ import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import net.minecraft.server.v1_7_R4.EntityPlayer;
|
||||
@ -573,6 +574,15 @@ public class FriendsGUI implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
if (event.getPlayer() == _player)
|
||||
{
|
||||
unregisterListener();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void OnInventoryClose(InventoryCloseEvent event)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user