From 9c0979bf58ba9d966db58e42ef372606c9a2da2c Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 10 Oct 2020 11:09:16 +0200 Subject: [PATCH] Fixing Inventory not Removing --- .../src/de/steamwar/comms/handlers/InventoryHandler.java | 7 +++++-- SpigotCore_Main/src/de/steamwar/inventory/SWInventory.java | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/SpigotCore_Main/src/de/steamwar/comms/handlers/InventoryHandler.java b/SpigotCore_Main/src/de/steamwar/comms/handlers/InventoryHandler.java index 521755e..a62398e 100644 --- a/SpigotCore_Main/src/de/steamwar/comms/handlers/InventoryHandler.java +++ b/SpigotCore_Main/src/de/steamwar/comms/handlers/InventoryHandler.java @@ -23,6 +23,7 @@ import com.google.common.io.ByteArrayDataInput; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.gson.JsonParser; +import de.steamwar.core.Core; import de.steamwar.inventory.SWInventory; import de.steamwar.inventory.SWItem; import de.steamwar.sql.SteamwarUser; @@ -54,8 +55,10 @@ public class InventoryHandler implements BungeeHandler { SWInventory inventory = new SWInventory(Bukkit.getPlayer(player), size, title, items); inventory.addCloseCallback(click -> { - if(Bukkit.getPlayer(player).getOpenInventory().getType() == InventoryType.CRAFTING) - new InventoryCallbackPacket(player).send(Bukkit.getPlayer(player)); + Bukkit.getScheduler().runTaskLaterAsynchronously(Core.getInstance(), () -> { + if(Bukkit.getPlayer(player).getOpenInventory().getType() != InventoryType.CHEST) + new InventoryCallbackPacket(player).send(Bukkit.getPlayer(player)); + }, 1); }); inventory.open(); } diff --git a/SpigotCore_Main/src/de/steamwar/inventory/SWInventory.java b/SpigotCore_Main/src/de/steamwar/inventory/SWInventory.java index 1208056..83661db 100644 --- a/SpigotCore_Main/src/de/steamwar/inventory/SWInventory.java +++ b/SpigotCore_Main/src/de/steamwar/inventory/SWInventory.java @@ -28,6 +28,7 @@ import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.InventoryView; import java.util.ArrayList; import java.util.HashMap;