diff options
author | Nassim Jahnke <[email protected]> | 2024-07-11 20:58:20 +0200 |
---|---|---|
committer | Nassim Jahnke <[email protected]> | 2024-07-12 18:09:07 +0200 |
commit | eb8e4f468858c6eaf7078cd10362a0cee133bc39 (patch) | |
tree | 3704c8dbc75d608eb956a5161dced9f0e68e842a | |
parent | 3ea0dd4d0abc91452143ae512e0a452aad39ccd7 (diff) | |
download | Paper-eb8e4f468858c6eaf7078cd10362a0cee133bc39.tar.gz Paper-eb8e4f468858c6eaf7078cd10362a0cee133bc39.zip |
Rename to canUse
-rw-r--r-- | patches/api/0469-Brigadier-based-command-API.patch | 10 | ||||
-rw-r--r-- | patches/server/0975-Brigadier-based-command-API.patch | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/patches/api/0469-Brigadier-based-command-API.patch b/patches/api/0469-Brigadier-based-command-API.patch index 0f9cf5b83c..9e99f07ecd 100644 --- a/patches/api/0469-Brigadier-based-command-API.patch +++ b/patches/api/0469-Brigadier-based-command-API.patch @@ -502,7 +502,7 @@ index 0000000000000000000000000000000000000000..9df87708206e26167a2c4934deff7fc6 +} diff --git a/src/main/java/io/papermc/paper/command/brigadier/BasicCommand.java b/src/main/java/io/papermc/paper/command/brigadier/BasicCommand.java new file mode 100644 -index 0000000000000000000000000000000000000000..712db7acae2f9818a3b112f770ee77029c6c4e04 +index 0000000000000000000000000000000000000000..99a9a5ecc5010bcd30351f8844cb5d824c252523 --- /dev/null +++ b/src/main/java/io/papermc/paper/command/brigadier/BasicCommand.java @@ -0,0 +1,60 @@ @@ -548,18 +548,18 @@ index 0000000000000000000000000000000000000000..712db7acae2f9818a3b112f770ee7702 + * Checks whether a command sender can receive and run the root command. + * + * @param sender the command sender trying to execute the command -+ * @return whether the command sender fulfill the root command requirement ++ * @return whether the command sender fulfills the root command requirement + * @see #permission() + */ + @ApiStatus.OverrideOnly -+ default boolean requires(final @NotNull CommandSender sender) { ++ default boolean canUse(final @NotNull CommandSender sender) { + return this.permission() == null || sender.hasPermission(this.permission()); + } + + /** -+ * Returns the permission for the root command used in {@link #requires(CommandSender)} by default. ++ * Returns the permission for the root command used in {@link #canUse(CommandSender)} by default. + * -+ * @return the permission for the root command used in {@link #requires(CommandSender)} ++ * @return the permission for the root command used in {@link #canUse(CommandSender)} + */ + @ApiStatus.OverrideOnly + default @Nullable String permission() { diff --git a/patches/server/0975-Brigadier-based-command-API.patch b/patches/server/0975-Brigadier-based-command-API.patch index 8be8329438..ab14bb6a9c 100644 --- a/patches/server/0975-Brigadier-based-command-API.patch +++ b/patches/server/0975-Brigadier-based-command-API.patch @@ -686,7 +686,7 @@ 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..ac83eefcea3f22b7980bf7b4f1f22a5ae18d82c1 +index 0000000000000000000000000000000000000000..a3e128bde0fa4ab0ecab4172f02288a29b9fddc7 --- /dev/null +++ b/src/main/java/io/papermc/paper/command/brigadier/PaperCommands.java @@ -0,0 +1,194 @@ @@ -860,7 +860,7 @@ index 0000000000000000000000000000000000000000..ac83eefcea3f22b7980bf7b4f1f22a5a + @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.requires(stack.getSender())) ++ .requires(stack -> basicCommand.canUse(stack.getSender())) + .then( + Commands.argument("args", StringArgumentType.greedyString()) + .suggests((context, suggestionsBuilder) -> { |