diff --git a/patches/server/0833-Check-requirement-before-suggesting-root-nodes.patch b/patches/server/0833-Check-requirement-before-suggesting-root-nodes.patch new file mode 100644 index 0000000000..da19d3f1ca --- /dev/null +++ b/patches/server/0833-Check-requirement-before-suggesting-root-nodes.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: stonar96 +Date: Sun, 12 Sep 2021 00:14:21 +0200 +Subject: [PATCH] Check requirement before suggesting root nodes + +Child nodes are handled by CommandDispatcher#parse checking +requirements. + +Vanilla clients only send ServerboundCommandSuggestionPacket when +encountering a command node with ASK_SERVER suggestions, however a +modified client can send this packet whenever it wants. + +diff --git a/src/main/java/com/mojang/brigadier/CommandDispatcher.java b/src/main/java/com/mojang/brigadier/CommandDispatcher.java +index ca24830bac1a04b798229d1946863429c7849495..5584040fe48c18aa809f5a1510157e735851df79 100644 +--- a/src/main/java/com/mojang/brigadier/CommandDispatcher.java ++++ b/src/main/java/com/mojang/brigadier/CommandDispatcher.java +@@ -594,10 +594,14 @@ public class CommandDispatcher { + int i = 0; + for (final CommandNode node : parent.getChildren()) { + CompletableFuture future = Suggestions.empty(); ++ // Paper start - Don't suggest if the requirement isn't met ++ if (parent != this.root || node.canUse(context.getSource())) { + try { + future = node.listSuggestions(context.build(truncatedInput), new SuggestionsBuilder(truncatedInput, truncatedInputLowerCase, start)); + } catch (final CommandSyntaxException ignored) { + } ++ } ++ // Paper end + futures[i++] = future; + } + diff --git a/patches/server/0834-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch b/patches/server/0834-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch new file mode 100644 index 0000000000..61da4b8894 --- /dev/null +++ b/patches/server/0834-Don-t-respond-to-ServerboundCommandSuggestionPacket-.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: stonar96 +Date: Sun, 12 Sep 2021 00:14:21 +0200 +Subject: [PATCH] Don't respond to ServerboundCommandSuggestionPacket when + tab-complete is disabled + + +diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index 5d7c47b0a302f7db95a0b2bb811c5656c6b02beb..7bf03b78a26b6a697a8d10e8832703421f96b2bb 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -796,6 +796,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + } + // Paper end + // CraftBukkit end ++ // Paper start - Don't suggest if tab-complete is disabled ++ if (org.spigotmc.SpigotConfig.tabComplete < 0) { ++ return; ++ } ++ // Paper end + StringReader stringreader = new StringReader(packet.getCommand()); + + if (stringreader.canRead() && stringreader.peek() == '/') {