diff --git a/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java b/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java index 2c6c215..9f5dbac 100644 --- a/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java +++ b/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java @@ -26,10 +26,10 @@ import de.steamwar.comms.handlers.InventoryHandler; import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWListInv; import de.steamwar.sql.*; +import net.minecraft.server.v1_15_R1.Packet; 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; @@ -49,7 +49,7 @@ public class BungeeReceiver implements PluginMessageListener { UUID uuid = SteamwarUser.get(byteArrayDataInput.readInt()).getUUID(); if(Bukkit.getPlayer(uuid).isOnline()) { Player player = Bukkit.getPlayer(uuid); - player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, SoundCategory.MASTER, 1, 1); + player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1); } }); @@ -58,7 +58,7 @@ public class BungeeReceiver implements PluginMessageListener { Player player = Bukkit.getPlayer(SteamwarUser.get(byteArrayDataInput.readInt()).getUUID()); player.closeInventory(); }); - BungeeReceiver.registerHandler((byte) 0x26, byteArrayDataInput -> { + BungeeReceiver.registerHandler((byte) PacketIdManager.CHANGE_ITEM_INV, byteArrayDataInput -> { Player player = Bukkit.getPlayer(SteamwarUser.get(byteArrayDataInput.readInt()).getUUID()); Schematic schem = Schematic.getSchemFromDB(byteArrayDataInput.readInt()); List> materials = new LinkedList<>(); @@ -81,10 +81,6 @@ public class BungeeReceiver implements PluginMessageListener { public void onPluginMessageReceived(String s, Player player, byte[] bytes) { ByteArrayDataInput in = ByteStreams.newDataInput(bytes); Byte handler = in.readByte(); - if(handlerMap.containsKey(handler)) - handlerMap.get(handler).handle(in); - else - throw new SecurityException("Could not find Handler"); - + handlerMap.get(handler).handle(in); } } diff --git a/SpigotCore_Main/src/de/steamwar/comms/PacketIdManager.java b/SpigotCore_Main/src/de/steamwar/comms/PacketIdManager.java index 63d0327..6026b17 100644 --- a/SpigotCore_Main/src/de/steamwar/comms/PacketIdManager.java +++ b/SpigotCore_Main/src/de/steamwar/comms/PacketIdManager.java @@ -28,6 +28,8 @@ public class PacketIdManager { public final static byte INVENTORY_CALLBACK_PACKET = 0x11; public final static byte INVENTORY_CLOSE_PACKET = 0x12; //0x2(X) Schematic System - public final static byte MATERIALS_GET_PACKET = 0x21; - public final static byte MATERIALS_RETURN_PACKET = 0x22; + public static final byte LOAD_SCHEMATIC = 0x23; + public static final byte SAVE_SCHEMATIC = 0x24; + public static final byte CHECK_SCHEMATIC = 0x25; + public static final byte CHANGE_ITEM_INV = 0x26; } diff --git a/SpigotCore_Main/src/de/steamwar/sql/Schematic.java b/SpigotCore_Main/src/de/steamwar/sql/Schematic.java index 00bff09..fb4846f 100644 --- a/SpigotCore_Main/src/de/steamwar/sql/Schematic.java +++ b/SpigotCore_Main/src/de/steamwar/sql/Schematic.java @@ -61,8 +61,8 @@ public class Schematic { } public static void createSchem(String schemName, int schemOwner, String item, SchematicType schemType){ - SQL.update("INSERT INTO Schematic (SchemName, SchemOwner, Item, SchemType, Rank) VALUES (?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE Item = VALUES(Item), SchemType = VALUES(SchemType)", - schemName, schemOwner, item, schemType.toDB(), 0); + SQL.update("INSERT INTO Schematic (SchemName, SchemOwner, Item, SchemType) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE Item = VALUES(Item), SchemType = VALUES(SchemType)", + schemName, schemOwner, item, schemType.toDB()); } public static Schematic getSchemFromDB(String schemName, UUID schemOwner){