public abstract class CommandManager<I,FT,F extends MessageFormatter<FT>> extends Object
| Modifier and Type | Field and Description |
|---|---|
protected ExceptionHandler |
defaultExceptionHandler |
protected F |
defaultFormatter |
protected Map<MessageType,F> |
formatters |
protected CommandReplacements |
replacements |
protected Map<String,co.aikar.commands.RootCommand> |
rootCommands |
protected Set<Locale> |
supportedLanguages |
| Constructor and Description |
|---|
CommandManager() |
| Modifier and Type | Method and Description |
|---|---|
void |
addSupportedLanguage(Locale locale)
Adds a new locale to the list of automatic Locales to load Message Bundles for.
|
abstract <R extends CommandExecutionContext> |
createCommandContext(RegisteredCommand command,
Parameter parameter,
CommandIssuer sender,
List<String> args,
int i,
Map<String,Object> passedArgs) |
CommandOperationContext |
createCommandOperationContext(BaseCommand command,
CommandIssuer issuer,
String commandLabel,
String[] args) |
abstract CommandCompletionContext |
createCompletionContext(RegisteredCommand command,
CommandIssuer sender,
String input,
String config,
String[] args) |
RegisteredCommand |
createRegisteredCommand(BaseCommand command,
String cmdName,
Method method,
String prefSubCommand) |
abstract co.aikar.commands.RootCommand |
createRootCommand(String cmd) |
void |
enableUnstableAPI(String api)
Deprecated.
Use this with caution! If you enable and use Unstable API's, your next compile using ACF
may require you to update your implementation to those unstable API's
|
String |
formatMessage(CommandIssuer issuer,
MessageType type,
co.aikar.locales.MessageKeyProvider key,
String... replacements) |
CommandHelp |
generateCommandHelp()
Deprecated.
Unstable API
|
CommandHelp |
generateCommandHelp(CommandIssuer issuer,
co.aikar.commands.RootCommand rootCommand)
Deprecated.
Unstable API
|
CommandHelp |
generateCommandHelp(CommandIssuer issuer,
@NotNull String command)
Deprecated.
Unstable API
|
CommandHelp |
generateCommandHelp(@NotNull String command)
Deprecated.
Unstable API
|
abstract CommandCompletions<?> |
getCommandCompletions()
Gets the command completions manager
|
abstract CommandContexts<?> |
getCommandContexts()
Gets the command contexts manager
|
abstract CommandIssuer |
getCommandIssuer(Object issuer) |
CommandReplacements |
getCommandReplacements()
Lets you add custom string replacements that can be applied to annotation values,
to reduce duplication/repetition of common values such as permission nodes and command prefixes.
|
static CommandIssuer |
getCurrentCommandIssuer() |
static CommandManager |
getCurrentCommandManager() |
static CommandOperationContext |
getCurrentCommandOperationContext() |
ExceptionHandler |
getDefaultExceptionHandler()
Gets the current default exception handler, might be null.
|
F |
getDefaultFormatter() |
F |
getFormat(MessageType type) |
Locale |
getIssuerLocale(CommandIssuer issuer) |
abstract Locales |
getLocales()
Returns a Locales Manager to add and modify language tables for your commands.
|
Set<Locale> |
getSupportedLanguages()
Gets a list of all currently supported languages for this manager.
|
protected boolean |
handleUncaughtException(BaseCommand scope,
RegisteredCommand registeredCommand,
CommandIssuer sender,
List<String> args,
Throwable t) |
boolean |
hasPermission(CommandIssuer issuer,
String permission) |
abstract boolean |
hasRegisteredCommands() |
abstract boolean |
isCommandIssuer(Class<?> type) |
void |
log(co.aikar.commands.LogLevel level,
String message) |
abstract void |
log(co.aikar.commands.LogLevel level,
String message,
Throwable throwable) |
co.aikar.commands.RootCommand |
obtainRootCommand(String cmd) |
abstract void |
registerCommand(BaseCommand command)
Registers a command with ACF
|
void |
sendMessage(CommandIssuer issuer,
MessageType type,
co.aikar.locales.MessageKeyProvider key,
String... replacements) |
void |
sendMessage(I issuerArg,
MessageType type,
co.aikar.locales.MessageKeyProvider key,
String... replacements) |
void |
setDefaultExceptionHandler(ExceptionHandler exceptionHandler)
Sets the default
ExceptionHandler that is called when an exception occurs while executing a command, if the command doesn't have it's own exception handler registered. |
void |
setDefaultFormatter(F defaultFormatter) |
F |
setFormat(MessageType type,
F formatter) |
void |
setFormat(MessageType type,
FT... colors) |
void |
setFormat(MessageType type,
int i,
FT color) |
protected Map<String,co.aikar.commands.RootCommand> rootCommands
protected CommandReplacements replacements
protected ExceptionHandler defaultExceptionHandler
protected Set<Locale> supportedLanguages
protected Map<MessageType,F extends MessageFormatter<FT>> formatters
protected F extends MessageFormatter<FT> defaultFormatter
public CommandManager()
public static CommandOperationContext getCurrentCommandOperationContext()
public static CommandIssuer getCurrentCommandIssuer()
public static CommandManager getCurrentCommandManager()
public F setFormat(MessageType type, F formatter)
public F getFormat(MessageType type)
public void setFormat(MessageType type, FT... colors)
public void setFormat(MessageType type, int i, FT color)
public F getDefaultFormatter()
public void setDefaultFormatter(F defaultFormatter)
public abstract CommandContexts<?> getCommandContexts()
public abstract CommandCompletions<?> getCommandCompletions()
@Deprecated public CommandHelp generateCommandHelp(@NotNull @NotNull String command)
@Deprecated public CommandHelp generateCommandHelp(CommandIssuer issuer, @NotNull @NotNull String command)
@Deprecated public CommandHelp generateCommandHelp()
@Deprecated public CommandHelp generateCommandHelp(CommandIssuer issuer, co.aikar.commands.RootCommand rootCommand)
public abstract void registerCommand(BaseCommand command)
command - The command to registerpublic abstract boolean hasRegisteredCommands()
public abstract boolean isCommandIssuer(Class<?> type)
public abstract CommandIssuer getCommandIssuer(Object issuer)
public abstract co.aikar.commands.RootCommand createRootCommand(String cmd)
public abstract Locales getLocales()
public abstract <R extends CommandExecutionContext> R createCommandContext(RegisteredCommand command, Parameter parameter, CommandIssuer sender, List<String> args, int i, Map<String,Object> passedArgs)
public abstract CommandCompletionContext createCompletionContext(RegisteredCommand command, CommandIssuer sender, String input, String config, String[] args)
public CommandReplacements getCommandReplacements()
public boolean hasPermission(CommandIssuer issuer, String permission)
public co.aikar.commands.RootCommand obtainRootCommand(String cmd)
public RegisteredCommand createRegisteredCommand(BaseCommand command, String cmdName, Method method, String prefSubCommand)
public void setDefaultExceptionHandler(ExceptionHandler exceptionHandler)
ExceptionHandler that is called when an exception occurs while executing a command, if the command doesn't have it's own exception handler registered.exceptionHandler - the handler that should handle uncaught exceptionspublic ExceptionHandler getDefaultExceptionHandler()
protected boolean handleUncaughtException(BaseCommand scope, RegisteredCommand registeredCommand, CommandIssuer sender, List<String> args, Throwable t)
public void sendMessage(I issuerArg, MessageType type, co.aikar.locales.MessageKeyProvider key, String... replacements)
public void sendMessage(CommandIssuer issuer, MessageType type, co.aikar.locales.MessageKeyProvider key, String... replacements)
public String formatMessage(CommandIssuer issuer, MessageType type, co.aikar.locales.MessageKeyProvider key, String... replacements)
public Locale getIssuerLocale(CommandIssuer issuer)
public CommandOperationContext createCommandOperationContext(BaseCommand command, CommandIssuer issuer, String commandLabel, String[] args)
public Set<Locale> getSupportedLanguages()
public void addSupportedLanguage(Locale locale)
locale - @Deprecated public void enableUnstableAPI(String api)
Copyright © 2017. All rights reserved.