diff --git a/pom.xml b/pom.xml index 9d831d1..6f07674 100644 --- a/pom.xml +++ b/pom.xml @@ -206,6 +206,19 @@ + + org.apache.maven.plugins + maven-javadoc-plugin + 3.2.0 + + + attach-javadocs + + jar + + + + \ No newline at end of file diff --git a/src/main/java/com/github/artemis/the/gr8/playerstats/api/ApiFormatter.java b/src/main/java/com/github/artemis/the/gr8/playerstats/api/ApiFormatter.java index 58ece2a..1b61846 100644 --- a/src/main/java/com/github/artemis/the/gr8/playerstats/api/ApiFormatter.java +++ b/src/main/java/com/github/artemis/the/gr8/playerstats/api/ApiFormatter.java @@ -3,18 +3,13 @@ package com.github.artemis.the.gr8.playerstats.api; import com.github.artemis.the.gr8.playerstats.enums.Unit; import com.github.artemis.the.gr8.playerstats.msg.components.ComponentUtils; import com.github.artemis.the.gr8.playerstats.msg.msgutils.NumberFormatter; -import net.kyori.adventure.platform.bukkit.BukkitAudiences; +import com.github.artemis.the.gr8.playerstats.statistic.result.StatResult; import net.kyori.adventure.text.TextComponent; import org.bukkit.Statistic; import org.jetbrains.annotations.Nullable; -/** Formats messages meant for usage outside PlayerStats. - - The output is ready to be sent to a Minecraft client or console with the Adventure library. - To send a Component, you need to get a {@link BukkitAudiences} object. Normally you would - have to add the library as a dependency, but since the library is included in PlayerStats, you can - access it directly. Information on how to get and use the BukkitAudiences object can be found on - Adventure's website.*/ +/** Formats messages meant for usage outside PlayerStats. For more information about + the default formatting PlayerStats uses, see the class description of {@link StatResult}.*/ public interface ApiFormatter { /** Turns a TextComponent into its String representation. This method is equipped diff --git a/src/main/java/com/github/artemis/the/gr8/playerstats/api/StatManager.java b/src/main/java/com/github/artemis/the/gr8/playerstats/api/StatManager.java index 660f7ba..ec7ad7f 100644 --- a/src/main/java/com/github/artemis/the/gr8/playerstats/api/StatManager.java +++ b/src/main/java/com/github/artemis/the/gr8/playerstats/api/StatManager.java @@ -28,9 +28,11 @@ public interface StatManager { RequestGenerator> topStatRequest(int topListSize); /** Gets a RequestGenerator that can be used to create a TopStatRequest - for all offline players on the server. This RequestGenerator will make sure + for all offline players on the server (those that are included by + PlayerStats' settings). This RequestGenerator will make sure all default settings for a top-statistic-lookup are configured. + @return the RequestGenerator*/ RequestGenerator> totalTopStatRequest(); } diff --git a/src/main/java/com/github/artemis/the/gr8/playerstats/msg/msgutils/NumberFormatter.java b/src/main/java/com/github/artemis/the/gr8/playerstats/msg/msgutils/NumberFormatter.java index d1d8a45..ed4ebc8 100644 --- a/src/main/java/com/github/artemis/the/gr8/playerstats/msg/msgutils/NumberFormatter.java +++ b/src/main/java/com/github/artemis/the/gr8/playerstats/msg/msgutils/NumberFormatter.java @@ -54,7 +54,8 @@ public final class NumberFormatter { } } - /** The unit of time-based statistics is ticks by default.*/ + /** The unit of time-based statistics is ticks by default. + @return a String with the form "1D 2H 3M 4S" (depending on the Unit range selected)*/ public String formatTimeNumber(long number, Unit bigUnit, Unit smallUnit) { //5 statistics if (number == 0) { return "-"; diff --git a/src/main/java/com/github/artemis/the/gr8/playerstats/statistic/request/StatRequest.java b/src/main/java/com/github/artemis/the/gr8/playerstats/statistic/request/StatRequest.java index 56c6d3b..baaa848 100644 --- a/src/main/java/com/github/artemis/the/gr8/playerstats/statistic/request/StatRequest.java +++ b/src/main/java/com/github/artemis/the/gr8/playerstats/statistic/request/StatRequest.java @@ -7,6 +7,10 @@ import org.bukkit.Statistic; import org.bukkit.entity.EntityType; import org.jetbrains.annotations.Nullable; +/** Holds all the information PlayerStats needs to perform a lookup, and can be executed + to get the results. Calling {@link #execute()} on a Top- or ServerRequest can take some + time (especially if there is a substantial amount of OfflinePlayers on this particular server), + so I strongly advice you to call this asynchronously! */ public abstract class StatRequest { protected final RequestSettings requestSettings; @@ -15,25 +19,38 @@ public abstract class StatRequest { requestSettings = request; } - /** Don't call this from the Main Thread!*/ + /** Executes this StatRequest. Don't call this from the Main Thread! + @return a StatResult containing the value of this lookup, both as numerical value + and as formatted message*/ public abstract StatResult execute(); + /** @return the Statistic this StatRequest will get the data of */ public Statistic getStatisticSetting() { return requestSettings.getStatistic(); } + /** If the Statistic setting for this StatRequest is of Type.Block, + this will get the Material that was set + @return a Material for which #isBlock is true, or null if no Material was set*/ public @Nullable Material getBlockSetting() { return requestSettings.getBlock(); } + /** If the Statistic setting for this StatRequest is of Type.Item, + this will get the Material that was set + @return a Material for which #isItem is true, or null if no Material was set*/ public @Nullable Material getItemSetting() { return requestSettings.getItem(); } + /** If the Statistic setting for this StatRequest is of Type.Entity, + this will get the EntityType that was set + @return an EntityType, or null if no EntityType was set*/ public @Nullable EntityType getEntitySetting() { return requestSettings.getEntity(); } + /** @return the Target for this lookup (either Player, Server or Top)*/ public Target getTargetSetting() { return requestSettings.getTarget(); }