SwiftlyS2

Interface ICommandService

Interface ICommandService

Namespace: SwiftlyS2.Shared.Commands

Assembly: SwiftlyS2.CS2.dll

public interface ICommandService

Methods

GetAllCommands()

Gets all registered commands by plugins.

List<string> GetAllCommands()
Returns

GetAllCommandsByPlugin()

Gets all plugins that have registered commands.

Dictionary<string, List<CommandInfo>> GetAllCommandsByPlugin()
Returns

GetAllCommandsInfo()

Gets all commands info for the commands registered by plugins.

List<CommandInfo> GetAllCommandsInfo()
Returns

GetCommandsByPlugin(string)

Gets all commands registered by a specific plugin.

List<CommandInfo> GetCommandsByPlugin(string pluginName)
Parameters
  • pluginName string — The name of the plugin.
Returns

HookClientChat(ClientChatHandler)

Hooks client chat, will be fired when a player sends any chat message.

Guid HookClientChat(ICommandService.ClientChatHandler handler)
Parameters
Returns

HookClientCommand(ClientCommandHandler)

Hooks client commands, will be fired when a player sends any command.

Guid HookClientCommand(ICommandService.ClientCommandHandler handler)
Parameters
Returns

IsCommandRegistered(string)

Checks if a command is registered.

bool IsCommandRegistered(string commandName)
Parameters
  • commandName string — The command name.
Returns
  • bool — Whether the command is registered.

RegisterCommand(string, CommandListener, bool, string)

Registers a command (backward compatibility overload).

Guid RegisterCommand(string commandName, ICommandService.CommandListener handler, bool registerRaw, string permission)
Parameters
  • commandName string — The command name.
  • handler ICommandService.CommandListener — The handler callback for the command.
  • registerRaw bool — If set to true, the command will not starts with a sw_ prefix.
  • permission string — The permission required to use the command.
Returns
  • Guid — The guid of the command.

RegisterCommand(string, CommandListener, bool, string, string)

Registers a command.

Guid RegisterCommand(string commandName, ICommandService.CommandListener handler, bool registerRaw = false, string permission = "", string helpText = "SwiftlyS2 registered command")
Parameters
  • commandName string — The command name.
  • handler ICommandService.CommandListener — The handler callback for the command.
  • registerRaw bool — If set to true, the command will not starts with a sw_ prefix.
  • permission string — The permission required to use the command.
  • helpText string — The help text of the command.
Returns
  • Guid — The guid of the command.

RegisterCommandAlias(string, string, bool)

Registers a command alias.

void RegisterCommandAlias(string commandName, string alias, bool registerRaw = false)
Parameters
  • commandName string — The command name.
  • alias string — The alias.
  • registerRaw bool — If set to true, the alias will not starts with a sw_ prefix.

UnhookClientChat(Guid)

Unhooks a client chat.

void UnhookClientChat(Guid guid)
Parameters
  • guid Guid — The guid of the client chat.

UnhookClientCommand(Guid)

Unhooks a client command.

void UnhookClientCommand(Guid guid)
Parameters
  • guid Guid — The guid of the client command.

UnregisterCommand(Guid)

Unregisters a command.

void UnregisterCommand(Guid guid)
Parameters
  • guid Guid — The guid of the command.

UnregisterCommand(string)

Unregisters all command listeners with the specified command name.

void UnregisterCommand(string commandName)
Parameters
  • commandName string — The command name.

On this page