From d3607d8265edce9971663f0406fc478785803ef2 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Wed, 22 Dec 2021 10:37:51 +0100 Subject: [PATCH] Update to TinyProtocol from SpigotCore Signed-off-by: yoyosource --- .../steamwar/bausystem/utils/ProtocolAPI.java | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/utils/ProtocolAPI.java b/BauSystem_Main/src/de/steamwar/bausystem/utils/ProtocolAPI.java index 351a27fb..bfa5bda4 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/utils/ProtocolAPI.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/utils/ProtocolAPI.java @@ -20,8 +20,6 @@ package de.steamwar.bausystem.utils; import com.comphenix.tinyprotocol.TinyProtocol; -import de.steamwar.bausystem.BauSystem; -import io.netty.channel.Channel; import lombok.experimental.UtilityClass; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -36,23 +34,7 @@ public class ProtocolAPI { private static final Map, BiFunction> outgoingHandler = new HashMap<>(); private static final Map, BiFunction> incomingHandler = new HashMap<>(); - public static final TinyProtocol tinyProtocol = new TinyProtocol(BauSystem.getInstance()) { - @Override - public Object onPacketOutAsync(Player receiver, Channel channel, Object packet) { - BiFunction handler = outgoingHandler.get(packet.getClass()); - if (handler == null) - return packet; - return handler.apply(receiver, packet); - } - - @Override - public Object onPacketInAsync(Player sender, Channel channel, Object packet) { - BiFunction handler = incomingHandler.get(packet.getClass()); - if (handler == null) - return packet; - return handler.apply(sender, packet); - } - }; + public static final TinyProtocol tinyProtocol = TinyProtocol.instance; public static void setOutgoingHandler(Class packetClass, BiFunction handler) { outgoingHandler.put(packetClass, handler);