@rbxts/fletchette
    Preparing search index...

    Class AbstractMapPropertyPacket<K, V>Abstract

    AbstractMapPropertyPacket provides a base class for map-based property packets, defining the essential methods for managing a map of key-value pairs that goes through diff-based updates. It extends AbstractPropertyPacket with a Map<K, V> type.

    Type Parameters

    • K
    • V

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    className: string

    Class name of the packet, used for debugging purposes.

    Methods

    • Clears the value of the property for players that pass the predicate. Should only be used on the server.

      Parameters

      • predicate: (player: Player) => boolean

        The predicate to filter players

      Returns void

    • Removes an entry from the map if present.

      Parameters

      • key: K

        The key of the entry to remove.

      Returns boolean

      True if the entry was present and removed, false otherwise.

    • Retrieves the entire map. If a player is provided, retrieves the map specific to that player if it exists.

      Parameters

      • Optionalplayer: Player

        The player for whom to retrieve the map, or undefined for the global map.

      Returns Map<K, V>

    • Returns the value of the property for a specific player. Should only be used on the server.

      Parameters

      • player: Player

        The player to get the value for

      Returns Map<K, V>

      The value of the property for the player

      Use get instead.

    • Observes the property for changes. Unlike changed, this will fire the handler immediately if the value is already set. Else, it will wait for the value to be set and then fire the handler.

      Parameters

      • handler: (value: Map) => void

        The handler to call when the property changes

      Returns Connection

      A connection that can be disconnected to stop observing the property

    • Sets multiple entries in the map, keeping existing entries intact.

      Parameters

      • entries: Map<K, V>

        The entries to set in the map.

      Returns void

    • Sets a single entry in the map, keeping existing entries intact.

      Parameters

      • key: K

        The key of the entry to set.

      • value: V

        The value to set for the specified key.

      Returns void

    • Sets the value of the property for players that pass the predicate. Should only be used on the server.

      Parameters

      • predicate: (player: Player) => boolean

        The predicate to filter players

      • value: Map

        The new value of the property

      Returns void

    • Sets the value of the property for a list of players. Should only be used on the server.

      Parameters

      • players: Player[]

        The list of players to set the value for

      • value: Map

        The new value of the property

      Returns void