From 70de18adf4a51141735f11bd916b54f448acc031 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 24 Sep 2022 19:48:10 +0200 Subject: [PATCH] Update CommonCore Update handlers --- CommonCore | 2 +- .../steamwar/network/CoreNetworkHandler.java | 18 ++++++------------ .../network/handlers/InventoryHandler.java | 4 +++- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/CommonCore b/CommonCore index be2b368..d90938e 160000 --- a/CommonCore +++ b/CommonCore @@ -1 +1 @@ -Subproject commit be2b368802a2f6c188266f829f0743beaf1931c3 +Subproject commit d90938eff2a258d3dbd9b975b9df0fc7fe87b938 diff --git a/SpigotCore_Main/src/de/steamwar/network/CoreNetworkHandler.java b/SpigotCore_Main/src/de/steamwar/network/CoreNetworkHandler.java index bf74682..0a07cee 100644 --- a/SpigotCore_Main/src/de/steamwar/network/CoreNetworkHandler.java +++ b/SpigotCore_Main/src/de/steamwar/network/CoreNetworkHandler.java @@ -20,9 +20,12 @@ package de.steamwar.network; import de.steamwar.core.BountifulWrapper; -import de.steamwar.network.handlers.InventoryHandler; +import de.steamwar.linkage.Linked; import de.steamwar.network.packets.PacketHandler; -import de.steamwar.network.packets.server.*; +import de.steamwar.network.packets.server.BaumemberUpdatePacket; +import de.steamwar.network.packets.server.CloseInventoryPacket; +import de.steamwar.network.packets.server.LocaleInvalidationPacket; +import de.steamwar.network.packets.server.PingPacket; import de.steamwar.sql.BauweltMember; import de.steamwar.sql.SteamwarUser; import org.bukkit.Bukkit; @@ -30,13 +33,9 @@ import org.bukkit.entity.Player; import java.util.UUID; +@Linked public class CoreNetworkHandler extends PacketHandler { - public CoreNetworkHandler() { - super(); - new InventoryHandler().register(); - } - @Handler public void handleBaumemberUpdatePacket(BaumemberUpdatePacket packet) { BauweltMember.clear(); @@ -50,11 +49,6 @@ public class CoreNetworkHandler extends PacketHandler { } } - @Handler - public void handleInventoryPacket(InventoryPacket packet) { - InventoryHandler.handleInventoryPacket(packet); - } - @Handler public void handlePingPacket(PingPacket packet) { UUID uuid = SteamwarUser.get(packet.getId()).getUUID(); diff --git a/SpigotCore_Main/src/de/steamwar/network/handlers/InventoryHandler.java b/SpigotCore_Main/src/de/steamwar/network/handlers/InventoryHandler.java index a8a378a..275e908 100644 --- a/SpigotCore_Main/src/de/steamwar/network/handlers/InventoryHandler.java +++ b/SpigotCore_Main/src/de/steamwar/network/handlers/InventoryHandler.java @@ -22,6 +22,7 @@ package de.steamwar.network.handlers; import com.google.gson.JsonParser; import de.steamwar.inventory.SWInventory; import de.steamwar.inventory.SWItem; +import de.steamwar.linkage.Linked; import de.steamwar.network.NetworkSender; import de.steamwar.network.packets.PacketHandler; import de.steamwar.network.packets.client.InventoryCallbackPacket; @@ -34,10 +35,11 @@ import org.bukkit.event.inventory.InventoryType; import java.util.HashMap; import java.util.Map; +@Linked public class InventoryHandler extends PacketHandler { @Handler - public static void handleInventoryPacket(InventoryPacket packet) { + public void handleInventoryPacket(InventoryPacket packet) { Player player = Bukkit.getPlayer(SteamwarUser.get(packet.getPlayer()).getUUID()); Map items = new HashMap<>(); packet.getItems().forEach((i, item) -> {