diff --git a/SpigotCore/SpigotCore_Main/src/com/comphenix/tinyprotocol/TinyProtocol.java b/SpigotCore/SpigotCore_Main/src/com/comphenix/tinyprotocol/TinyProtocol.java
index 9cd1bc93..24773cd6 100644
--- a/SpigotCore/SpigotCore_Main/src/com/comphenix/tinyprotocol/TinyProtocol.java
+++ b/SpigotCore/SpigotCore_Main/src/com/comphenix/tinyprotocol/TinyProtocol.java
@@ -26,6 +26,8 @@ import com.google.common.collect.Lists;
import com.google.common.collect.MapMaker;
import com.mojang.authlib.GameProfile;
+import java.util.function.BiFunction;
+
/**
* Represents a very tiny alternative to ProtocolLib.
*
@@ -58,6 +60,7 @@ public class TinyProtocol {
public static final TinyProtocol instance = new TinyProtocol(Core.getInstance());
private final Map, List>> packetFilters = new HashMap<>();
+ private final Set> globalFilters = new HashSet<>();
public static void init() {
// enforce init
@@ -235,6 +238,10 @@ public class TinyProtocol {
packetFilters.getOrDefault(packetType, Collections.emptyList()).remove(filter);
}
+ public void addGlobalFilter(BiFunction filter) {
+ globalFilters.add(filter);
+ }
+
/**
* Send a packet to a particular player.
*
@@ -469,6 +476,11 @@ public class TinyProtocol {
if (packet == null) break;
}
+ for (BiFunction filter : globalFilters) {
+ packet = filter.apply(player, packet);
+ if (packet == null) break;
+ }
+
return packet;
}
}
diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/TechHider.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/TechHider.java
index ead26362..490e19ff 100644
--- a/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/TechHider.java
+++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/TechHider.java
@@ -449,6 +449,18 @@ public abstract class TechHider {
});
this.packetProcessors = processors;
+
+ TinyProtocol.instance.addGlobalFilter((player, packet) -> {
+ if(bypassingPackets.contains(packet.getClass())) {
+ return packet;
+ }
+ else if(packetProcessors.containsKey(packet.getClass())) {
+ return packetProcessors.get(packet.getClass()).apply(player, packet);
+ }
+ else {
+ return null;
+ }
+ });
}
private Packet extends PacketListener> processAddEntityPacket(Player player, ClientboundAddEntityPacket packet) {