mirror of
https://github.com/itHotL/PlayerStats.git
synced 2024-11-21 11:47:03 +01:00
Added more festive decorations and wrote test method to see and compare them in-game
This commit is contained in:
parent
7a48e59049
commit
a12521e529
@ -11,4 +11,4 @@ public interface StatNumberFormatter {
|
||||
String formatDistanceNumber(long number, Unit statUnit);
|
||||
|
||||
String formatTimeNumber(long number, Unit biggestTimeUnit, Unit smallestTimeUnit);
|
||||
}
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
package com.artemis.the.gr8.playerstats.core.commands;
|
||||
|
||||
|
||||
import com.artemis.the.gr8.playerstats.core.msg.OutputManager;
|
||||
import com.artemis.the.gr8.playerstats.core.utils.OfflinePlayerHandler;
|
||||
import org.bukkit.command.Command;
|
||||
@ -9,8 +8,6 @@ import org.bukkit.command.CommandSender;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public final class ExcludeCommand implements CommandExecutor {
|
||||
|
||||
@ -24,7 +21,7 @@ public final class ExcludeCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||
if (args.length == 1) {
|
||||
if (args.length >= 1) {
|
||||
switch (args[0]) {
|
||||
case "list" -> {
|
||||
ArrayList<String> excludedPlayers = offlinePlayerHandler.getExcludedPlayerNames();
|
||||
@ -35,28 +32,36 @@ public final class ExcludeCommand implements CommandExecutor {
|
||||
outputManager.sendExcludeInfo(sender);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (args.length >= 2) {
|
||||
String playerName = args[1];
|
||||
switch (args[0]) {
|
||||
case "test" -> {
|
||||
List<String> converted = new ArrayList<>(List.copyOf(Arrays.asList(args)));
|
||||
converted.remove(0);
|
||||
outputManager.sendTest(sender, converted.toArray(new String[0]));
|
||||
if (args.length >= 3) {
|
||||
switch (args[1]) {
|
||||
case "help" -> outputManager.sendHelpTest(sender, args[2]);
|
||||
case "examples" -> outputManager.sendExampleTest(sender, args[2]);
|
||||
case "exclude" -> outputManager.sendExcludeTest(sender, args[2]);
|
||||
case "prefix" -> outputManager.sendPrefixTest(sender, args[2]);
|
||||
case "title" -> outputManager.sendPrefixTitleTest(sender, args[2]);
|
||||
case "name" -> {
|
||||
if (args.length >= 4) {
|
||||
outputManager.sendNameTest(sender, args[2], args[3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case "add" -> {
|
||||
if (offlinePlayerHandler.isLoadedPlayer(playerName)) {
|
||||
offlinePlayerHandler.addLoadedPlayerToExcludeList(playerName);
|
||||
sender.sendMessage("Excluded " + playerName + "!");
|
||||
if (args.length >= 2 &&
|
||||
offlinePlayerHandler.isLoadedPlayer(args[1])) {
|
||||
offlinePlayerHandler.addLoadedPlayerToExcludeList(args[1]);
|
||||
sender.sendMessage("Excluded " + args[1] + "!");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
case "remove" -> {
|
||||
if (offlinePlayerHandler.isExcludedPlayer(playerName)) {
|
||||
offlinePlayerHandler.addExcludedPlayerToLoadedList(playerName);
|
||||
sender.sendMessage("Removed " + playerName + " from the exclude list again!");
|
||||
if (args.length >= 2 &&
|
||||
offlinePlayerHandler.isExcludedPlayer(args[1])) {
|
||||
offlinePlayerHandler.addExcludedPlayerToLoadedList(args[1]);
|
||||
sender.sendMessage("Removed " + args[1] + " from the exclude list again!");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -64,4 +69,4 @@ public final class ExcludeCommand implements CommandExecutor {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -7,12 +7,16 @@ import org.bukkit.Statistic;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public final class TabCompleter implements org.bukkit.command.TabCompleter {
|
||||
@ -60,12 +64,33 @@ public final class TabCompleter implements org.bukkit.command.TabCompleter {
|
||||
loadedPlayers.addAll(offlinePlayerHandler.getExcludedPlayerNames());
|
||||
yield loadedPlayers;
|
||||
}
|
||||
case "test" -> getTestSuggestions();
|
||||
default -> tabSuggestions;
|
||||
};
|
||||
}
|
||||
else if (args.length == 3) {
|
||||
Pattern testPattern = Pattern.compile("help|examples|exclude|prefix|title|name");
|
||||
Matcher matcher = testPattern.matcher(args[1]);
|
||||
if (matcher.find()) {
|
||||
tabSuggestions = getSecondTestSuggestions();
|
||||
}
|
||||
}
|
||||
else if (args.length == 4 && args[1].equalsIgnoreCase("name")) {
|
||||
tabSuggestions = offlinePlayerHandler.getLoadedOfflinePlayerNames();
|
||||
}
|
||||
return getDynamicTabSuggestions(tabSuggestions, args[args.length-1]);
|
||||
}
|
||||
|
||||
@Contract(pure = true)
|
||||
private @Unmodifiable List<String> getTestSuggestions() {
|
||||
return List.of("help", "examples", "exclude", "prefix", "title", "name");
|
||||
}
|
||||
|
||||
@Contract(pure = true)
|
||||
private @Unmodifiable List<String> getSecondTestSuggestions() {
|
||||
return List.of("halloween", "pride", "bukkit", "console", "default", "winter");
|
||||
}
|
||||
|
||||
private @Nullable List<String> getStatCommandSuggestions(@NotNull String[] args) {
|
||||
if (args.length == 0) {
|
||||
return null;
|
||||
@ -143,17 +168,8 @@ public final class TabCompleter implements org.bukkit.command.TabCompleter {
|
||||
}
|
||||
|
||||
private void prepareLists() {
|
||||
statCommandTargets = new ArrayList<>();
|
||||
statCommandTargets.add("top");
|
||||
statCommandTargets.add("player");
|
||||
statCommandTargets.add("server");
|
||||
statCommandTargets.add("me");
|
||||
|
||||
excludeCommandOptions = new ArrayList<>();
|
||||
excludeCommandOptions.add("add");
|
||||
excludeCommandOptions.add("list");
|
||||
excludeCommandOptions.add("remove");
|
||||
excludeCommandOptions.add("info");
|
||||
statCommandTargets = List.of("top", "player", "server", "me");
|
||||
excludeCommandOptions = List.of("add", "list", "remove", "info");
|
||||
|
||||
//breaking an item means running its durability negative
|
||||
itemsThatCanBreak = Arrays.stream(Material.values())
|
||||
|
@ -81,7 +81,7 @@ public final class MessageBuilder implements StatTextFormatter {
|
||||
@Override
|
||||
public TextComponent getRainbowPluginPrefix() {
|
||||
PrideComponentFactory pride = new PrideComponentFactory();
|
||||
return pride.rainbowPrefix();
|
||||
return pride.pluginPrefix();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -95,6 +95,10 @@ public final class MessageBuilder implements StatTextFormatter {
|
||||
return pride.pluginPrefixAsTitle();
|
||||
}
|
||||
|
||||
public TextComponent getSharerName(String name) {
|
||||
return componentFactory.sharerName(name);
|
||||
}
|
||||
|
||||
public @NotNull TextComponent reloadedConfig() {
|
||||
return composePluginMessage("Config reloaded!");
|
||||
}
|
||||
|
@ -3,16 +3,11 @@ package com.artemis.the.gr8.playerstats.core.msg;
|
||||
import com.artemis.the.gr8.playerstats.api.StatTextFormatter;
|
||||
import com.artemis.the.gr8.playerstats.core.config.ConfigHandler;
|
||||
import com.artemis.the.gr8.playerstats.core.enums.StandardMessage;
|
||||
import com.artemis.the.gr8.playerstats.core.msg.components.ConsoleComponentFactory;
|
||||
import com.artemis.the.gr8.playerstats.core.msg.components.PrideComponentFactory;
|
||||
import com.artemis.the.gr8.playerstats.core.msg.components.BukkitConsoleComponentFactory;
|
||||
import com.artemis.the.gr8.playerstats.core.msg.components.HalloweenComponentFactory;
|
||||
import com.artemis.the.gr8.playerstats.core.msg.components.*;
|
||||
import com.artemis.the.gr8.playerstats.core.msg.msgutils.FormattingFunction;
|
||||
import com.artemis.the.gr8.playerstats.api.StatRequest;
|
||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
@ -20,7 +15,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.Month;
|
||||
import java.util.EnumMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.function.Function;
|
||||
@ -129,14 +123,50 @@ public final class OutputManager {
|
||||
.excludeInfoMsg());
|
||||
}
|
||||
|
||||
public void sendTest(@NotNull CommandSender sender, String[] args) {
|
||||
StringBuilder msg = new StringBuilder();
|
||||
for (String arg : args) {
|
||||
char text = (char) Integer.parseInt(arg, 16);
|
||||
msg.append(text);
|
||||
public void sendPrefixTest(@NotNull CommandSender sender, String arg) {
|
||||
adventure.sender(sender).sendMessage(getTestBuilder(arg)
|
||||
.getPluginPrefix());
|
||||
}
|
||||
|
||||
public void sendPrefixTitleTest(@NotNull CommandSender sender, String arg) {
|
||||
adventure.sender(sender).sendMessage(getTestBuilder(arg)
|
||||
.getPluginPrefixAsTitle());
|
||||
}
|
||||
|
||||
public void sendHelpTest(@NotNull CommandSender sender, String arg) {
|
||||
adventure.sender(sender).sendMessage(getTestBuilder(arg)
|
||||
.helpMsg());
|
||||
}
|
||||
|
||||
public void sendExcludeTest(@NotNull CommandSender sender, String arg) {
|
||||
adventure.sender(sender).sendMessage(getTestBuilder(arg)
|
||||
.excludeInfoMsg());
|
||||
}
|
||||
|
||||
public void sendExampleTest(@NotNull CommandSender sender, String arg) {
|
||||
adventure.sender(sender).sendMessage(getTestBuilder(arg)
|
||||
.usageExamples());
|
||||
}
|
||||
|
||||
public void sendNameTest(@NotNull CommandSender sender, String arg, String playerName) {
|
||||
adventure.sender(sender).sendMessage(getTestBuilder(arg)
|
||||
.getSharerName(playerName));
|
||||
}
|
||||
|
||||
private MessageBuilder getTestBuilder(String arg) {
|
||||
if (arg == null) {
|
||||
return MessageBuilder.defaultBuilder();
|
||||
} else {
|
||||
ComponentFactory factory = switch (arg) {
|
||||
case "halloween" -> new HalloweenComponentFactory();
|
||||
case "pride" -> new PrideComponentFactory();
|
||||
case "bukkit" -> new BukkitConsoleComponentFactory();
|
||||
case "console" -> new ConsoleComponentFactory();
|
||||
case "winter" -> new WinterComponentFactory();
|
||||
default -> new ComponentFactory();
|
||||
};
|
||||
return MessageBuilder.fromComponentFactory(factory);
|
||||
}
|
||||
Component test = MiniMessage.miniMessage().deserialize(msg.toString());
|
||||
adventure.sender(sender).sendMessage(test);
|
||||
}
|
||||
|
||||
public void sendToAllPlayers(@NotNull TextComponent component) {
|
||||
@ -157,12 +187,11 @@ public final class OutputManager {
|
||||
}
|
||||
|
||||
private MessageBuilder getClientMessageBuilder() {
|
||||
if (useRainbowStyle()) {
|
||||
return MessageBuilder.fromComponentFactory(new PrideComponentFactory());
|
||||
} else if (useHalloweenStyle()) {
|
||||
return MessageBuilder.fromComponentFactory(new HalloweenComponentFactory());
|
||||
ComponentFactory festiveFactory = getFestiveFactory();
|
||||
if (festiveFactory == null) {
|
||||
return MessageBuilder.defaultBuilder();
|
||||
}
|
||||
return MessageBuilder.defaultBuilder();
|
||||
return MessageBuilder.fromComponentFactory(festiveFactory);
|
||||
}
|
||||
|
||||
private @NotNull MessageBuilder getConsoleMessageBuilder() {
|
||||
@ -175,12 +204,25 @@ public final class OutputManager {
|
||||
return consoleBuilder;
|
||||
}
|
||||
|
||||
private boolean useRainbowStyle() {
|
||||
return config.useRainbowMode() || (config.useFestiveFormatting() && LocalDate.now().getMonth().equals(Month.JUNE));
|
||||
}
|
||||
|
||||
private boolean useHalloweenStyle() {
|
||||
return config.useFestiveFormatting() && LocalDate.now().getMonth().equals(Month.OCTOBER);
|
||||
private @Nullable ComponentFactory getFestiveFactory() {
|
||||
if (config.useRainbowMode()) {
|
||||
return new PrideComponentFactory();
|
||||
}
|
||||
else if (config.useFestiveFormatting()) {
|
||||
return switch (LocalDate.now().getMonth()) {
|
||||
case JUNE -> new PrideComponentFactory();
|
||||
case OCTOBER -> new HalloweenComponentFactory();
|
||||
case SEPTEMBER -> {
|
||||
if (LocalDate.now().getDayOfMonth() == 12) {
|
||||
yield new BirthdayComponentFactory();
|
||||
}
|
||||
yield null;
|
||||
}
|
||||
case DECEMBER -> new WinterComponentFactory();
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean isBukkit() {
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.artemis.the.gr8.playerstats.core.msg.components;
|
||||
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
|
||||
public class BirthdayComponentFactory extends ComponentFactory {
|
||||
|
||||
public BirthdayComponentFactory() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextComponent pluginPrefixAsTitle() {
|
||||
return miniMessageToComponent(
|
||||
"<gradient:#a405e3:#f74040:red:#ff9300:#f74040:#a405e3>" +
|
||||
"<white>\ud83d\udd25</white> __________ [PlayerStats] __________ " +
|
||||
"<white>\ud83d\udd25</white></gradient>");
|
||||
}
|
||||
}
|
@ -32,12 +32,12 @@ public class BukkitConsoleComponentFactory extends ComponentFactory {
|
||||
FEEDBACK_MSG_ACCENT = PluginColor.LIGHT_BLUE.getConsoleColor();
|
||||
|
||||
INFO_MSG = PluginColor.GOLD.getConsoleColor();
|
||||
INFO_MSG_ACCENT_1 = PluginColor.MEDIUM_GOLD.getConsoleColor();
|
||||
INFO_MSG_ACCENT_2 = PluginColor.LIGHT_YELLOW.getConsoleColor();
|
||||
INFO_MSG_ACCENT_DARKEST = PluginColor.MEDIUM_GOLD.getConsoleColor();
|
||||
INFO_MSG_ACCENT_MEDIUM = PluginColor.LIGHT_GOLD.getConsoleColor();
|
||||
INFO_MSG_ACCENT_LIGHTEST = PluginColor.LIGHT_YELLOW.getConsoleColor();
|
||||
|
||||
MSG_HOVER = PluginColor.LIGHTEST_BLUE.getConsoleColor();
|
||||
MSG_CLICKED = PluginColor.LIGHT_PURPLE.getConsoleColor();
|
||||
MSG_HOVER_ACCENT = PluginColor.LIGHT_GOLD.getConsoleColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -45,11 +45,11 @@ public class ComponentFactory {
|
||||
protected TextColor FEEDBACK_MSG_ACCENT; //light_blue
|
||||
|
||||
protected TextColor INFO_MSG; //gold
|
||||
protected TextColor INFO_MSG_ACCENT_1; //medium_gold
|
||||
protected TextColor INFO_MSG_ACCENT_2; //light_yellow
|
||||
protected TextColor INFO_MSG_ACCENT_DARKEST; //medium_gold
|
||||
protected TextColor INFO_MSG_ACCENT_MEDIUM; //light_gold
|
||||
protected TextColor INFO_MSG_ACCENT_LIGHTEST; //light_yellow
|
||||
|
||||
protected TextColor MSG_HOVER; //lightest_blue
|
||||
protected TextColor MSG_HOVER_ACCENT; //light_gold
|
||||
protected TextColor MSG_CLICKED; //light_purple
|
||||
|
||||
|
||||
@ -68,11 +68,11 @@ public class ComponentFactory {
|
||||
FEEDBACK_MSG_ACCENT = PluginColor.LIGHT_BLUE.getColor();
|
||||
|
||||
INFO_MSG = PluginColor.GOLD.getColor();
|
||||
INFO_MSG_ACCENT_1 = PluginColor.MEDIUM_GOLD.getColor();
|
||||
INFO_MSG_ACCENT_2 = PluginColor.LIGHT_YELLOW.getColor();
|
||||
INFO_MSG_ACCENT_DARKEST = PluginColor.MEDIUM_GOLD.getColor();
|
||||
INFO_MSG_ACCENT_MEDIUM = PluginColor.LIGHT_GOLD.getColor();
|
||||
INFO_MSG_ACCENT_LIGHTEST = PluginColor.LIGHT_YELLOW.getColor();
|
||||
|
||||
MSG_HOVER = PluginColor.LIGHTEST_BLUE.getColor();
|
||||
MSG_HOVER_ACCENT = PluginColor.LIGHT_GOLD.getColor();
|
||||
MSG_CLICKED = PluginColor.LIGHT_PURPLE.getColor();
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ public class ComponentFactory {
|
||||
}
|
||||
|
||||
public TextComponent getExampleName() {
|
||||
return text("Artemis_the_gr8").color(INFO_MSG_ACCENT_2);
|
||||
return text("Artemis_the_gr8").color(INFO_MSG_ACCENT_LIGHTEST);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -105,11 +105,10 @@ public class ComponentFactory {
|
||||
* Returns [PlayerStats] surrounded by underscores on both sides.
|
||||
*/
|
||||
public TextComponent pluginPrefixAsTitle() {
|
||||
//12 underscores for both console and in-game
|
||||
return text("____________").color(UNDERSCORE)
|
||||
return text("____________").color(UNDERSCORE) //12 underscores
|
||||
.append(text(" ")) //4 spaces
|
||||
.append(pluginPrefix())
|
||||
.append(text(" ")) //4 spaces
|
||||
.append(text(" "))
|
||||
.append(text("____________"));
|
||||
}
|
||||
|
||||
@ -183,7 +182,7 @@ public class ComponentFactory {
|
||||
.color(FEEDBACK_MSG_ACCENT)
|
||||
.clickEvent(ClickEvent.runCommand("/statshare " + shareCode))
|
||||
.hoverEvent(HoverEvent.showText(text("Click here to share this statistic in chat!")
|
||||
.color(MSG_HOVER_ACCENT))));
|
||||
.color(INFO_MSG_ACCENT_MEDIUM))));
|
||||
}
|
||||
|
||||
public TextComponent sharedByMessage(Component playerName) {
|
||||
@ -324,7 +323,7 @@ public class ComponentFactory {
|
||||
.toBuilder()
|
||||
.hoverEvent(HoverEvent.showText(
|
||||
text(Unit.HEART.getLabel())
|
||||
.color(MSG_HOVER_ACCENT)))
|
||||
.color(INFO_MSG_ACCENT_MEDIUM)))
|
||||
.build();
|
||||
return surroundWithBrackets(heart);
|
||||
}
|
||||
|
@ -39,20 +39,20 @@ public final class ExampleMessage implements TextComponent {
|
||||
.append(spaces).append(
|
||||
factory.arrow()).append(Component.space())
|
||||
.append(text("/stat ").color(factory.INFO_MSG)
|
||||
.append(text("animals_bred ").color(factory.INFO_MSG_ACCENT_1)
|
||||
.append(text("top").color(factory.INFO_MSG_ACCENT_2))))
|
||||
.append(text("animals_bred ").color(factory.INFO_MSG_ACCENT_MEDIUM)
|
||||
.append(text("top").color(factory.INFO_MSG_ACCENT_LIGHTEST))))
|
||||
.append(Component.newline())
|
||||
.append(spaces).append(
|
||||
factory.arrow()).append(Component.space())
|
||||
.append(text("/stat ").color(factory.INFO_MSG)
|
||||
.append(text("mine_block diorite ").color(factory.INFO_MSG_ACCENT_1)
|
||||
.append(text("me").color(factory.INFO_MSG_ACCENT_2))))
|
||||
.append(text("mine_block diorite ").color(factory.INFO_MSG_ACCENT_MEDIUM)
|
||||
.append(text("me").color(factory.INFO_MSG_ACCENT_LIGHTEST))))
|
||||
.append(Component.newline())
|
||||
.append(spaces).append(
|
||||
factory.arrow()).append(Component.space())
|
||||
.append(text("/stat ").color(factory.INFO_MSG)
|
||||
.append(text("deaths ").color(factory.INFO_MSG_ACCENT_1)
|
||||
.append(text("player ").color(factory.INFO_MSG_ACCENT_2)
|
||||
.append(text("deaths ").color(factory.INFO_MSG_ACCENT_MEDIUM)
|
||||
.append(text("player ").color(factory.INFO_MSG_ACCENT_LIGHTEST)
|
||||
.append(factory.getExampleName()))));
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,9 @@ package com.artemis.the.gr8.playerstats.core.msg.components;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.ComponentLike;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import net.kyori.adventure.text.event.HoverEvent;
|
||||
import net.kyori.adventure.text.format.Style;
|
||||
import net.kyori.adventure.text.format.TextDecoration;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
@ -31,9 +33,7 @@ public final class ExcludeInfoMessage implements TextComponent {
|
||||
return Component.newline()
|
||||
.append(factory.pluginPrefixAsTitle())
|
||||
.append(Component.newline())
|
||||
.append(factory.subTitle("The /statexclude command is used to hide"))
|
||||
.append(Component.newline())
|
||||
.append(factory.subTitle("specific players' results from /stat lookups"))
|
||||
.append(factory.subTitle("Hide a player's statistics from /stat results"))
|
||||
.append(Component.newline())
|
||||
.append(text("Excluded players are:")
|
||||
.color(factory.INFO_MSG))
|
||||
@ -41,12 +41,41 @@ public final class ExcludeInfoMessage implements TextComponent {
|
||||
.append(spaces).append(
|
||||
factory.arrow()).append(Component.space())
|
||||
.append(text("not visible in the top 10")
|
||||
.color(factory.INFO_MSG_ACCENT_1))
|
||||
.color(factory.INFO_MSG_ACCENT_MEDIUM))
|
||||
.append(Component.newline())
|
||||
.append(spaces).append(
|
||||
factory.arrow()).append(Component.space())
|
||||
.append(text("not counted for the server total")
|
||||
.color(factory.INFO_MSG_ACCENT_1));
|
||||
.color(factory.INFO_MSG_ACCENT_MEDIUM))
|
||||
.append(Component.newline())
|
||||
.append(spaces).append(
|
||||
factory.arrow()).append(Component.space())
|
||||
.append(text("hidden")
|
||||
.decorate(TextDecoration.BOLD)
|
||||
.color(factory.INFO_MSG_ACCENT_MEDIUM)
|
||||
.hoverEvent(HoverEvent.showText(text("All data is still stored by the server,")
|
||||
.append(Component.newline())
|
||||
.append(text("and excluded players can still look up"))
|
||||
.append(Component.newline())
|
||||
.append(text("their own statistics in the in-game menu"))
|
||||
.color(factory.FEEDBACK_MSG))))
|
||||
.append(text(", not removed")
|
||||
.decorations(TextDecoration.NAMES.values(), false)
|
||||
.color(factory.INFO_MSG_ACCENT_MEDIUM))
|
||||
.append(Component.newline())
|
||||
.append(Component.newline())
|
||||
.append(text("Usage: ").color(factory.INFO_MSG)
|
||||
.append(text("/statexclude").color(factory.INFO_MSG_ACCENT_MEDIUM)))
|
||||
.append(Component.newline())
|
||||
.append(spaces).append(spaces).append(
|
||||
factory.bulletPoint()).append(Component.space())
|
||||
.append(text("add ").color(factory.INFO_MSG_ACCENT_DARKEST))
|
||||
.append(text("player-name").color(factory.INFO_MSG_ACCENT_MEDIUM))
|
||||
.append(Component.newline())
|
||||
.append(spaces).append(spaces).append(
|
||||
factory.bulletPoint()).append(Component.space())
|
||||
.append(text("remove ").color(factory.INFO_MSG_ACCENT_DARKEST))
|
||||
.append(text("player-name").color(factory.INFO_MSG_ACCENT_MEDIUM));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,6 +1,9 @@
|
||||
package com.artemis.the.gr8.playerstats.core.msg.components;
|
||||
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class HalloweenComponentFactory extends ComponentFactory {
|
||||
|
||||
@ -22,4 +25,23 @@ public class HalloweenComponentFactory extends ComponentFactory {
|
||||
return miniMessageToComponent(
|
||||
"<gradient:#f74040:gold:#f74040>[PlayerStats]</gradient>");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextComponent sharerName(String sharerName) {
|
||||
return miniMessageToComponent(decorateWithRandomGradient(sharerName));
|
||||
}
|
||||
|
||||
private @NotNull String decorateWithRandomGradient(@NotNull String input) {
|
||||
Random random = new Random();
|
||||
String colorString = switch (random.nextInt(6)) {
|
||||
case 0 -> "<gradient:#fcad23:red>";
|
||||
case 1 -> "<gradient:#fcad23:#f967b2:#F79438:#ffe30f>";
|
||||
case 2 -> "<gradient:red:#fcad23:red>";
|
||||
case 3 -> "<gradient:#f28e30:#f5cb42:#f74040>";
|
||||
case 4 -> "<gradient:#F79438:#f967b2>";
|
||||
case 5 -> "<gradient:#f967b2:#fcad23:#f967b2>";
|
||||
default -> "<gradient:#fcad23:#f967b2:#F74040>";
|
||||
};
|
||||
return colorString + input + "</gradient>";
|
||||
}
|
||||
}
|
@ -48,44 +48,44 @@ public final class HelpMessage implements TextComponent {
|
||||
.append(text("Type \"/statistic examples\" to see examples!").color(factory.BRACKETS).decorate(TextDecoration.ITALIC))
|
||||
.append(newline())
|
||||
.append(text("Usage:").color(factory.INFO_MSG)).append(space())
|
||||
.append(text("/statistic").color(factory.MSG_HOVER_ACCENT))
|
||||
.append(text("/statistic").color(factory.INFO_MSG_ACCENT_MEDIUM))
|
||||
.append(newline())
|
||||
.append(spaces).append(
|
||||
factory.arrow()).append(space())
|
||||
.append(text("name").color(factory.MSG_HOVER_ACCENT))
|
||||
.append(text("name").color(factory.INFO_MSG_ACCENT_MEDIUM))
|
||||
.append(newline())
|
||||
.append(spaces).append(
|
||||
factory.arrow()).append(space())
|
||||
.append(text("{sub-statistic}").color(factory.MSG_HOVER_ACCENT)).append(space())
|
||||
.append(text("{sub-statistic}").color(factory.INFO_MSG_ACCENT_MEDIUM)).append(space())
|
||||
.append(text("(a block, item or entity)").color(factory.BRACKETS))
|
||||
.append(newline())
|
||||
.append(spaces).append(
|
||||
factory.arrow()).append(space())
|
||||
.append(text("me | player | server | top").color(factory.MSG_HOVER_ACCENT))
|
||||
.append(text("me | player | server | top").color(factory.INFO_MSG_ACCENT_MEDIUM))
|
||||
.append(newline())
|
||||
.append(spaces).append(spaces).append(
|
||||
factory.bulletPoint()).append(space())
|
||||
.append(text("me:").color(factory.INFO_MSG_ACCENT_1)).append(space())
|
||||
.append(text("me:").color(factory.INFO_MSG_ACCENT_DARKEST)).append(space())
|
||||
.append(text("your own statistic").color(factory.BRACKETS))
|
||||
.append(newline())
|
||||
.append(spaces).append(spaces).append(
|
||||
factory.bulletPoint()).append(space())
|
||||
.append(text("player:").color(factory.INFO_MSG_ACCENT_1)).append(space())
|
||||
.append(text("player:").color(factory.INFO_MSG_ACCENT_DARKEST)).append(space())
|
||||
.append(text("choose a player").color(factory.BRACKETS))
|
||||
.append(newline())
|
||||
.append(spaces).append(spaces).append(
|
||||
factory.bulletPoint()).append(space())
|
||||
.append(text("server:").color(factory.INFO_MSG_ACCENT_1)).append(space())
|
||||
.append(text("server:").color(factory.INFO_MSG_ACCENT_DARKEST)).append(space())
|
||||
.append(text("everyone on the server combined").color(factory.BRACKETS))
|
||||
.append(newline())
|
||||
.append(spaces).append(spaces).append(
|
||||
factory.bulletPoint()).append(space())
|
||||
.append(text("top:").color(factory.INFO_MSG_ACCENT_1)).append(space())
|
||||
.append(text("top:").color(factory.INFO_MSG_ACCENT_DARKEST)).append(space())
|
||||
.append(text("the top").color(factory.BRACKETS).append(space()).append(text(listSize)))
|
||||
.append(newline())
|
||||
.append(spaces).append(
|
||||
factory.arrow()).append(space())
|
||||
.append(text("{player-name}").color(factory.MSG_HOVER_ACCENT));
|
||||
.append(text("{player-name}").color(factory.INFO_MSG_ACCENT_MEDIUM));
|
||||
}
|
||||
|
||||
private @NotNull TextComponent buildHoverMsg(@NotNull ComponentFactory factory, int listSize) {
|
||||
@ -97,49 +97,49 @@ public final class HelpMessage implements TextComponent {
|
||||
.append(factory.subTitle("Hover over the arguments for more information!"))
|
||||
.append(newline())
|
||||
.append(text("Usage:").color(factory.INFO_MSG)).append(space())
|
||||
.append(text("/statistic").color(factory.MSG_HOVER_ACCENT))
|
||||
.append(text("/statistic").color(factory.INFO_MSG_ACCENT_MEDIUM))
|
||||
.append(newline())
|
||||
.append(spaces).append(factory.arrow()).append(space())
|
||||
.append(text("name").color(factory.MSG_HOVER_ACCENT)
|
||||
.append(text("name").color(factory.INFO_MSG_ACCENT_MEDIUM)
|
||||
.hoverEvent(HoverEvent.showText(text("The name that describes the statistic").color(factory.MSG_HOVER)
|
||||
.append(newline())
|
||||
.append(text("Example: ").color(factory.INFO_MSG))
|
||||
.append(text("\"animals_bred\"").color(factory.MSG_HOVER_ACCENT)))))
|
||||
.append(text("\"animals_bred\"").color(factory.INFO_MSG_ACCENT_MEDIUM)))))
|
||||
.append(newline())
|
||||
.append(spaces).append(factory.arrow()).append(space())
|
||||
.append(text("sub-statistic").color(factory.MSG_HOVER_ACCENT)
|
||||
.append(text("sub-statistic").color(factory.INFO_MSG_ACCENT_MEDIUM)
|
||||
.hoverEvent(HoverEvent.showText(
|
||||
text("Some statistics need an item, block or entity as extra input").color(factory.MSG_HOVER)
|
||||
.append(newline())
|
||||
.append(text("Example: ").color(factory.INFO_MSG)
|
||||
.append(text("\"mine_block diorite\"").color(factory.MSG_HOVER_ACCENT))))))
|
||||
.append(text("\"mine_block diorite\"").color(factory.INFO_MSG_ACCENT_MEDIUM))))))
|
||||
.append(newline())
|
||||
.append(spaces).append(factory.arrow()
|
||||
.hoverEvent(HoverEvent.showText(
|
||||
text("Choose one").color(factory.MSG_CLICKED))))
|
||||
.append(space())
|
||||
.append(text("me").color(factory.MSG_HOVER_ACCENT)
|
||||
.append(text("me").color(factory.INFO_MSG_ACCENT_MEDIUM)
|
||||
.hoverEvent(HoverEvent.showText(
|
||||
text("See your own statistic").color(factory.MSG_HOVER))))
|
||||
.append(text(" | ").color(factory.MSG_HOVER_ACCENT))
|
||||
.append(text("player").color(factory.MSG_HOVER_ACCENT)
|
||||
.append(text(" | ").color(factory.INFO_MSG_ACCENT_MEDIUM))
|
||||
.append(text("player").color(factory.INFO_MSG_ACCENT_MEDIUM)
|
||||
.hoverEvent(HoverEvent.showText(
|
||||
text("Choose any player that has played on your server").color(factory.MSG_HOVER))))
|
||||
.append(text(" | ").color(factory.MSG_HOVER_ACCENT))
|
||||
.append(text("server").color(factory.MSG_HOVER_ACCENT)
|
||||
.append(text(" | ").color(factory.INFO_MSG_ACCENT_MEDIUM))
|
||||
.append(text("server").color(factory.INFO_MSG_ACCENT_MEDIUM)
|
||||
.hoverEvent(HoverEvent.showText(
|
||||
text("See the combined total for everyone on your server").color(factory.MSG_HOVER))))
|
||||
.append(text(" | ").color(factory.MSG_HOVER_ACCENT))
|
||||
.append(text("top").color(factory.MSG_HOVER_ACCENT)
|
||||
.append(text(" | ").color(factory.INFO_MSG_ACCENT_MEDIUM))
|
||||
.append(text("top").color(factory.INFO_MSG_ACCENT_MEDIUM)
|
||||
.hoverEvent(HoverEvent.showText(
|
||||
text("See the top").color(factory.MSG_HOVER).append(space())
|
||||
.append(text(listSize)))))
|
||||
.append(newline())
|
||||
.append(spaces).append(factory.arrow()).append(space())
|
||||
.append(text("player-name").color(factory.MSG_HOVER_ACCENT)
|
||||
.append(text("player-name").color(factory.INFO_MSG_ACCENT_MEDIUM)
|
||||
.hoverEvent(HoverEvent.showText(
|
||||
text("In case you typed").color(factory.MSG_HOVER).append(space())
|
||||
.append(text("\"player\"").color(factory.MSG_HOVER_ACCENT))
|
||||
.append(text("\"player\"").color(factory.INFO_MSG_ACCENT_MEDIUM))
|
||||
.append(text(", add the player's name")))));
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.artemis.the.gr8.playerstats.core.msg.components;
|
||||
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Random;
|
||||
@ -11,11 +10,8 @@ import java.util.Random;
|
||||
*/
|
||||
public class PrideComponentFactory extends ComponentFactory {
|
||||
|
||||
private final Random random;
|
||||
|
||||
public PrideComponentFactory() {
|
||||
super();
|
||||
random = new Random();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -36,46 +32,23 @@ public class PrideComponentFactory extends ComponentFactory {
|
||||
|
||||
@Override
|
||||
public TextComponent pluginPrefix() {
|
||||
if (random.nextBoolean()) {
|
||||
return backwardsPluginPrefixComponent();
|
||||
}
|
||||
return rainbowPrefix();
|
||||
}
|
||||
|
||||
public TextComponent rainbowPrefix() {
|
||||
return miniMessageToComponent("<#f74040>[</#f74040>" +
|
||||
"<#F54D39>P</#F54D39>" +
|
||||
"<#F16E28>l</#F16E28>" +
|
||||
"<#ee8a19>a</#ee8a19>" +
|
||||
"<#EEA019>y</#EEA019>" +
|
||||
"<#F7C522>e</#F7C522>" +
|
||||
"<#C1DA15>r</#C1DA15>" +
|
||||
"<#84D937>S</#84D937>" +
|
||||
"<#46D858>t</#46D858>" +
|
||||
"<#01c1a7>a</#01c1a7>" +
|
||||
"<#1F8BEB>t</#1F8BEB>" +
|
||||
"<#3341E6>s</#3341E6>" +
|
||||
"<#631ae6>]</#631ae6>");
|
||||
}
|
||||
|
||||
@Contract(" -> new")
|
||||
private @NotNull TextComponent backwardsPluginPrefixComponent() {
|
||||
return miniMessageToComponent("<#631ae6>[</#631ae6>" +
|
||||
"<#3341E6>P</#3341E6>" +
|
||||
"<#1F8BEB>l</#1F8BEB>" +
|
||||
"<#01c1a7>a</#01c1a7>" +
|
||||
"<#46D858>y</#46D858>" +
|
||||
"<#84D937>e</#84D937>" +
|
||||
"<#C1DA15>r</#C1DA15>" +
|
||||
"<#F7C522>S</#F7C522>" +
|
||||
"<#EEA019>t</#EEA019>" +
|
||||
"<#ee8a19>a</#ee8a19>" +
|
||||
"<#f67824>t</#f67824>" +
|
||||
"<#f76540>s</#f76540>" +
|
||||
"<#f74040>]</#f74040>");
|
||||
"<#F54D39>P</#F54D39>" +
|
||||
"<#F16E28>l</#F16E28>" +
|
||||
"<#ee8a19>a</#ee8a19>" +
|
||||
"<#EEA019>y</#EEA019>" +
|
||||
"<#F7C522>e</#F7C522>" +
|
||||
"<#C1DA15>r</#C1DA15>" +
|
||||
"<#84D937>S</#84D937>" +
|
||||
"<#46D858>t</#46D858>" +
|
||||
"<#01c1a7>a</#01c1a7>" +
|
||||
"<#1F8BEB>t</#1F8BEB>" +
|
||||
"<#3341E6>s</#3341E6>" +
|
||||
"<#631ae6>]</#631ae6>");
|
||||
}
|
||||
|
||||
private @NotNull String decorateWithRandomGradient(@NotNull String input) {
|
||||
Random random = new Random();
|
||||
String colorString = switch (random.nextInt(8)) {
|
||||
case 0 -> "<gradient:#03b6fc:#f854df>";
|
||||
case 1 -> "<gradient:#14f7a0:#4287f5>";
|
||||
|
@ -0,0 +1,24 @@
|
||||
package com.artemis.the.gr8.playerstats.core.msg.components;
|
||||
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
|
||||
public class WinterComponentFactory extends ComponentFactory {
|
||||
|
||||
public WinterComponentFactory() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextComponent pluginPrefixAsTitle() {
|
||||
return miniMessageToComponent(
|
||||
"<gradient:#4f20f7:#4bc3fa:#05ebb1:#4f20f7>" +
|
||||
"<white>\u2744</white> __________ [PlayerStats] __________ " +
|
||||
"<white>\u2744</white></gradient>");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextComponent pluginPrefix() {
|
||||
return miniMessageToComponent(
|
||||
"<gradient:#4bc3fa:#05ebb1:#409ef7>[PlayerStats]</gradient>");
|
||||
}
|
||||
}
|
@ -7,7 +7,7 @@
|
||||
# For more general filtering settings, see the config.yml (section 'General')
|
||||
|
||||
# Format:
|
||||
# - playerUUID-1
|
||||
# - playerUUID-2
|
||||
# - player1UUID
|
||||
# - player2UUID
|
||||
excluded:
|
||||
-
|
Loading…
Reference in New Issue
Block a user