Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-16 21:10:30 +01:00
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,11 +44,24 @@ public class SessionCommandHandler implements CommandHandler<SessionPlayerComman
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private MinecraftPacket consumeCommand(SessionPlayerCommandPacket packet) {
|
private MinecraftPacket consumeCommand(SessionPlayerCommandPacket packet) {
|
||||||
if (packet.lastSeenMessages != null) {
|
if (packet.lastSeenMessages == null) {
|
||||||
return new ChatAcknowledgementPacket(packet.lastSeenMessages.getOffset());
|
|
||||||
}
|
|
||||||
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
|
@Nullable
|
||||||
private MinecraftPacket forwardCommand(SessionPlayerCommandPacket packet, String newCommand) {
|
private MinecraftPacket forwardCommand(SessionPlayerCommandPacket packet, String newCommand) {
|
||||||
@ -83,14 +96,6 @@ public class SessionCommandHandler implements CommandHandler<SessionPlayerComman
|
|||||||
queueCommandResult(this.server, this.player, event -> {
|
queueCommandResult(this.server, this.player, event -> {
|
||||||
CommandExecuteEvent.CommandResult result = event.getResult();
|
CommandExecuteEvent.CommandResult result = event.getResult();
|
||||||
if (result == CommandExecuteEvent.CommandResult.denied()) {
|
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));
|
return CompletableFuture.completedFuture(consumeCommand(packet));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren