Represents a bounty.

Constructors

  • Creates a new bounty.

    Parameters

    • properties:
          | {
              creationTime?: number;
              id?: undefined;
              new?: true;
              playerId: string;
              status?: undefined;
              targetId: string;
              valid?: undefined;
              value: bigint;
          }
          | {
              creationTime: number;
              id: bigint;
              new: false;
              playerId: string;
              status: "none"
              | "canceled"
              | "deleted"
              | "claimed";
              targetId: string;
              valid: boolean;
              value: bigint;
          }

      The properties of the bounty.

      • {
            creationTime?: number;
            id?: undefined;
            new?: true;
            playerId: string;
            status?: undefined;
            targetId: string;
            valid?: undefined;
            value: bigint;
        }
        • OptionalcreationTime?: number

          The creation time of this bounty. Defaults to the current time.

        • Optionalid?: undefined

          The unique identifier of this bounty.

        • Optionalnew?: true

          Whether this bounty is new. Defaults to true.

        • playerId: string

          The UUID of the player who placed this bounty.

        • Optionalstatus?: undefined

          The status of this bounty. Defaults to undefined.

        • targetId: string

          The UUID of the target of this bounty.

        • Optionalvalid?: undefined

          Whether this bounty is valid. Defaults to undefined.

        • value: bigint

          The value of this bounty.

      • {
            creationTime: number;
            id: bigint;
            new: false;
            playerId: string;
            status: "none" | "canceled" | "deleted" | "claimed";
            targetId: string;
            valid: boolean;
            value: bigint;
        }
        • creationTime: number

          The creation time of this bounty. Defaults to the current time.

        • Readonlyid: bigint

          The unique identifier of this bounty.

        • new: false

          Whether this bounty is new. Defaults to true.

        • playerId: string

          The UUID of the player who placed this bounty.

        • status: "none" | "canceled" | "deleted" | "claimed"

          The status of this bounty. Defaults to undefined.

        • targetId: string

          The UUID of the target of this bounty.

        • valid: boolean

          Whether this bounty is valid. Defaults to undefined.

        • value: bigint

          The value of this bounty.

    Returns Globals.modules.main.Bounty

Properties

creationTime: number

The creation time of this bounty.

id: bigint

The unique identifier of this bounty.

playerId: string

The UUID of the player who placed this bounty.

status: "none" | "canceled" | "deleted" | "claimed" = "none"

The status of this bounty.

"none"
targetId: string

The UUID of the target of this bounty.

valid: boolean = true

Whether this bounty is valid.

true
value: bigint

The value of this bounty.

Methods

  • Cancels this bounty.

    Returns boolean

    Whether this bounty was canceled.

  • Claims this bounty.

    Parameters

    • claimer: Player

      The player who claimed this bounty.

    Returns boolean

    Whether this bounty was claimed.

  • Deletes this bounty.

    Returns boolean

    Whether this bounty was deleted.

  • Initializes this bounty.

    Returns void

  • Converts this bounty to a JSONB serializable object.

    Returns {
        creationTime: number;
        id: bigint;
        playerId: string;
        status: "none" | "canceled" | "deleted" | "claimed";
        targetId: string;
        valid: boolean;
        value: bigint;
    }

  • Retrieves all bounties placed by the specified player.

    Parameters

    • playerId: string

      The player's UUID.

    Returns Globals.modules.main.Bounty[]

    An array of bounties placed by the player.

  • Retrieves all bounties placed on the specified player.

    Parameters

    • targetId: string

      The target's UUID.

    Returns Globals.modules.main.Bounty[]

    An array of bounties placed on the target.

  • Loads all saved bounties.

    Returns void

    If the saved bounties are not valid stringified JSONB.

  • Places a bounty on the specified player.

    Parameters

    • value: bigint

      The bounty value.

    • playerId: string

      The player's UUID.

    • targetId: string

      The target's UUID.

    • OptionalplayerDisplayName: string

      The player's display name.

    • OptionaltargetDisplayName: string

      The target's display name.

    • Optionalsilent: boolean = false

      If set to true, will not notify all online players of the bounty. Defaults to false.

    • OptionalchargePlayer: boolean = true

      Whether to charge the player for the bounty. Defaults to true.

    • OptionalcreationTime: number = ...

      The creation time of the bounty. Defaults to the current time.

    Returns Globals.modules.main.Bounty

    The created bounty.

    If the player has already placed a bounty on the target.

    If chargePlayer is true and the player does not have enough money to place the bounty.

  • Saves all loaded bounties.

    Returns void