2024-12-11 22:26:36 +01:00
|
|
|
--- a/com/mojang/brigadier/CommandDispatcher.java
|
|
|
|
+++ b/com/mojang/brigadier/CommandDispatcher.java
|
|
|
|
@@ -3,6 +3,7 @@
|
|
|
|
|
|
|
|
package com.mojang.brigadier;
|
|
|
|
|
|
|
|
+// CHECKSTYLE:OFF
|
|
|
|
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
|
|
|
import com.mojang.brigadier.context.CommandContext;
|
|
|
|
import com.mojang.brigadier.context.CommandContextBuilder;
|
2021-09-12 00:14:21 +02:00
|
|
|
@@ -537,10 +538,14 @@
|
|
|
|
int i = 0;
|
2024-12-11 22:26:36 +01:00
|
|
|
for (final CommandNode<S> node : parent.getChildren()) {
|
|
|
|
CompletableFuture<Suggestions> future = Suggestions.empty();
|
2021-09-12 00:14:21 +02:00
|
|
|
+ // Paper start - Don't suggest if the requirement isn't met
|
|
|
|
+ if (parent != this.root || node.canUse(context.getSource())) {
|
2024-12-11 22:26:36 +01:00
|
|
|
try {
|
|
|
|
- future = node.listSuggestions(context.build(truncatedInput), new SuggestionsBuilder(truncatedInput, truncatedInputLowerCase, start));
|
2021-09-12 00:14:21 +02:00
|
|
|
+ future = node.listSuggestions(context.build(truncatedInput), new SuggestionsBuilder(truncatedInput, truncatedInputLowerCase, start)); // CraftBukkit
|
2024-12-11 22:26:36 +01:00
|
|
|
} catch (final CommandSyntaxException ignored) {
|
|
|
|
}
|
2021-09-12 00:14:21 +02:00
|
|
|
+ }
|
|
|
|
+ // Paper end - Don't suggest if the requirement isn't met
|
2024-12-11 22:26:36 +01:00
|
|
|
futures[i++] = future;
|
2021-09-12 00:14:21 +02:00
|
|
|
}
|
|
|
|
|