Ignore fake players in MCPC++
Dieser Commit ist enthalten in:
Ursprung
f3b2b0bf3b
Commit
68c0a3c1dc
@ -62,6 +62,7 @@ import com.comphenix.protocol.injector.packet.PacketInjector;
|
|||||||
import com.comphenix.protocol.injector.packet.PacketInjectorBuilder;
|
import com.comphenix.protocol.injector.packet.PacketInjectorBuilder;
|
||||||
import com.comphenix.protocol.injector.packet.PacketRegistry;
|
import com.comphenix.protocol.injector.packet.PacketRegistry;
|
||||||
import com.comphenix.protocol.injector.player.PlayerInjectionHandler;
|
import com.comphenix.protocol.injector.player.PlayerInjectionHandler;
|
||||||
|
import com.comphenix.protocol.injector.player.PlayerInjector.ServerHandlerNull;
|
||||||
import com.comphenix.protocol.injector.player.PlayerInjectorBuilder;
|
import com.comphenix.protocol.injector.player.PlayerInjectorBuilder;
|
||||||
import com.comphenix.protocol.injector.player.PlayerInjectionHandler.ConflictStrategy;
|
import com.comphenix.protocol.injector.player.PlayerInjectionHandler.ConflictStrategy;
|
||||||
import com.comphenix.protocol.injector.spigot.SpigotPacketInjector;
|
import com.comphenix.protocol.injector.spigot.SpigotPacketInjector;
|
||||||
@ -904,6 +905,8 @@ public final class PacketFilterManager implements ProtocolManager, ListenerInvok
|
|||||||
try {
|
try {
|
||||||
// This call will be ignored if no listeners are registered
|
// This call will be ignored if no listeners are registered
|
||||||
playerInjection.injectPlayer(event.getPlayer(), ConflictStrategy.OVERRIDE);
|
playerInjection.injectPlayer(event.getPlayer(), ConflictStrategy.OVERRIDE);
|
||||||
|
} catch (ServerHandlerNull e) {
|
||||||
|
// Caused by logged out players, or fake login events in MCPC++. Ignore it.
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
reporter.reportDetailed(PacketFilterManager.this,
|
reporter.reportDetailed(PacketFilterManager.this,
|
||||||
Report.newBuilder(REPORT_CANNOT_INJECT_PLAYER).callerParam(event).error(e)
|
Report.newBuilder(REPORT_CANNOT_INJECT_PLAYER).callerParam(event).error(e)
|
||||||
|
@ -388,7 +388,7 @@ public abstract class PlayerInjector implements SocketInjector {
|
|||||||
|
|
||||||
// This is bad
|
// This is bad
|
||||||
if (currentHandler == null)
|
if (currentHandler == null)
|
||||||
throw new IllegalAccessError("Unable to fetch server handler: was NUll.");
|
throw new ServerHandlerNull();
|
||||||
|
|
||||||
// See if this isn't a standard net handler class
|
// See if this isn't a standard net handler class
|
||||||
if (!isStandardMinecraftNetHandler(currentHandler)) {
|
if (!isStandardMinecraftNetHandler(currentHandler)) {
|
||||||
@ -714,4 +714,22 @@ public abstract class PlayerInjector implements SocketInjector {
|
|||||||
public void setUpdatedPlayer(Player updatedPlayer) {
|
public void setUpdatedPlayer(Player updatedPlayer) {
|
||||||
this.updatedPlayer = updatedPlayer;
|
this.updatedPlayer = updatedPlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that a player's NetServerHandler or PlayerConnection was NULL.
|
||||||
|
* <p>
|
||||||
|
* This is usually because the player has just logged out, or due to it being a "fake" player in MCPC++.
|
||||||
|
* @author Kristian
|
||||||
|
*/
|
||||||
|
public static class ServerHandlerNull extends IllegalAccessError {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public ServerHandlerNull() {
|
||||||
|
super("Unable to fetch server handler: was NUll.");
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServerHandlerNull(String s) {
|
||||||
|
super(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren