add number format api

Signed-off-by: David Mayr <davidliebtkekse@gmail.com>
This commit is contained in:
David Mayr
2023-12-16 10:40:29 +01:00
parent 8363e77ad2
commit 3ebc5bb92c
8 changed files with 173 additions and 0 deletions

View File

@@ -195,4 +195,22 @@ public interface Objective {
*/
void setAutoUpdateDisplay(boolean autoUpdateDisplay);
// Paper end - add more score API
// Paper start - number format api
/**
* Gets the number format for this objective's scores or null if the client default is used.
*
* @return this objective's number format, or null if the client default is used
* @throws IllegalStateException if this objective has been unregistered
*/
@Nullable io.papermc.paper.scoreboard.numbers.NumberFormat numberFormat();
/**
* Sets the number format for this objective's scores.
*
* @param format the number format to set, pass null to reset format to default
* @throws IllegalStateException if this objective has been unregistered
*/
void numberFormat(@Nullable io.papermc.paper.scoreboard.numbers.NumberFormat format);
// Paper end - number format api
}

View File

@@ -129,4 +129,26 @@ public interface Score {
*/
void customName(net.kyori.adventure.text.@Nullable Component customName);
// Paper end - add more score API
// Paper start - number format api
/**
* Gets the number format for this score or null if the score has not been set yet
* or the objective's default is being used.
*
* @return this score's number format, or null if the objective's default is used or the score doesn't exist
* @throws IllegalStateException if the associated objective has been
* unregistered
*/
@Nullable io.papermc.paper.scoreboard.numbers.NumberFormat numberFormat();
/**
* Sets the number format for this score. If this score has not been set yet {@link #isScoreSet()}, it will be created
*
* @param format the number format to set, pass null to reset format to default
* @throws IllegalStateException if the associated objective has been
* unregistered
*/
void numberFormat(@Nullable io.papermc.paper.scoreboard.numbers.NumberFormat format);
// Paper end - number format api
}