Class CommandHandler
java.lang.Object
dev.satyrn.papermc.api.commands.v1.CommandHandler
- All Implemented Interfaces:
org.bukkit.command.CommandExecutor
,org.bukkit.command.TabCompleter
public abstract class CommandHandler
extends Object
implements org.bukkit.command.CommandExecutor, org.bukkit.command.TabCompleter
Represents a basic command handler.
- Since:
- 1.1.0
- Author:
- Isabel Maskrey
-
Constructor Summary
ModifierConstructorDescriptionprotected
CommandHandler
(@NotNull org.bukkit.plugin.Plugin plugin) Initializes a new instance of a command handler. -
Method Summary
Modifier and TypeMethodDescription@NotNull org.bukkit.plugin.Plugin
Gets the plugin instance.protected @NotNull String
getUsage
(@NotNull org.bukkit.command.CommandSender sender, @NotNull org.bukkit.command.Command command) Gets the command usage hint.final @NotNull CommandHandler
setupCommand
(@NotNull org.bukkit.command.PluginCommand command) Sets up a plugin command.final @NotNull CommandHandler
setupCommand
(@NotNull org.bukkit.plugin.Plugin plugin, @NotNull String commandName) Sets up a plugin command by name.final @NotNull CommandHandler
Sets the command usage hint.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.bukkit.command.CommandExecutor
onCommand
Methods inherited from interface org.bukkit.command.TabCompleter
onTabComplete
-
Constructor Details
-
CommandHandler
protected CommandHandler(@NotNull @NotNull org.bukkit.plugin.Plugin plugin) Initializes a new instance of a command handler.- Parameters:
plugin
- The parent plugin.- Since:
- 1.1.0
-
-
Method Details
-
setupCommand
@Contract(value="_ -> this", mutates="this") @NotNull public final @NotNull CommandHandler setupCommand(@NotNull @NotNull org.bukkit.command.PluginCommand command) Sets up a plugin command.- Parameters:
command
- The plugin command.- Returns:
- The command handler instance.
- Since:
- 1.1.0
-
setupCommand
@Contract(value="_, _ -> this", mutates="this") @NotNull public final @NotNull CommandHandler setupCommand(@NotNull @NotNull org.bukkit.plugin.Plugin plugin, @NotNull @NotNull String commandName) Sets up a plugin command by name.- Parameters:
plugin
- The plugin instance.commandName
- The command name.- Returns:
- The command handler instance.
- Since:
- 1.1.0
-
getUsage
@NotNull protected @NotNull String getUsage(@NotNull @NotNull org.bukkit.command.CommandSender sender, @NotNull @NotNull org.bukkit.command.Command command) Gets the command usage hint.- Parameters:
sender
- The command's sender.command
- The command to default to if the usage is not set on the handler.- Returns:
- The command usage hint.
- Since:
- 1.1.0
-
getPlugin
@NotNull public @NotNull org.bukkit.plugin.Plugin getPlugin()Gets the plugin instance.- Returns:
- The plugin instance.
- Since:
- 1.2.0
-
setUsage
@NotNull @Contract(value="_ -> this", mutates="this") public final @NotNull CommandHandler setUsage(@Nullable @Nullable String usage) Sets the command usage hint.- Parameters:
usage
- The new usage hint.- Returns:
- Self.
- Since:
- 1.1.0
-