Package dev.satyrn.xpeconomy.commands
Class XPEconomyCommandHandler
java.lang.Object
dev.satyrn.papermc.api.commands.v1.CommandHandler
dev.satyrn.xpeconomy.api.commands.VaultCommandHandler
dev.satyrn.xpeconomy.commands.XPEconomyCommandHandler
- All Implemented Interfaces:
org.bukkit.command.CommandExecutor
,org.bukkit.command.TabCompleter
-
Constructor Summary
ConstructorDescriptionXPEconomyCommandHandler
(@NotNull org.bukkit.plugin.Plugin plugin, @NotNull net.milkbowl.vault.permission.Permission permission) Creates a new command executor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
onCommand
(@NotNull org.bukkit.command.CommandSender sender, @NotNull org.bukkit.command.Command command, @NotNull String label, @NotNull String[] args) Executes the given command, returning its success.onTabComplete
(@NotNull org.bukkit.command.CommandSender sender, @NotNull org.bukkit.command.Command command, @NotNull String alias, @NotNull String[] args) Requests a list of possible completions for a command argument.registerSubcommand
(@NotNull String name, @NotNull dev.satyrn.papermc.api.commands.v1.CommandHandler commandHandler, @NotNull String... aliases) Adds a new subcommand to the command handler.registerSubcommand
(@NotNull String name, @Nullable String defaultPermission, @NotNull dev.satyrn.papermc.api.commands.v1.CommandHandler commandHandler, boolean allowPlayer, boolean allowNonPlayer, @NotNull String... aliases) Adds a new subcommand to the command handler.registerSubcommand
(@NotNull String name, @Nullable String defaultPermission, @NotNull dev.satyrn.papermc.api.commands.v1.CommandHandler commandHandler, @NotNull String... aliases) Adds a new subcommand to the command handler.Methods inherited from class dev.satyrn.xpeconomy.api.commands.VaultCommandHandler
getPermission
Methods inherited from class dev.satyrn.papermc.api.commands.v1.CommandHandler
getPlugin, getUsage, setupCommand, setupCommand, setUsage
-
Constructor Details
-
XPEconomyCommandHandler
public XPEconomyCommandHandler(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @NotNull @NotNull net.milkbowl.vault.permission.Permission permission) Creates a new command executor.- Parameters:
permission
- The permission manager instance.
-
-
Method Details
-
onCommand
public boolean onCommand(@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull org.bukkit.command.Command command, @NotNull @NotNull String label, @NotNull @NotNull String[] args) Executes the given command, returning its success.
If false is returned, then the "usage" plugin.yml entry for this command (if defined) will be sent to the player.- Parameters:
sender
- Source of the commandcommand
- Command which was executedlabel
- Alias of the command which was usedargs
- Passed command arguments- Returns:
- true if a valid command, otherwise false
-
onTabComplete
@NotNull public @NotNull List<String> onTabComplete(@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull org.bukkit.command.Command command, @NotNull @NotNull String alias, @NotNull @NotNull String[] args) Requests a list of possible completions for a command argument.- Parameters:
sender
- Source of the command. For players tab-completing a command inside a command block, this will be the player, not the command block.command
- Command which was executedalias
- The alias usedargs
- The arguments passed to the command, including final partial argument to be completed and command label- Returns:
- A List of possible completions for the final argument, or null to default to the command executor
-
registerSubcommand
@Contract(value="_, _, _ -> this", mutates="this") public XPEconomyCommandHandler registerSubcommand(@NotNull @NotNull String name, @NotNull @NotNull dev.satyrn.papermc.api.commands.v1.CommandHandler commandHandler, @NotNull @NotNull String... aliases) Adds a new subcommand to the command handler.- Parameters:
name
- The name of the subcommand. Registration will fail if this matches any existing subcommand's name or aliases.commandHandler
- The command handler instance.- Returns:
- The command handler instance.
-
registerSubcommand
@Contract(value="_, _, _, _ -> this", mutates="this") public XPEconomyCommandHandler registerSubcommand(@NotNull @NotNull String name, @Nullable @Nullable String defaultPermission, @NotNull @NotNull dev.satyrn.papermc.api.commands.v1.CommandHandler commandHandler, @NotNull @NotNull String... aliases) Adds a new subcommand to the command handler.- Parameters:
name
- The name of the subcommand. Registration will fail if this matches any existing subcommand's name or aliases.commandHandler
- The command handler instance.defaultPermission
- The default permission to allow access to the command.- Returns:
- The command handler instance.
-
registerSubcommand
@Contract(value="_, _, _, _, _, _ -> this", mutates="this") public XPEconomyCommandHandler registerSubcommand(@NotNull @NotNull String name, @Nullable @Nullable String defaultPermission, @NotNull @NotNull dev.satyrn.papermc.api.commands.v1.CommandHandler commandHandler, boolean allowPlayer, boolean allowNonPlayer, @NotNull @NotNull String... aliases) Adds a new subcommand to the command handler.- Parameters:
name
- The name of the subcommand. Registration will fail if this matches any existing subcommand's name or aliases.commandHandler
- The command handler instance.defaultPermission
- The default permission to allow access to the command.allowPlayer
-true
if the command should require a player to invoke; otherwise,false
aliases
- A list of aliases for the command. This will fail if any of these match any existing subcommand's name or alias.- Returns:
- The command handler instance.
-