Package de.marcely.bedwars.api.command
Interface CommandHandler
- All Known Subinterfaces:
CommandHandlerWrappedSender
- All Known Implementing Classes:
CollectionCommandHandler
,CommandHandler.Silent
,HelpCommandHandler
public interface CommandHandler
A CommandHandler handles the execution of a command
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
The default command handler that effectively does nothing -
Method Summary
Modifier and TypeMethodDescriptiondefault String
getBukkitLabel(String fullUsage)
Returns the name of the command using the given full usage.default @Nullable Integer
getContentAmount(CommandSender sender)
A command may display an amount as an additional info in /bw [...] helpReturns the plugin that created this handleronAutocomplete(CommandSender sender, String[] args)
Gets called whenever someone autocompletes (presses tab) on the commandvoid
onFire(CommandSender sender, String fullUsage, String[] args)
Gets called whenever someone executes the commandvoid
onRegister(SubCommand cmd)
Gets called whenever the command is getting added as handler
-
Method Details
-
getPlugin
Plugin getPlugin()Returns the plugin that created this handler- Returns:
- The plugin of this handler
-
onRegister
Gets called whenever the command is getting added as handler- Parameters:
cmd
- The command to which the handler has been added to
-
onFire
Gets called whenever someone executes the command- Parameters:
sender
- The person who executed the commandfullUsage
- The full usage, including the label and everythingargs
- Passed arguments to this command
-
onAutocomplete
Gets called whenever someone autocompletes (presses tab) on the command- Parameters:
sender
- The person who did the autocompleteargs
- The given arguments- Returns:
- What shall be shown to the player as options. Returning null will display all players
-
getContentAmount
A command may display an amount as an additional info in /bw [...] helpIt's optional. It's not required to override it. Keep in mind that
SubCommand.setHasContentAmount(boolean)
must be set to true for it to be actually shown- Parameters:
sender
- The sender to which this amount shall be shown- Returns:
- The amount of entries this (list) command has.
null
if it shouldn't be shown in this event
-
getBukkitLabel
Returns the name of the command using the given full usage.Example: With "/bw arena" this method returns "bw"
- Parameters:
fullUsage
- The full usage that's being passed inonFire(CommandSender, String, String[])
- Returns:
- The name of the command that was used to execute the command
-