aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOwen <[email protected]>2024-05-12 02:46:42 -0400
committerGitHub <[email protected]>2024-05-11 23:46:42 -0700
commit7e48f66c05dcc85f8533c96b29fc90b87be65a66 (patch)
treef1adb00ecf7ac8c95705859b301c6a36f73afe92
parent711f82e01e44d8d86b47040aaa8ce33130b2f194 (diff)
downloadPaper-7e48f66c05dcc85f8533c96b29fc90b87be65a66.tar.gz
Paper-7e48f66c05dcc85f8533c96b29fc90b87be65a66.zip
Properly pass requirement on namespaced redirects (#10701)
-rw-r--r--patches/server/1048-Brigadier-based-command-API.patch15
1 files changed, 8 insertions, 7 deletions
diff --git a/patches/server/1048-Brigadier-based-command-API.patch b/patches/server/1048-Brigadier-based-command-API.patch
index ce4c0764c7..e99486deda 100644
--- a/patches/server/1048-Brigadier-based-command-API.patch
+++ b/patches/server/1048-Brigadier-based-command-API.patch
@@ -2020,7 +2020,7 @@ index e6c7f62ed379a78645933670299e4fcda8540ed1..59d7e8a3d83d3ab7aa28606401bb129c
public org.bukkit.command.CommandSender getBukkitSender() {
return this.source.getBukkitSender(this);
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
-index aa2fca6917fb67fe0e9ba067d11487c3a274f675..2b33c5f5a7c5c87cf975c5237a2c9ba8cc0d2bdf 100644
+index aa2fca6917fb67fe0e9ba067d11487c3a274f675..24086a82e1687cb1925398218b18c2384fa8f6e3 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -156,7 +156,7 @@ public class Commands {
@@ -2032,7 +2032,7 @@ index aa2fca6917fb67fe0e9ba067d11487c3a274f675..2b33c5f5a7c5c87cf975c5237a2c9ba8
AdvancementCommands.register(this.dispatcher);
AttributeCommand.register(this.dispatcher, commandRegistryAccess);
ExecuteCommand.register(this.dispatcher, commandRegistryAccess);
-@@ -265,11 +265,17 @@ public class Commands {
+@@ -265,11 +265,18 @@ public class Commands {
}
}
// Paper end - Vanilla command permission fixes
@@ -2047,6 +2047,7 @@ index aa2fca6917fb67fe0e9ba067d11487c3a274f675..2b33c5f5a7c5c87cf975c5237a2c9ba8
+ this.dispatcher.register(
+ com.mojang.brigadier.builder.LiteralArgumentBuilder.<CommandSourceStack>literal("minecraft:" + node.getName())
+ .executes(node.getCommand())
++ .requires(node.getRequirement())
+ .redirect(node)
+ );
+ }
@@ -2055,7 +2056,7 @@ index aa2fca6917fb67fe0e9ba067d11487c3a274f675..2b33c5f5a7c5c87cf975c5237a2c9ba8
this.dispatcher.setConsumer(ExecutionCommandSource.resultConsumer());
}
-@@ -325,6 +331,11 @@ public class Commands {
+@@ -325,6 +332,11 @@ public class Commands {
}
public void performCommand(ParseResults<CommandSourceStack> parseresults, String s, String label) { // CraftBukkit
@@ -2067,7 +2068,7 @@ index aa2fca6917fb67fe0e9ba067d11487c3a274f675..2b33c5f5a7c5c87cf975c5237a2c9ba8
CommandSourceStack commandlistenerwrapper = (CommandSourceStack) parseresults.getContext().getSource();
commandlistenerwrapper.getServer().getProfiler().push(() -> {
-@@ -339,6 +350,7 @@ public class Commands {
+@@ -339,6 +351,7 @@ public class Commands {
});
}
} catch (Exception exception) {
@@ -2075,7 +2076,7 @@ index aa2fca6917fb67fe0e9ba067d11487c3a274f675..2b33c5f5a7c5c87cf975c5237a2c9ba8
MutableComponent ichatmutablecomponent = Component.literal(exception.getMessage() == null ? exception.getClass().getName() : exception.getMessage());
if (commandlistenerwrapper.getServer().isDebugging() || Commands.LOGGER.isDebugEnabled()) { // Paper - Debugging
-@@ -477,7 +489,7 @@ public class Commands {
+@@ -477,7 +490,7 @@ public class Commands {
Map<CommandNode<CommandSourceStack>, CommandNode<SharedSuggestionProvider>> map = Maps.newIdentityHashMap(); // Use identity to prevent aliasing issues
RootCommandNode vanillaRoot = new RootCommandNode();
@@ -2084,7 +2085,7 @@ index aa2fca6917fb67fe0e9ba067d11487c3a274f675..2b33c5f5a7c5c87cf975c5237a2c9ba8
map.put(vanilla, vanillaRoot);
this.fillUsableCommands(vanilla, vanillaRoot, player.createCommandSourceStack(), (Map) map);
-@@ -515,6 +527,7 @@ public class Commands {
+@@ -515,6 +528,7 @@ public class Commands {
}
private void fillUsableCommands(CommandNode<CommandSourceStack> tree, CommandNode<SharedSuggestionProvider> result, CommandSourceStack source, Map<CommandNode<CommandSourceStack>, CommandNode<SharedSuggestionProvider>> resultNodes) {
@@ -2092,7 +2093,7 @@ index aa2fca6917fb67fe0e9ba067d11487c3a274f675..2b33c5f5a7c5c87cf975c5237a2c9ba8
Iterator iterator = tree.getChildren().iterator();
boolean registeredAskServerSuggestionsForTree = false; // Paper - tell clients to ask server for suggestions for EntityArguments
-@@ -529,6 +542,42 @@ public class Commands {
+@@ -529,6 +543,42 @@ public class Commands {
if (commandnode2.canUse(source)) {
ArgumentBuilder argumentbuilder = commandnode2.createBuilder(); // CraftBukkit - decompile error