Class AirshipServerManagerService

Allows access to and modification of the game server list.

Properties

onShutdown: Signal<void> = ...

Fired when the server begins shutting down.

You can yield for up to 30 minutes to perform shutdown logic. You can also yield to ensure an in-progress match is completed.

Methods

  • Adds a userId to the allowed player list. You can get the current allowed players list with AirshipServerManager.GetAllowedPlayers.

    Parameters

    • userId: string

      The userId of the player.

    Returns Promise<boolean>

    True if the userId was added, false otherwise.

  • Adds a tag to server.

    Parameters

    • tag: string

      The tag to add.

    Returns Promise<boolean>

    True if the tag was added, false otherwise.

  • When set to true (default), players will be allowed to connect to the server. When set to false, no players will be allowed to join the server, no matter how they are transferred. All transfers to this server will no longer succeed.

    AllowNewConnections is automatically set to false when a server shutdown is triggered, but you can override that behavior by setting it back to true when the onShutdown signal is fired. This may be useful in cases where you wish to delay the server shutdown for an extended period and want players to be able to rejoin the server during that time.

    Parameters

    • allowed: boolean

      If new connections should be allowed

    Returns Promise<boolean>

    true if the setting was updated, false otherwise

  • Creates a new server and returns a server id which can be used to transfer players to the new server.

    Parameters

    • Optional config: AirshipServerConfig

      The configuration the server should start with. If not provided, the server will use the defaults provided during deployment.

    Returns Promise<PublicServerData>

    The id of the new server. Undefined if the server was not able to be created.

  • Unlists the server if it has been listed. No change is made if the server is not listed.

    Returns Promise<boolean>

  • Gets the user IDs of players that are allowed on this server. An empty array indicates that all players are allowed.

    Returns Promise<readonly string[]>

    The userIds of all players allowed to join this server.

  • Get the region the current server is running in.

    Returns string

    The regionId of the region the server is currently running in.

  • Retrieves the game config passed to this server in the AirshipServerManagerService.CreateServer function. If the configuration cannot be parsed or does not exist, returns undefined.

    Type Parameters

    • T

    Returns undefined | T

    The game configuration object or undefined.

  • Gets the available regionIds for game servers. Available regions may change periodically.

    Returns Promise<string[]>

  • Gets data about a given server ID.

    Parameters

    • serverId: string

      The server ID to retrieve

    Returns Promise<undefined | PublicServerData>

    The server data if it exists. Returns undefined if the server could not be found.

  • Gets a page of the server list.

    Parameters

    • page: number = 0

      The page to retrieve. Starts at 0.

    Returns Promise<{
        entries: PublicServerData[];
    }>

  • Gets data about the given server IDs.

    Parameters

    • serverIds: string[]

      An array of server IDs to retrieve

    Returns Promise<{
        [serverId: string]: AirshipServer | undefined;
    }>

    A map of server ID to server data. If the server could not be found, it will not be included in the map.

  • Gets the tags on this server.

    Returns Promise<readonly string[]>

    The tags on this server.

  • Checks if the provided userId is allowed on the server.

    Parameters

    • userId: string

      The userId of the player.

    Returns Promise<boolean>

    True if allowed, false otherwise.

  • Checks if the provided tag exists on the server.

    Parameters

    • tag: string

      The tag to check for.

    Returns Promise<boolean>

    True if the tag exists, false otherwise.

  • Lists the current server on the games server list. You can optionally specify a name and description to be passed through to the server list.

    Parameters

    • Optional config: {
          description?: string;
          name?: string;
      }

      The list configuration to use. Name and description will be passed to the server list data.

      • Optional description?: string
      • Optional name?: string

    Returns Promise<boolean>

    True if the server was successfully listed.

  • Removes a userId from the allowed player list. If the allowed players list is empty, all players will be allowed to join. You can get the current allowed players list with AirshipServerManager.GetAllowedPlayers.

    Parameters

    • userId: string

      The userId of the player

    Returns Promise<boolean>

    True if the userId was removed, false otherwise.

  • Removes a tag from the server.

    Parameters

    • tag: string

      The tag to remove.

    Returns Promise<boolean>

    True if the tag was removed, false otherwise.

  • Updates the access mode of the server.

    Parameters

    • mode: AccessMode

    Returns Promise<boolean>

  • Shuts down the current server. All players will be transferred off of the server before shutting down.

    Returns void