Merge pull request #119 from itHotL/api

Added another formatting method to the API (v1.7.2)
This commit is contained in:
Elise 2022-08-20 21:19:27 +02:00 committed by GitHub
commit 2c3f71c8a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 3 deletions

View File

@ -4,7 +4,7 @@
<groupId>io.github.ithotl</groupId>
<artifactId>PlayerStats</artifactId>
<name>PlayerStats</name>
<version>1.7.1</version>
<version>1.7.2-SNAPSHOT</version>
<description>Statistics Plugin</description>
<url>https://www.spigotmc.org/resources/playerstats.102347/</url>
<developers>

View File

@ -6,7 +6,7 @@
<groupId>io.github.ithotl</groupId>
<artifactId>PlayerStats</artifactId>
<version>1.7.1</version>
<version>1.7.2-SNAPSHOT</version>
<name>PlayerStats</name>
<description>Statistics Plugin</description>

View File

@ -80,6 +80,16 @@ public interface ApiFormatter {
*/
TextComponent getStatTitle(Statistic statistic, @Nullable String subStatName);
/**
* Gets a formatted message that displays the name of this Statistic as it is
* displayed by PlayerStats. If this Statistic is not of Type.Untyped,
* include the name of the relevant sub-statistic (block, item or entity).
*
* @param statistic the Statistic enum constant to display the name of
* @param unit the Unit to display
* @return [stat-name] [unit]
*/
TextComponent getStatTitle(Statistic statistic, Unit unit);
/**
* Gets a formatted message that displays the name of this Statistic as it is
* displayed by PlayerStats in a top-stat-message. If this Statistic is not
@ -94,6 +104,18 @@ public interface ApiFormatter {
*/
TextComponent getTopStatTitle(int topStatSize, Statistic statistic, @Nullable String subStatName);
/**
* Gets a formatted message that displays the name of this Statistic as it is
* displayed by PlayerStats in a top-stat-message, with the specified
* Unit in the name.
*
* @param topStatSize the size of the top-list this title is for
* @param statistic the Statistic enum constant for this message
* @param unit the Unit to display
* @return Top [topStatSize] [stat-name] [unit-name]
*/
TextComponent getTopStatTitle(int topStatSize, Statistic statistic, Unit unit);
/**
* Formats the input into a single top-statistic line. The stat-number
* is formatted into the most suitable {@link Unit} based on the provided

View File

@ -214,11 +214,21 @@ public final class MessageBuilder implements ApiFormatter {
return getTopStatTitleComponent(0, statistic, subStatName, null);
}
@Override
public TextComponent getStatTitle(Statistic statistic, Unit unit) {
return getTopStatTitleComponent(0, statistic, null, unit);
}
@Override
public TextComponent getTopStatTitle(int topListSize, Statistic statistic, @Nullable String subStatName) {
return getTopStatTitleComponent(topListSize, statistic, subStatName, null);
}
@Override
public TextComponent getTopStatTitle(int topStatSize, Statistic statistic, Unit unit) {
return getTopStatTitleComponent(topStatSize, statistic, null, unit);
}
@Override
public TextComponent formatTopStatLine(int positionInTopList, String playerName, long statNumber, Statistic statistic) {
TextComponent statNumberComponent = getStatNumberComponent(statNumber, Target.TOP, statistic);

View File

@ -1,6 +1,6 @@
main: com.artemis.the.gr8.playerstats.Main
name: PlayerStats
version: 1.7.1
version: 1.7.2
api-version: 1.13
description: adds commands to view player statistics in chat
author: Artemis_the_gr8