SwiftlyS2

Interface ICommandService

Interface ICommandService

Namespace: SwiftlyS2.Shared.Commands

Assembly: SwiftlyS2.CS2.dll

public interface ICommandService

Methods

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.

Guid RegisterCommand(string commandName, ICommandService.CommandListener handler, bool registerRaw = false, string permission = "")
Parameters
  • commandName string — The command name.
  • handler ICommandService.CommandListener — The handler callback for the command.
  • registerRaw bool — If set to false, 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.

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 false, 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