Package dev.satyrn.xpeconomy.commands
Class AddCommandHandler
java.lang.Object
dev.satyrn.papermc.api.commands.v1.CommandHandler
dev.satyrn.xpeconomy.api.commands.VaultCommandHandler
dev.satyrn.xpeconomy.api.commands.AccountCommandHandler
dev.satyrn.xpeconomy.commands.AddCommandHandler
- All Implemented Interfaces:
org.bukkit.command.CommandExecutor
,org.bukkit.command.TabCompleter
Models a command which allows players to add a balance to another player's account.
- Since:
- 1.0-SNAPSHOT
- Author:
- Isabel Maskrey
-
Constructor Summary
ConstructorDescriptionAddCommandHandler
(@NotNull org.bukkit.plugin.Plugin plugin, @NotNull net.milkbowl.vault.permission.Permission permission, @NotNull AccountManager accountManager, @NotNull Configuration configuration) Initializes a new command handler with the permission manager instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected @NotNull String
getUsage
(@NotNull org.bukkit.command.CommandSender sender, @NotNull org.bukkit.command.Command command) Gets the command usage.boolean
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.Methods inherited from class dev.satyrn.xpeconomy.api.commands.AccountCommandHandler
getAccountManager, getConfiguration, getEconomyMethod
Methods inherited from class dev.satyrn.xpeconomy.api.commands.VaultCommandHandler
getPermission
Methods inherited from class dev.satyrn.papermc.api.commands.v1.CommandHandler
getPlugin, setupCommand, setupCommand, setUsage
-
Constructor Details
-
AddCommandHandler
public AddCommandHandler(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @NotNull @NotNull net.milkbowl.vault.permission.Permission permission, @NotNull @NotNull AccountManager accountManager, @NotNull @NotNull Configuration configuration) Initializes a new command handler with the permission manager instance.- Parameters:
plugin
- The plugin instance.permission
- The permission manager instance.accountManager
- The account manager instance.configuration
- The plugin configuration 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
-
getUsage
@NotNull protected @NotNull String getUsage(@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull org.bukkit.command.Command command) Gets the command usage.- Overrides:
getUsage
in classdev.satyrn.papermc.api.commands.v1.CommandHandler
- Parameters:
sender
- The command sender.command
- The command.- Returns:
- The command usage.
-