Don't create a network marker unnecessarily.
Dieser Commit ist enthalten in:
Ursprung
50c2931484
Commit
65f1371cf4
@ -26,6 +26,7 @@ import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import com.comphenix.protocol.PacketStream;
|
||||
import com.comphenix.protocol.events.NetworkMarker;
|
||||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import com.comphenix.protocol.injector.PrioritizedListener;
|
||||
import com.comphenix.protocol.reflect.FieldAccessException;
|
||||
@ -381,9 +382,9 @@ public class AsyncMarker implements Serializable, Comparable<AsyncMarker> {
|
||||
void sendPacket(PacketEvent event) throws IOException {
|
||||
try {
|
||||
if (event.isServerPacket()) {
|
||||
packetStream.sendServerPacket(event.getPlayer(), event.getPacket(), event.getNetworkMarker(), false);
|
||||
packetStream.sendServerPacket(event.getPlayer(), event.getPacket(), NetworkMarker.getNetworkMarker(event), false);
|
||||
} else {
|
||||
packetStream.recieveClientPacket(event.getPlayer(), event.getPacket(), event.getNetworkMarker(), false);
|
||||
packetStream.recieveClientPacket(event.getPlayer(), event.getPacket(), NetworkMarker.getNetworkMarker(event), false);
|
||||
}
|
||||
transmitted = true;
|
||||
|
||||
|
@ -189,4 +189,15 @@ public class NetworkMarker {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the network marker of a particular event without creating it.
|
||||
* <p>
|
||||
* This is an internal method that should not be used by API users.
|
||||
* @param event - the event.
|
||||
* @return The network marker.
|
||||
*/
|
||||
public static NetworkMarker getNetworkMarker(PacketEvent event) {
|
||||
return event.networkMarker;
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public class PacketEvent extends EventObject implements Cancellable {
|
||||
private boolean asynchronous;
|
||||
|
||||
// Network input and output handlers
|
||||
private NetworkMarker networkMarker;
|
||||
NetworkMarker networkMarker;
|
||||
|
||||
// Whether or not a packet event is read only
|
||||
private boolean readOnly;
|
||||
|
@ -643,7 +643,7 @@ public final class PacketFilterManager implements ProtocolManager, ListenerInvok
|
||||
|
||||
sendingListeners.invokePacketSending(
|
||||
reporter, event, ListenerPriority.MONITOR);
|
||||
marker = event.getNetworkMarker();
|
||||
marker = NetworkMarker.getNetworkMarker(event);
|
||||
}
|
||||
playerInjection.sendServerPacket(reciever, packet, marker, filters);
|
||||
}
|
||||
|
@ -611,7 +611,7 @@ public abstract class PlayerInjector implements SocketInjector {
|
||||
|
||||
// Right, remember to replace the packet again
|
||||
Object result = event.getPacket().getHandle();
|
||||
marker = event.getNetworkMarker();
|
||||
marker = NetworkMarker.getNetworkMarker(event);
|
||||
|
||||
// See if we need to proxy the write method
|
||||
if (result != null && NetworkMarker.hasOutputHandlers(marker)) {
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren