From e52a7983eba0d34dd85bffd4a59e9a1d7fe2e02a Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sun, 11 Oct 2020 10:08:56 +0200 Subject: [PATCH] Moved Change Item --- .../src/de/steamwar/comms/BungeeReceiver.java | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java b/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java index 071a1a5..2c6c215 100644 --- a/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java +++ b/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java @@ -23,16 +23,18 @@ import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteStreams; import de.steamwar.comms.handlers.BungeeHandler; import de.steamwar.comms.handlers.InventoryHandler; +import de.steamwar.inventory.SWItem; +import de.steamwar.inventory.SWListInv; import de.steamwar.sql.*; import org.bukkit.Bukkit; +import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.SoundCategory; import org.bukkit.entity.Player; +import org.bukkit.event.inventory.ClickType; import org.bukkit.plugin.messaging.PluginMessageListener; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; +import java.util.*; public class BungeeReceiver implements PluginMessageListener { @@ -56,6 +58,23 @@ public class BungeeReceiver implements PluginMessageListener { Player player = Bukkit.getPlayer(SteamwarUser.get(byteArrayDataInput.readInt()).getUUID()); player.closeInventory(); }); + BungeeReceiver.registerHandler((byte) 0x26, byteArrayDataInput -> { + Player player = Bukkit.getPlayer(SteamwarUser.get(byteArrayDataInput.readInt()).getUUID()); + Schematic schem = Schematic.getSchemFromDB(byteArrayDataInput.readInt()); + List> materials = new LinkedList<>(); + for(Material material : Material.values()){ + SWItem item = new SWItem(material, "§7" + material); + if(item.getItemMeta() != null && material.isItem()) + materials.add(new SWListInv.SWListEntry<>(item, material)); + } + + SWListInv inv = new SWListInv<>(player, "Item ändern", materials, (clickType, material) -> { + schem.setItem(material.name()); + player.closeInventory(); + }); + inv.setCallback(-999, (ClickType click) -> player.closeInventory()); + inv.open(); + }); } @Override