Extracting BungeeGUI Changes #73
@ -23,15 +23,16 @@ 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.comms.packets.InventoryCallbackPacket;
|
||||
import de.steamwar.inventory.SWInventory;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import org.bukkit.Bukkit;
|
||||
import de.steamwar.comms.packets.*;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class InventoryHandler implements BungeeHandler {
|
||||
|
||||
@ -47,18 +48,14 @@ public class InventoryHandler implements BungeeHandler {
|
||||
for (int i = 0; i < length; i++) {
|
||||
JsonObject itemJson = array.get(i).getAsJsonObject();
|
||||
SWItem item = SWItem.getItemFromJson(itemJson);
|
||||
item.setCallback(click -> {
|
||||
new InventoryCallbackPacket(itemJson, click, player).send(Bukkit.getPlayer(player));
|
||||
});
|
||||
item.setCallback(click -> new InventoryCallbackPacket(itemJson, click, player).send(Bukkit.getPlayer(player)));
|
||||
items.put(itemJson.get("position").getAsInt(), item);
|
||||
}
|
||||
|
||||
SWInventory inventory = new SWInventory(Bukkit.getPlayer(player), size, title, items);
|
||||
inventory.addCloseCallback(click -> {
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(Core.getInstance(), () -> {
|
||||
if(Bukkit.getPlayer(player).getOpenInventory().getType() != InventoryType.CHEST)
|
||||
new InventoryCallbackPacket(player).send(Bukkit.getPlayer(player));
|
||||
}, 1);
|
||||
if(Bukkit.getPlayer(player).getOpenInventory().getType() != InventoryType.CHEST)
|
||||
new InventoryCallbackPacket(player).send(Bukkit.getPlayer(player));
|
||||
});
|
||||
inventory.open();
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren