backport: fix loading cmds in datapacks (#6793)

This commit is contained in:
Jake Potrebic 2021-10-18 15:01:41 -07:00 committed by GitHub
parent 7f332fab84
commit 42e2f67b29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -43,7 +43,7 @@ index c0fac7369b111e65b896a15848ae22457e5e8914..fd310f5d009801492def4af943322a3b
private final RedirectModifier<S> modifier;
private final boolean forks;
diff --git a/src/main/java/net/minecraft/commands/CommandDispatcher.java b/src/main/java/net/minecraft/commands/CommandDispatcher.java
index 4270a9bbc272706b5a88807d465a32e73d18b90f..077beec1c1f0ae99854fe9e57fccfaaa94bbfd33 100644
index 4270a9bbc272706b5a88807d465a32e73d18b90f..3d255c2ed31d7267bb6cd789702063671d785018 100644
--- a/src/main/java/net/minecraft/commands/CommandDispatcher.java
+++ b/src/main/java/net/minecraft/commands/CommandDispatcher.java
@@ -197,6 +197,13 @@ public class CommandDispatcher {
@ -53,7 +53,7 @@ index 4270a9bbc272706b5a88807d465a32e73d18b90f..077beec1c1f0ae99854fe9e57fccfaaa
+ // Paper start
+ for (final CommandNode<CommandListenerWrapper> node : this.dispatcher().getRoot().getChildren()) {
+ if (node.getRequirement() == com.mojang.brigadier.builder.ArgumentBuilder.<CommandListenerWrapper>defaultRequirement()) {
+ node.requirement = stack -> stack.getBukkitSender().hasPermission(org.bukkit.craftbukkit.command.VanillaCommandWrapper.getPermission(node));
+ node.requirement = stack -> stack.base == ICommandListener.DUMMY || stack.getBukkitSender().hasPermission(org.bukkit.craftbukkit.command.VanillaCommandWrapper.getPermission(node));
+ }
+ }
+ // Paper end