Skip to content

Commit

Permalink
22w42a
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDrakify committed Oct 21, 2022
1 parent 7d77bfb commit eb2e7a0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ public enum ProtocolVersion {
MINECRAFT_1_18(757, "1.18", "1.18.1"),
MINECRAFT_1_18_2(758, "1.18.2"),
MINECRAFT_1_19(759, "1.19"),
MINECRAFT_1_19_1(760, "1.19.1", "1.19.2");
MINECRAFT_1_19_1(760, "1.19.1", "1.19.2"),
MINECRAFT_1_20(-1, 102, "1.20"); // 22w42a

private static final int SNAPSHOT_BIT = 30;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,18 +187,9 @@ private CompletableFuture<MinecraftPacket> callChat(MinecraftPacket original, Pl
String messageNew = eventMsg.get();
if (playerKey != null) {
if (signedMessage != null && !messageNew.equals(signedMessage.getMessage())) {
if (playerKey.getKeyRevision().compareTo(IdentifiedKey.Revision.LINKED_V2) >= 0) {
// Bad, very bad.
logger.fatal("A plugin tried to change a signed chat message. "
+ "This is no longer possible in 1.19.1 and newer. "
+ "Disconnecting player " + player.getUsername());
player.disconnect(Component.text("A proxy plugin caused an illegal protocol state. "
+ "Contact your network administrator."));
} else {
logger.warn("A plugin changed a signed chat message. The server may not accept it.");
return ChatBuilder.builder(player.getProtocolVersion())
.message(messageNew).toServer();
}
logger.warn("A plugin changed a signed chat message. The server may not accept it.");
return ChatBuilder.builder(player.getProtocolVersion())
.message(messageNew).toServer();
} else {
return original;
}
Expand All @@ -209,14 +200,6 @@ private CompletableFuture<MinecraftPacket> callChat(MinecraftPacket original, Pl
} else {
return original;
}
} else {
if (playerKey != null && playerKey.getKeyRevision().compareTo(IdentifiedKey.Revision.LINKED_V2) >= 0) {
logger.fatal("A plugin tried to cancel a signed chat message."
+ " This is no longer possible in 1.19.1 and newer. "
+ "Disconnecting player " + player.getUsername());
player.disconnect(Component.text("A proxy plugin caused an illegal protocol state. "
+ "Contact your network administrator."));
}
}
return null;
})
Expand Down Expand Up @@ -744,16 +727,6 @@ private CompletableFuture<MinecraftPacket> processCommandExecuteResult(String or
Instant passedTimestamp) {
IdentifiedKey playerKey = player.getIdentifiedKey();
if (result == CommandResult.denied()) {
if (playerKey != null) {
if (signedCommand != null && playerKey.getKeyRevision()
.compareTo(IdentifiedKey.Revision.LINKED_V2) >= 0) {
logger.fatal("A plugin tried to deny a command with signable component(s). "
+ "This is not supported. "
+ "Disconnecting player " + player.getUsername());
player.disconnect(Component.text("A proxy plugin caused an illegal protocol state. "
+ "Contact your network administrator."));
}
}
return CompletableFuture.completedFuture(null);
}

Expand All @@ -767,15 +740,6 @@ private CompletableFuture<MinecraftPacket> processCommandExecuteResult(String or
if (signedCommand != null && commandToRun.equals(signedCommand.getBaseCommand())) {
write.message(signedCommand);
} else {
if (signedCommand != null && playerKey != null && playerKey.getKeyRevision()
.compareTo(IdentifiedKey.Revision.LINKED_V2) >= 0) {
logger.fatal("A plugin tried to change a command with signed component(s). "
+ "This is not supported. "
+ "Disconnecting player " + player.getUsername());
player.disconnect(Component.text("A proxy plugin caused an illegal protocol state. "
+ "Contact your network administrator."));
return CompletableFuture.completedFuture(null);
}
write.message("/" + commandToRun);
}
return CompletableFuture.completedFuture(write.toServer());
Expand All @@ -791,15 +755,6 @@ private CompletableFuture<MinecraftPacket> processCommandExecuteResult(String or
if (signedCommand != null && commandToRun.equals(signedCommand.getBaseCommand())) {
write.message(signedCommand);
} else {
if (signedCommand != null && playerKey != null && playerKey.getKeyRevision()
.compareTo(IdentifiedKey.Revision.LINKED_V2) >= 0) {
logger.fatal("A plugin tried to change a command with signed component(s). "
+ "This is not supported. "
+ "Disconnecting player " + player.getUsername());
player.disconnect(Component.text("A proxy plugin caused an illegal protocol state. "
+ "Contact your network administrator."));
return null;
}
write.message("/" + commandToRun);
}
return write.toServer();
Expand Down

0 comments on commit eb2e7a0

Please sign in to comment.