Class PlayersManager

    Manages tracking and updating all players in the room session.

    Hierarchy

    Accessors

    Methods

    Accessors

    • get teams(): Player[][]
    • Returns a 2D array of player metadata ranked by team number, then slot number.

      Returns Player[][]

      Take care when accessing data for 0th slot on a team (such as when iterating over all team members), as slot 0 does not technically exist in the server's multi-data, and is only relevant in-case a server sends cheated items.

      for (const team of client.players.teams) {
      for (const player of team) {
      console.log(player.alias);
      }
      }

    Methods

    • Attempt to find a player by their team or slot name.

      Parameters

      • slot: number

        The slot id associated with the searched player.

      • Optionalteam: number

        The team id associated with the searched player. If omitted, defaults to the team of the client player.

      Returns undefined | Player

      The player's metadata or undefined if not found.

    • Returns a promise that waits for a single specified event to be received. Resolves with the list of arguments dispatched with the event.

      Type Parameters

      • Event extends "aliasUpdated"

      Parameters

      • event: Event

        The event name to listen for.

      • clearPredicate: ((...args: PlayerEvents[Event]) => boolean) = ...

        An optional predicate to check on incoming events to validate if the correct event has been received. If omitted, will return immediately on next event type received.

      Returns Promise<PlayerEvents[Event]>