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