SteamWar/SpigotCore
Archiviert
13
0

Fixing Inventory not Removing

Dieser Commit ist enthalten in:
Chaoscaot 2020-10-10 11:09:16 +02:00
Ursprung 5491be4430
Commit 9c0979bf58
2 geänderte Dateien mit 6 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -23,6 +23,7 @@ import com.google.common.io.ByteArrayDataInput;
import com.google.gson.JsonArray; import com.google.gson.JsonArray;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
import de.steamwar.core.Core;
import de.steamwar.inventory.SWInventory; import de.steamwar.inventory.SWInventory;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
@ -54,8 +55,10 @@ public class InventoryHandler implements BungeeHandler {
SWInventory inventory = new SWInventory(Bukkit.getPlayer(player), size, title, items); SWInventory inventory = new SWInventory(Bukkit.getPlayer(player), size, title, items);
inventory.addCloseCallback(click -> { inventory.addCloseCallback(click -> {
if(Bukkit.getPlayer(player).getOpenInventory().getType() == InventoryType.CRAFTING) Bukkit.getScheduler().runTaskLaterAsynchronously(Core.getInstance(), () -> {
new InventoryCallbackPacket(player).send(Bukkit.getPlayer(player)); if(Bukkit.getPlayer(player).getOpenInventory().getType() != InventoryType.CHEST)
new InventoryCallbackPacket(player).send(Bukkit.getPlayer(player));
}, 1);
}); });
inventory.open(); inventory.open();
} }

Datei anzeigen

@ -28,6 +28,7 @@ import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryView;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;