mooball
    Preparing search index...

    Interface ModifierRoomConfigCallbacks

    interface ModifierRoomConfigCallbacks {
        modifyClientPingAfter?(ping: number, customData?: any): number;
        modifyClientPingBefore?(ping: number): number;
        modifyPlayerDataAfter?(
            playerId: number,
            name: string,
            flag: string,
            avatar: string,
            conn: string,
            auth: string,
            customData?: any,
        ):
            | [modifiedName: string, modifiedFlag: string, modifiedAvatar: string]
            | Promise<
                [modifiedName: string, modifiedFlag: string, modifiedAvatar: string],
            >
            | null;
        modifyPlayerDataBefore?(
            playerId: number,
            name: string,
            flag: string,
            avatar: string,
            conn: string,
            auth: string,
        ):
            | [
                [modifiedName: string, modifiedFlag: string, modifiedAvatar: string],
                customData: any,
            ]
            | Promise<
                [
                    [modifiedName: string, modifiedFlag: string, modifiedAvatar: string],
                    customData: any,
                ],
            >
            | null;
        modifyPlayerPingAfter?(
            playerId: number,
            ping: number,
            customData?: any,
        ): number;
        modifyPlayerPingBefore?(playerId: number, ping: number): number;
        onAfterOperationReceived?(
            type: OperationType,
            msg: MooballEvent,
            globalFrameNo: number,
            clientFrameNo: number,
            customData?: any,
        ): boolean;
        onBeforeOperationReceived?(
            type: OperationType,
            msg: MooballEvent,
            globalFrameNo: number,
            clientFrameNo: number,
        ): boolean;
    }

    Hierarchy (View Summary)

    Index

    Methods

    • If defined, runs only for the current player in a client room and modifies its ping value.

      Parameters

      • ping: number

        Current ping value of the current player.

      • OptionalcustomData: any

        Any custom data that might be returned from the previous addon's calback.

      Returns number

      The new ping value of the current player.

    • If defined, runs only for the current player in a client room and modifies its ping value.

      Parameters

      • ping: number

        Current ping value of the current player.

      Returns number

      The new ping value of the current player.

    • Called just before the player has joined the room. Using this callback, you may block all players or modify all players' name, flag and avatar properties just before they join the room.

      Parameters

      • playerId: number

        Id of the new player who is about to join the room.

      • name: string

        Name of the new player who is about to join the room.

      • flag: string

        Country code of the new player who is about to join the room.

      • avatar: string

        Avatar of the new player who is about to join the room.

      • conn: string

        Connection string of the new player who is about to join the room.

      • auth: string

        Auth string of the new player who is about to join the room.

      • OptionalcustomData: any

        Any custom data that might be returned from the previous addon's calback.

      Returns
          | [modifiedName: string, modifiedFlag: string, modifiedAvatar: string]
          | Promise<
              [modifiedName: string, modifiedFlag: string, modifiedAvatar: string],
          >
          | null

      • null: Blocks the player from joining the room.
        • [modifiedName: string, modifiedFlag: string, modifiedAvatar: string]: Modifies the name, flag and avatar values.
        • Promise<[modifiedName: string, modifiedFlag: string, modifiedAvatar: string]>: Modifies the name, flag and avatar values after the promise might be resolved.
    • Called just before the player has joined the room. Using this callback, you may block all players or modify all players' name, flag and avatar properties just before they join the room.

      Parameters

      • playerId: number

        Id of the new player who is about to join the room.

      • name: string

        Name of the new player who is about to join the room.

      • flag: string

        Country code of the new player who is about to join the room.

      • avatar: string

        Avatar of the new player who is about to join the room.

      • conn: string

        Connection string of the new player who is about to join the room.

      • auth: string

        Auth string of the new player who is about to join the room.

      Returns
          | [
              [modifiedName: string, modifiedFlag: string, modifiedAvatar: string],
              customData: any,
          ]
          | Promise<
              [
                  [modifiedName: string, modifiedFlag: string, modifiedAvatar: string],
                  customData: any,
              ],
          >
          | null

      • null: Blocks the player from joining the room.
        • [[modifiedName: string, modifiedFlag: string, modifiedAvatar: string], customData: any]: Modifies the name, flag and avatar values.
        • Promise<[[modifiedName: string, modifiedFlag: string, modifiedAvatar: string], customData: any]>: Modifies the name, flag and avatar values after the promise might be resolved.
    • If defined, runs for all players except host in a host room. Modifies the ping value of the player whose id is playerId. Host player's ping will not change using this callback. In order to change host player's ping, you need to modify room.hostPing value directly.

      Parameters

      • playerId: number

        Id of the current player.

      • ping: number

        Current ping value of the current player.

      • OptionalcustomData: any

        Any custom data that might be returned from the previous addon's calback.

      Returns number

      The new ping value of the current player.

    • If defined, runs for all players except host in a host room. Modifies the ping value of the player whose id is playerId. Host player's ping will not change using this callback. In order to change host player's ping, you need to modify room.hostPing value directly.

      Parameters

      • playerId: number

        Id of the current player.

      • ping: number

        Current ping value of the current player.

      Returns number

      The new ping value of the current player.

    • If defined, runs for each message received from all clients in a host room, before they are processed and sent to all clients. This is the most important callback inside a host room; all permission logic should reside here. You are also allowed to freely modify the contents of all messages here.

      Parameters

      • type: OperationType

        Type of the received message. We have to look it up in the global OperationType object to understand what type of message it actually is.

      • msg: MooballEvent

        The original message object. We can directly modify all contents of this object here as we wish.

      • globalFrameNo: number

        The global frame no that host's physics engine is at, at the time that the message is received.

      • clientFrameNo: number

        The frame no that this client's physics engine is at, at the time that the message is received.

      • OptionalcustomData: any

        Any custom data that might be returned from the previous addon's calback.

      Returns boolean

      • true: accept event.
        • false: block message from being processed.
        • throw exception: break the connection of the sender of this message.
    • If defined, runs for each message received from all clients in a host room, before they are processed and sent to all clients. This is the most important callback inside a host room; all permission logic should reside here. You are also allowed to freely modify the contents of all messages here.

      Parameters

      • type: OperationType

        Type of the received message. We have to look it up in the global OperationType object to understand what type of message it actually is.

      • msg: MooballEvent

        The original message object. We can directly modify all contents of this object here as we wish.

      • globalFrameNo: number

        The global frame no that host's physics engine is at, at the time that the message is received.

      • clientFrameNo: number

        The frame no that this client's physics engine is at, at the time that the message is received.

      Returns boolean

      • true: accept event.
        • false: block message from being processed.
        • throw exception: break the connection of the sender of this message.