From d0fe58565d723ff3a6233462aa819d4880c4999d Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 2 Oct 2020 14:15:00 +0200 Subject: [PATCH 01/15] Bungee-SchemGUI --- .../src/de/steamwar/comms/BungeeReceiver.java | 70 ++++++++++++++++++- .../de/steamwar/comms/PacketIdManager.java | 5 ++ .../comms/packets/MaterialsReturnPacket.java | 36 ++++++++++ .../src/de/steamwar/core/Core.java | 1 + 4 files changed, 110 insertions(+), 2 deletions(-) create mode 100644 SpigotCore_Main/src/de/steamwar/comms/packets/MaterialsReturnPacket.java diff --git a/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java b/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java index 7c1ba11..f70c147 100644 --- a/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java +++ b/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java @@ -23,24 +23,34 @@ 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.sql.SteamwarUser; +import de.steamwar.comms.packets.MaterialsReturnPacket; +import de.steamwar.core.Core; +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.plugin.messaging.PluginMessageListener; +import java.io.IOException; import java.util.HashMap; import java.util.Map; import java.util.UUID; +import java.util.logging.Level; +import java.util.stream.Collectors; public class BungeeReceiver implements PluginMessageListener { private static Map handlerMap = new HashMap<>(); + private static Map backupMap = new HashMap<>(); public static void registerHandler(Byte code, BungeeHandler handler) { handlerMap.put(code, handler); } + public static void registerBackup(Byte code, BungeeHandler handler) { + backupMap.put(code, handler); + } static { registerHandler(PacketIdManager.PING_PACKET, byteArrayDataInput -> { @@ -56,12 +66,68 @@ public class BungeeReceiver implements PluginMessageListener { Player player = Bukkit.getPlayer(SteamwarUser.get(byteArrayDataInput.readInt()).getUUID()); player.closeInventory(); }); + registerHandler(PacketIdManager.MATERIALS_GET_PACKET, byteArrayDataInput -> { + UUID id = UUID.fromString(byteArrayDataInput.readUTF()); + MaterialsReturnPacket packet = new MaterialsReturnPacket(id, Material.values()); + packet.send(Bukkit.getOnlinePlayers().stream().limit(1).collect(Collectors.toList()).get(1)); + }); + registerHandler(PacketIdManager.LOAD_SCHEMATIC, byteArrayDataInput -> { + Player player = Bukkit.getPlayer(SteamwarUser.get(byteArrayDataInput.readInt()).getUUID()); + Schematic schematic = Schematic.getSchemFromDB(byteArrayDataInput.readInt()); + if(SchematicMember.getAccessibleSchems(player.getUniqueId()).contains(schematic)) { + try { + schematic.loadToPlayer(player); + player.sendMessage("§eSchematic§8» §7" + "Schematic §e" + schematic.getSchemName() + " §7geladen"); + }catch (IOException | NoClipboardException e){ + Bukkit.getLogger().log(Level.SEVERE, "Schematic konnte nicht geladen werden", e); + player.sendMessage("§eSchematic§8» §7" + "§cFehler beim Laden der Schematic. Bitte wende dich an einen Developer"); + } + } + }); + registerHandler(PacketIdManager.SAVE_SCHEMATIC, byteArrayDataInput -> { + Player player = Bukkit.getPlayer(SteamwarUser.get(byteArrayDataInput.readInt()).getUUID()); + String name = byteArrayDataInput.readUTF(); + Schematic schematic = Schematic.getSchemFromDB(name, player.getUniqueId()); + boolean newSchem = false; + if(schematic == null || schematic.getSchemOwner() != SteamwarUser.get(player.getUniqueId()).getId()){ + newSchem = true; + Schematic.createSchem(name, player.getUniqueId(), "", SchematicType.Normal); + schematic = Schematic.getSchemFromDB(name, player.getUniqueId()); + } + try { + schematic.saveFromPlayer(player); + }catch(IOException ex){ + Bukkit.getLogger().log(Level.SEVERE, "Could not save schematic", ex); + player.sendMessage(Core.SCHEMATIC_PREFIX + "§cFehler beim Speichern der Schematic. Bitte wende dich an einen Developer"); + if(newSchem) + schematic.remove(); + return; + }catch (NoClipboardException e) { + player.sendMessage(Core.SCHEMATIC_PREFIX + "§cDein Clipboard ist leer"); + if(newSchem) + schematic.remove(); + return; + } + if (newSchem) + player.sendMessage(Core.SCHEMATIC_PREFIX + "Schematic §e" + name + " §7gespeichert"); + else + player.sendMessage(Core.SCHEMATIC_PREFIX + "Schematic §e" + name + " §7überschrieben"); + }); + registerBackup((byte) 0x25, byteArrayDataInput -> { + byteArrayDataInput.readInt(); + Player player = Bukkit.getPlayer(SteamwarUser.get(byteArrayDataInput.readInt()).getUUID()); + player.sendMessage(Core.SCHEMATIC_PREFIX + "§cDieser Server kann keine Schematics prüfen"); + }); } @Override public void onPluginMessageReceived(String s, Player player, byte[] bytes) { ByteArrayDataInput in = ByteStreams.newDataInput(bytes); Byte handler = in.readByte(); - handlerMap.get(handler).handle(in); + if(handlerMap.containsKey(handler)) + handlerMap.get(handler).handle(in); + else if(backupMap.containsKey(handler)) + backupMap.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 27dbd81..6ec81d3 100644 --- a/SpigotCore_Main/src/de/steamwar/comms/PacketIdManager.java +++ b/SpigotCore_Main/src/de/steamwar/comms/PacketIdManager.java @@ -27,4 +27,9 @@ public class PacketIdManager { public final static byte INVENTORY_PACKET = 0x10; 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; } diff --git a/SpigotCore_Main/src/de/steamwar/comms/packets/MaterialsReturnPacket.java b/SpigotCore_Main/src/de/steamwar/comms/packets/MaterialsReturnPacket.java new file mode 100644 index 0000000..1b4b0fd --- /dev/null +++ b/SpigotCore_Main/src/de/steamwar/comms/packets/MaterialsReturnPacket.java @@ -0,0 +1,36 @@ +package de.steamwar.comms.packets; + +import com.google.common.io.ByteArrayDataOutput; +import com.google.gson.JsonArray; +import de.steamwar.comms.PacketIdManager; +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; + +import java.util.UUID; + +public class MaterialsReturnPacket extends SpigotPacket{ + + final UUID id; + final Material[] array; + + public MaterialsReturnPacket(UUID id, Material[] array) { + this.id = id; + this.array = array; + } + + @Override + public int getName() { + return PacketIdManager.MATERIALS_RETURN_PACKET; + } + + @Override + public void writeVars(ByteArrayDataOutput byteArrayDataOutput) { + byteArrayDataOutput.writeUTF(id.toString()); + JsonArray array = new JsonArray(); + for (int i = 0; i < this.array.length; i++) { + if(new ItemStack(this.array[i]).getItemMeta() != null && this.array[i].isItem()) + array.add(this.array[i].name()); + } + byteArrayDataOutput.writeUTF(array.toString()); + } +} diff --git a/SpigotCore_Main/src/de/steamwar/core/Core.java b/SpigotCore_Main/src/de/steamwar/core/Core.java index 893e53a..9bc14ef 100644 --- a/SpigotCore_Main/src/de/steamwar/core/Core.java +++ b/SpigotCore_Main/src/de/steamwar/core/Core.java @@ -32,6 +32,7 @@ import org.bukkit.plugin.java.JavaPlugin; public class Core extends JavaPlugin{ private static Core instance; private static final int version; + public static final String SCHEMATIC_PREFIX = "§eSchematic§8» §7"; static{ String packageName = Bukkit.getServer().getClass().getPackage().getName(); -- 2.39.5 From f2a0100229c18cf73f28a5d980432b12f629583c Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 2 Oct 2020 14:52:58 +0200 Subject: [PATCH 02/15] Add License --- .../comms/packets/MaterialsReturnPacket.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/SpigotCore_Main/src/de/steamwar/comms/packets/MaterialsReturnPacket.java b/SpigotCore_Main/src/de/steamwar/comms/packets/MaterialsReturnPacket.java index 1b4b0fd..6feb97d 100644 --- a/SpigotCore_Main/src/de/steamwar/comms/packets/MaterialsReturnPacket.java +++ b/SpigotCore_Main/src/de/steamwar/comms/packets/MaterialsReturnPacket.java @@ -1,3 +1,22 @@ +/* + This file is a part of the SteamWar software. + + Copyright (C) 2020 SteamWar.de-Serverteam + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + */ + package de.steamwar.comms.packets; import com.google.common.io.ByteArrayDataOutput; -- 2.39.5 From 43eb2c3293e2e1dd18731ac32575ad89e9849402 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 2 Oct 2020 15:22:39 +0200 Subject: [PATCH 03/15] Moved Schemhandeling to SchematicSystem --- .../src/de/steamwar/comms/BungeeReceiver.java | 63 +++---------------- .../de/steamwar/comms/PacketIdManager.java | 4 +- .../comms/packets/PluginCallbackPacket.java | 45 +++++++++++++ 3 files changed, 55 insertions(+), 57 deletions(-) create mode 100644 SpigotCore_Main/src/de/steamwar/comms/packets/PluginCallbackPacket.java diff --git a/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java b/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java index f70c147..e45bae4 100644 --- a/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java +++ b/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java @@ -24,6 +24,7 @@ import com.google.common.io.ByteStreams; import de.steamwar.comms.handlers.BungeeHandler; import de.steamwar.comms.handlers.InventoryHandler; import de.steamwar.comms.packets.MaterialsReturnPacket; +import de.steamwar.comms.packets.PluginCallbackPacket; import de.steamwar.core.Core; import de.steamwar.sql.*; import org.bukkit.Bukkit; @@ -33,24 +34,18 @@ import org.bukkit.SoundCategory; import org.bukkit.entity.Player; import org.bukkit.plugin.messaging.PluginMessageListener; -import java.io.IOException; import java.util.HashMap; import java.util.Map; import java.util.UUID; -import java.util.logging.Level; import java.util.stream.Collectors; public class BungeeReceiver implements PluginMessageListener { private static Map handlerMap = new HashMap<>(); - private static Map backupMap = new HashMap<>(); public static void registerHandler(Byte code, BungeeHandler handler) { handlerMap.put(code, handler); } - public static void registerBackup(Byte code, BungeeHandler handler) { - backupMap.put(code, handler); - } static { registerHandler(PacketIdManager.PING_PACKET, byteArrayDataInput -> { @@ -69,54 +64,12 @@ public class BungeeReceiver implements PluginMessageListener { registerHandler(PacketIdManager.MATERIALS_GET_PACKET, byteArrayDataInput -> { UUID id = UUID.fromString(byteArrayDataInput.readUTF()); MaterialsReturnPacket packet = new MaterialsReturnPacket(id, Material.values()); - packet.send(Bukkit.getOnlinePlayers().stream().limit(1).collect(Collectors.toList()).get(1)); + packet.send(Bukkit.getOnlinePlayers().stream().limit(1).collect(Collectors.toList()).get(0)); }); - registerHandler(PacketIdManager.LOAD_SCHEMATIC, byteArrayDataInput -> { - Player player = Bukkit.getPlayer(SteamwarUser.get(byteArrayDataInput.readInt()).getUUID()); - Schematic schematic = Schematic.getSchemFromDB(byteArrayDataInput.readInt()); - if(SchematicMember.getAccessibleSchems(player.getUniqueId()).contains(schematic)) { - try { - schematic.loadToPlayer(player); - player.sendMessage("§eSchematic§8» §7" + "Schematic §e" + schematic.getSchemName() + " §7geladen"); - }catch (IOException | NoClipboardException e){ - Bukkit.getLogger().log(Level.SEVERE, "Schematic konnte nicht geladen werden", e); - player.sendMessage("§eSchematic§8» §7" + "§cFehler beim Laden der Schematic. Bitte wende dich an einen Developer"); - } - } - }); - registerHandler(PacketIdManager.SAVE_SCHEMATIC, byteArrayDataInput -> { - Player player = Bukkit.getPlayer(SteamwarUser.get(byteArrayDataInput.readInt()).getUUID()); - String name = byteArrayDataInput.readUTF(); - Schematic schematic = Schematic.getSchemFromDB(name, player.getUniqueId()); - boolean newSchem = false; - if(schematic == null || schematic.getSchemOwner() != SteamwarUser.get(player.getUniqueId()).getId()){ - newSchem = true; - Schematic.createSchem(name, player.getUniqueId(), "", SchematicType.Normal); - schematic = Schematic.getSchemFromDB(name, player.getUniqueId()); - } - try { - schematic.saveFromPlayer(player); - }catch(IOException ex){ - Bukkit.getLogger().log(Level.SEVERE, "Could not save schematic", ex); - player.sendMessage(Core.SCHEMATIC_PREFIX + "§cFehler beim Speichern der Schematic. Bitte wende dich an einen Developer"); - if(newSchem) - schematic.remove(); - return; - }catch (NoClipboardException e) { - player.sendMessage(Core.SCHEMATIC_PREFIX + "§cDein Clipboard ist leer"); - if(newSchem) - schematic.remove(); - return; - } - if (newSchem) - player.sendMessage(Core.SCHEMATIC_PREFIX + "Schematic §e" + name + " §7gespeichert"); - else - player.sendMessage(Core.SCHEMATIC_PREFIX + "Schematic §e" + name + " §7überschrieben"); - }); - registerBackup((byte) 0x25, byteArrayDataInput -> { - byteArrayDataInput.readInt(); - Player player = Bukkit.getPlayer(SteamwarUser.get(byteArrayDataInput.readInt()).getUUID()); - player.sendMessage(Core.SCHEMATIC_PREFIX + "§cDieser Server kann keine Schematics prüfen"); + registerHandler(PacketIdManager.CHECK_PLUGIN, byteArrayDataInput -> { + String id = byteArrayDataInput.readUTF(); + String plugin = byteArrayDataInput.readUTF(); + new PluginCallbackPacket(id, Bukkit.getPluginManager().getPlugin(plugin) != null).send(Bukkit.getOnlinePlayers().stream().limit(1).collect(Collectors.toList()).get(0)); }); } @@ -126,8 +79,8 @@ public class BungeeReceiver implements PluginMessageListener { Byte handler = in.readByte(); if(handlerMap.containsKey(handler)) handlerMap.get(handler).handle(in); - else if(backupMap.containsKey(handler)) - backupMap.get(handler).handle(in); + else + throw new SecurityException("Could not find Handler"); } } diff --git a/SpigotCore_Main/src/de/steamwar/comms/PacketIdManager.java b/SpigotCore_Main/src/de/steamwar/comms/PacketIdManager.java index 6ec81d3..5d9bd2e 100644 --- a/SpigotCore_Main/src/de/steamwar/comms/PacketIdManager.java +++ b/SpigotCore_Main/src/de/steamwar/comms/PacketIdManager.java @@ -23,6 +23,8 @@ public class PacketIdManager { //0x0(X) Standalone Packets public final static byte PING_PACKET = 0x01; + public static final byte CHECK_PLUGIN = 0x02; + public static final byte CHECK_PLUGIN_CALLBACK = 0x03; //0x1(X) Bungee Inventory public final static byte INVENTORY_PACKET = 0x10; public final static byte INVENTORY_CALLBACK_PACKET = 0x11; @@ -30,6 +32,4 @@ public class PacketIdManager { //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; } diff --git a/SpigotCore_Main/src/de/steamwar/comms/packets/PluginCallbackPacket.java b/SpigotCore_Main/src/de/steamwar/comms/packets/PluginCallbackPacket.java new file mode 100644 index 0000000..b4feec8 --- /dev/null +++ b/SpigotCore_Main/src/de/steamwar/comms/packets/PluginCallbackPacket.java @@ -0,0 +1,45 @@ +/* + This file is a part of the SteamWar software. + + Copyright (C) 2020 SteamWar.de-Serverteam + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + */ + +package de.steamwar.comms.packets; + +import com.google.common.io.ByteArrayDataOutput; +import de.steamwar.comms.PacketIdManager; + +public class PluginCallbackPacket extends SpigotPacket { + + private final String id; + private final boolean hasPlugin; + + public PluginCallbackPacket(String id, boolean hasPlugin) { + this.id = id; + this.hasPlugin = hasPlugin; + } + + @Override + public int getName() { + return PacketIdManager.CHECK_PLUGIN_CALLBACK; + } + + @Override + public void writeVars(ByteArrayDataOutput byteArrayDataOutput) { + byteArrayDataOutput.writeUTF(id); + byteArrayDataOutput.writeBoolean(hasPlugin); + } +} -- 2.39.5 From 3472f711020907b4c5aff56f2283d142a5c64df6 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 6 Oct 2020 00:11:42 +0200 Subject: [PATCH 04/15] Fixing Bugs --- .../src/de/steamwar/comms/BungeeReceiver.java | 8 --- .../comms/handlers/InventoryHandler.java | 10 +++- .../comms/packets/MaterialsReturnPacket.java | 55 ------------------- .../src/de/steamwar/sql/Schematic.java | 4 +- 4 files changed, 10 insertions(+), 67 deletions(-) delete mode 100644 SpigotCore_Main/src/de/steamwar/comms/packets/MaterialsReturnPacket.java diff --git a/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java b/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java index e45bae4..3778223 100644 --- a/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java +++ b/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java @@ -23,12 +23,9 @@ 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.comms.packets.MaterialsReturnPacket; import de.steamwar.comms.packets.PluginCallbackPacket; -import de.steamwar.core.Core; 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; @@ -61,11 +58,6 @@ public class BungeeReceiver implements PluginMessageListener { Player player = Bukkit.getPlayer(SteamwarUser.get(byteArrayDataInput.readInt()).getUUID()); player.closeInventory(); }); - registerHandler(PacketIdManager.MATERIALS_GET_PACKET, byteArrayDataInput -> { - UUID id = UUID.fromString(byteArrayDataInput.readUTF()); - MaterialsReturnPacket packet = new MaterialsReturnPacket(id, Material.values()); - packet.send(Bukkit.getOnlinePlayers().stream().limit(1).collect(Collectors.toList()).get(0)); - }); registerHandler(PacketIdManager.CHECK_PLUGIN, byteArrayDataInput -> { String id = byteArrayDataInput.readUTF(); String plugin = byteArrayDataInput.readUTF(); diff --git a/SpigotCore_Main/src/de/steamwar/comms/handlers/InventoryHandler.java b/SpigotCore_Main/src/de/steamwar/comms/handlers/InventoryHandler.java index 433aa86..521755e 100644 --- a/SpigotCore_Main/src/de/steamwar/comms/handlers/InventoryHandler.java +++ b/SpigotCore_Main/src/de/steamwar/comms/handlers/InventoryHandler.java @@ -28,6 +28,7 @@ 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.*; @@ -45,12 +46,17 @@ 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 -> new InventoryCallbackPacket(player).send(Bukkit.getPlayer(player))); + inventory.addCloseCallback(click -> { + if(Bukkit.getPlayer(player).getOpenInventory().getType() == InventoryType.CRAFTING) + new InventoryCallbackPacket(player).send(Bukkit.getPlayer(player)); + }); inventory.open(); } } diff --git a/SpigotCore_Main/src/de/steamwar/comms/packets/MaterialsReturnPacket.java b/SpigotCore_Main/src/de/steamwar/comms/packets/MaterialsReturnPacket.java deleted file mode 100644 index 6feb97d..0000000 --- a/SpigotCore_Main/src/de/steamwar/comms/packets/MaterialsReturnPacket.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - This file is a part of the SteamWar software. - - Copyright (C) 2020 SteamWar.de-Serverteam - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - */ - -package de.steamwar.comms.packets; - -import com.google.common.io.ByteArrayDataOutput; -import com.google.gson.JsonArray; -import de.steamwar.comms.PacketIdManager; -import org.bukkit.Material; -import org.bukkit.inventory.ItemStack; - -import java.util.UUID; - -public class MaterialsReturnPacket extends SpigotPacket{ - - final UUID id; - final Material[] array; - - public MaterialsReturnPacket(UUID id, Material[] array) { - this.id = id; - this.array = array; - } - - @Override - public int getName() { - return PacketIdManager.MATERIALS_RETURN_PACKET; - } - - @Override - public void writeVars(ByteArrayDataOutput byteArrayDataOutput) { - byteArrayDataOutput.writeUTF(id.toString()); - JsonArray array = new JsonArray(); - for (int i = 0; i < this.array.length; i++) { - if(new ItemStack(this.array[i]).getItemMeta() != null && this.array[i].isItem()) - array.add(this.array[i].name()); - } - byteArrayDataOutput.writeUTF(array.toString()); - } -} diff --git a/SpigotCore_Main/src/de/steamwar/sql/Schematic.java b/SpigotCore_Main/src/de/steamwar/sql/Schematic.java index fb4846f..00bff09 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) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE Item = VALUES(Item), SchemType = VALUES(SchemType)", - schemName, schemOwner, item, schemType.toDB()); + 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); } public static Schematic getSchemFromDB(String schemName, UUID schemOwner){ -- 2.39.5 From 5491be4430b33b5c08fcfb28bf7f527b71b2dac8 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Tue, 6 Oct 2020 10:40:57 +0200 Subject: [PATCH 05/15] Fixing Bugs --- .../src/de/steamwar/comms/BungeeReceiver.java | 7 --- .../de/steamwar/comms/PacketIdManager.java | 2 - .../comms/packets/PluginCallbackPacket.java | 45 ------------------- 3 files changed, 54 deletions(-) delete mode 100644 SpigotCore_Main/src/de/steamwar/comms/packets/PluginCallbackPacket.java diff --git a/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java b/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java index 3778223..071a1a5 100644 --- a/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java +++ b/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java @@ -23,7 +23,6 @@ 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.comms.packets.PluginCallbackPacket; import de.steamwar.sql.*; import org.bukkit.Bukkit; import org.bukkit.Sound; @@ -34,7 +33,6 @@ import org.bukkit.plugin.messaging.PluginMessageListener; import java.util.HashMap; import java.util.Map; import java.util.UUID; -import java.util.stream.Collectors; public class BungeeReceiver implements PluginMessageListener { @@ -58,11 +56,6 @@ public class BungeeReceiver implements PluginMessageListener { Player player = Bukkit.getPlayer(SteamwarUser.get(byteArrayDataInput.readInt()).getUUID()); player.closeInventory(); }); - registerHandler(PacketIdManager.CHECK_PLUGIN, byteArrayDataInput -> { - String id = byteArrayDataInput.readUTF(); - String plugin = byteArrayDataInput.readUTF(); - new PluginCallbackPacket(id, Bukkit.getPluginManager().getPlugin(plugin) != null).send(Bukkit.getOnlinePlayers().stream().limit(1).collect(Collectors.toList()).get(0)); - }); } @Override diff --git a/SpigotCore_Main/src/de/steamwar/comms/PacketIdManager.java b/SpigotCore_Main/src/de/steamwar/comms/PacketIdManager.java index 5d9bd2e..63d0327 100644 --- a/SpigotCore_Main/src/de/steamwar/comms/PacketIdManager.java +++ b/SpigotCore_Main/src/de/steamwar/comms/PacketIdManager.java @@ -23,8 +23,6 @@ public class PacketIdManager { //0x0(X) Standalone Packets public final static byte PING_PACKET = 0x01; - public static final byte CHECK_PLUGIN = 0x02; - public static final byte CHECK_PLUGIN_CALLBACK = 0x03; //0x1(X) Bungee Inventory public final static byte INVENTORY_PACKET = 0x10; public final static byte INVENTORY_CALLBACK_PACKET = 0x11; diff --git a/SpigotCore_Main/src/de/steamwar/comms/packets/PluginCallbackPacket.java b/SpigotCore_Main/src/de/steamwar/comms/packets/PluginCallbackPacket.java deleted file mode 100644 index b4feec8..0000000 --- a/SpigotCore_Main/src/de/steamwar/comms/packets/PluginCallbackPacket.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - This file is a part of the SteamWar software. - - Copyright (C) 2020 SteamWar.de-Serverteam - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - */ - -package de.steamwar.comms.packets; - -import com.google.common.io.ByteArrayDataOutput; -import de.steamwar.comms.PacketIdManager; - -public class PluginCallbackPacket extends SpigotPacket { - - private final String id; - private final boolean hasPlugin; - - public PluginCallbackPacket(String id, boolean hasPlugin) { - this.id = id; - this.hasPlugin = hasPlugin; - } - - @Override - public int getName() { - return PacketIdManager.CHECK_PLUGIN_CALLBACK; - } - - @Override - public void writeVars(ByteArrayDataOutput byteArrayDataOutput) { - byteArrayDataOutput.writeUTF(id); - byteArrayDataOutput.writeBoolean(hasPlugin); - } -} -- 2.39.5 From 9c0979bf58ba9d966db58e42ef372606c9a2da2c Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 10 Oct 2020 11:09:16 +0200 Subject: [PATCH 06/15] Fixing Inventory not Removing --- .../src/de/steamwar/comms/handlers/InventoryHandler.java | 7 +++++-- SpigotCore_Main/src/de/steamwar/inventory/SWInventory.java | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/SpigotCore_Main/src/de/steamwar/comms/handlers/InventoryHandler.java b/SpigotCore_Main/src/de/steamwar/comms/handlers/InventoryHandler.java index 521755e..a62398e 100644 --- a/SpigotCore_Main/src/de/steamwar/comms/handlers/InventoryHandler.java +++ b/SpigotCore_Main/src/de/steamwar/comms/handlers/InventoryHandler.java @@ -23,6 +23,7 @@ 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.inventory.SWInventory; import de.steamwar.inventory.SWItem; import de.steamwar.sql.SteamwarUser; @@ -54,8 +55,10 @@ public class InventoryHandler implements BungeeHandler { SWInventory inventory = new SWInventory(Bukkit.getPlayer(player), size, title, items); inventory.addCloseCallback(click -> { - if(Bukkit.getPlayer(player).getOpenInventory().getType() == InventoryType.CRAFTING) - new InventoryCallbackPacket(player).send(Bukkit.getPlayer(player)); + Bukkit.getScheduler().runTaskLaterAsynchronously(Core.getInstance(), () -> { + if(Bukkit.getPlayer(player).getOpenInventory().getType() != InventoryType.CHEST) + new InventoryCallbackPacket(player).send(Bukkit.getPlayer(player)); + }, 1); }); inventory.open(); } diff --git a/SpigotCore_Main/src/de/steamwar/inventory/SWInventory.java b/SpigotCore_Main/src/de/steamwar/inventory/SWInventory.java index 1208056..83661db 100644 --- a/SpigotCore_Main/src/de/steamwar/inventory/SWInventory.java +++ b/SpigotCore_Main/src/de/steamwar/inventory/SWInventory.java @@ -28,6 +28,7 @@ import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.InventoryView; import java.util.ArrayList; import java.util.HashMap; -- 2.39.5 From b0288c90c357f6e28cd4bee6d60b4c16808d5236 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 10 Oct 2020 11:12:02 +0200 Subject: [PATCH 07/15] Imports --- SpigotCore_Main/src/de/steamwar/inventory/SWInventory.java | 1 - 1 file changed, 1 deletion(-) diff --git a/SpigotCore_Main/src/de/steamwar/inventory/SWInventory.java b/SpigotCore_Main/src/de/steamwar/inventory/SWInventory.java index 83661db..1208056 100644 --- a/SpigotCore_Main/src/de/steamwar/inventory/SWInventory.java +++ b/SpigotCore_Main/src/de/steamwar/inventory/SWInventory.java @@ -28,7 +28,6 @@ import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.InventoryView; import java.util.ArrayList; import java.util.HashMap; -- 2.39.5 From e52a7983eba0d34dd85bffd4a59e9a1d7fe2e02a Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sun, 11 Oct 2020 10:08:56 +0200 Subject: [PATCH 08/15] 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 -- 2.39.5 From b013be845715f3bf3d5a2811283d15a3be651da9 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Thu, 29 Oct 2020 15:35:38 +0100 Subject: [PATCH 09/15] Fixed #65 --- .../src/de/steamwar/comms/BungeeReceiver.java | 12 ++++-------- .../src/de/steamwar/comms/PacketIdManager.java | 6 ++++-- SpigotCore_Main/src/de/steamwar/sql/Schematic.java | 4 ++-- 3 files changed, 10 insertions(+), 12 deletions(-) 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){ -- 2.39.5 From b90051458303fd3f37e7ad1c2f5a8aacd23a1ca6 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sun, 15 Nov 2020 11:08:34 +0100 Subject: [PATCH 10/15] Revert "Fixed #65" This reverts commit b013be84 --- SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java b/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java index 9f5dbac..0678dc9 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, 1, 1); + player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, SoundCategory.MASTER, 1, 1); } }); -- 2.39.5 From dbd0b4f4fecf3e5359db81c3cd624ede3ce78b95 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Mon, 16 Nov 2020 21:38:51 +0100 Subject: [PATCH 11/15] Fixing Merge Conflicts --- SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java b/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java index 70bc593..2ebbb79 100644 --- a/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java +++ b/SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java @@ -30,8 +30,6 @@ import de.steamwar.core.Core; import de.steamwar.sql.SteamwarUser; 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; -- 2.39.5 From d99d37807746c56b22dfa503340ab592414a6564 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Thu, 19 Nov 2020 09:10:32 +0100 Subject: [PATCH 12/15] Add Item Legacy Support --- SpigotCore_Main/src/de/steamwar/inventory/SWItem.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java b/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java index f75b0b2..8d4636d 100644 --- a/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java +++ b/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java @@ -154,7 +154,11 @@ public class SWItem { item = new SWItem(Material.valueOf(itemJson.get("material").getAsString()), itemJson.get("title").getAsString()); } }catch (IllegalArgumentException e) { - item = new SWItem(Material.STONE, itemJson.get("title").getAsString()); + try { + item = new SWItem(Material.valueOf(Material.LEGACY_PREFIX + itemJson.get("material").getAsString()), itemJson.get("title").getAsString()); + }catch (IllegalArgumentException ex) { + item = new SWItem(Material.STONE, itemJson.get("title").getAsString()); + } } if(itemJson.has("skullOwner")) { item = SWItem.getPlayerSkull(itemJson.get("skullOwner").getAsString()); -- 2.39.5 From 64f72da357f065b5e550e5dee3c7dddbfe54ed5b Mon Sep 17 00:00:00 2001 From: Lixfel Date: Thu, 19 Nov 2020 09:58:42 +0100 Subject: [PATCH 13/15] Remove unneccessary string --- SpigotCore_Main/src/de/steamwar/core/Core.java | 1 - 1 file changed, 1 deletion(-) diff --git a/SpigotCore_Main/src/de/steamwar/core/Core.java b/SpigotCore_Main/src/de/steamwar/core/Core.java index 379795e..d9c59df 100644 --- a/SpigotCore_Main/src/de/steamwar/core/Core.java +++ b/SpigotCore_Main/src/de/steamwar/core/Core.java @@ -32,7 +32,6 @@ import org.bukkit.plugin.java.JavaPlugin; public class Core extends JavaPlugin{ private static Core instance; private static final int version; - public static final String SCHEMATIC_PREFIX = "§eSchematic§8» §7"; static{ String packageName = Bukkit.getServer().getClass().getPackage().getName(); -- 2.39.5 From aa798d366ce24f85ce431c0f983e088d65e4c47b Mon Sep 17 00:00:00 2001 From: Lixfel Date: Fri, 27 Nov 2020 14:31:40 +0100 Subject: [PATCH 14/15] Adding ignored messages --- SpigotCore_Main/src/de/steamwar/sql/SWException.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SpigotCore_Main/src/de/steamwar/sql/SWException.java b/SpigotCore_Main/src/de/steamwar/sql/SWException.java index 67c2724..6b28ca0 100644 --- a/SpigotCore_Main/src/de/steamwar/sql/SWException.java +++ b/SpigotCore_Main/src/de/steamwar/sql/SWException.java @@ -48,8 +48,8 @@ public class SWException { reasons.add("To change this, set \"online-mode\" to \"true\" in the server.properties file."); reasons.add("This crash report has been saved to:"); reasons.add("Could not pass event PlayerQuitEvent to WorldEditSUI"); - reasons.add("[ViaVersion] Failed to remove injection handler"); - reasons.add("[ViaBackwards] Metadata for entity id"); + reasons.add("[ViaVersion] "); + reasons.add("[ViaBackwards] "); reasons.add("Something went wrong upgrading!"); reasons.add("Tried to load unrecognized recipe"); reasons.add("Invalid BlockState in palette:"); @@ -57,8 +57,8 @@ public class SWException { reasons.add("Can't keep up! Is the server overloaded?"); reasons.add("\tat "); reasons.add("java.lang.Exception"); - reasons.add("[ViaVersion] Ignoring"); - reasons.add("[ViaBackwards] Ignoring"); + reasons.add("An exceptionCaught()"); + reasons.add("Exception verifying"); ignorereasons = Collections.unmodifiableList(reasons); } -- 2.39.5 From 31a44e410fb2a806958c4f2837d3826ff77d67e9 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 28 Nov 2020 00:04:28 +0100 Subject: [PATCH 15/15] Revert "Adding ignored messages" This reverts commit aa798d36 --- SpigotCore_Main/src/de/steamwar/sql/SWException.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SpigotCore_Main/src/de/steamwar/sql/SWException.java b/SpigotCore_Main/src/de/steamwar/sql/SWException.java index 6b28ca0..67c2724 100644 --- a/SpigotCore_Main/src/de/steamwar/sql/SWException.java +++ b/SpigotCore_Main/src/de/steamwar/sql/SWException.java @@ -48,8 +48,8 @@ public class SWException { reasons.add("To change this, set \"online-mode\" to \"true\" in the server.properties file."); reasons.add("This crash report has been saved to:"); reasons.add("Could not pass event PlayerQuitEvent to WorldEditSUI"); - reasons.add("[ViaVersion] "); - reasons.add("[ViaBackwards] "); + reasons.add("[ViaVersion] Failed to remove injection handler"); + reasons.add("[ViaBackwards] Metadata for entity id"); reasons.add("Something went wrong upgrading!"); reasons.add("Tried to load unrecognized recipe"); reasons.add("Invalid BlockState in palette:"); @@ -57,8 +57,8 @@ public class SWException { reasons.add("Can't keep up! Is the server overloaded?"); reasons.add("\tat "); reasons.add("java.lang.Exception"); - reasons.add("An exceptionCaught()"); - reasons.add("Exception verifying"); + reasons.add("[ViaVersion] Ignoring"); + reasons.add("[ViaBackwards] Ignoring"); ignorereasons = Collections.unmodifiableList(reasons); } -- 2.39.5