public class CommandCore extends Object
CommandCore| Modifier and Type | Method and Description |
|---|---|
static @NotNull CommandContext |
createContext(CommandSource source,
Command command,
String label,
Arguments arguments)
Creates a new
CommandContext |
static @NotNull CommandSource |
createSource(org.bukkit.command.CommandSender sender)
Creates a new
CommandSource |
CommandManager |
getCommandManager()
Gets the command manager
|
static CommandCore |
getInstance()
Gets this instance of
CommandCore |
InitOptions |
getOptions()
Gets the options used to initialize
CommandCore |
@NotNull List<String> |
getUsagesFor(String commandName,
int spaces)
Generates a formatted string for each usage of a command
|
static @NotNull CommandCore |
init(org.bukkit.plugin.java.JavaPlugin plugin,
InitOptions options)
Initializes CommandCore so that it can be accessed using
getInstance() |
static @NotNull CommandCore |
init(org.bukkit.plugin.java.JavaPlugin plugin,
String rootCommand)
Initializes CommandCore so that it can be accessed using
getInstance() |
void |
sendCommandHelp(@NotNull org.bukkit.command.CommandSender sender,
@NotNull String commandName)
Sends command usage to
sender |
void |
sendHelpMenu(@NotNull org.bukkit.command.CommandSender sender)
Sends the help menu to
sender |
public CommandManager getCommandManager()
public InitOptions getOptions()
CommandCoreCommandCorepublic void sendCommandHelp(@NotNull
@NotNull org.bukkit.command.CommandSender sender,
@NotNull
@NotNull String commandName)
sendersender - The sendercommandName - The name of the commandIllegalArgumentException - If commandName is not the name of a commandpublic void sendHelpMenu(@NotNull
@NotNull org.bukkit.command.CommandSender sender)
sendersender - The sender@NotNull public @NotNull List<String> getUsagesFor(String commandName, int spaces)
commandName - The name of the commandspaces - The # of spaces to add before each usage stringIllegalArgumentException - If commandName is not the name of a commandpublic static CommandCore getInstance()
CommandCoreIllegalStateException - If CommandCore hasn't been initialized yet with init@NotNull public static @NotNull CommandCore init(org.bukkit.plugin.java.JavaPlugin plugin, String rootCommand)
getInstance()plugin - Your plugin instancerootCommand - The name of your root commandIllegalStateException - If it has already been initialized@NotNull public static @NotNull CommandCore init(org.bukkit.plugin.java.JavaPlugin plugin, InitOptions options)
getInstance()plugin - Your plugin instanceoptions - The initialization optionsIllegalStateException - If it has already been initialized@Contract(value="_, _, _, _ -> new",
pure=true)
@NotNull
public static @NotNull CommandContext createContext(CommandSource source,
Command command,
String label,
Arguments arguments)
CommandContextsource - The sender that executed the commandcommand - The command being executedlabel - The exact string used to execute the command. This can either be the name of the command or one of its aliasesarguments - The command argumentsCommandContext@Contract(value="_ -> new",
pure=true)
@NotNull
public static @NotNull CommandSource createSource(org.bukkit.command.CommandSender sender)
CommandSourcesender - The source of the commandCommandSourceCopyright © 2024. All rights reserved.