Interface playerMenuLeaderboardStatistic<T, SortType>

Represents a leaderboard statistic in the player menu.

interface playerMenuLeaderboardStatistic<
    T extends "built-in"
    | "custom"
    | "customAdvanced",
    SortType extends "function" | "order" | never = "function" | "order",
> {
    buttonDisplayName: string;
    buttonIcon?: string;
    displayOptions: {
        addCommaSeparators?: boolean;
        currencyPrefix?: string;
        toFixed?: number;
        valueDisplayColor?: string;
        valueDisplayTransformer_button?: (value: string) => string;
        valueDisplayTransformer_statsList?: (value: string) => string;
    };
    getterFunction?: T extends "built-in"
    | "customAdvanced"
        ? (player: Globals.modules.playersave.savedPlayer) => string
        : undefined;
    id: string;
    menuTitle: string;
    scoreboardObjective?: T extends "custom" ? string : undefined;
    sorter: T extends "built-in"
        ? (a: string, b: string) => number
        : T extends "customAdvanced"
            ? SortType extends "function"
                ? (a: string, b: string) => number
                : ObjectiveSortOrder
            : ObjectiveSortOrder;
    sortType?: SortType;
    statsListDisplayName: string;
    type: T;
    valueType: T extends "built-in"
    | "customAdvanced"
        ? "string" | "number" | "bigint"
        : "bigint";
}

Type Parameters

  • T extends "built-in" | "custom" | "customAdvanced"

    The type of the leaderboard statistic, which can be "built-in", "custom", or "customAdvanced".

  • SortType extends "function" | "order" | never = "function" | "order"

Properties

buttonDisplayName: string

The display name for the button associated with this statistic.

buttonIcon?: string

The optional icon for the button associated with this statistic.

displayOptions: {
    addCommaSeparators?: boolean;
    currencyPrefix?: string;
    toFixed?: number;
    valueDisplayColor?: string;
    valueDisplayTransformer_button?: (value: string) => string;
    valueDisplayTransformer_statsList?: (value: string) => string;
}

Options for displaying the statistic.

Type declaration

  • OptionaladdCommaSeparators?: boolean

    Whether to add comma separators to the value when displayed.

    true
    
  • OptionalcurrencyPrefix?: string

    A currency symbol to prefix the displayed value with.

    ""
    
  • OptionaltoFixed?: number

    The number of decimal places to display.

  • OptionalvalueDisplayColor?: string

    The color to use for displaying the value.

  • OptionalvalueDisplayTransformer_button?: (value: string) => string

    A function to transform the value for display on the button.

  • OptionalvalueDisplayTransformer_statsList?: (value: string) => string

    A function to transform the value for display in the stats list.

getterFunction?: T extends "built-in"
| "customAdvanced"
    ? (player: Globals.modules.playersave.savedPlayer) => string
    : undefined

The function to get the score for a savedPlayer instance.

id: string

The unique identifier for the statistic.

menuTitle: string

The title of the menu where this statistic is displayed.

scoreboardObjective?: T extends "custom" ? string : undefined

The scoreboard objective for custom statistics.

sorter: T extends "built-in"
    ? (a: string, b: string) => number
    : T extends "customAdvanced"
        ? SortType extends "function"
            ? (a: string, b: string) => number
            : ObjectiveSortOrder
        : ObjectiveSortOrder

The function to sort the statistics.

sortType?: SortType

The type of sorting for customAdvanced statistics.

statsListDisplayName: string

The display name for the statistic in the stats list.

type: T

The type of the statistic, which can be "built-in", "custom", or "customAdvanced".

valueType: T extends "built-in"
| "customAdvanced"
    ? "string" | "number" | "bigint"
    : "bigint"

The type of value for the statistic, which varies based on the type of statistic.