Interface IChatCommand
- Namespace
- Vintagestory.API.Common
- Assembly
- VintagestoryAPI.dll
public interface IChatCommand
- Extension Methods
Properties
AdditionalInformation
Get the detailed description of this command
string AdditionalInformation { get; }
Property Value
Aliases
Aliases for this command or subcommand
List<string> Aliases { get; }
Property Value
AllSubcommands
Dictionary<string, IChatCommand> AllSubcommands { get; }
Property Value
CallSyntax
Get a string showing how to call this command or subcommand
string CallSyntax { get; }
Property Value
CallSyntaxUnformatted
string CallSyntaxUnformatted { get; }
Property Value
CommandPrefix
Get the prefix of this command
string CommandPrefix { get; }
Property Value
Description
Get the description of this command
string Description { get; }
Property Value
Examples
Get the examples of this command
string[] Examples { get; }
Property Value
- string[]
FullName
Name of this command plus parent command names
string FullName { get; }
Property Value
Incomplete
True if either name or privilege has not been set
bool Incomplete { get; }
Property Value
this[string]
Retrieve subcommand
IChatCommand this[string name] { get; }
Parameters
name
string
Property Value
Name
Name of this command
string Name { get; }
Property Value
RootAliases
RootAliases for this command or subcommand
List<string> RootAliases { get; }
Property Value
Subcommands
IEnumerable<IChatCommand> Subcommands { get; }
Property Value
Methods
AddParameterSyntax(StringBuilder, string)
Add text listing the parameters
void AddParameterSyntax(StringBuilder sb, string indent)
Parameters
sb
StringBuilderindent
string
AddSyntaxExplanation(StringBuilder, string)
Add text explaining the form and interpretation of some of the more complex parameter types
void AddSyntaxExplanation(StringBuilder sb, string indent)
Parameters
sb
StringBuilderindent
string
BeginSubCommand(string)
Define/Modify a subcommnad. Returns a new subcommand instance.
IChatCommand BeginSubCommand(string name)
Parameters
name
string
Returns
BeginSubCommands(params string[])
Define/Modify multiple subcommands. Returns a new subcommand instance.
IChatCommand BeginSubCommands(params string[] name)
Parameters
name
string[]
Returns
EndSubCommand()
Leave current subcommand. Returns parent command instance.
IChatCommand EndSubCommand()
Returns
Execute(TextCommandCallingArgs, Action<TextCommandResult>)
Manually execute this command
void Execute(TextCommandCallingArgs callargs, Action<TextCommandResult> onCommandComplete = null)
Parameters
callargs
TextCommandCallingArgsonCommandComplete
Action<TextCommandResult>
GetCallSyntax(string, bool)
string GetCallSyntax(string alias, bool isRootAlias = false)
Parameters
Returns
GetCallSyntaxUnformatted(string, bool)
string GetCallSyntaxUnformatted(string alias, bool isRootAlias = false)
Parameters
Returns
GetFullName(string, bool)
string GetFullName(string alias, bool isRootAlias = false)
Parameters
Returns
GetFullSyntaxConsole(Caller)
string GetFullSyntaxConsole(Caller caller)
Parameters
caller
Caller
Returns
GetFullSyntaxHandbook(Caller, string, bool)
string GetFullSyntaxHandbook(Caller caller, string indent = "", bool isRootAlias = false)
Parameters
Returns
HandleWith(OnCommandDelegate)
Define method to be called when the command is executed
IChatCommand HandleWith(OnCommandDelegate handler)
Parameters
handler
OnCommandDelegate
Returns
IgnoreAdditionalArgs()
IChatCommand IgnoreAdditionalArgs()
Returns
IsAvailableTo(Caller)
Confirm whether the specified caller has the required privilege for this command
bool IsAvailableTo(Caller caller)
Parameters
caller
Caller
Returns
RequiresPlayer()
This command can only be run if the caller is a player
IChatCommand RequiresPlayer()
Returns
RequiresPrivilege(string)
Define the required privilege to run this command / subcommand
IChatCommand RequiresPrivilege(string privilege)
Parameters
privilege
string
Returns
Validate()
Optional validation step that ensures that all the command and all its subcommands has a name, handler, privilege and description defined
void Validate()
WithAdditionalInformation(string)
Set additional detailed command description, for command-specific help
IChatCommand WithAdditionalInformation(string detail)
Parameters
detail
string
Returns
WithAlias(params string[])
Registers alternative names for this command
IChatCommand WithAlias(params string[] name)
Parameters
name
string[]
Returns
WithArgs(params ICommandArgumentParser[])
Define command arguments, you'd usually want to use one of the parsers supplied from from capi.ChatCommands.Parsers
IChatCommand WithArgs(params ICommandArgumentParser[] args)
Parameters
args
ICommandArgumentParser[]
Returns
WithDescription(string)
Set command description
IChatCommand WithDescription(string description)
Parameters
description
string
Returns
WithExamples(params string[])
Define one ore more examples on how this command can be executed
IChatCommand WithExamples(params string[] examaples)
Parameters
examaples
string[]
Returns
WithName(string)
Sets the command name
IChatCommand WithName(string name)
Parameters
name
string
Returns
WithPreCondition(CommandPreconditionDelegate)
If return value is error, command cannot be executed
IChatCommand WithPreCondition(CommandPreconditionDelegate p)
Parameters
Returns
WithRootAlias(string)
Registers an alternative name for this command, always at the root level, i.e. /name
IChatCommand WithRootAlias(string name)
Parameters
name
string