Added bStats!

This commit is contained in:
Artemis-the-gr8 2022-07-26 01:17:33 +02:00
parent fe4f5db12e
commit 810c93c5bd
5 changed files with 18 additions and 2 deletions

11
pom.xml
View File

@ -76,6 +76,13 @@
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
<version>3.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
@ -127,6 +134,10 @@
<pattern>com.tchristofferson</pattern>
<shadedPattern>com.gmail.artemis.the.gr8.tchristofferson</shadedPattern>
</relocation>
<relocation>
<pattern>org.bstats</pattern>
<shadedPattern>com.gmail.artemis.the.gr8.bstats</shadedPattern>
</relocation>
</relocations>
<filters>
<filter>

View File

@ -13,6 +13,7 @@ import com.gmail.artemis.the.gr8.playerstats.statistic.RequestManager;
import com.gmail.artemis.the.gr8.playerstats.statistic.StatManager;
import com.gmail.artemis.the.gr8.playerstats.utils.OfflinePlayerHandler;
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
import org.bstats.bukkit.Metrics;
import org.bukkit.Bukkit;
import org.bukkit.command.PluginCommand;
import org.bukkit.plugin.java.JavaPlugin;
@ -32,6 +33,8 @@ public final class Main extends JavaPlugin {
@Override
public void onEnable() {
//TODO fix (move these two into initializeMainClasses also, and remove all the Main.get... methods)
Metrics metrics = new Metrics(this, 15923);
//first get an instance of all the classes that need to be passed along to different classes
ConfigHandler config = new ConfigHandler(this);
OfflinePlayerHandler offlinePlayerHandler = new OfflinePlayerHandler();

View File

@ -50,7 +50,7 @@ public interface PlayerStats {
Adventure's TextComponents, you can call this method to turn any stat-result into a String.
@return a String representation of this TextComponent, without color and style, but with line-breaks*/
default String statResultComponentToString(TextComponent statResult) {
return LegacyComponentSerializer.builder().hexColors().build().serialize(statResult);
return LegacyComponentSerializer.builder().hexColors().useUnusualXRepeatedCharacterHexFormat().build().serialize(statResult);
}
/** Get a formatted player-statistic of Statistic.Type UNTYPED.

View File

@ -4,6 +4,7 @@ import com.gmail.artemis.the.gr8.playerstats.enums.Target;
import com.gmail.artemis.the.gr8.playerstats.models.StatRequest;
import com.gmail.artemis.the.gr8.playerstats.statistic.RequestManager;
import com.gmail.artemis.the.gr8.playerstats.statistic.StatManager;
import com.gmail.artemis.the.gr8.playerstats.utils.MyLogger;
import net.kyori.adventure.text.TextComponent;
import org.bukkit.Material;
import org.bukkit.Statistic;
@ -79,6 +80,7 @@ public final class PlayerStatsAPI implements PlayerStats {
@Nullable Material material, @Nullable EntityType entity, @Nullable String playerName) throws NullPointerException {
StatRequest request = requestManager.generateRequest(selection, statistic, material, entity, playerName);
if (requestManager.validateAPIRequest(request)) {
MyLogger.logMsg("API is being called! We are calculating a " + selection + "for " + statistic);
switch (selection) {
case PLAYER -> {
int stat = statManager.getPlayerStat(request);

View File

@ -51,7 +51,7 @@ public final class EasterEggProvider {
}
case "46dd0c5a-2b51-4ee6-80e8-29deca6dedc1" -> {
if (sillyNumberIsBetween(sillyNumber, 0, 20)) {
playerName = "<papi:luckperms_prefix><gradient:#f74040:#FF6600:#f74040>fire demon</gradient>";
playerName = "<gradient:#f74040:#FF6600:#f74040>fire demon</gradient>";
}
else if (sillyNumberIsBetween(sillyNumber, 69, 69)) {
playerName = "<gradient:blue:#b01bd1:blue>best admin</gradient>";