geforkt von Mirrors/Velocity
Explicitly reject consuming signed command when denied by event
This would fail down the line anyway due to inconsistent chat state (if holding a 'last seen' update)
Dieser Commit ist enthalten in:
Ursprung
3b7ffa837e
Commit
ec9745769f
@ -44,10 +44,23 @@ public class SessionCommandHandler implements CommandHandler<SessionPlayerComman
|
||||
|
||||
@Nullable
|
||||
private MinecraftPacket consumeCommand(SessionPlayerCommandPacket packet) {
|
||||
if (packet.lastSeenMessages != null) {
|
||||
return new ChatAcknowledgementPacket(packet.lastSeenMessages.getOffset());
|
||||
if (packet.lastSeenMessages == null) {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
if (packet.isSigned()) {
|
||||
// Any signed message produced by the client *must* be passed through to the server in order to maintain a
|
||||
// consistent state for future messages.
|
||||
logger.fatal("A plugin tried to deny a command with signable component(s). "
|
||||
+ "This is not supported. "
|
||||
+ "Disconnecting player " + player.getUsername() + ". Command packet: " + packet);
|
||||
player.disconnect(Component.text(
|
||||
"A proxy plugin caused an illegal protocol state. "
|
||||
+ "Contact your network administrator."));
|
||||
return null;
|
||||
}
|
||||
// An unsigned command with a 'last seen' update will not happen as of 1.20.5+, but for earlier versions - we still
|
||||
// need to pass through the acknowledgement
|
||||
return new ChatAcknowledgementPacket(packet.lastSeenMessages.getOffset());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@ -83,14 +96,6 @@ public class SessionCommandHandler implements CommandHandler<SessionPlayerComman
|
||||
queueCommandResult(this.server, this.player, event -> {
|
||||
CommandExecuteEvent.CommandResult result = event.getResult();
|
||||
if (result == CommandExecuteEvent.CommandResult.denied()) {
|
||||
if (packet.isSigned()) {
|
||||
logger.fatal("A plugin tried to deny a command with signable component(s). "
|
||||
+ "This is not supported. "
|
||||
+ "Disconnecting player " + player.getUsername() + ". Command packet: " + packet);
|
||||
player.disconnect(Component.text(
|
||||
"A proxy plugin caused an illegal protocol state. "
|
||||
+ "Contact your network administrator."));
|
||||
}
|
||||
return CompletableFuture.completedFuture(consumeCommand(packet));
|
||||
}
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren