public abstract class ViaCommandHandler extends Object implements ViaVersionCommand
| Constructor and Description |
|---|
ViaCommandHandler() |
| Modifier and Type | Method and Description |
|---|---|
static String |
color(String string)
Replaces colour codes in a string
|
ViaSubCommand |
getSubCommand(String name)
Get subcommand instance by name
|
boolean |
hasSubCommand(String name)
Check if a subcommand is registered.
|
boolean |
onCommand(ViaCommandSender sender,
String[] args)
Executed when the Command sender executes the commands
|
List<String> |
onTabComplete(ViaCommandSender sender,
String[] args)
Executed when the Command sender tab-completes
|
void |
registerSubCommand(ViaSubCommand command)
Register your own subcommand inside ViaVersion
|
static void |
sendMessage(ViaCommandSender sender,
String message,
Object... args)
Send a colour coded string with replacements to a user
|
void |
showHelp(ViaCommandSender sender)
Shows the ViaVersion help to a sender
|
public void registerSubCommand(ViaSubCommand command) throws Exception
ViaVersionCommandregisterSubCommand in interface ViaVersionCommandcommand - Your own SubCommand instance to handle it.Exception - throws an exception when the subcommand already exists or if it's not valid, example: spaceepublic boolean hasSubCommand(String name)
ViaVersionCommandhasSubCommand in interface ViaVersionCommandname - Subcommand namepublic ViaSubCommand getSubCommand(String name)
ViaVersionCommandgetSubCommand in interface ViaVersionCommandname - subcommand namepublic boolean onCommand(ViaCommandSender sender, String[] args)
ViaVersionCommandonCommand in interface ViaVersionCommandsender - Sender objectargs - arguments providedpublic List<String> onTabComplete(ViaCommandSender sender, String[] args)
ViaVersionCommandonTabComplete in interface ViaVersionCommandsender - Sender objectargs - arguments providedpublic void showHelp(ViaCommandSender sender)
sender - The sender to send the help topublic static String color(String string)
string - String to replacepublic static void sendMessage(ViaCommandSender sender, String message, Object... args)
sender - The target to send the message tomessage - The messageargs - The objects to replaceCopyright © 2016–2021. All rights reserved.