API Reference › Commands
ICommandService
InterfaceNamespace: SwiftlyS2.Shared.Commands · Assembly: SwiftlyS2.CS2.dll
public interface ICommandServiceMethods
Gets all registered commands by plugins.
List<string> GetAllCommands()Gets all plugins that have registered commands.
Dictionary<string, List<CommandInfo>> GetAllCommandsByPlugin()Returns
Dictionary mapping plugin names to their registered command information.
Gets all commands info for the commands registered by plugins.
List<CommandInfo> GetAllCommandsInfo()Gets all commands registered by a specific plugin.
List<CommandInfo> GetCommandsByPlugin(string pluginName)Parameters
- pluginNamestringThe name of the plugin.
Hooks client chat, will be fired when a player sends any chat message.
Guid HookClientChat(ICommandService.ClientChatHandler handler)Parameters
- handlerICommandService.ClientChatHandlerThe handler callback for the client chat.
Returns
Hooks client commands, will be fired when a player sends any command.
Guid HookClientCommand(ICommandService.ClientCommandHandler handler)Parameters
- handlerICommandService.ClientCommandHandlerThe handler callback for the client command.
Returns
Checks if a command is registered.
bool IsCommandRegistered(string commandName)Parameters
- commandNamestringThe command name.
Registers a command (backward compatibility overload).
Guid RegisterCommand(string commandName, ICommandService.CommandListener handler, bool registerRaw, string permission)Parameters
- commandNamestringThe command name.
- handlerICommandService.CommandListenerThe handler callback for the command.
- registerRawboolIf set to true, the command will not starts with a `sw_` prefix.
- permissionstringThe permission required to use the command.
Registers a command.
Guid RegisterCommand(string commandName, ICommandService.CommandListener handler, bool registerRaw = false, string permission = "", string helpText = "SwiftlyS2 registered command")Parameters
- commandNamestringThe command name.
- handlerICommandService.CommandListenerThe handler callback for the command.
- registerRawbooloptionalIf set to true, the command will not starts with a `sw_` prefix.
- permissionstringoptionalThe permission required to use the command.
- helpTextstringoptionalThe help text of the command.
Registers a command alias.
void RegisterCommandAlias(string commandName, string alias, bool registerRaw = false)Unhooks a client chat.
void UnhookClientChat(Guid guid)Parameters
- guidGuidThe guid of the client chat.
Unhooks a client command.
void UnhookClientCommand(Guid guid)Parameters
- guidGuidThe guid of the client command.
Unregisters all command listeners with the specified command name.
void UnregisterCommand(string commandName)Parameters
- commandNamestringThe command name.