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);