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;