public class CommandStore
The console mod's internal command storage. You can retrieve detailed information on the loaded commands using this class.
Modifier and Type | Class and Description |
---|---|
static class |
CommandStore.StoredCommand
Contains detailed information on a loaded command.
|
Modifier and Type | Method and Description |
---|---|
static java.util.Map<java.lang.String,java.lang.String> |
getAliases()
Returns all aliases currently registered by the mod.
|
static java.util.List<java.lang.String> |
getApplicableCommands(BaseCommand.CommandContext context)
Returns all commands applicable in the given
. A command will only be excluded if it contains an opposing tag and does not contain the matching one (ex: for CommandContext#CAMPAIGN_MAP , commands will only be excluded if they contain the tag "combat" or "market" but not the tag "campaign". |
static java.util.List<java.lang.String> |
getCommandsWithTag(java.lang.String tag)
Returns all commands with a specific tag.
|
static java.util.List<java.lang.String> |
getKnownTags()
Returns all command tags that the mod is currently aware of.
|
static java.util.List<org.lazywizard.console.CommandListener> |
getListeners()
Returns all
s that are registered with the console. |
static java.util.List<java.lang.String> |
getLoadedCommands()
Returns all commands currently loaded by the mod.
|
static void |
registerAlias(java.lang.String alias,
java.lang.String command)
Registers an alias to be used as shorthand for long or multiple commands..
|
static void |
reloadCommands()
Forces the console to clear its stored commands and reload them from the CSV. If a command fails to load it will not throw an
Exception . Instead it will display an error message to the player and continue to load the rest of the commands normally. |
static CommandStore.StoredCommand |
retrieveCommand(java.lang.String command)
Retrieves the raw data for a specific command.
|
public static void reloadCommands()
Forces the console to clear its stored commands and reload them from the CSV. If a command fails to load it will not throw an Exception
. Instead it will display an error message to the player and continue to load the rest of the commands normally.
IOException
- if the CSV file at CommonStrings#PATH_CSV
does not exist or can't be opened.JSONException
- if the CSV is malformed or missing columns.public static java.util.List<java.lang.String> getLoadedCommands()
Returns all commands currently loaded by the mod.
List
containing the names of all loaded commands.public static java.util.List<java.lang.String> getApplicableCommands(BaseCommand.CommandContext context)
Returns all commands applicable in the given
. A command will only be excluded if it contains an opposing tag and does not contain the matching one (ex: for enum BaseCommand.CommandContext
CommandContext#CAMPAIGN_MAP
, commands will only be excluded if they contain the tag "combat" or "market" but not the tag "campaign".
Commands with the tag "console" are assumed to be system-level, and will run anywhere.
List
containing the names of all loaded commands that are applicable to the given context.enum BaseCommand.CommandContext
public static java.util.Map<java.lang.String,java.lang.String> getAliases()
Returns all aliases currently registered by the mod.
Map
containing all registered aliases as keys, with the commands they expand to as values.public static void registerAlias(java.lang.String alias, java.lang.String command)
Registers an alias to be used as shorthand for long or multiple commands..
alias
- org.jetbrains.dokka.NodeRenderContent@7d937e17: The alias to register.command
- org.jetbrains.dokka.NodeRenderContent@754df6f5: The command that will be run in place of alias
. This can include separators to run multiple commands. If null
is passed in, removes any existing alias instead.IOException
JSONException
public static java.util.List<java.lang.String> getKnownTags()
Returns all command tags that the mod is currently aware of.
List
containing all tags used by the currently loaded commands.public static java.util.List<java.lang.String> getCommandsWithTag(java.lang.String tag)
Returns all commands with a specific tag.
tag
- org.jetbrains.dokka.NodeRenderContent@401163b3: The tag to search for.List
containing the names of all loaded commands that use the tag tag
.public static java.util.List<org.lazywizard.console.CommandListener> getListeners()
Returns all
s that are registered with the console.interface CommandListener
interface CommandListener
s.interface CommandListener
public static CommandStore.StoredCommand retrieveCommand(java.lang.String command)
Retrieves the raw data for a specific command.
command
- org.jetbrains.dokka.NodeRenderContent@13105a8: The name of the command to retrieve.class CommandStore.StoredCommand
containing all of the data the console needs to use this command, such as its name, class, syntax, helpfile, and what mod registered it.