From 18bf8a56a7e72f2b6f0dd32728cdabbdf21677f8 Mon Sep 17 00:00:00 2001 From: Artemis-the-gr8 Date: Sat, 25 Feb 2023 14:32:36 +0100 Subject: [PATCH] Added method to API to check whether a player is on the exclude-list --- dependency-reduced-pom.xml | 6 +++--- .../artemis/the/gr8/playerstats/api/StatManager.java | 10 ++++++++++ .../playerstats/core/statrequest/RequestManager.java | 7 ++++++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml index 244c296..5ef58c2 100644 --- a/dependency-reduced-pom.xml +++ b/dependency-reduced-pom.xml @@ -107,7 +107,7 @@ attach-sources - deploy + verify jar-no-fork @@ -120,7 +120,7 @@ sign-artifacts - deploy + verify sign @@ -133,7 +133,7 @@ attach-javadocs - deploy + verify jar diff --git a/src/main/java/com/artemis/the/gr8/playerstats/api/StatManager.java b/src/main/java/com/artemis/the/gr8/playerstats/api/StatManager.java index 0317fc3..33eae8c 100644 --- a/src/main/java/com/artemis/the/gr8/playerstats/api/StatManager.java +++ b/src/main/java/com/artemis/the/gr8/playerstats/api/StatManager.java @@ -4,6 +4,16 @@ import java.util.LinkedHashMap; public interface StatManager { + /** Checks if the player belonging to this name + * is on PlayerStats' exclude-list (meaning this + * player is not counted for the server total, and + * does not show in top results). + * + * @param playerName the name of the player to check + * @return true if this player is on the exclude-list + */ + boolean isExcludedPlayer(String playerName); + /** Gets a RequestGenerator that can be used to create a PlayerStatRequest. * This RequestGenerator will make sure all default settings * for a player-statistic-lookup are configured. diff --git a/src/main/java/com/artemis/the/gr8/playerstats/core/statrequest/RequestManager.java b/src/main/java/com/artemis/the/gr8/playerstats/core/statrequest/RequestManager.java index 33f8fd9..3373cc9 100644 --- a/src/main/java/com/artemis/the/gr8/playerstats/core/statrequest/RequestManager.java +++ b/src/main/java/com/artemis/the/gr8/playerstats/core/statrequest/RequestManager.java @@ -25,7 +25,7 @@ import java.util.stream.Collectors; /** * Turns user input into a {@link StatRequest} that can be - * used to get statistic data. + * executed to get statistic data. */ public final class RequestManager implements StatManager { @@ -45,6 +45,11 @@ public final class RequestManager implements StatManager { }; } + @Override + public boolean isExcludedPlayer(String playerName) { + return offlinePlayerHandler.isExcludedPlayer(playerName); + } + @Contract("_ -> new") @Override public @NotNull RequestGenerator createPlayerStatRequest(String playerName) {