diff options
author | Nassim Jahnke <[email protected]> | 2024-07-14 14:04:38 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2024-07-14 14:04:38 +0200 |
commit | 34a2917dccd1a39888c85badd7cf7aad7c44ff61 (patch) | |
tree | 969bef118a439471074210089a8a05795c627f9e /patches/server/0975-Brigadier-based-command-API.patch | |
parent | 1595e4afc097ad595cf10106044774170f779701 (diff) | |
download | Paper-34a2917dccd1a39888c85badd7cf7aad7c44ff61.tar.gz Paper-34a2917dccd1a39888c85badd7cf7aad7c44ff61.zip |
Add default canUse and permission methods to BasicCommand (#11047)
Diffstat (limited to 'patches/server/0975-Brigadier-based-command-API.patch')
-rw-r--r-- | patches/server/0975-Brigadier-based-command-API.patch | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/patches/server/0975-Brigadier-based-command-API.patch b/patches/server/0975-Brigadier-based-command-API.patch index 71f121c880..ab14bb6a9c 100644 --- a/patches/server/0975-Brigadier-based-command-API.patch +++ b/patches/server/0975-Brigadier-based-command-API.patch @@ -686,10 +686,10 @@ index 0000000000000000000000000000000000000000..1b1642f306771f029e6214a2e2ebebb6 +} diff --git a/src/main/java/io/papermc/paper/command/brigadier/PaperCommands.java b/src/main/java/io/papermc/paper/command/brigadier/PaperCommands.java new file mode 100644 -index 0000000000000000000000000000000000000000..27509813a90980be1dfc7bde27d0eba60adfc820 +index 0000000000000000000000000000000000000000..a3e128bde0fa4ab0ecab4172f02288a29b9fddc7 --- /dev/null +++ b/src/main/java/io/papermc/paper/command/brigadier/PaperCommands.java -@@ -0,0 +1,193 @@ +@@ -0,0 +1,194 @@ +package io.papermc.paper.command.brigadier; + +import com.google.common.base.Preconditions; @@ -860,11 +860,12 @@ index 0000000000000000000000000000000000000000..27509813a90980be1dfc7bde27d0eba6 + @Override + public @Unmodifiable Set<String> register(final PluginMeta pluginMeta, final String label, final @Nullable String description, final Collection<String> aliases, final BasicCommand basicCommand) { + final LiteralArgumentBuilder<CommandSourceStack> builder = Commands.literal(label) ++ .requires(stack -> basicCommand.canUse(stack.getSender())) + .then( + Commands.argument("args", StringArgumentType.greedyString()) + .suggests((context, suggestionsBuilder) -> { + final String[] args = StringUtils.split(suggestionsBuilder.getRemaining()); -+ final SuggestionsBuilder offsetSuggestionsBuilder = suggestionsBuilder.createOffset(suggestionsBuilder.getInput().lastIndexOf(' ') + 1);; ++ final SuggestionsBuilder offsetSuggestionsBuilder = suggestionsBuilder.createOffset(suggestionsBuilder.getInput().lastIndexOf(' ') + 1); + + final Collection<String> suggestions = basicCommand.suggest(context.getSource(), args); + suggestions.forEach(offsetSuggestionsBuilder::suggest); |