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
ViaVersionCommand
registerSubCommand
in interface ViaVersionCommand
command
- 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)
ViaVersionCommand
hasSubCommand
in interface ViaVersionCommand
name
- Subcommand namepublic ViaSubCommand getSubCommand(String name)
ViaVersionCommand
getSubCommand
in interface ViaVersionCommand
name
- subcommand namepublic boolean onCommand(ViaCommandSender sender, String[] args)
ViaVersionCommand
onCommand
in interface ViaVersionCommand
sender
- Sender objectargs
- arguments providedpublic List<String> onTabComplete(ViaCommandSender sender, String[] args)
ViaVersionCommand
onTabComplete
in interface ViaVersionCommand
sender
- 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.