Archiviert
13
0

Fix the server packet cancelling feature.

Dieser Commit ist enthalten in:
Kristian S. Stangeland 2012-09-13 14:56:14 +02:00
Ursprung 16d231f778
Commit 5a6f3be219
2 geänderte Dateien mit 14 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -418,6 +418,14 @@ public final class PacketFilterManager implements ProtocolManager {
throw new IllegalArgumentException("Player has no injected handler.");
}
/**
* Retrieves the current plugin class loader.
* @return Class loader.
*/
public ClassLoader getClassLoader() {
return classLoader;
}
@Override
public boolean isClosed() {
return hasClosed;

Datei anzeigen

@ -218,19 +218,21 @@ class PlayerInjector {
@Override
public boolean add(Packet packet) {
Packet result = null;
// Check for fake packets and ignored packets
if (packet instanceof FakePacket) {
return true;
} else if (ignoredPackets.contains(packet)) {
ignoredPackets.remove(packet);
} else {
packet = handlePacketRecieved(packet);
result = handlePacketRecieved(packet);
}
// A NULL packet indicate cancelling
try {
if (packet != null) {
super.add(packet);
if (result != null) {
super.add(result);
} else {
// We'll use the FakePacket marker instead of preventing the filters
sendServerPacket(createNegativePacket(packet), true);
@ -280,7 +282,7 @@ class PlayerInjector {
// }
ex.setInterfaces(new Class[] { FakePacket.class } );
ex.setUseCache(true);
ex.setClassLoader(type.getClassLoader());
ex.setClassLoader(manager.getClassLoader());
ex.setSuperclass(type);
ex.setCallback(new MethodInterceptor() {
@Override