SwiftlyS2

Interface IGameEventService

Interface IGameEventService

Namespace: SwiftlyS2.Shared.GameEvents

Assembly: SwiftlyS2.CS2.dll

Plugin-scoped service for managing game events.

public interface IGameEventService

Methods

Fire<T>()

Fires an event to all players.

Thread unsafe, use async variant instead for non-main thread context.

[ThreadUnsafe]
void Fire<T>() where T : IGameEvent<T>
Type Parameters
  • T — The event type.

Fire<T>(Action<T>)

Fires an event to all players with a configured event.

Thread unsafe, use async variant instead for non-main thread context.

  • configureEvent: The action to configure the event.
[ThreadUnsafe]
void Fire<T>(Action<T> configureEvent) where T : IGameEvent<T>
Parameters
Type Parameters
  • T — The event type.

FireAsync<T>()

Fires an event to all players asynchronously.

Task FireAsync<T>() where T : IGameEvent<T>
Returns
Type Parameters
  • T — The event type.

FireAsync<T>(Action<T>)

Fires an event to all players with a configured event asynchronously.

Task FireAsync<T>(Action<T> configureEvent) where T : IGameEvent<T>
Parameters
Returns
Type Parameters
  • T — The event type.

FireToPlayer<T>(int)

Fires an event to a player.

Thread unsafe, use async variant instead for non-main thread context.

[ThreadUnsafe]
void FireToPlayer<T>(int slot) where T : IGameEvent<T>
Parameters
  • slot int — The player slot.
Type Parameters
  • T — The event type.

FireToPlayer<T>(int, Action<T>)

Fires an event to a player with a configured event.

Thread unsafe, use async variant instead for non-main thread context.

[ThreadUnsafe]
void FireToPlayer<T>(int slot, Action<T> configureEvent) where T : IGameEvent<T>
Parameters
  • slot int — The player slot.
  • configureEvent Action<T> — The action to configure the event.
Type Parameters
  • T — The event type.

FireToPlayerAsync<T>(int)

Fires an event to a player asynchronously.

Task FireToPlayerAsync<T>(int slot) where T : IGameEvent<T>
Parameters
  • slot int — The player slot.
Returns
Type Parameters
  • T — The event type.

FireToPlayerAsync<T>(int, Action<T>)

Fires an event to a player with a configured event asynchronously.

Task FireToPlayerAsync<T>(int slot, Action<T> configureEvent) where T : IGameEvent<T>
Parameters
  • slot int — The player slot.
  • configureEvent Action<T> — The action to configure the event.
Returns
Type Parameters
  • T — The event type.

FireToServer<T>()

Fires an event to the server.

Thread unsafe, use async variant instead for non-main thread context.

[ThreadUnsafe]
void FireToServer<T>() where T : IGameEvent<T>
Type Parameters
  • T

FireToServer<T>(Action<T>)

Fires an event to the server with a configured event.

Thread unsafe, use async variant instead for non-main thread context.

[ThreadUnsafe]
void FireToServer<T>(Action<T> configureEvent) where T : IGameEvent<T>
Parameters
  • configureEvent Action<T> — The action to configure the event.
Type Parameters
  • T — The event type.

FireToServerAsync<T>()

Fires an event to the server asynchronously.

Task FireToServerAsync<T>() where T : IGameEvent<T>
Returns
Type Parameters
  • T — The event type.

FireToServerAsync<T>(Action<T>)

Fires an event to the server with a configured event asynchronously.

Task FireToServerAsync<T>(Action<T> configureEvent) where T : IGameEvent<T>
Parameters
  • configureEvent Action<T> — The action to configure the event.
Returns
Type Parameters
  • T — The event type.

HookPost<T>(GameEventHandler<T>)

Hooks a post-event callback.

Guid HookPost<T>(IGameEventService.GameEventHandler<T> callback) where T : IGameEvent<T>
Parameters
Returns
  • Guid — A GUID representing the hook. You can use this to unhook the callback later.
Type Parameters
  • T — The event type.

HookPre<T>(GameEventHandler<T>)

Hooks a pre-event callback.

Guid HookPre<T>(IGameEventService.GameEventHandler<T> callback) where T : IGameEvent<T>
Parameters
Returns
  • Guid — A GUID representing the hook. You can use this to unhook the callback later.
Type Parameters
  • T — The event type.

Unhook(Guid)

Unhooks a callback.

void Unhook(Guid guid)
Parameters
  • guid Guid — The GUID of the hook to unhook.

UnhookPost<T>()

Unhooks all post-event callbacks.

void UnhookPost<T>() where T : IGameEvent<T>
Type Parameters
  • T — The event type.

UnhookPre<T>()

Unhooks all pre-event callbacks.

void UnhookPre<T>() where T : IGameEvent<T>
Type Parameters
  • T — The event type.

On this page