Class CommandStore
-
- All Implemented Interfaces:
public class CommandStoreThe console mod's internal command storage. You can retrieve detailed information on the loaded commands using this class.
- Since:
2.0
LazyWizard
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classCommandStore.StoredCommandContains detailed information on a loaded command.
-
Method Summary
Modifier and Type Method Description static Map<String, String>getAliases()Returns all aliases currently registered by the mod. static voidreloadAll()Forces the console to clear its stored commands and reload them from the CSV. static voidreloadCommands()static voidreloadAliases()static voidreloadListeners()static List<String>getLoadedCommands()Returns all commands currently loaded by the mod. static List<String>getApplicableCommands(BaseCommand.CommandContext context)Returns all commands applicable in the given CommandContext. static voidregisterAlias(String alias, String command)Registers an alias to be used as shorthand for long or multiple commands.. static List<String>getKnownTags()Returns all command tags that the mod is currently aware of. static List<String>getCommandsWithTag(String tag)Returns all commands with a specific tag. static List<CommandListener>getListeners()Returns all CommandListeners that are registered with the console. static CommandStore.StoredCommandretrieveCommand(String command)Retrieves the internal data for a specific command. -
-
Method Detail
-
getAliases
static Map<String, String> getAliases()
Returns all aliases currently registered by the mod.
- Returns:
A Map containing all registered aliases as keys, with the commands they expand to as values.
- Since:
2.4
-
reloadAll
static void reloadAll()
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.
- Since:
2.0
-
reloadCommands
static void reloadCommands()
-
reloadAliases
static void reloadAliases()
-
reloadListeners
static void reloadListeners()
-
getLoadedCommands
static List<String> getLoadedCommands()
Returns all commands currently loaded by the mod.
- Returns:
A List containing the names of all loaded commands.
- Since:
2.0
-
getApplicableCommands
static List<String> getApplicableCommands(BaseCommand.CommandContext context)
Returns all commands applicable in the given CommandContext. A command will only be excluded if it contains an opposing tag and does not contain the matching one (ex: for 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.
- Returns:
A List containing the names of all loaded commands that are applicable to the given context.
- Since:
3.0
-
registerAlias
static void registerAlias(String alias, String command)
Registers an alias to be used as shorthand for long or multiple commands..
- Parameters:
alias- The alias to register.command- The command that will be run in place ofalias.- Since:
3.0
-
getKnownTags
static List<String> getKnownTags()
Returns all command tags that the mod is currently aware of.
- Returns:
A List containing all tags used by the currently loaded commands.
- Since:
2.0
-
getCommandsWithTag
static List<String> getCommandsWithTag(String tag)
Returns all commands with a specific tag.
- Parameters:
tag- The tag to search for.- Returns:
A List containing the names of all loaded commands that use the tag
tag.- Since:
2.0
-
getListeners
static List<CommandListener> getListeners()
Returns all CommandListeners that are registered with the console.
- Returns:
All registered CommandListeners.
- Since:
3.0
-
retrieveCommand
static CommandStore.StoredCommand retrieveCommand(String command)
Retrieves the internal data for a specific command.
- Parameters:
command- The name of the command to retrieve.- Returns:
The StoredCommand containing all the information the console has registered for this command, such as its name, class, syntax, helpfile, and which mod is responsible for adding it.
- Since:
2.0
-
-
-
-