Archiviert
13
0

Ensure output handlers function correctly in 1.7.2

Dieser Commit ist enthalten in:
Kristian S. Stangeland 2014-03-21 22:19:24 +01:00
Ursprung bd3a60b7eb
Commit 7adb6548aa

Datei anzeigen

@ -43,7 +43,6 @@ import com.comphenix.protocol.utility.MinecraftMethods;
import com.comphenix.protocol.utility.MinecraftReflection; import com.comphenix.protocol.utility.MinecraftReflection;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.collect.MapMaker; import com.google.common.collect.MapMaker;
import com.google.common.primitives.Bytes;
/** /**
* Represents a channel injector. * Represents a channel injector.
@ -300,8 +299,13 @@ class ChannelInjector extends ByteToMessageDecoder implements Injector {
PacketEvent event = currentEvent; PacketEvent event = currentEvent;
NetworkMarker marker = null; NetworkMarker marker = null;
// Skip every kind of non-filtered packet
if (!scheduleProcessPackets.get()) {
return;
}
// This packet has not been seen by the main thread // This packet has not been seen by the main thread
if (event == null && scheduleProcessPackets.get()) { if (event == null) {
Class<?> clazz = packet.getClass(); Class<?> clazz = packet.getClass();
// Schedule the transmission on the main thread instead // Schedule the transmission on the main thread instead
@ -331,11 +335,12 @@ class ChannelInjector extends ByteToMessageDecoder implements Injector {
byte[] data = getBytes(packetBuffer); byte[] data = getBytes(packetBuffer);
for (PacketOutputHandler handler : marker.getOutputHandlers()) { for (PacketOutputHandler handler : marker.getOutputHandlers()) {
handler.handle(event, data); data = handler.handle(event, data);
} }
// Write the result // Write the result
output.writeBytes(data); output.writeBytes(data);
packet = null;
return; return;
} }
} catch (Exception e) { } catch (Exception e) {