From 7adb6548aafe3b47e6cb537e397bc2e6d7d262d3 Mon Sep 17 00:00:00 2001 From: "Kristian S. Stangeland" Date: Fri, 21 Mar 2014 22:19:24 +0100 Subject: [PATCH] Ensure output handlers function correctly in 1.7.2 --- .../protocol/injector/netty/ChannelInjector.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/ChannelInjector.java b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/ChannelInjector.java index 0c3be7f8..5d630ad4 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/ChannelInjector.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/injector/netty/ChannelInjector.java @@ -43,7 +43,6 @@ import com.comphenix.protocol.utility.MinecraftMethods; import com.comphenix.protocol.utility.MinecraftReflection; import com.google.common.base.Preconditions; import com.google.common.collect.MapMaker; -import com.google.common.primitives.Bytes; /** * Represents a channel injector. @@ -300,8 +299,13 @@ class ChannelInjector extends ByteToMessageDecoder implements Injector { PacketEvent event = currentEvent; NetworkMarker marker = null; + // Skip every kind of non-filtered packet + if (!scheduleProcessPackets.get()) { + return; + } + // This packet has not been seen by the main thread - if (event == null && scheduleProcessPackets.get()) { + if (event == null) { Class clazz = packet.getClass(); // Schedule the transmission on the main thread instead @@ -331,11 +335,12 @@ class ChannelInjector extends ByteToMessageDecoder implements Injector { byte[] data = getBytes(packetBuffer); for (PacketOutputHandler handler : marker.getOutputHandlers()) { - handler.handle(event, data); + data = handler.handle(event, data); } // Write the result output.writeBytes(data); + packet = null; return; } } catch (Exception e) {