Interface ICommandRegistration
Represents a registered command.
Namespace: OpenMod.API.Commands
Assembly: OpenMod.API.dll
Syntax
public interface ICommandRegistration
Properties
| Improve this Doc View SourceAliases
Gets the aliases of the command, which are often shorter versions of the primary name.
Declaration
IReadOnlyCollection<string>? Aliases { get; }
Property Value
Type | Description |
---|---|
System.Nullable<IReadOnlyCollection<System.String>> |
Examples
If the aliases are "h" and "he", the command can be executed using "/h" or "/he".
| Improve this Doc View SourceComponent
Gets the owner component of the command.
Declaration
IOpenModComponent Component { get; }
Property Value
Type | Description |
---|---|
IOpenModComponent |
Description
Gets the description of the command.
Declaration
string? Description { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.String> |
Id
Gets the unique ID of the command.
Declaration
string Id { get; }
Property Value
Type | Description |
---|---|
System.String |
IsEnabled
True if the command is enabled; otherwise, false.
Declaration
bool IsEnabled { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Name
Gets the primary name of the command, which will be used to execute it.
The primary name overrides any Aliases of other commands by default.
Declaration
string Name { get; }
Property Value
Type | Description |
---|---|
System.String |
Examples
If the name is "heal", the command will be usually be called using "/heal" (or just "heal" in console)
| Improve this Doc View SourceParentId
Gets the ID of the parent command. Returns if the command does not have a parent command.
Declaration
string? ParentId { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.String> |
PermissionRegistrations
The permission registrations for this command.
Declaration
IReadOnlyCollection<IPermissionRegistration>? PermissionRegistrations { get; }
Property Value
Type | Description |
---|---|
System.Nullable<IReadOnlyCollection<IPermissionRegistration>> |
Priority
Gets the priority for this command. Used in case of conflicting commands for determining which command to execute. The command with higher priority will be preferred.
Declaration
Priority Priority { get; }
Property Value
Type | Description |
---|---|
Priority |
Syntax
Gets the command syntax will be shown to the actor when the command was not used correctly.
An output for the above example could be "/heal [player] <amount>".
The syntax should not contain Child Command usage.
Declaration
string? Syntax { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.String> |
Remarks
[...] means optional argument and <...> means required argument, so in this case "player" is an optional argument while "amount" is a required one.
Examples
"[player] <amount>"
Methods
| Improve this Doc View SourceInstantiate(IServiceProvider)
Instantiates a new command instance for execution.
Declaration
ICommand Instantiate(IServiceProvider serviceProvider)
Parameters
Type | Name | Description |
---|---|---|
IServiceProvider | serviceProvider | The service provider of the command scope. |
Returns
Type | Description |
---|---|
ICommand |
SupportsActor(ICommandActor)
Checks if the given actor can use this command.
Declaration
bool SupportsActor(ICommandActor actor)
Parameters
Type | Name | Description |
---|---|---|
ICommandActor | actor | The actor to check. |
Returns
Type | Description |
---|---|
System.Boolean |