Skip to content

Commit

Permalink
Disable check out-of-order command (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yh-china committed Jun 15, 2023
1 parent 060414f commit f8783b7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
9 changes: 7 additions & 2 deletions patches/server/0004-Leaves-Server-Config-And-Command.patch
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ index 5c4bf6d99da409988871465de27e0357af79f37e..ce9873f216cbb330dee4abbdf8b0459f
.withRequiredArg()
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..f7d2c983946174da2cf4d24a9d62a9c413567188
index 0000000000000000000000000000000000000000..325c4068bfddc28dd3b04e60cba1d27fc0302b8a
--- /dev/null
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -0,0 +1,728 @@
@@ -0,0 +1,733 @@
+package top.leavesmc.leaves;
+
+import com.destroystokyo.paper.util.SneakyThrow;
Expand Down Expand Up @@ -685,6 +685,11 @@ index 0000000000000000000000000000000000000000..f7d2c983946174da2cf4d24a9d62a9c4
+ redstoneDontCantOnTrapDoor = getBoolean("settings.modify.redstone-wire-dont-connect-if-on-trapdoor", redstoneDontCantOnTrapDoor);
+ }
+
+ public static boolean disableCheckOutOfOrderCommand = false;
+ private static void disableCheckOutOfOrderCommand() {
+ disableCheckOutOfOrderCommand = getBoolean("settings.modify.disable-check-out-of-order-command", disableCheckOutOfOrderCommand);
+ }
+
+ public static final class WorldConfig {
+
+ public final String worldName;
Expand Down
19 changes: 19 additions & 0 deletions patches/server/0068-Disable-check-out-of-order-command.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: violetc <[email protected]>
Date: Thu, 15 Jun 2023 18:01:51 +0800
Subject: [PATCH] Disable check out-of-order command


diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 0cc4bd960383759abeabe20c52e9af84228527a1..3100ad9c7da7e48d5c0f8b2a976cba708c62dfcb 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2360,7 +2360,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
}

private Optional<LastSeenMessages> tryHandleChat(String message, Instant timestamp, LastSeenMessages.Update acknowledgment) {
- if (!this.updateChatOrder(timestamp)) {
+ if (!(top.leavesmc.leaves.LeavesConfig.disableCheckOutOfOrderCommand && message.startsWith("/")) && !this.updateChatOrder(timestamp)) { // Leaves - disable check to support Velocity
ServerGamePacketListenerImpl.LOGGER.warn("{} sent out-of-order chat: '{}': {} > {}", this.player.getName().getString(), message, this.lastChatTimeStamp.get().getEpochSecond(), timestamp.getEpochSecond()); // Paper
this.server.scheduleOnMain(() -> { // Paper - push to main
this.disconnect(Component.translatable("multiplayer.disconnect.out_of_order_chat"), org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event ca

0 comments on commit f8783b7

Please sign in to comment.