aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--patches/server/1029-Prioritize-Minecraft-commands-in-function-parsing.patch27
1 files changed, 24 insertions, 3 deletions
diff --git a/patches/server/1029-Prioritize-Minecraft-commands-in-function-parsing.patch b/patches/server/1029-Prioritize-Minecraft-commands-in-function-parsing.patch
index 44b500d8b6..6e36d9a7b3 100644
--- a/patches/server/1029-Prioritize-Minecraft-commands-in-function-parsing.patch
+++ b/patches/server/1029-Prioritize-Minecraft-commands-in-function-parsing.patch
@@ -1,7 +1,8 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jason Penilla <[email protected]>
Date: Mon, 1 Jul 2024 11:58:49 -0700
-Subject: [PATCH] Prioritize Minecraft commands in function parsing
+Subject: [PATCH] Prioritize Minecraft commands in function parsing and command
+ blocks
diff --git a/src/main/java/com/mojang/brigadier/CommandDispatcher.java b/src/main/java/com/mojang/brigadier/CommandDispatcher.java
@@ -18,7 +19,7 @@ index a4d5d7017e0be79844b996de85a63cad5f8488bc..770aec1976bd391eb5712b57b6c6a029
continue;
}
diff --git a/src/main/java/com/mojang/brigadier/tree/CommandNode.java b/src/main/java/com/mojang/brigadier/tree/CommandNode.java
-index 03ce8a2abb6dceaa922dcce7f3adbc228bbde4bc..e95a803f414bf8ea667d352c73670bce72f00d24 100644
+index 03ce8a2abb6dceaa922dcce7f3adbc228bbde4bc..dc76fcf4c6cc6cd65ce117b1855c15ede60f30ab 100644
--- a/src/main/java/com/mojang/brigadier/tree/CommandNode.java
+++ b/src/main/java/com/mojang/brigadier/tree/CommandNode.java
@@ -173,6 +173,12 @@ public abstract class CommandNode<S> implements Comparable<CommandNode<S>> {
@@ -34,7 +35,7 @@ index 03ce8a2abb6dceaa922dcce7f3adbc228bbde4bc..e95a803f414bf8ea667d352c73670bce
if (this.literals.size() > 0) {
final int cursor = input.getCursor();
while (input.canRead() && input.peek() != ' ') {
-@@ -180,7 +186,17 @@ public abstract class CommandNode<S> implements Comparable<CommandNode<S>> {
+@@ -180,7 +186,21 @@ public abstract class CommandNode<S> implements Comparable<CommandNode<S>> {
}
final String text = input.getString().substring(cursor, input.getCursor());
input.setCursor(cursor);
@@ -45,6 +46,10 @@ index 03ce8a2abb6dceaa922dcce7f3adbc228bbde4bc..e95a803f414bf8ea667d352c73670bce
+ if (!text.contains(":")) {
+ literal = this.literals.get("minecraft:" + text);
+ }
++ } else if (source instanceof CommandSourceStack css && css.source instanceof net.minecraft.world.level.BaseCommandBlock) {
++ if (css.getServer().server.getCommandBlockOverride(text) && !text.contains(":")) {
++ literal = this.literals.get("minecraft:" + text);
++ }
+ }
+ if (literal == null) {
+ literal = this.literals.get(text);
@@ -112,3 +117,19 @@ index 85a890403645f0f9d381e85b48efcae126673945..bcc27fec043a57eb5064934c967982de
}
@Override
+diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
+index 3e454515360c22a26c9329e4032d525579110d7e..1d1e76de60e40224f5cb81893f9ee50fe987badb 100644
+--- a/src/main/java/net/minecraft/commands/Commands.java
++++ b/src/main/java/net/minecraft/commands/Commands.java
+@@ -310,10 +310,7 @@ public class Commands {
+
+ // Paper - Fix permission levels for command blocks
+
+- // Handle vanilla commands;
+- if (sender.getLevel().getCraftServer().getCommandBlockOverride(args[0])) {
+- args[0] = "minecraft:" + args[0];
+- }
++ // Handle vanilla commands; // Paper - handled in CommandNode/CommandDispatcher
+
+ String newCommand = joiner.join(args);
+ this.performPrefixedCommand(sender, newCommand, newCommand);