Don't fetch NetworkMarker uncessarily.

This commit is contained in:
Kristian S. Stangeland 2014-03-27 23:23:45 +01:00
parent 3b26940385
commit 485c3856c1
3 changed files with 4 additions and 14 deletions

View File

@ -257,16 +257,7 @@ class ChannelInjector extends ByteToMessageDecoder implements Injector {
* @return The resulting message/packet.
*/
private PacketEvent processSending(Object message) {
return processSending(message, packetMarker.get(message));
}
/**
* Process a given message on the packet listeners.
* @param message - the message/packet.
* @return The resulting message/packet.
*/
private PacketEvent processSending(Object message, NetworkMarker marker) {
return channelListener.onPacketSending(ChannelInjector.this, message, marker);
return channelListener.onPacketSending(ChannelInjector.this, message);
}
/**
@ -315,7 +306,7 @@ class ChannelInjector extends ByteToMessageDecoder implements Injector {
packet = null;
} else {
event = processSending(packet, marker);
event = processSending(packet);
// Handle the output
if (event != null) {

View File

@ -16,10 +16,9 @@ interface ChannelListener {
* This is invoked on the main thread.
* @param injector - the channel injector.
* @param packet - the packet.
* @param marker - the associated network marker, if any.
* @return The packet even that was passed to the listeners, with a possible packet change, or NULL.
*/
public PacketEvent onPacketSending(Injector injector, Object packet, NetworkMarker marker);
public PacketEvent onPacketSending(Injector injector, Object packet);
/**
* Invoked when a packet is being received from a client.

View File

@ -227,7 +227,7 @@ public class NettyProtocolInjector implements ChannelListener {
}
@Override
public PacketEvent onPacketSending(Injector injector, Object packet, NetworkMarker marker) {
public PacketEvent onPacketSending(Injector injector, Object packet) {
Class<?> clazz = packet.getClass();
if (sendingFilters.contains(clazz)) {