mirror of
https://github.com/itHotL/PlayerStats.git
synced 2025-01-07 19:27:47 +01:00
Added finishing touches to javadoc comments and started preparing for 1.7 release (#100)
This commit is contained in:
parent
7c9f03038f
commit
7e2a105b71
@ -49,7 +49,7 @@
|
||||
<configuration>
|
||||
<transformers>
|
||||
<transformer>
|
||||
<mainClass>com.github.artemis.the.gr8.playerstats.Main</mainClass>
|
||||
<mainClass>com.artemis.the.gr8.playerstats.Main</mainClass>
|
||||
</transformer>
|
||||
</transformers>
|
||||
<artifactSet>
|
||||
@ -126,7 +126,6 @@
|
||||
</executions>
|
||||
<configuration>
|
||||
<name>PlayerStats Javadocs</name>
|
||||
<docTitle>PlayerStats Javadocs</docTitle>
|
||||
<additionalOptions>-Xdoclint:none</additionalOptions>
|
||||
<failOnError>false</failOnError>
|
||||
<quiet>true</quiet>
|
||||
|
12
pom.xml
12
pom.xml
@ -4,7 +4,7 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>io.github.artemis-the-gr8</groupId>
|
||||
<groupId>io.github.ithotl</groupId>
|
||||
<artifactId>PlayerStats</artifactId>
|
||||
<version>1.7</version>
|
||||
|
||||
@ -141,7 +141,7 @@
|
||||
<transformers>
|
||||
<transformer
|
||||
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
||||
<mainClass>com.github.artemis.the.gr8.playerstats.Main</mainClass>
|
||||
<mainClass>com.artemis.the.gr8.playerstats.Main</mainClass>
|
||||
</transformer>
|
||||
</transformers>
|
||||
<artifactSet>
|
||||
@ -152,15 +152,15 @@
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>net.kyori</pattern>
|
||||
<shadedPattern>com.github.artemis.the.gr8.lib.kyori</shadedPattern>
|
||||
<shadedPattern>com.artemis.the.gr8.lib.kyori</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>com.tchristofferson</pattern>
|
||||
<shadedPattern>com.github.artemis.the.gr8.util.tchristofferson</shadedPattern>
|
||||
<shadedPattern>com.artemis.the.gr8.util.tchristofferson</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.bstats</pattern>
|
||||
<shadedPattern>com.github.artemis.the.gr8.util.bstats</shadedPattern>
|
||||
<shadedPattern>com.artemis.the.gr8.util.bstats</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
<filters>
|
||||
@ -226,7 +226,7 @@
|
||||
<groups>
|
||||
<group>
|
||||
<title>API</title>
|
||||
<packages>com.github.artemis.the.gr8.playerstats.api</packages>
|
||||
<packages>com.artemis.the.gr8.playerstats.api</packages>
|
||||
</group>
|
||||
</groups>
|
||||
<detectLinks>true</detectLinks>
|
||||
|
@ -1,20 +1,20 @@
|
||||
package com.github.artemis.the.gr8.playerstats;
|
||||
package com.artemis.the.gr8.playerstats;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.api.PlayerStats;
|
||||
import com.github.artemis.the.gr8.playerstats.msg.OutputManager;
|
||||
import com.github.artemis.the.gr8.playerstats.api.PlayerStatsAPI;
|
||||
import com.github.artemis.the.gr8.playerstats.commands.ReloadCommand;
|
||||
import com.github.artemis.the.gr8.playerstats.commands.ShareCommand;
|
||||
import com.github.artemis.the.gr8.playerstats.commands.StatCommand;
|
||||
import com.github.artemis.the.gr8.playerstats.commands.TabCompleter;
|
||||
import com.github.artemis.the.gr8.playerstats.config.ConfigHandler;
|
||||
import com.github.artemis.the.gr8.playerstats.listeners.JoinListener;
|
||||
import com.github.artemis.the.gr8.playerstats.msg.InternalFormatter;
|
||||
import com.github.artemis.the.gr8.playerstats.msg.MessageBuilder;
|
||||
import com.github.artemis.the.gr8.playerstats.msg.msgutils.LanguageKeyHandler;
|
||||
import com.github.artemis.the.gr8.playerstats.statistic.StatCalculator;
|
||||
import com.github.artemis.the.gr8.playerstats.utils.EnumHandler;
|
||||
import com.github.artemis.the.gr8.playerstats.utils.OfflinePlayerHandler;
|
||||
import com.artemis.the.gr8.playerstats.api.PlayerStats;
|
||||
import com.artemis.the.gr8.playerstats.msg.OutputManager;
|
||||
import com.artemis.the.gr8.playerstats.api.PlayerStatsAPI;
|
||||
import com.artemis.the.gr8.playerstats.commands.ReloadCommand;
|
||||
import com.artemis.the.gr8.playerstats.commands.ShareCommand;
|
||||
import com.artemis.the.gr8.playerstats.commands.StatCommand;
|
||||
import com.artemis.the.gr8.playerstats.commands.TabCompleter;
|
||||
import com.artemis.the.gr8.playerstats.config.ConfigHandler;
|
||||
import com.artemis.the.gr8.playerstats.listeners.JoinListener;
|
||||
import com.artemis.the.gr8.playerstats.msg.InternalFormatter;
|
||||
import com.artemis.the.gr8.playerstats.msg.MessageBuilder;
|
||||
import com.artemis.the.gr8.playerstats.msg.msgutils.LanguageKeyHandler;
|
||||
import com.artemis.the.gr8.playerstats.statistic.StatCalculator;
|
||||
import com.artemis.the.gr8.playerstats.utils.EnumHandler;
|
||||
import com.artemis.the.gr8.playerstats.utils.OfflinePlayerHandler;
|
||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
@ -1,8 +1,8 @@
|
||||
package com.github.artemis.the.gr8.playerstats;
|
||||
package com.artemis.the.gr8.playerstats;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.statistic.result.InternalStatResult;
|
||||
import com.github.artemis.the.gr8.playerstats.config.ConfigHandler;
|
||||
import com.github.artemis.the.gr8.playerstats.utils.MyLogger;
|
||||
import com.artemis.the.gr8.playerstats.statistic.result.InternalStatResult;
|
||||
import com.artemis.the.gr8.playerstats.config.ConfigHandler;
|
||||
import com.artemis.the.gr8.playerstats.utils.MyLogger;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
@ -1,13 +1,13 @@
|
||||
package com.github.artemis.the.gr8.playerstats;
|
||||
package com.artemis.the.gr8.playerstats;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.msg.OutputManager;
|
||||
import com.github.artemis.the.gr8.playerstats.config.ConfigHandler;
|
||||
import com.github.artemis.the.gr8.playerstats.enums.StandardMessage;
|
||||
import com.github.artemis.the.gr8.playerstats.statistic.request.RequestSettings;
|
||||
import com.github.artemis.the.gr8.playerstats.reload.ReloadThread;
|
||||
import com.github.artemis.the.gr8.playerstats.statistic.StatCalculator;
|
||||
import com.github.artemis.the.gr8.playerstats.statistic.StatThread;
|
||||
import com.github.artemis.the.gr8.playerstats.utils.MyLogger;
|
||||
import com.artemis.the.gr8.playerstats.msg.OutputManager;
|
||||
import com.artemis.the.gr8.playerstats.config.ConfigHandler;
|
||||
import com.artemis.the.gr8.playerstats.enums.StandardMessage;
|
||||
import com.artemis.the.gr8.playerstats.statistic.request.RequestSettings;
|
||||
import com.artemis.the.gr8.playerstats.reload.ReloadThread;
|
||||
import com.artemis.the.gr8.playerstats.statistic.StatCalculator;
|
||||
import com.artemis.the.gr8.playerstats.statistic.StatThread;
|
||||
import com.artemis.the.gr8.playerstats.utils.MyLogger;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import java.util.HashMap;
|
@ -1,9 +1,9 @@
|
||||
package com.github.artemis.the.gr8.playerstats.api;
|
||||
package com.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 com.github.artemis.the.gr8.playerstats.statistic.result.StatResult;
|
||||
import com.artemis.the.gr8.playerstats.enums.Unit;
|
||||
import com.artemis.the.gr8.playerstats.msg.components.ComponentUtils;
|
||||
import com.artemis.the.gr8.playerstats.msg.msgutils.NumberFormatter;
|
||||
import com.artemis.the.gr8.playerstats.statistic.result.StatResult;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import org.bukkit.Statistic;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@ -20,8 +20,9 @@ public interface ApiFormatter {
|
||||
|
||||
/**
|
||||
* Turns a TextComponent into its String representation. This method is equipped
|
||||
* to turn all PlayerStats' formatted statResults into String.
|
||||
|
||||
* to turn all PlayerStats' formatted statResults into String, using a custom
|
||||
* Serializer.
|
||||
*
|
||||
* @param component the Component to turn into String
|
||||
* @return a String representation of this TextComponent, without hover/click events,
|
||||
* but with color, style and formatting. TranslatableComponents will be turned into
|
||||
@ -34,7 +35,7 @@ public interface ApiFormatter {
|
||||
|
||||
/**
|
||||
* Gets a {@link NumberFormatter} to format raw numbers into something more readable.
|
||||
|
||||
*
|
||||
* @return the <code>NumberFormatter</code>
|
||||
*/
|
||||
default NumberFormatter getNumberFormatter() {
|
||||
@ -56,13 +57,13 @@ public interface ApiFormatter {
|
||||
/**
|
||||
* Gets the version of the prefix that is surrounded by underscores.
|
||||
* This is meant to be used as a title above a message or statistic display.
|
||||
* @return ________ [PlayerStats] ________
|
||||
* @return ________ [PlayerStats] ________
|
||||
*/
|
||||
TextComponent getPluginPrefixAsTitle();
|
||||
|
||||
/**
|
||||
* Gets the special rainbow version of the title-prefix.
|
||||
|
||||
*
|
||||
* @return ________ [PlayerStats] ________ in rainbow colors
|
||||
*/
|
||||
TextComponent getRainbowPluginPrefixAsTitle();
|
||||
@ -71,7 +72,7 @@ public interface ApiFormatter {
|
||||
* 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 subStatName where necessary, the name of the Material or EntityType
|
||||
* to include, acquired by doing #toString() on the Material/EntityType in question
|
||||
@ -84,7 +85,7 @@ public interface ApiFormatter {
|
||||
* displayed by PlayerStats in a top-stat-message. 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 for this message
|
||||
* @param subStatName the name of the Material or EntityType to include,
|
||||
* acquired by doing #toString() on the Material/EntityType in question
|
||||
@ -99,7 +100,7 @@ public interface ApiFormatter {
|
||||
* Statistic. For Type.Time, the resulting formatted number will have as
|
||||
* many additional smaller units as are specified in the config,
|
||||
* unless <code>formatTopStatLineForTypeTime()</code> is used.
|
||||
|
||||
*
|
||||
* @param positionInTopList the rank-number in this list of the Player
|
||||
* @param playerName the name of the Player on this line
|
||||
* @param statNumber the result of Player#getStatistic()
|
||||
@ -115,7 +116,7 @@ public interface ApiFormatter {
|
||||
* resulting formatted number will have as many additional smaller
|
||||
* units as are specified in the config, unless
|
||||
* <code>formatTopStatLineForTypeTime()</code> is used.
|
||||
|
||||
*
|
||||
* @param positionInTopList the rank-number in this list of the Player
|
||||
* @param playerName the name of the Player on this line
|
||||
* @param statNumber the result of Player#getStatistic()
|
||||
@ -129,7 +130,7 @@ public interface ApiFormatter {
|
||||
* Formats the input into a single top-statistic line for a time-based
|
||||
* statistic with the Unit-range that is between <code>bigUnit</code>
|
||||
* and <code>smallUnit</code> (both inclusive).
|
||||
|
||||
*
|
||||
* @param positionInTopList the rank-number in this list of the Player
|
||||
* @param playerName the name of the Player on this line
|
||||
* @param statNumber the result of Player#getStatistic()
|
||||
@ -146,7 +147,7 @@ public interface ApiFormatter {
|
||||
* Statistic. For Type.Time, the resulting formatted number will have as
|
||||
* many additional smaller units as are specified in the config,
|
||||
* unless <code>formatServerStatForTypeTime()</code> is used.
|
||||
|
||||
*
|
||||
* @param statNumber the result of all Player#getStatistic() values combined
|
||||
* @param statistic te Statistic enum constant for this message
|
||||
* @return [Total on this server]: [stat-number] [stat-name]
|
||||
@ -156,7 +157,7 @@ public interface ApiFormatter {
|
||||
/**
|
||||
* Formats the input into a server statistic message for a statistic
|
||||
* that has a sub-statistic (block, item or entity).
|
||||
|
||||
*
|
||||
* @param statistic the Statistic enum constant for this message
|
||||
* @param statNumber the result of all Player#getStatistic() values combined
|
||||
* @param subStatName the name of the Material or EntityType of this
|
||||
@ -173,7 +174,7 @@ public interface ApiFormatter {
|
||||
* resulting formatted number will have as many additional smaller
|
||||
* units as are specified in the config, unless
|
||||
* <code>formatServerStatForTypeTime()</code> is used.
|
||||
|
||||
*
|
||||
* @param statistic the Statistic enum constant for this message
|
||||
* @param statNumber the result of all Player#getStatistic() values combined
|
||||
* @param unit the Unit to use to format te <code>statNumber</code>
|
||||
@ -185,7 +186,7 @@ public interface ApiFormatter {
|
||||
* Formats the input into a server statistic message for a time-based
|
||||
* statistic with the Unit-range that is between <code>bigUnit</code>
|
||||
* and <code>smallUnit</code> (both inclusive).
|
||||
|
||||
*
|
||||
* @param statistic the Statistic enum constant for this message
|
||||
* @param statNumber the result of all Player#getStatistic() values combined
|
||||
* @param bigUnit the biggest Unit to use of {@link Unit.Type#TIME}
|
||||
@ -199,7 +200,7 @@ public interface ApiFormatter {
|
||||
* the resulting formatted number will have as many additional smaller
|
||||
* units as are specified in the config, unless
|
||||
* <code>formatPlayerStatForTypeTime</code> is used.
|
||||
|
||||
*
|
||||
* @param playerName the name of the Player
|
||||
* @param statistic the Statistic enum constant for this message
|
||||
* @param statNumber the result of Player#getStatistic()
|
||||
@ -210,7 +211,7 @@ public interface ApiFormatter {
|
||||
/**
|
||||
* Formats the input into a player statistic message for a statistic
|
||||
* that has a sub-statistic (block, item or entity).
|
||||
|
||||
*
|
||||
* @param playerName the name of the Player
|
||||
* @param statistic the Statistic enum constant for this message
|
||||
* @param statNumber the result of Player#getStatistic()
|
||||
@ -226,7 +227,7 @@ public interface ApiFormatter {
|
||||
* {@link Unit}. For Unit.Type.Time, the resulting formatted number will
|
||||
* have as many additional smaller units as are specified in the config,
|
||||
* unless <code>formatPlayerStatForTypeTime</code> is used.
|
||||
|
||||
*
|
||||
* @param playerName the name of the Player
|
||||
* @param statistic the Statistic enum constant for this message
|
||||
* @param statNumber the result of Player#getStatistic()
|
||||
@ -239,7 +240,7 @@ public interface ApiFormatter {
|
||||
* Formats the input into a player statistic message for a time-based
|
||||
* statistic with the Unit-range that is between <code>bigUnit</code>
|
||||
* and <code>smallUnit</code> (both inclusive).
|
||||
|
||||
*
|
||||
* @param playerName the name of the Player
|
||||
* @param statNumber the result of Player#getStatistic()
|
||||
* @param statistic the Statistic enum constant for this message
|
@ -1,20 +1,23 @@
|
||||
package com.github.artemis.the.gr8.playerstats.api;
|
||||
package com.artemis.the.gr8.playerstats.api;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.Main;
|
||||
import com.github.artemis.the.gr8.playerstats.statistic.request.StatRequest;
|
||||
import com.artemis.the.gr8.playerstats.Main;
|
||||
import com.artemis.the.gr8.playerstats.statistic.request.StatRequest;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* The outgoing API that represents the core functionality of PlayerStats!
|
||||
*
|
||||
* <p> To work with it, you'll need to call PlayerStats.{@link #getAPI()} to get an instance of
|
||||
* <p> To work with it, you'll need to call PlayerStats.{@link #getAPI()} and get an instance of
|
||||
* {@link PlayerStatsAPI}. You can then use this object to access any of the further methods.
|
||||
* <br>
|
||||
* <br>Since calculating a top or server statistics can take some time, I strongly
|
||||
*
|
||||
* <p> Since calculating a top or server statistics can take some time, I strongly
|
||||
* encourage you to call {@link StatRequest#execute()} asynchronously.
|
||||
* Otherwise, the main Thread will have to wait until all calculations are done,
|
||||
* and this can severely impact server performance.
|
||||
*
|
||||
* @see StatManager
|
||||
* @see ApiFormatter
|
||||
*/
|
||||
public interface PlayerStats {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.artemis.the.gr8.playerstats.api;
|
||||
package com.artemis.the.gr8.playerstats.api;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.statistic.request.*;
|
||||
import com.github.artemis.the.gr8.playerstats.utils.OfflinePlayerHandler;
|
||||
import com.artemis.the.gr8.playerstats.statistic.request.*;
|
||||
import com.artemis.the.gr8.playerstats.utils.OfflinePlayerHandler;
|
||||
|
||||
import static org.jetbrains.annotations.ApiStatus.Internal;
|
||||
|
@ -1,33 +1,39 @@
|
||||
package com.github.artemis.the.gr8.playerstats.api;
|
||||
package com.artemis.the.gr8.playerstats.api;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.statistic.StatCalculator;
|
||||
import com.github.artemis.the.gr8.playerstats.statistic.request.StatRequest;
|
||||
import com.artemis.the.gr8.playerstats.statistic.StatCalculator;
|
||||
import com.artemis.the.gr8.playerstats.statistic.request.StatRequest;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Statistic;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/** Creates an executable {@link StatRequest}. This Request holds all
|
||||
/**
|
||||
* Creates an executable {@link StatRequest}. This Request holds all
|
||||
* the information PlayerStats needs to work with, and is used by the {@link StatCalculator}
|
||||
* to get the desired statistic data.*/
|
||||
* to get the desired statistic data.
|
||||
*/
|
||||
public interface RequestGenerator<T> {
|
||||
|
||||
/** Gets an executable Request object for a Statistic of Statistic.Type {@code Untyped}.
|
||||
|
||||
/**
|
||||
* Gets an executable Request object for a Statistic of Statistic.Type {@code Untyped}.
|
||||
*
|
||||
* @param statistic a Statistic of Type.Untyped
|
||||
* @return a {@link StatRequest}
|
||||
* @throws IllegalArgumentException if <code>statistic</code> is not of Type.Untyped*/
|
||||
* @throws IllegalArgumentException if <code>statistic</code> is not of Type.Untyped
|
||||
* */
|
||||
StatRequest<T> untyped(@NotNull Statistic statistic) throws IllegalArgumentException;
|
||||
|
||||
/** Gets an executable Request object for a Statistic of Statistic.Type Block or Item.
|
||||
|
||||
/**
|
||||
* Gets an executable Request object for a Statistic of Statistic.Type Block or Item.
|
||||
*
|
||||
* @param statistic a Statistic of Type.Block or Type.Item
|
||||
* @param material a block if the <code>statistic</code> is of Type.Block,
|
||||
* and an item if the <code>statistic</code> is of Type.Item
|
||||
* @return a {@link StatRequest}
|
||||
* @throws IllegalArgumentException if <code>statistic</code> is not of Type.Block
|
||||
* (with a block as <code>material</code>), or <code>statistic</code> is not of Type.Item
|
||||
* (with an item as <code>material</code>) */
|
||||
* (with an item as <code>material</code>)
|
||||
*/
|
||||
StatRequest<T> blockOrItemType(@NotNull Statistic statistic, @NotNull Material material) throws IllegalArgumentException;
|
||||
|
||||
/** Gets an executable Request object for a Statistic of Statistic.Type Entity.
|
@ -1,6 +1,7 @@
|
||||
package com.github.artemis.the.gr8.playerstats.api;
|
||||
package com.artemis.the.gr8.playerstats.api;
|
||||
|
||||
import com.artemis.the.gr8.playerstats.statistic.request.StatRequest;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.statistic.request.StatRequest;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
/**
|
@ -0,0 +1,4 @@
|
||||
/**
|
||||
* The PlayerStats API
|
||||
*/
|
||||
package com.artemis.the.gr8.playerstats.api;
|
@ -1,6 +1,6 @@
|
||||
package com.github.artemis.the.gr8.playerstats.commands;
|
||||
package com.artemis.the.gr8.playerstats.commands;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.ThreadManager;
|
||||
import com.artemis.the.gr8.playerstats.ThreadManager;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
@ -1,10 +1,10 @@
|
||||
package com.github.artemis.the.gr8.playerstats.commands;
|
||||
package com.artemis.the.gr8.playerstats.commands;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.ShareManager;
|
||||
import com.github.artemis.the.gr8.playerstats.enums.StandardMessage;
|
||||
import com.github.artemis.the.gr8.playerstats.msg.OutputManager;
|
||||
import com.github.artemis.the.gr8.playerstats.statistic.result.InternalStatResult;
|
||||
import com.github.artemis.the.gr8.playerstats.utils.MyLogger;
|
||||
import com.artemis.the.gr8.playerstats.ShareManager;
|
||||
import com.artemis.the.gr8.playerstats.enums.StandardMessage;
|
||||
import com.artemis.the.gr8.playerstats.msg.OutputManager;
|
||||
import com.artemis.the.gr8.playerstats.statistic.result.InternalStatResult;
|
||||
import com.artemis.the.gr8.playerstats.utils.MyLogger;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
@ -1,11 +1,11 @@
|
||||
package com.github.artemis.the.gr8.playerstats.commands;
|
||||
package com.artemis.the.gr8.playerstats.commands;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.ThreadManager;
|
||||
import com.github.artemis.the.gr8.playerstats.enums.StandardMessage;
|
||||
import com.github.artemis.the.gr8.playerstats.enums.Target;
|
||||
import com.github.artemis.the.gr8.playerstats.msg.OutputManager;
|
||||
import com.github.artemis.the.gr8.playerstats.statistic.request.RequestHandler;
|
||||
import com.github.artemis.the.gr8.playerstats.statistic.request.RequestSettings;
|
||||
import com.artemis.the.gr8.playerstats.ThreadManager;
|
||||
import com.artemis.the.gr8.playerstats.enums.StandardMessage;
|
||||
import com.artemis.the.gr8.playerstats.enums.Target;
|
||||
import com.artemis.the.gr8.playerstats.msg.OutputManager;
|
||||
import com.artemis.the.gr8.playerstats.statistic.request.RequestHandler;
|
||||
import com.artemis.the.gr8.playerstats.statistic.request.RequestSettings;
|
||||
import org.bukkit.Statistic;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@ -47,9 +47,9 @@ public final class StatCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
/**
|
||||
* If a given {@link RequestSettings} does not result in a valid statistic look-up,
|
||||
* this will send a feedback message to the CommandSender that made the request.
|
||||
* <br> The following is checked:
|
||||
* If a given {@link RequestSettings} object does not result in a valid
|
||||
* statistic look-up, this will send a feedback message to the CommandSender
|
||||
* that made the request. The following is checked:
|
||||
* <ul>
|
||||
* <li>Is a <code>statistic</code> set?
|
||||
* <li>Is a <code>subStatEntry</code> needed, and if so, is a corresponding Material/EntityType present?
|
@ -1,8 +1,8 @@
|
||||
package com.github.artemis.the.gr8.playerstats.commands;
|
||||
package com.artemis.the.gr8.playerstats.commands;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.utils.EnumHandler;
|
||||
import com.github.artemis.the.gr8.playerstats.utils.OfflinePlayerHandler;
|
||||
import com.github.artemis.the.gr8.playerstats.commands.cmdutils.TabCompleteHelper;
|
||||
import com.artemis.the.gr8.playerstats.utils.EnumHandler;
|
||||
import com.artemis.the.gr8.playerstats.utils.OfflinePlayerHandler;
|
||||
import com.artemis.the.gr8.playerstats.commands.cmdutils.TabCompleteHelper;
|
||||
import org.bukkit.Statistic;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
@ -1,6 +1,6 @@
|
||||
package com.github.artemis.the.gr8.playerstats.commands.cmdutils;
|
||||
package com.artemis.the.gr8.playerstats.commands.cmdutils;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.utils.EnumHandler;
|
||||
import com.artemis.the.gr8.playerstats.utils.EnumHandler;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
@ -1,9 +1,9 @@
|
||||
package com.github.artemis.the.gr8.playerstats.config;
|
||||
package com.artemis.the.gr8.playerstats.config;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.Main;
|
||||
import com.github.artemis.the.gr8.playerstats.enums.Target;
|
||||
import com.github.artemis.the.gr8.playerstats.enums.Unit;
|
||||
import com.github.artemis.the.gr8.playerstats.utils.MyLogger;
|
||||
import com.artemis.the.gr8.playerstats.Main;
|
||||
import com.artemis.the.gr8.playerstats.enums.Target;
|
||||
import com.artemis.the.gr8.playerstats.enums.Unit;
|
||||
import com.artemis.the.gr8.playerstats.utils.MyLogger;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
@ -1,7 +1,7 @@
|
||||
package com.github.artemis.the.gr8.playerstats.config;
|
||||
package com.artemis.the.gr8.playerstats.config;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.Main;
|
||||
import com.github.artemis.the.gr8.playerstats.utils.MyLogger;
|
||||
import com.artemis.the.gr8.playerstats.Main;
|
||||
import com.artemis.the.gr8.playerstats.utils.MyLogger;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
@ -1,4 +1,4 @@
|
||||
package com.github.artemis.the.gr8.playerstats.enums;
|
||||
package com.artemis.the.gr8.playerstats.enums;
|
||||
|
||||
/**
|
||||
* Represents the debugging level that PlayerStats can use.
|
@ -1,4 +1,4 @@
|
||||
package com.github.artemis.the.gr8.playerstats.enums;
|
||||
package com.artemis.the.gr8.playerstats.enums;
|
||||
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.kyori.adventure.text.format.TextColor;
|
@ -1,4 +1,4 @@
|
||||
package com.github.artemis.the.gr8.playerstats.enums;
|
||||
package com.artemis.the.gr8.playerstats.enums;
|
||||
|
||||
/**
|
||||
* All standard messages PlayerStats can send as feedback.
|
@ -1,4 +1,4 @@
|
||||
package com.github.artemis.the.gr8.playerstats.enums;
|
||||
package com.artemis.the.gr8.playerstats.enums;
|
||||
|
||||
/**
|
||||
* This enum represents the targets PlayerStats accepts
|
@ -1,10 +1,11 @@
|
||||
package com.github.artemis.the.gr8.playerstats.enums;
|
||||
package com.artemis.the.gr8.playerstats.enums;
|
||||
|
||||
import org.bukkit.Statistic;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* All the units PlayerStats can display statistics in, separated by Type.
|
||||
* All the units PlayerStats can display statistics in, separated
|
||||
* by {@link Unit.Type}.
|
||||
*/
|
||||
public enum Unit {
|
||||
NUMBER (Type.UNTYPED, "Times"),
|
||||
@ -29,26 +30,31 @@ public enum Unit {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a pretty name belonging to this enum constant. If the Unit is
|
||||
* NUMBER, it will return null.
|
||||
* Gets the pretty name belonging to this enum constant.
|
||||
*
|
||||
* @return the label
|
||||
*/
|
||||
public String getLabel() {
|
||||
return this.label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Type this enum constant belongs to.
|
||||
* Gets the Type this enum constant belongs to.
|
||||
*
|
||||
* @return the Type
|
||||
*/
|
||||
public Type getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
/**
|
||||
* For Type Time, Damage and Distance, this will return a smaller Unit than the current one
|
||||
* (if there is a smaller Unit, that is, otherwise it will return itself).
|
||||
* So for DAY, for example, it can return HOUR, MINUTE or SECOND.
|
||||
* For Type Time, Damage and Distance, this will return a smaller Unit
|
||||
* than the current one (if there is a smaller Unit, that is, otherwise
|
||||
* it will return itself). So for DAY, for example, it can return HOUR,
|
||||
* MINUTE or SECOND.
|
||||
*
|
||||
* @param stepsSmaller how many steps smaller the returned Unit should be
|
||||
* @return the smaller Unit
|
||||
*/
|
||||
public Unit getSmallerUnit(int stepsSmaller) {
|
||||
switch (this) {
|
||||
@ -110,7 +116,9 @@ public enum Unit {
|
||||
|
||||
/**
|
||||
* Converts the current Unit into seconds (and returns
|
||||
* -1 if the current Unit is not of Type TIME)
|
||||
* -1 if the current Unit is not of {@link Unit.Type} TIME).
|
||||
*
|
||||
* @return this Unit in seconds
|
||||
*/
|
||||
public double getSeconds() {
|
||||
return switch (this) {
|
||||
@ -124,11 +132,13 @@ public enum Unit {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Unit corresponding to the given String. This String does NOT need to
|
||||
* match exactly (it can be "day" or "days", for example), and is case-insensitive.
|
||||
* Gets the Unit corresponding to the given String. This String
|
||||
* does not need to match exactly (it can be "day" or "days",
|
||||
* for example), and is case-insensitive.
|
||||
*
|
||||
* @param unitName an approximation of the name belonging to the desired Unit,
|
||||
* @param unitName the name belonging to the desired Unit,
|
||||
* case-insensitive
|
||||
* @return the Unit
|
||||
*/
|
||||
public static @NotNull Unit fromString(@NotNull String unitName) {
|
||||
return switch (unitName.toLowerCase()) {
|
||||
@ -148,10 +158,11 @@ public enum Unit {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Unit.Type of this Statistic, which can be Untyped,
|
||||
* Gets the Unit.Type of this Statistic, which can be Untyped,
|
||||
* Distance, Damage, or Time.
|
||||
*
|
||||
* @param statistic the Statistic enum constant
|
||||
* @return the Type of this Unit
|
||||
*/
|
||||
public static @NotNull Type getTypeFromStatistic(Statistic statistic) {
|
||||
String name = statistic.toString().toLowerCase();
|
||||
@ -167,10 +178,11 @@ public enum Unit {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the most suitable Unit for this number.
|
||||
* Gets the most suitable Unit for this number.
|
||||
*
|
||||
* @param type the Unit.Type of the statistic this number belongs to
|
||||
* @param number the statistic number as returned by Player.getStatistic()
|
||||
* @return the Unit
|
||||
*/
|
||||
public static Unit getMostSuitableUnit(Unit.Type type, long number) {
|
||||
switch (type) {
|
@ -1,6 +1,6 @@
|
||||
package com.github.artemis.the.gr8.playerstats.listeners;
|
||||
package com.artemis.the.gr8.playerstats.listeners;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.ThreadManager;
|
||||
import com.artemis.the.gr8.playerstats.ThreadManager;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
@ -1,16 +1,17 @@
|
||||
package com.github.artemis.the.gr8.playerstats.msg;
|
||||
package com.artemis.the.gr8.playerstats.msg;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.statistic.request.RequestSettings;
|
||||
import com.github.artemis.the.gr8.playerstats.statistic.StatCalculator;
|
||||
import com.artemis.the.gr8.playerstats.statistic.request.RequestSettings;
|
||||
import com.artemis.the.gr8.playerstats.statistic.StatCalculator;
|
||||
import net.kyori.adventure.text.*;
|
||||
import org.jetbrains.annotations.ApiStatus.Internal;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
/** The {@link InternalFormatter} formats raw numbers into pretty messages.
|
||||
* This ApiFormatter takes a {@link RequestSettings} object and combines it with the raw data
|
||||
* returned by the {@link StatCalculator}, and transforms those into a pretty message
|
||||
* with all the relevant information in it.
|
||||
* This Formatter takes a {@link RequestSettings} object and combines it
|
||||
* with the raw data returned by the {@link StatCalculator}, and transforms
|
||||
* those into a pretty message with all the relevant information in it.
|
||||
* @see MessageBuilder
|
||||
*/
|
||||
@Internal
|
||||
public interface InternalFormatter {
|
@ -1,19 +1,20 @@
|
||||
package com.github.artemis.the.gr8.playerstats.msg;
|
||||
package com.artemis.the.gr8.playerstats.msg;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.Main;
|
||||
import com.github.artemis.the.gr8.playerstats.api.ApiFormatter;
|
||||
import com.github.artemis.the.gr8.playerstats.msg.components.ComponentFactory;
|
||||
import com.github.artemis.the.gr8.playerstats.msg.components.ExampleMessage;
|
||||
import com.github.artemis.the.gr8.playerstats.msg.components.HelpMessage;
|
||||
import com.github.artemis.the.gr8.playerstats.msg.components.PrideComponentFactory;
|
||||
import com.github.artemis.the.gr8.playerstats.msg.msgutils.*;
|
||||
import com.github.artemis.the.gr8.playerstats.utils.EnumHandler;
|
||||
import com.github.artemis.the.gr8.playerstats.utils.MyLogger;
|
||||
import com.github.artemis.the.gr8.playerstats.enums.Target;
|
||||
import com.github.artemis.the.gr8.playerstats.config.ConfigHandler;
|
||||
import com.github.artemis.the.gr8.playerstats.enums.Unit;
|
||||
import com.artemis.the.gr8.playerstats.Main;
|
||||
import com.artemis.the.gr8.playerstats.api.ApiFormatter;
|
||||
import com.artemis.the.gr8.playerstats.msg.components.ComponentFactory;
|
||||
import com.artemis.the.gr8.playerstats.msg.components.ExampleMessage;
|
||||
import com.artemis.the.gr8.playerstats.msg.components.HelpMessage;
|
||||
import com.artemis.the.gr8.playerstats.msg.components.BukkitConsoleComponentFactory;
|
||||
import com.artemis.the.gr8.playerstats.msg.components.PrideComponentFactory;
|
||||
import com.artemis.the.gr8.playerstats.msg.msgutils.*;
|
||||
import com.artemis.the.gr8.playerstats.utils.EnumHandler;
|
||||
import com.artemis.the.gr8.playerstats.utils.MyLogger;
|
||||
import com.artemis.the.gr8.playerstats.enums.Target;
|
||||
import com.artemis.the.gr8.playerstats.config.ConfigHandler;
|
||||
import com.artemis.the.gr8.playerstats.enums.Unit;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.statistic.request.RequestSettings;
|
||||
import com.artemis.the.gr8.playerstats.statistic.request.RequestSettings;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import org.bukkit.Statistic;
|
||||
@ -29,10 +30,13 @@ import static net.kyori.adventure.text.Component.*;
|
||||
|
||||
/**
|
||||
* Composes messages to send to a Player or Console. This class is responsible
|
||||
* for constructing a final Component with the text content of the desired message.
|
||||
* The component parts (with appropriate formatting) are supplied by a
|
||||
* {@link ComponentFactory}. By default, this class works with the default
|
||||
* for constructing a final {@link TextComponent} with the text content of the
|
||||
* desired message. The component parts (with appropriate formatting) are supplied
|
||||
* by a {@link ComponentFactory}. By default, this class works with the standard
|
||||
* ComponentFactory, but you can give it a different ComponentFactory upon creation.
|
||||
*
|
||||
* @see PrideComponentFactory
|
||||
* @see BukkitConsoleComponentFactory
|
||||
*/
|
||||
public final class MessageBuilder implements ApiFormatter {
|
||||
|
@ -1,11 +1,11 @@
|
||||
package com.github.artemis.the.gr8.playerstats.msg;
|
||||
package com.artemis.the.gr8.playerstats.msg;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.ShareManager;
|
||||
import com.github.artemis.the.gr8.playerstats.config.ConfigHandler;
|
||||
import com.github.artemis.the.gr8.playerstats.enums.StandardMessage;
|
||||
import com.github.artemis.the.gr8.playerstats.statistic.request.RequestSettings;
|
||||
import com.github.artemis.the.gr8.playerstats.msg.components.BukkitConsoleComponentFactory;
|
||||
import com.github.artemis.the.gr8.playerstats.msg.components.PrideComponentFactory;
|
||||
import com.artemis.the.gr8.playerstats.ShareManager;
|
||||
import com.artemis.the.gr8.playerstats.config.ConfigHandler;
|
||||
import com.artemis.the.gr8.playerstats.enums.StandardMessage;
|
||||
import com.artemis.the.gr8.playerstats.statistic.request.RequestSettings;
|
||||
import com.artemis.the.gr8.playerstats.msg.components.BukkitConsoleComponentFactory;
|
||||
import com.artemis.the.gr8.playerstats.msg.components.PrideComponentFactory;
|
||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -22,7 +22,7 @@ import java.util.LinkedHashMap;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
|
||||
import static com.github.artemis.the.gr8.playerstats.enums.StandardMessage.*;
|
||||
import static com.artemis.the.gr8.playerstats.enums.StandardMessage.*;
|
||||
|
||||
/**
|
||||
* This class manages all PlayerStats output. It is the only
|
||||
@ -30,7 +30,7 @@ import static com.github.artemis.the.gr8.playerstats.enums.StandardMessage.*;
|
||||
* {@link MessageBuilder} configured for either a Console or
|
||||
* for Players (mainly to deal with the lack of hover-text,
|
||||
* and for Bukkit consoles to make up for the lack of hex-colors).
|
||||
* */
|
||||
*/
|
||||
public final class OutputManager implements InternalFormatter {
|
||||
|
||||
private static BukkitAudiences adventure;
|
@ -1,7 +1,7 @@
|
||||
package com.github.artemis.the.gr8.playerstats.msg.components;
|
||||
package com.artemis.the.gr8.playerstats.msg.components;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.enums.PluginColor;
|
||||
import com.github.artemis.the.gr8.playerstats.config.ConfigHandler;
|
||||
import com.artemis.the.gr8.playerstats.enums.PluginColor;
|
||||
import com.artemis.the.gr8.playerstats.config.ConfigHandler;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.kyori.adventure.text.format.TextColor;
|
@ -1,11 +1,11 @@
|
||||
package com.github.artemis.the.gr8.playerstats.msg.components;
|
||||
package com.artemis.the.gr8.playerstats.msg.components;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.config.ConfigHandler;
|
||||
import com.github.artemis.the.gr8.playerstats.enums.PluginColor;
|
||||
import com.github.artemis.the.gr8.playerstats.enums.Target;
|
||||
import com.github.artemis.the.gr8.playerstats.enums.Unit;
|
||||
import com.github.artemis.the.gr8.playerstats.msg.MessageBuilder;
|
||||
import com.github.artemis.the.gr8.playerstats.msg.msgutils.LanguageKeyHandler;
|
||||
import com.artemis.the.gr8.playerstats.config.ConfigHandler;
|
||||
import com.artemis.the.gr8.playerstats.enums.PluginColor;
|
||||
import com.artemis.the.gr8.playerstats.enums.Target;
|
||||
import com.artemis.the.gr8.playerstats.enums.Unit;
|
||||
import com.artemis.the.gr8.playerstats.msg.MessageBuilder;
|
||||
import com.artemis.the.gr8.playerstats.msg.msgutils.LanguageKeyHandler;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.kyori.adventure.text.TranslatableComponent;
|
||||
@ -26,8 +26,10 @@ import static net.kyori.adventure.text.Component.*;
|
||||
* {@link MessageBuilder} to build messages with. This class
|
||||
* can put Strings into formatted Components with TextColor
|
||||
* and TextDecoration, or return empty Components with the
|
||||
* desired formatting.
|
||||
* */
|
||||
* desired formatting (as specified by the {@link ConfigHandler}).
|
||||
*
|
||||
* @see PluginColor
|
||||
*/
|
||||
public class ComponentFactory {
|
||||
|
||||
private static ConfigHandler config;
|
@ -1,7 +1,7 @@
|
||||
package com.github.artemis.the.gr8.playerstats.msg.components;
|
||||
package com.artemis.the.gr8.playerstats.msg.components;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.msg.msgutils.LanguageKeyHandler;
|
||||
import com.github.artemis.the.gr8.playerstats.msg.msgutils.StringUtils;
|
||||
import com.artemis.the.gr8.playerstats.msg.msgutils.LanguageKeyHandler;
|
||||
import com.artemis.the.gr8.playerstats.msg.msgutils.StringUtils;
|
||||
import net.kyori.adventure.text.*;
|
||||
import net.kyori.adventure.text.flattener.ComponentFlattener;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
@ -17,6 +17,9 @@ public final class ComponentUtils {
|
||||
* language-keys I am using to improve the entity-related statistic
|
||||
* names. This serializer will create a String with hex colors and styles,
|
||||
* and it will turn language keys into prettified, readable English.
|
||||
*
|
||||
* @return the Serializer
|
||||
* @see LanguageKeyHandler
|
||||
*/
|
||||
public static LegacyComponentSerializer getTranslatableComponentSerializer() {
|
||||
LegacyComponentSerializer serializer = getTextComponentSerializer();
|
@ -1,4 +1,4 @@
|
||||
package com.github.artemis.the.gr8.playerstats.msg.components;
|
||||
package com.artemis.the.gr8.playerstats.msg.components;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.ComponentLike;
|
@ -1,4 +1,4 @@
|
||||
package com.github.artemis.the.gr8.playerstats.msg.components;
|
||||
package com.artemis.the.gr8.playerstats.msg.components;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.ComponentLike;
|
@ -1,8 +1,8 @@
|
||||
package com.github.artemis.the.gr8.playerstats.msg.components;
|
||||
package com.artemis.the.gr8.playerstats.msg.components;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.config.ConfigHandler;
|
||||
import com.artemis.the.gr8.playerstats.config.ConfigHandler;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.enums.PluginColor;
|
||||
import com.artemis.the.gr8.playerstats.enums.PluginColor;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.kyori.adventure.text.format.TextColor;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
@ -1,4 +1,4 @@
|
||||
package com.github.artemis.the.gr8.playerstats.msg.msgutils;
|
||||
package com.artemis.the.gr8.playerstats.msg.msgutils;
|
||||
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import net.kyori.adventure.text.Component;
|
@ -1,4 +1,4 @@
|
||||
package com.github.artemis.the.gr8.playerstats.msg.msgutils;
|
||||
package com.artemis.the.gr8.playerstats.msg.msgutils;
|
||||
|
||||
import org.bukkit.map.MinecraftFont;
|
||||
|
@ -1,9 +1,9 @@
|
||||
package com.github.artemis.the.gr8.playerstats.msg.msgutils;
|
||||
package com.artemis.the.gr8.playerstats.msg.msgutils;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.Main;
|
||||
import com.github.artemis.the.gr8.playerstats.utils.EnumHandler;
|
||||
import com.github.artemis.the.gr8.playerstats.utils.MyLogger;
|
||||
import com.github.artemis.the.gr8.playerstats.enums.Unit;
|
||||
import com.artemis.the.gr8.playerstats.Main;
|
||||
import com.artemis.the.gr8.playerstats.utils.EnumHandler;
|
||||
import com.artemis.the.gr8.playerstats.utils.MyLogger;
|
||||
import com.artemis.the.gr8.playerstats.enums.Unit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Statistic;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
@ -30,6 +30,10 @@ public final class LanguageKeyHandler {
|
||||
private static FileConfiguration languageKeys;
|
||||
|
||||
/**
|
||||
* Since this class uses a file to get the English translations
|
||||
* of languageKeys, it needs an instance of the PlayerStats
|
||||
* plugin to get access to this file.
|
||||
*
|
||||
* @param plugin an instance of PlayerStats' Main class
|
||||
*/
|
||||
public LanguageKeyHandler(Main plugin) {
|
@ -1,6 +1,6 @@
|
||||
package com.github.artemis.the.gr8.playerstats.msg.msgutils;
|
||||
package com.artemis.the.gr8.playerstats.msg.msgutils;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.enums.Unit;
|
||||
import com.artemis.the.gr8.playerstats.enums.Unit;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.artemis.the.gr8.playerstats.msg.msgutils;
|
||||
package com.artemis.the.gr8.playerstats.msg.msgutils;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.utils.MyLogger;
|
||||
import com.artemis.the.gr8.playerstats.utils.MyLogger;
|
||||
|
||||
/**
|
||||
* A small utility class that helps make enum constant
|
@ -1,8 +1,9 @@
|
||||
package com.github.artemis.the.gr8.playerstats.reload;
|
||||
package com.artemis.the.gr8.playerstats.reload;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.ThreadManager;
|
||||
import com.github.artemis.the.gr8.playerstats.utils.MyLogger;
|
||||
import com.github.artemis.the.gr8.playerstats.utils.UnixTimeHandler;
|
||||
import com.artemis.the.gr8.playerstats.ThreadManager;
|
||||
import com.artemis.the.gr8.playerstats.utils.MyLogger;
|
||||
import com.artemis.the.gr8.playerstats.utils.OfflinePlayerHandler;
|
||||
import com.artemis.the.gr8.playerstats.utils.UnixTimeHandler;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
import java.util.UUID;
|
||||
@ -30,6 +31,7 @@ final class ReloadAction extends RecursiveAction {
|
||||
* @param players array of all OfflinePlayers (straight from Bukkit)
|
||||
* @param lastPlayedLimit whether to set a limit based on last-played-date
|
||||
* @param offlinePlayerUUIDs the ConcurrentHashMap to put playerNames and UUIDs in
|
||||
* @see OfflinePlayerHandler
|
||||
*/
|
||||
public ReloadAction(OfflinePlayer[] players,
|
||||
int lastPlayedLimit, ConcurrentHashMap<String, UUID> offlinePlayerUUIDs) {
|
@ -1,16 +1,16 @@
|
||||
package com.github.artemis.the.gr8.playerstats.reload;
|
||||
package com.artemis.the.gr8.playerstats.reload;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.ShareManager;
|
||||
import com.github.artemis.the.gr8.playerstats.ThreadManager;
|
||||
import com.github.artemis.the.gr8.playerstats.enums.StandardMessage;
|
||||
import com.github.artemis.the.gr8.playerstats.msg.OutputManager;
|
||||
import com.github.artemis.the.gr8.playerstats.msg.msgutils.LanguageKeyHandler;
|
||||
import com.github.artemis.the.gr8.playerstats.statistic.StatCalculator;
|
||||
import com.github.artemis.the.gr8.playerstats.statistic.StatThread;
|
||||
import com.github.artemis.the.gr8.playerstats.utils.MyLogger;
|
||||
import com.github.artemis.the.gr8.playerstats.utils.OfflinePlayerHandler;
|
||||
import com.github.artemis.the.gr8.playerstats.config.ConfigHandler;
|
||||
import com.github.artemis.the.gr8.playerstats.enums.DebugLevel;
|
||||
import com.artemis.the.gr8.playerstats.ShareManager;
|
||||
import com.artemis.the.gr8.playerstats.ThreadManager;
|
||||
import com.artemis.the.gr8.playerstats.enums.StandardMessage;
|
||||
import com.artemis.the.gr8.playerstats.msg.OutputManager;
|
||||
import com.artemis.the.gr8.playerstats.msg.msgutils.LanguageKeyHandler;
|
||||
import com.artemis.the.gr8.playerstats.statistic.StatCalculator;
|
||||
import com.artemis.the.gr8.playerstats.statistic.StatThread;
|
||||
import com.artemis.the.gr8.playerstats.utils.MyLogger;
|
||||
import com.artemis.the.gr8.playerstats.utils.OfflinePlayerHandler;
|
||||
import com.artemis.the.gr8.playerstats.config.ConfigHandler;
|
||||
import com.artemis.the.gr8.playerstats.enums.DebugLevel;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.CommandSender;
|
@ -1,9 +1,9 @@
|
||||
package com.github.artemis.the.gr8.playerstats.statistic;
|
||||
package com.artemis.the.gr8.playerstats.statistic;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.ThreadManager;
|
||||
import com.github.artemis.the.gr8.playerstats.utils.OfflinePlayerHandler;
|
||||
import com.github.artemis.the.gr8.playerstats.statistic.request.RequestSettings;
|
||||
import com.github.artemis.the.gr8.playerstats.utils.MyLogger;
|
||||
import com.artemis.the.gr8.playerstats.ThreadManager;
|
||||
import com.artemis.the.gr8.playerstats.utils.OfflinePlayerHandler;
|
||||
import com.artemis.the.gr8.playerstats.statistic.request.RequestSettings;
|
||||
import com.artemis.the.gr8.playerstats.utils.MyLogger;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
@ -24,12 +24,14 @@ final class StatAction extends RecursiveTask<ConcurrentHashMap<String, Integer>>
|
||||
private final ConcurrentHashMap<String, Integer> allStats;
|
||||
|
||||
/**
|
||||
* Gets the statistic numbers for all players whose name is on the list, puts them in a ConcurrentHashMap
|
||||
* using the default ForkJoinPool, and returns the ConcurrentHashMap when everything is done.
|
||||
* Gets the statistic numbers for all players whose name is on
|
||||
* the list, puts them in a ConcurrentHashMap using the default
|
||||
* ForkJoinPool, and returns the ConcurrentHashMap when
|
||||
* everything is done.
|
||||
*
|
||||
* @param offlinePlayerHandler the OfflinePlayerHandler to convert playerNames into Players
|
||||
* @param playerNames ImmutableList of playerNames for players that should be included in stat calculations
|
||||
* @param requestSettings a validated requestSettings
|
||||
* @param requestSettings a validated requestSettings object
|
||||
* @param allStats the ConcurrentHashMap to put the results on
|
||||
*/
|
||||
public StatAction(OfflinePlayerHandler offlinePlayerHandler, ImmutableList<String> playerNames, RequestSettings requestSettings, ConcurrentHashMap<String, Integer> allStats) {
|
@ -1,9 +1,9 @@
|
||||
package com.github.artemis.the.gr8.playerstats.statistic;
|
||||
package com.artemis.the.gr8.playerstats.statistic;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.ThreadManager;
|
||||
import com.github.artemis.the.gr8.playerstats.utils.OfflinePlayerHandler;
|
||||
import com.github.artemis.the.gr8.playerstats.statistic.request.RequestSettings;
|
||||
import com.github.artemis.the.gr8.playerstats.utils.MyLogger;
|
||||
import com.artemis.the.gr8.playerstats.ThreadManager;
|
||||
import com.artemis.the.gr8.playerstats.utils.OfflinePlayerHandler;
|
||||
import com.artemis.the.gr8.playerstats.statistic.request.RequestSettings;
|
||||
import com.artemis.the.gr8.playerstats.utils.MyLogger;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@ -47,9 +47,8 @@ public final class StatCalculator {
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes a bunch of worker pool threads to divide and conquer
|
||||
* (get the statistics for all players that are stored in the
|
||||
* {@link OfflinePlayerHandler})
|
||||
* Invokes a bunch of worker pool threads to get the statistics for
|
||||
* all players that are stored in the {@link OfflinePlayerHandler}).
|
||||
*/
|
||||
private @NotNull ConcurrentHashMap<String, Integer> getAllStatsAsync(RequestSettings requestSettings) {
|
||||
long time = System.currentTimeMillis();
|
@ -1,12 +1,12 @@
|
||||
package com.github.artemis.the.gr8.playerstats.statistic;
|
||||
package com.artemis.the.gr8.playerstats.statistic;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.ThreadManager;
|
||||
import com.github.artemis.the.gr8.playerstats.msg.OutputManager;
|
||||
import com.github.artemis.the.gr8.playerstats.utils.MyLogger;
|
||||
import com.github.artemis.the.gr8.playerstats.enums.StandardMessage;
|
||||
import com.github.artemis.the.gr8.playerstats.enums.Target;
|
||||
import com.github.artemis.the.gr8.playerstats.statistic.request.RequestSettings;
|
||||
import com.github.artemis.the.gr8.playerstats.reload.ReloadThread;
|
||||
import com.artemis.the.gr8.playerstats.ThreadManager;
|
||||
import com.artemis.the.gr8.playerstats.msg.OutputManager;
|
||||
import com.artemis.the.gr8.playerstats.utils.MyLogger;
|
||||
import com.artemis.the.gr8.playerstats.enums.StandardMessage;
|
||||
import com.artemis.the.gr8.playerstats.enums.Target;
|
||||
import com.artemis.the.gr8.playerstats.statistic.request.RequestSettings;
|
||||
import com.artemis.the.gr8.playerstats.reload.ReloadThread;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
@ -1,9 +1,9 @@
|
||||
package com.github.artemis.the.gr8.playerstats.statistic.request;
|
||||
package com.artemis.the.gr8.playerstats.statistic.request;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.Main;
|
||||
import com.github.artemis.the.gr8.playerstats.statistic.result.PlayerStatResult;
|
||||
import com.github.artemis.the.gr8.playerstats.api.RequestGenerator;
|
||||
import com.github.artemis.the.gr8.playerstats.msg.components.ComponentUtils;
|
||||
import com.artemis.the.gr8.playerstats.Main;
|
||||
import com.artemis.the.gr8.playerstats.statistic.result.PlayerStatResult;
|
||||
import com.artemis.the.gr8.playerstats.api.RequestGenerator;
|
||||
import com.artemis.the.gr8.playerstats.msg.components.ComponentUtils;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Statistic;
|
@ -1,9 +1,9 @@
|
||||
package com.github.artemis.the.gr8.playerstats.statistic.request;
|
||||
package com.artemis.the.gr8.playerstats.statistic.request;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.Main;
|
||||
import com.github.artemis.the.gr8.playerstats.enums.Target;
|
||||
import com.github.artemis.the.gr8.playerstats.utils.EnumHandler;
|
||||
import com.github.artemis.the.gr8.playerstats.utils.OfflinePlayerHandler;
|
||||
import com.artemis.the.gr8.playerstats.Main;
|
||||
import com.artemis.the.gr8.playerstats.utils.EnumHandler;
|
||||
import com.artemis.the.gr8.playerstats.utils.OfflinePlayerHandler;
|
||||
import com.artemis.the.gr8.playerstats.enums.Target;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Statistic;
|
||||
import org.bukkit.command.CommandSender;
|
@ -1,7 +1,7 @@
|
||||
package com.github.artemis.the.gr8.playerstats.statistic.request;
|
||||
package com.artemis.the.gr8.playerstats.statistic.request;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.api.RequestGenerator;
|
||||
import com.github.artemis.the.gr8.playerstats.enums.Target;
|
||||
import com.artemis.the.gr8.playerstats.api.RequestGenerator;
|
||||
import com.artemis.the.gr8.playerstats.enums.Target;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Statistic;
|
@ -1,9 +1,9 @@
|
||||
package com.github.artemis.the.gr8.playerstats.statistic.request;
|
||||
package com.artemis.the.gr8.playerstats.statistic.request;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.Main;
|
||||
import com.github.artemis.the.gr8.playerstats.statistic.result.ServerStatResult;
|
||||
import com.github.artemis.the.gr8.playerstats.api.RequestGenerator;
|
||||
import com.github.artemis.the.gr8.playerstats.msg.components.ComponentUtils;
|
||||
import com.artemis.the.gr8.playerstats.Main;
|
||||
import com.artemis.the.gr8.playerstats.statistic.result.ServerStatResult;
|
||||
import com.artemis.the.gr8.playerstats.api.RequestGenerator;
|
||||
import com.artemis.the.gr8.playerstats.msg.components.ComponentUtils;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Statistic;
|
@ -1,7 +1,8 @@
|
||||
package com.github.artemis.the.gr8.playerstats.statistic.request;
|
||||
package com.artemis.the.gr8.playerstats.statistic.request;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.statistic.result.StatResult;
|
||||
import com.github.artemis.the.gr8.playerstats.enums.Target;
|
||||
import com.artemis.the.gr8.playerstats.api.PlayerStats;
|
||||
import com.artemis.the.gr8.playerstats.statistic.result.StatResult;
|
||||
import com.artemis.the.gr8.playerstats.enums.Target;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Statistic;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@ -24,16 +25,21 @@ public abstract class StatRequest<T> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes this StatRequest. Don't call this from the Main Thread!
|
||||
* Executes this StatRequest. For a Top- or ServerRequest, this can
|
||||
* take some time!
|
||||
*
|
||||
* @return a StatResult containing the value of this lookup, both as
|
||||
* numerical value and as formatted message
|
||||
* @see PlayerStats
|
||||
* @see StatResult
|
||||
*/
|
||||
public abstract StatResult<T> execute();
|
||||
|
||||
/**
|
||||
* @return the Statistic this StatRequest will get the data of
|
||||
* */
|
||||
* Gets the Statistic that calling {@link #execute()} will calculate
|
||||
* the data for.
|
||||
* @return the Statistic
|
||||
*/
|
||||
public Statistic getStatisticSetting() {
|
||||
return requestSettings.getStatistic();
|
||||
}
|
||||
@ -71,6 +77,8 @@ public abstract class StatRequest<T> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Target that will be used when calling {@link #execute()}.
|
||||
*
|
||||
* @return the Target for this lookup (either Player, Server or Top)
|
||||
*/
|
||||
public Target getTargetSetting() {
|
@ -1,9 +1,9 @@
|
||||
package com.github.artemis.the.gr8.playerstats.statistic.request;
|
||||
package com.artemis.the.gr8.playerstats.statistic.request;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.Main;
|
||||
import com.github.artemis.the.gr8.playerstats.statistic.result.TopStatResult;
|
||||
import com.github.artemis.the.gr8.playerstats.api.RequestGenerator;
|
||||
import com.github.artemis.the.gr8.playerstats.msg.components.ComponentUtils;
|
||||
import com.artemis.the.gr8.playerstats.Main;
|
||||
import com.artemis.the.gr8.playerstats.statistic.result.TopStatResult;
|
||||
import com.artemis.the.gr8.playerstats.api.RequestGenerator;
|
||||
import com.artemis.the.gr8.playerstats.msg.components.ComponentUtils;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Statistic;
|
@ -1,6 +1,6 @@
|
||||
package com.github.artemis.the.gr8.playerstats.statistic.result;
|
||||
package com.artemis.the.gr8.playerstats.statistic.result;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.msg.components.ComponentUtils;
|
||||
import com.artemis.the.gr8.playerstats.msg.components.ComponentUtils;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
|
||||
/**
|
@ -1,4 +1,4 @@
|
||||
package com.github.artemis.the.gr8.playerstats.statistic.result;
|
||||
package com.artemis.the.gr8.playerstats.statistic.result;
|
||||
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.github.artemis.the.gr8.playerstats.statistic.result;
|
||||
package com.artemis.the.gr8.playerstats.statistic.result;
|
||||
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.artemis.the.gr8.playerstats.statistic.result;
|
||||
package com.artemis.the.gr8.playerstats.statistic.result;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.api.ApiFormatter;
|
||||
import com.artemis.the.gr8.playerstats.api.ApiFormatter;
|
||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
|
||||
@ -35,9 +35,9 @@ import net.kyori.adventure.text.TextComponent;
|
||||
* on how to get and use the BukkitAudiences object can be found on
|
||||
* <a href="https://docs.adventure.kyori.net/platform/bukkit.html">Adventure's website</a>.
|
||||
*
|
||||
* <p>You can also use the provided {@link #getFormattedString()} method to
|
||||
* get the same information in String-format. Don't use Adventure's .content()
|
||||
* or .toString() methods on the Components - those won't get the actual
|
||||
* <p>You can also use the provided {@link #getFormattedString()} method to get the
|
||||
* same information in String-format. Don't use Adventure's <code>#content()</code>
|
||||
* or <code>#toString()</code> methods on the Components - those won't get the actual
|
||||
* message. And finally, if you want the results to be formatted differently,
|
||||
* you can get an instance of the {@link ApiFormatter}.
|
||||
*/
|
||||
@ -54,23 +54,25 @@ public interface StatResult<T> {
|
||||
|
||||
/**
|
||||
* Gets the formatted message for the completed stat-lookup this
|
||||
* {@link StatResult} stores.
|
||||
* StatResult stores.
|
||||
|
||||
* @return a {@code TextComponent} message containing the formatted number.
|
||||
* This message follows the same style/color/language settings that are
|
||||
* specified in the PlayerStats config. See class description for more
|
||||
* information.
|
||||
* @see StatResult
|
||||
*/
|
||||
TextComponent getFormattedTextComponent();
|
||||
|
||||
/**
|
||||
* Gets the formatted message for the completed stat-lookup this
|
||||
* {@link StatResult} stores.
|
||||
* StatResult stores.
|
||||
|
||||
* @return a String message containing the formatted number. This message
|
||||
* follows the same style and color settings that are specified in the
|
||||
* PlayerStats config, but it is not translatable (it is always plain English).
|
||||
* See class description for more information.
|
||||
* @see StatResult
|
||||
*/
|
||||
String getFormattedString();
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.github.artemis.the.gr8.playerstats.statistic.result;
|
||||
package com.artemis.the.gr8.playerstats.statistic.result;
|
||||
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.github.artemis.the.gr8.playerstats.utils;
|
||||
package com.artemis.the.gr8.playerstats.utils;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Statistic;
|
||||
@ -32,6 +32,8 @@ public final class EnumHandler {
|
||||
|
||||
/**
|
||||
* Returns all block-names in lowercase.
|
||||
*
|
||||
* @return the List
|
||||
*/
|
||||
public List<String> getBlockNames() {
|
||||
return blockNames;
|
||||
@ -39,6 +41,8 @@ public final class EnumHandler {
|
||||
|
||||
/**
|
||||
* Returns all item-names in lowercase.
|
||||
*
|
||||
* @return the List
|
||||
*/
|
||||
public List<String> getItemNames() {
|
||||
return itemNames;
|
||||
@ -46,6 +50,8 @@ public final class EnumHandler {
|
||||
|
||||
/**
|
||||
* Returns all statistic-names in lowercase.
|
||||
*
|
||||
* @return the List
|
||||
*/
|
||||
public List<String> getStatNames() {
|
||||
return statNames;
|
||||
@ -54,8 +60,9 @@ public final class EnumHandler {
|
||||
/**
|
||||
* Returns the corresponding Material enum constant for an itemName.
|
||||
*
|
||||
* @param itemName String, case-insensitive
|
||||
* @return Material enum constant, uppercase
|
||||
* @param itemName String (case-insensitive)
|
||||
* @return Material enum constant (uppercase), or null if none
|
||||
* can be found
|
||||
*/
|
||||
public static @Nullable Material getItemEnum(String itemName) {
|
||||
if (itemName == null) return null;
|
||||
@ -67,8 +74,9 @@ public final class EnumHandler {
|
||||
/**
|
||||
* Returns the corresponding EntityType enum constant for an entityName.
|
||||
*
|
||||
* @param entityName String, case-insensitive
|
||||
* @return EntityType enum constant, uppercase
|
||||
* @param entityName String (case-insensitive)
|
||||
* @return EntityType enum constant (uppercase), or null if none
|
||||
* can be found
|
||||
*/
|
||||
public static @Nullable EntityType getEntityEnum(String entityName) {
|
||||
try {
|
||||
@ -82,8 +90,9 @@ public final class EnumHandler {
|
||||
/**
|
||||
* Returns the corresponding Material enum constant for a materialName.
|
||||
*
|
||||
* @param materialName String, case-insensitive
|
||||
* @return Material enum constant, uppercase
|
||||
* @param materialName String (case-insensitive)
|
||||
* @return Material enum constant (uppercase), or null if none
|
||||
* can be found
|
||||
*/
|
||||
public static @Nullable Material getBlockEnum(String materialName) {
|
||||
if (materialName == null) return null;
|
||||
@ -95,7 +104,8 @@ public final class EnumHandler {
|
||||
/**
|
||||
* Returns the statistic enum constant, or null if that failed.
|
||||
*
|
||||
* @param statName String, case-insensitive
|
||||
* @param statName String (case-insensitive)
|
||||
* @return the Statistic enum constant, or null
|
||||
*/
|
||||
public static @Nullable Statistic getStatEnum(@NotNull String statName) {
|
||||
try {
|
||||
@ -107,16 +117,21 @@ public final class EnumHandler {
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if string is a valid statistic.
|
||||
* Checks if string is a valid {@link Statistic}.
|
||||
*
|
||||
* @param statName String, case-insensitive
|
||||
* @param statName the String to check (case-insensitive)
|
||||
* @return true if this String is a valid Statistic
|
||||
*/
|
||||
public boolean isStatistic(@NotNull String statName) {
|
||||
return statNames.contains(statName.toLowerCase());
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the given String equals the name of an entity-type statistic.
|
||||
* Checks whether the given String equals the name of a
|
||||
* {@link Statistic} of Type.Entity.
|
||||
*
|
||||
* @param statName the String to check (case-insensitive)
|
||||
* @return true if this String is a Statistic of Type.Entity
|
||||
*/
|
||||
public boolean isEntityStatistic(String statName) {
|
||||
return statName.equalsIgnoreCase(Statistic.ENTITY_KILLED_BY.toString()) ||
|
||||
@ -127,14 +142,19 @@ public final class EnumHandler {
|
||||
* Checks if this statistic is a subStatEntry, meaning it is a block,
|
||||
* item or entity.
|
||||
*
|
||||
* @param statName String, case-insensitive
|
||||
* @param statName the String to check (case-insensitive)
|
||||
* @return true if this String is a Statistic that is not
|
||||
* of Type.Untyped
|
||||
*/
|
||||
public boolean isSubStatEntry(@NotNull String statName) {
|
||||
return subStatNames.contains(statName.toLowerCase());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns "block", "entity", "item", or "sub-statistic" if the
|
||||
* Gets the name of the given Statistic.Type
|
||||
*
|
||||
* @param statType the Type of the Statistic to check
|
||||
* @return "block", "entity", "item", or "sub-statistic" if the
|
||||
* provided Type is null.
|
||||
*/
|
||||
public static String getSubStatTypeName(Statistic.Type statType) {
|
@ -1,6 +1,6 @@
|
||||
package com.github.artemis.the.gr8.playerstats.utils;
|
||||
package com.artemis.the.gr8.playerstats.utils;
|
||||
|
||||
import com.github.artemis.the.gr8.playerstats.enums.DebugLevel;
|
||||
import com.artemis.the.gr8.playerstats.enums.DebugLevel;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
@ -1,4 +1,4 @@
|
||||
package com.github.artemis.the.gr8.playerstats.utils;
|
||||
package com.artemis.the.gr8.playerstats.utils;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@ -37,15 +37,18 @@ public final class OfflinePlayerHandler {
|
||||
* Checks if a given playerName is on the private HashMap of players
|
||||
* that should be included in statistic calculations.
|
||||
*
|
||||
* @param playerName String, case-sensitive
|
||||
* @param playerName String (case-sensitive)
|
||||
* @return true if this Player should be included in calculations
|
||||
*/
|
||||
public boolean isRelevantPlayer(String playerName) {
|
||||
return offlinePlayerUUIDs.containsKey(playerName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of OfflinePlayers that are included in
|
||||
* statistic calculations
|
||||
* Gets the number of OfflinePlayers that are included in
|
||||
* statistic calculations.
|
||||
*
|
||||
* @return the number of included OfflinePlayers
|
||||
*/
|
||||
public int getOfflinePlayerCount() {
|
||||
return offlinePlayerUUIDs.size();
|
||||
@ -54,6 +57,8 @@ public final class OfflinePlayerHandler {
|
||||
/**
|
||||
* Gets an ArrayList of names from all OfflinePlayers that should
|
||||
* be included in statistic calculations.
|
||||
*
|
||||
* @return the ArrayList
|
||||
*/
|
||||
public ArrayList<String> getOfflinePlayerNames() {
|
||||
return playerNames;
|
@ -1,4 +1,4 @@
|
||||
package com.github.artemis.the.gr8.playerstats.utils;
|
||||
package com.artemis.the.gr8.playerstats.utils;
|
||||
|
||||
/**
|
||||
* A small utility class that calculates with unix time.
|
@ -1,4 +0,0 @@
|
||||
/**
|
||||
* The PlayerStats API
|
||||
*/
|
||||
package com.github.artemis.the.gr8.playerstats.api;
|
Loading…
Reference in New Issue
Block a user