SteamWar/SpigotCore
Archiviert
13
0

Moved Change Item

Dieser Commit ist enthalten in:
Chaoscaot 2020-10-11 10:08:56 +02:00
Ursprung b0288c90c3
Commit e52a7983eb

Datei anzeigen

@ -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<SWListInv.SWListEntry<Material>> 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<Material> 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