diff --git a/pom.xml b/pom.xml index 217a328..32d5f64 100644 --- a/pom.xml +++ b/pom.xml @@ -40,6 +40,12 @@ provided + + net.kyori + adventure-api + 4.11.0 + + net.kyori adventure-platform-bukkit diff --git a/src/main/java/com/gmail/artemis/the/gr8/playerstats/Main.java b/src/main/java/com/gmail/artemis/the/gr8/playerstats/Main.java index 6d3034a..afc03da 100644 --- a/src/main/java/com/gmail/artemis/the/gr8/playerstats/Main.java +++ b/src/main/java/com/gmail/artemis/the/gr8/playerstats/Main.java @@ -14,9 +14,6 @@ import org.bukkit.command.PluginCommand; import org.bukkit.plugin.java.JavaPlugin; import org.jetbrains.annotations.NotNull; -import java.time.LocalDate; -import java.time.Month; - public class Main extends JavaPlugin { diff --git a/src/main/java/com/gmail/artemis/the/gr8/playerstats/msg/MessageFactory.java b/src/main/java/com/gmail/artemis/the/gr8/playerstats/msg/MessageFactory.java index e0ad6f3..4d795fe 100644 --- a/src/main/java/com/gmail/artemis/the/gr8/playerstats/msg/MessageFactory.java +++ b/src/main/java/com/gmail/artemis/the/gr8/playerstats/msg/MessageFactory.java @@ -53,7 +53,7 @@ public class MessageFactory { public TextComponent reloadedConfig(boolean isConsoleSender) { return pluginPrefix(isConsoleSender) .append(text("Config reloaded!") - .color(NamedTextColor.GREEN)); + .color(msgColor)); } public TextComponent stillReloading(boolean isConsoleSender) { @@ -257,7 +257,7 @@ public class MessageFactory { TextDecoration statNameStyle = getStyleFromString(config.getStatNameFormatting(selection, true)); Statistic.Type statType = EnumHandler.getStatType(statName); - TranslatableComponent subStat = subStatNameComponent(selection, subStatName, statType); + TextComponent subStat = subStatNameComponent(selection, subStatName, statType); TranslatableComponent.Builder totalName; String key = getLanguageKey(statName, null, statType); @@ -271,17 +271,17 @@ public class MessageFactory { } else { totalName = translatable().key(key); + if (subStat != null) totalName.append(space()).append(subStat); } if (statNameStyle != null) totalName.decoration(statNameStyle, TextDecoration.State.TRUE); - if (subStat != null) totalName.append(space()).append(subStat); return totalName .color(statNameColor) .build(); } /** Construct a custom translation for kill_entity */ - private TranslatableComponent.@NotNull Builder killEntityComponent(TranslatableComponent subStat) { + private TranslatableComponent.@NotNull Builder killEntityComponent(TextComponent subStat) { TranslatableComponent.Builder totalName = translatable() .key("commands.kill.success.single"); //"Killed %s" @@ -290,7 +290,7 @@ public class MessageFactory { } /** Construct a custom translation for entity_killed_by */ - private TranslatableComponent.@NotNull Builder entityKilledByComponent(Query selection, TranslatableComponent subStat) { + private TranslatableComponent.@NotNull Builder entityKilledByComponent(Query selection, TextComponent subStat) { String key = "stat.minecraft.player_kills"; //"Player Kills" if (selection == Query.PLAYER) { key = "stat.minecraft.deaths"; //"Number of Deaths" @@ -305,17 +305,21 @@ public class MessageFactory { return totalName; } - protected @Nullable TranslatableComponent subStatNameComponent(Query selection, @Nullable String subStatName, Statistic.Type statType) { + protected @Nullable TextComponent subStatNameComponent(Query selection, @Nullable String subStatName, Statistic.Type statType) { String key = getLanguageKey(null, subStatName, statType); if (key != null) { TextDecoration style = getStyleFromString(config.getSubStatNameFormatting(selection, true)); - TranslatableComponent.Builder subStat = translatable() - .key(key) + TextComponent.Builder subStat = text() + .append(text("(")) + .append(translatable() + .key(key)) + .append(text(")")) .color(getColorFromString(config.getSubStatNameFormatting(selection, false))); - if (style != null) { - subStat.decoration(style, TextDecoration.State.TRUE); + if (style != null) subStat.decoration(style, TextDecoration.State.TRUE); + else { + subStat.decorations(TextDecoration.NAMES.values(), false); } return subStat.build(); } diff --git a/src/main/java/com/gmail/artemis/the/gr8/playerstats/utils/MyLogger.java b/src/main/java/com/gmail/artemis/the/gr8/playerstats/utils/MyLogger.java index a328e35..b99a9fe 100644 --- a/src/main/java/com/gmail/artemis/the/gr8/playerstats/utils/MyLogger.java +++ b/src/main/java/com/gmail/artemis/the/gr8/playerstats/utils/MyLogger.java @@ -183,6 +183,6 @@ public class MyLogger { @param methodName Name or description of the task @param startTime Timestamp marking the beginning of the task */ public static void logTimeTakenDefault(String className, String methodName, long startTime) { - logger.info(className + " " + methodName + ":" + (System.currentTimeMillis() - startTime) + "ms"); + logger.info(className + " " + methodName + ": " + (System.currentTimeMillis() - startTime) + "ms"); } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 3095794..33a364d 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -8,7 +8,7 @@ config-version: 3.1 # # General # # # # ------------------------------- # # -# How much output in console you'll get while PlayerStats is processing +# How much output you'll get in the server console while PlayerStats is processing # 1 = low (only show unexpected errors) # 2 = medium (detail all encountered exceptions, log main tasks and show time taken) # 3 = high (log all tasks and time taken) @@ -34,12 +34,10 @@ translate-to-client-language: true # Use hover-text for additional info in the usage explanation enable-hover-text: true -# Use special themed formatting for the duration of certain holidays or festivals -# The festive formatting automatically stops when the holiday/event is over +# Automatically use themed formatting for the duration of certain holidays or festivals enable-festive-formatting: true # Always use rainbow for the [PlayerStats] prefix instead of the default gold/purple -# Changing this from false to true needs a server reboot to take full effect! rainbow-mode: false # Align the stat-numbers in the top list with dots @@ -74,17 +72,18 @@ your-server-name: 'this server' # # gray dark_gray # # # # black white # # # # ------------------------------ # # + top-list: - title: yellow + title: '#FFD52B' title-style: none title-number: gold title-number-style: none - stat-names: yellow + stat-names: '#FFD52B' stat-names-style: none - sub-stat-names: '#FFD52B' + sub-stat-names: yellow sub-stat-names-style: none rank-numbers: gold @@ -104,10 +103,10 @@ individual-statistics: player-names: gold player-names-style: none - stat-names: yellow + stat-names: '#FFD52B' stat-names-style: none - sub-stat-names: '#FFD52B' + sub-stat-names: yellow sub-stat-names-style: none stat-numbers: '#ADE7FF' @@ -115,16 +114,16 @@ individual-statistics: total-server: - title: gold + title: '#55AAFF' title-style: none - server-name: gold + server-name: '#55AAFF' server-name-style: none - stat-names: yellow + stat-names: '#FFD52B' stat-names-style: none - sub-stat-names: '#FFD52B' + sub-stat-names: yellow sub-stat-names-style: none stat-numbers: '#ADE7FF'