Patch my wishes
Dieser Commit ist enthalten in:
Ursprung
658946d4da
Commit
af12de9e41
@ -23,15 +23,16 @@ 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.comms.packets.InventoryCallbackPacket;
|
||||||
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;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import de.steamwar.comms.packets.*;
|
|
||||||
import org.bukkit.event.inventory.InventoryType;
|
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 {
|
public class InventoryHandler implements BungeeHandler {
|
||||||
|
|
||||||
@ -47,18 +48,14 @@ public class InventoryHandler implements BungeeHandler {
|
|||||||
for (int i = 0; i < length; i++) {
|
for (int i = 0; i < length; i++) {
|
||||||
JsonObject itemJson = array.get(i).getAsJsonObject();
|
JsonObject itemJson = array.get(i).getAsJsonObject();
|
||||||
SWItem item = SWItem.getItemFromJson(itemJson);
|
SWItem item = SWItem.getItemFromJson(itemJson);
|
||||||
item.setCallback(click -> {
|
item.setCallback(click -> new InventoryCallbackPacket(itemJson, click, player).send(Bukkit.getPlayer(player)));
|
||||||
new InventoryCallbackPacket(itemJson, click, player).send(Bukkit.getPlayer(player));
|
|
||||||
});
|
|
||||||
items.put(itemJson.get("position").getAsInt(), item);
|
items.put(itemJson.get("position").getAsInt(), item);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 -> {
|
||||||
Bukkit.getScheduler().runTaskLaterAsynchronously(Core.getInstance(), () -> {
|
if(Bukkit.getPlayer(player).getOpenInventory().getType() != InventoryType.CHEST)
|
||||||
if(Bukkit.getPlayer(player).getOpenInventory().getType() != InventoryType.CHEST)
|
new InventoryCallbackPacket(player).send(Bukkit.getPlayer(player));
|
||||||
new InventoryCallbackPacket(player).send(Bukkit.getPlayer(player));
|
|
||||||
}, 1);
|
|
||||||
});
|
});
|
||||||
inventory.open();
|
inventory.open();
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren