Fix the server packet cancelling feature.
Dieser Commit ist enthalten in:
Ursprung
16d231f778
Commit
5a6f3be219
@ -418,6 +418,14 @@ public final class PacketFilterManager implements ProtocolManager {
|
|||||||
throw new IllegalArgumentException("Player has no injected handler.");
|
throw new IllegalArgumentException("Player has no injected handler.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the current plugin class loader.
|
||||||
|
* @return Class loader.
|
||||||
|
*/
|
||||||
|
public ClassLoader getClassLoader() {
|
||||||
|
return classLoader;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isClosed() {
|
public boolean isClosed() {
|
||||||
return hasClosed;
|
return hasClosed;
|
||||||
|
@ -218,19 +218,21 @@ class PlayerInjector {
|
|||||||
@Override
|
@Override
|
||||||
public boolean add(Packet packet) {
|
public boolean add(Packet packet) {
|
||||||
|
|
||||||
|
Packet result = null;
|
||||||
|
|
||||||
// Check for fake packets and ignored packets
|
// Check for fake packets and ignored packets
|
||||||
if (packet instanceof FakePacket) {
|
if (packet instanceof FakePacket) {
|
||||||
return true;
|
return true;
|
||||||
} else if (ignoredPackets.contains(packet)) {
|
} else if (ignoredPackets.contains(packet)) {
|
||||||
ignoredPackets.remove(packet);
|
ignoredPackets.remove(packet);
|
||||||
} else {
|
} else {
|
||||||
packet = handlePacketRecieved(packet);
|
result = handlePacketRecieved(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
// A NULL packet indicate cancelling
|
// A NULL packet indicate cancelling
|
||||||
try {
|
try {
|
||||||
if (packet != null) {
|
if (result != null) {
|
||||||
super.add(packet);
|
super.add(result);
|
||||||
} else {
|
} else {
|
||||||
// We'll use the FakePacket marker instead of preventing the filters
|
// We'll use the FakePacket marker instead of preventing the filters
|
||||||
sendServerPacket(createNegativePacket(packet), true);
|
sendServerPacket(createNegativePacket(packet), true);
|
||||||
@ -280,7 +282,7 @@ class PlayerInjector {
|
|||||||
// }
|
// }
|
||||||
ex.setInterfaces(new Class[] { FakePacket.class } );
|
ex.setInterfaces(new Class[] { FakePacket.class } );
|
||||||
ex.setUseCache(true);
|
ex.setUseCache(true);
|
||||||
ex.setClassLoader(type.getClassLoader());
|
ex.setClassLoader(manager.getClassLoader());
|
||||||
ex.setSuperclass(type);
|
ex.setSuperclass(type);
|
||||||
ex.setCallback(new MethodInterceptor() {
|
ex.setCallback(new MethodInterceptor() {
|
||||||
@Override
|
@Override
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren