From a350f9fb005d3fb98aea28c46e40a71a3d6a34fd Mon Sep 17 00:00:00 2001 From: JaTiTV Date: Fri, 5 Jul 2024 09:35:57 +0200 Subject: [PATCH] 16.7_dev-22 --- pom.xml | 28 +-------- .../BUNGEE/api/yaml/T2CB_ConfigWriter.java | 20 +++++-- .../SPIGOT/api/commands/T2C_Cmd.java | 8 +-- .../SPIGOT/api/messages/T2C_HoverModule.java | 58 ------------------- .../SPIGOT/api/messages/T2C_Send.java | 12 ++-- .../SPIGOT/api/yaml/T2C_ConfigWriter.java | 24 ++++++-- .../SPIGOT/api/yaml/T2C_YmlWriter.java | 17 ++++-- ...va => T2C_ProxyCommandSenderReceiver.java} | 2 +- .../SPIGOT/system/cmd/CmdExecuter.java | 4 +- .../SPIGOT/system/cmd/Development.java | 1 + .../system/config/config/T2C_LibConfig.java | 6 +- .../config/languages/T2CLibLanguages.java | 22 +++---- .../VELOCITY/api/yml/T2CV_ConfigWriter.java | 20 +++++-- .../util/T2C_ConfigItemLanguages.java | 2 +- .../t2codelib/util/T2C_GenerateFrame.java | 2 - .../net/t2code/t2codelib/util/T2C_Util.java | 2 +- 16 files changed, 89 insertions(+), 139 deletions(-) delete mode 100644 src/main/java/net/t2code/t2codelib/SPIGOT/api/messages/T2C_HoverModule.java rename src/main/java/net/t2code/t2codelib/SPIGOT/system/{BungeeCommandSenderReceiver.java => T2C_ProxyCommandSenderReceiver.java} (97%) diff --git a/pom.xml b/pom.xml index c4ad4d9..07a2f26 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ net.t2code T2CodeLib - 16.7_dev-19 + 16.7_dev-22 @@ -47,31 +47,7 @@ net.kyori - net.t2code.libraries.kyori.adventure - - - com.google.gson - net.t2code.libraries.google - - - mozilla - net.t2code.libraries.mozilla - - - org.apache - net.t2code.libraries.apache - - - org.intellij - net.t2code.libraries.intellij - - - org.jetbrains - net.t2code.libraries.jetbrains - - - org.json - net.t2code.libraries.json + net.t2code.t2codelib.shaded.adventure diff --git a/src/main/java/net/t2code/t2codelib/BUNGEE/api/yaml/T2CB_ConfigWriter.java b/src/main/java/net/t2code/t2codelib/BUNGEE/api/yaml/T2CB_ConfigWriter.java index 3937491..793cee5 100644 --- a/src/main/java/net/t2code/t2codelib/BUNGEE/api/yaml/T2CB_ConfigWriter.java +++ b/src/main/java/net/t2code/t2codelib/BUNGEE/api/yaml/T2CB_ConfigWriter.java @@ -105,12 +105,20 @@ public class T2CB_ConfigWriter { // Add value with proper indentation // builder.append(indent).append(key).append(": ").append(value).append("\n"); if (value instanceof List) { - builder.append(indent).append(key).append(": ").append("\n"); - List zw = (List) value; - for (Object s : zw) { - if (s instanceof String) { - builder.append(indent).append("- \"").append(s).append("\"\n"); - } else builder.append(indent).append("- ").append(s).append("\n"); + List list = (List) value; + if (list.size() == 1){ + for (Object s : list) { + if (s instanceof String) { + builder.append(indent).append(key).append(": \"").append(value).append("\"\n"); + } else builder.append(indent).append(key).append(": ").append(value).append("\n"); + } + } else { + builder.append(indent).append(key).append(": ").append("\n"); + for (Object s : list) { + if (s instanceof String) { + builder.append(indent).append("- \"").append(s).append("\"\n"); + } else builder.append(indent).append("- ").append(s).append("\n"); + } } } else { if (value instanceof String) { diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/api/commands/T2C_Cmd.java b/src/main/java/net/t2code/t2codelib/SPIGOT/api/commands/T2C_Cmd.java index f1993a9..5107900 100644 --- a/src/main/java/net/t2code/t2codelib/SPIGOT/api/commands/T2C_Cmd.java +++ b/src/main/java/net/t2code/t2codelib/SPIGOT/api/commands/T2C_Cmd.java @@ -1,6 +1,6 @@ package net.t2code.t2codelib.SPIGOT.api.commands; -import net.t2code.t2codelib.SPIGOT.system.BungeeCommandSenderReceiver; +import net.t2code.t2codelib.SPIGOT.system.T2C_ProxyCommandSenderReceiver; import net.t2code.t2codelib.SPIGOT.system.T2C_Main; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -17,7 +17,7 @@ public class T2C_Cmd { @Override public void run() { if (cmd.contains("!onBungee")) { - BungeeCommandSenderReceiver.sendToBungee(null, cmd.replace("!onBungee", ""), true); + T2C_ProxyCommandSenderReceiver.sendToBungee(null, cmd.replace("!onBungee", ""), true); } else Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), cmd); } }, delay); @@ -32,11 +32,11 @@ public class T2C_Cmd { public void run() { if (cmd.contains("!asConsole")) { if (cmd.contains("!onBungee")) { - BungeeCommandSenderReceiver.sendToBungee(player, cmd.replace("!asConsole", "").replace("!onBungee", ""), true); + T2C_ProxyCommandSenderReceiver.sendToBungee(player, cmd.replace("!asConsole", "").replace("!onBungee", ""), true); } else console(cmd.replace("!asConsole", "")); } else { if (cmd.contains("!onBungee")) { - BungeeCommandSenderReceiver.sendToBungee(player, cmd.replace("!onBungee", ""), false); + T2C_ProxyCommandSenderReceiver.sendToBungee(player, cmd.replace("!onBungee", ""), false); } else player.chat("/" + cmd); } } diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/api/messages/T2C_HoverModule.java b/src/main/java/net/t2code/t2codelib/SPIGOT/api/messages/T2C_HoverModule.java deleted file mode 100644 index 654059e..0000000 --- a/src/main/java/net/t2code/t2codelib/SPIGOT/api/messages/T2C_HoverModule.java +++ /dev/null @@ -1,58 +0,0 @@ -package net.t2code.t2codelib.SPIGOT.api.messages; - -import net.md_5.bungee.api.chat.ClickEvent; -import net.t2code.t2codelib.SPIGOT.system.T2C_Main; -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class T2C_HoverModule { - - public static void modulePlayer(String text, String hover, String action, String actionValue, Player player) { - modulePlayer((text != null ? text : "null") + "/*/" + (hover != null ? hover : "null") + "/*/" + (action != null ? action : "null") - + "/*/" + (actionValue != null ? actionValue : "null"), player); - } - - public static void modulePlayer(String msg, Player player) { - if (msg.contains("/*/")) { - t2cmodule(msg, player); - return; - } - T2C_MiniMessage.sendPlayerMiniMessage(msg, player); - } - - public static void moduleSender(String msg, CommandSender sender) { - T2C_MiniMessage.sendSenderMiniMessage(msg, sender); - } - - public static void moduleConsole(String msg) { - if (T2C_Main.getMmIsLoad()) { - T2C_MiniMessage.sendConsoleMiniMessage(msg); - return; - } - Bukkit.getConsoleSender().sendMessage(msg); - } - - private static void t2cmodule(String msg, Player player) { - String[] split = msg.split("/\\*/"); - int i = split.length; - String text = null; - String hover = null; - String action = null; - String actionValue = null; - if (i > 0) text = split[0]; - if (i > 1) hover = split[1]; - if (i > 2) action = split[2]; - if (i > 3) actionValue = split[3]; - - T2C_TextBuilder textBuilder = new T2C_TextBuilder(text); - if (hover != null && !hover.equals("null")) { - textBuilder.addHover(hover); - } - - if (action != null && actionValue != null && !action.equals("null") && !actionValue.equals("null")) { - textBuilder.addClickEvent(ClickEvent.Action.valueOf(action.toUpperCase()), actionValue); - } - player.spigot().sendMessage(textBuilder.build()); - } -} diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/api/messages/T2C_Send.java b/src/main/java/net/t2code/t2codelib/SPIGOT/api/messages/T2C_Send.java index d331602..e941049 100644 --- a/src/main/java/net/t2code/t2codelib/SPIGOT/api/messages/T2C_Send.java +++ b/src/main/java/net/t2code/t2codelib/SPIGOT/api/messages/T2C_Send.java @@ -44,30 +44,30 @@ public class T2C_Send { public static void console(String msg) { if (msg == null || msg.contains("[empty]")) return; - T2C_HoverModule.moduleConsole(msg); + T2C_MiniMessage.sendConsoleMiniMessage(msg); } public static void player(Player player, String msg) { if (msg == null || msg.contains("[empty]")) return; - T2C_HoverModule.modulePlayer(msg, player); + T2C_MiniMessage.sendPlayerMiniMessage(msg, player); } public static void sender(CommandSender sender, String msg) { if (msg == null || msg.contains("[empty]")) return; - T2C_HoverModule.moduleSender(msg, sender); + T2C_MiniMessage.sendSenderMiniMessage(msg, sender); } public static void console(Object object) { for (String msg : list(object)) { if (msg == null || msg.contains("[empty]")) continue; - T2C_HoverModule.moduleConsole(msg); + T2C_MiniMessage.sendConsoleMiniMessage(msg); } } public static void player(Player player, Object object) { for (String msg : list(object)) { if (msg == null || msg.contains("[empty]")) continue; - T2C_HoverModule.modulePlayer(msg, player); + T2C_MiniMessage.sendPlayerMiniMessage(msg, player); } } @@ -75,7 +75,7 @@ public class T2C_Send { public static void sender(CommandSender sender, Object object) { for (String msg : list(object)) { if (msg == null || msg.contains("[empty]")) return; - T2C_HoverModule.moduleSender(msg, sender); + T2C_MiniMessage.sendSenderMiniMessage(msg, sender); } } diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/api/yaml/T2C_ConfigWriter.java b/src/main/java/net/t2code/t2codelib/SPIGOT/api/yaml/T2C_ConfigWriter.java index c4644d9..15bb47a 100644 --- a/src/main/java/net/t2code/t2codelib/SPIGOT/api/yaml/T2C_ConfigWriter.java +++ b/src/main/java/net/t2code/t2codelib/SPIGOT/api/yaml/T2C_ConfigWriter.java @@ -6,6 +6,7 @@ import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send; import net.t2code.t2codelib.SPIGOT.system.T2C_Main; import net.t2code.t2codelib.util.T2C_LanguageEnum; import net.t2code.t2codelib.util.T2C_ConfigItem; +import net.t2code.t2codelib.util.T2C_Util; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; @@ -19,7 +20,7 @@ public class T2C_ConfigWriter { private static FileConfiguration config; - public static void createConfig(File configFile, T2C_ConfigItem[] values, String... header) { + public static void createConfig(String prefix, File configFile, T2C_ConfigItem[] values, boolean isReload, String... header) { boolean exist = configFile.exists(); if (!exist) { configFile.getParentFile().mkdirs(); @@ -34,11 +35,20 @@ public class T2C_ConfigWriter { config = YamlConfiguration.loadConfiguration(configFile); Map> comments = new LinkedHashMap<>(); - T2C_LanguageEnum lang = T2C_LanguageEnum.english; + T2C_LanguageEnum lang = null; + String lp = values[0].getLanguagePath(); + try { - lang = T2C_LanguageEnum.valueOf(config.getString(values[0].getLanguagePath().replace(".yml", ""))); + lang = T2C_LanguageEnum.valueOf(lp); } catch (Exception ignore) { } + if (lang == null) { + try { + lang = T2C_LanguageEnum.valueOf(config.getString(lp.replace(".yml", ""))); + } catch (Exception e) { + lang = T2C_LanguageEnum.english; + } + } for (T2C_ConfigItem item : values) { if (item.getForceSet() || !exist) { @@ -55,12 +65,16 @@ public class T2C_ConfigWriter { config.options().copyDefaults(true); T2C_YmlWriter.saveConfigWithComments(configFile, config, comments, header); - readConfig(config, values); + readConfig(prefix, configFile, config, values, isReload); } - private static void readConfig(FileConfiguration config, T2C_ConfigItem[] values) { + private static void readConfig(String prefix, File configFile, FileConfiguration config, T2C_ConfigItem[] values, boolean isReload) { for (T2C_ConfigItem value : values) { value.setValue(config.get(value.getPath())); } + T2C_Send.sendStartTextCenter(prefix, "§2" + configFile.getName() + " were successfully created / updated.", isReload); + //T2C_Send.sendStartTextCenter(Util.getPrefix(), "§2opWhitelist.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms",isReload); } + + } diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/api/yaml/T2C_YmlWriter.java b/src/main/java/net/t2code/t2codelib/SPIGOT/api/yaml/T2C_YmlWriter.java index 2093bb0..4dbcdcd 100644 --- a/src/main/java/net/t2code/t2codelib/SPIGOT/api/yaml/T2C_YmlWriter.java +++ b/src/main/java/net/t2code/t2codelib/SPIGOT/api/yaml/T2C_YmlWriter.java @@ -54,18 +54,23 @@ public class T2C_YmlWriter { // Add value with proper indentation // builder.append(indent).append(key).append(": ").append(value).append("\n"); if (value instanceof List) { + List list = (List) value; + if (list.isEmpty()) { + builder.append(indent).append(key).append(": []").append("\n"); + continue; + } builder.append(indent).append(key).append(": ").append("\n"); - List zw = (List) value; - for (Object s : zw) { + for (Object s : list) { if (s instanceof String) { builder.append(indent).append("- \"").append(s).append("\"\n"); } else builder.append(indent).append("- ").append(s).append("\n"); } - } else { - if (value instanceof String) { - builder.append(indent).append(key).append(": \"").append(value).append("\"\n"); - } else builder.append(indent).append(key).append(": ").append(value).append("\n"); + continue; } + if (value instanceof String) { + builder.append(indent).append(key).append(": \"").append(value).append("\"\n"); + } else builder.append(indent).append(key).append(": ").append(value).append("\n"); + } } } diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/system/BungeeCommandSenderReceiver.java b/src/main/java/net/t2code/t2codelib/SPIGOT/system/T2C_ProxyCommandSenderReceiver.java similarity index 97% rename from src/main/java/net/t2code/t2codelib/SPIGOT/system/BungeeCommandSenderReceiver.java rename to src/main/java/net/t2code/t2codelib/SPIGOT/system/T2C_ProxyCommandSenderReceiver.java index 6f54305..635375a 100644 --- a/src/main/java/net/t2code/t2codelib/SPIGOT/system/BungeeCommandSenderReceiver.java +++ b/src/main/java/net/t2code/t2codelib/SPIGOT/system/T2C_ProxyCommandSenderReceiver.java @@ -13,7 +13,7 @@ import java.io.DataOutputStream; import java.io.IOException; import java.util.Arrays; -public class BungeeCommandSenderReceiver { +public class T2C_ProxyCommandSenderReceiver { public static void sendToBungee(CommandSender sender, String information, Boolean console) { ByteArrayOutputStream stream = new ByteArrayOutputStream(); diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/system/cmd/CmdExecuter.java b/src/main/java/net/t2code/t2codelib/SPIGOT/system/cmd/CmdExecuter.java index 5f84b46..6be026e 100644 --- a/src/main/java/net/t2code/t2codelib/SPIGOT/system/cmd/CmdExecuter.java +++ b/src/main/java/net/t2code/t2codelib/SPIGOT/system/cmd/CmdExecuter.java @@ -3,7 +3,7 @@ package net.t2code.t2codelib.SPIGOT.system.cmd; import net.t2code.t2codelib.SPIGOT.api.debug.T2C_Debug; import net.t2code.t2codelib.SPIGOT.api.messages.T2C_Send; import net.t2code.t2codelib.SPIGOT.api.update.T2C_UpdateAPI; -import net.t2code.t2codelib.SPIGOT.system.BungeeCommandSenderReceiver; +import net.t2code.t2codelib.SPIGOT.system.T2C_ProxyCommandSenderReceiver; import net.t2code.t2codelib.SPIGOT.system.T2C_Main; import net.t2code.t2codelib.SPIGOT.system.config.config.T2C_LibConfig; import net.t2code.t2codelib.SPIGOT.system.config.languages.T2CLibLanguages; @@ -106,7 +106,7 @@ public class CmdExecuter implements CommandExecutor, TabCompleter { cmd = cmd + s + " "; } cmd = cmd.replace("bcmd ", ""); - BungeeCommandSenderReceiver.sendToBungee(null, cmd, true); + T2C_ProxyCommandSenderReceiver.sendToBungee(null, cmd, true); T2C_Debug.debug(T2C_Main.getPlugin(), "PluginMessage BCMD: " + cmd); return false; diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/system/cmd/Development.java b/src/main/java/net/t2code/t2codelib/SPIGOT/system/cmd/Development.java index 1870106..613767b 100644 --- a/src/main/java/net/t2code/t2codelib/SPIGOT/system/cmd/Development.java +++ b/src/main/java/net/t2code/t2codelib/SPIGOT/system/cmd/Development.java @@ -63,6 +63,7 @@ public class Development implements Listener { msg = msg + "" + plSt + ", "; } else msg = msg + "" + plSt + ", "; } + T2C_Send.player(player, removeLastChar(msg, 2)); } diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/system/config/config/T2C_LibConfig.java b/src/main/java/net/t2code/t2codelib/SPIGOT/system/config/config/T2C_LibConfig.java index 8ffd8ea..6c79a65 100644 --- a/src/main/java/net/t2code/t2codelib/SPIGOT/system/config/config/T2C_LibConfig.java +++ b/src/main/java/net/t2code/t2codelib/SPIGOT/system/config/config/T2C_LibConfig.java @@ -61,7 +61,7 @@ public class T2C_LibConfig { put(T2C_LanguageEnum.german, List.of()); put(T2C_LanguageEnum.english, List.of()); }}), - proxy("proxy.enable", T2C_Main.getIsBungee(), true, + proxy("For this option, the option proxy.enable in the config.yml of the T2CodeLib must be set to true and the T2CodeLib must also be present on the proxy in order to function as a bridge.", T2C_Main.getIsBungee(), true, new HashMap<>() {{ put(T2C_LanguageEnum.german, List.of("Diese Option muss aktiviert werden, wenn du die T2CodeLib auf einem BungeeCord, Waterfall oder Velocity Proxy als Bridge verwenden möchtest." , "Bitte beachte, dass die einzelnen APIs der Plugins, die eine Bridge auf einem Proxy verwenden, in der config.yml der T2CodeLib auf dem Proxy aktiviert werden müssen!")); @@ -149,9 +149,7 @@ public class T2C_LibConfig { public static void set(boolean isReload) { long long_ = System.currentTimeMillis(); ConvertT2ClibConfig.convert(); - T2C_ConfigWriter.createConfig(new File(T2C_Main.getPath(), "config.yml"), VALUES.values(), T2C_Util.getConfigLogo()); - - T2C_Send.sendStartTextCenter(T2C_Util.getPrefix(), "§2config.yml were successfully created / updated." + " §7- §e" + (System.currentTimeMillis() - long_) + "ms", isReload); + T2C_ConfigWriter.createConfig(T2C_Util.getPrefix(), new File(T2C_Main.getPath(), "config.yml"), VALUES.values(), isReload, T2C_Util.getConfigLogo()); } } diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/system/config/languages/T2CLibLanguages.java b/src/main/java/net/t2code/t2codelib/SPIGOT/system/config/languages/T2CLibLanguages.java index 578cba7..426252b 100644 --- a/src/main/java/net/t2code/t2codelib/SPIGOT/system/config/languages/T2CLibLanguages.java +++ b/src/main/java/net/t2code/t2codelib/SPIGOT/system/config/languages/T2CLibLanguages.java @@ -29,8 +29,8 @@ public class T2CLibLanguages { vaultNotSetUp("plugin.vaultNotSetUp", null, new HashMap<>() {{ - put(T2C_LanguageEnum.german, "[prefix] &4Vault / Economy nicht eingerichtet!"); - put(T2C_LanguageEnum.english, "[prefix] &4Vault / Economy not set up!"); + put(T2C_LanguageEnum.german, List.of("[prefix] &4Vault / Economy nicht eingerichtet!")); + put(T2C_LanguageEnum.english,List.of( "[prefix] &4Vault / Economy not set up!")); }}, new HashMap<>() {{ put(T2C_LanguageEnum.german, List.of("Diese Meldung wird angezeigt, wenn ein Plugin auf die Vault Schnittstelle von T2CodeLib zugreift und Vault oder kein Economy System vorhanden ist.")); @@ -40,8 +40,8 @@ public class T2CLibLanguages { votingPluginNotSetUp("plugin.votingPluginNotSetUp", null, new HashMap<>() {{ - put(T2C_LanguageEnum.german, "[prefix] &4VotingPlugin ist auf dem Server nicht vorhanden!"); - put(T2C_LanguageEnum.english, "[prefix] &4VotingPlugin is not present on the server!"); + put(T2C_LanguageEnum.german, List.of("[prefix] &4VotingPlugin ist auf dem Server nicht vorhanden!")); + put(T2C_LanguageEnum.english, List.of("[prefix] &4VotingPlugin is not present on the server!")); }}, new HashMap<>() {{ put(T2C_LanguageEnum.german, List.of("Diese Meldung wird angezeigt, wenn ein Plugin auf die VotingPlugin Schnittstelle von T2CodeLib zugreift und VotingPlugin nicht vorhanden ist.", "VotingPlugin: https://spigotmc.org/resources/votingplugin.15358/")); @@ -50,22 +50,22 @@ public class T2CLibLanguages { soundNotFound("plugin.soundNotFound", null, new HashMap<>() {{ - put(T2C_LanguageEnum.german, "[prefix] &4Der Sound &6[sound] &4wurde nicht gefunden! Bitte überprüfe die Einstellungen."); - put(T2C_LanguageEnum.english, "[prefix] &4The sound &6[sound] &4was not found! Please check the settings."); + put(T2C_LanguageEnum.german, List.of("[prefix] &4Der Sound &6[sound] &4wurde nicht gefunden! Bitte überprüfe die Einstellungen.")); + put(T2C_LanguageEnum.english, List.of("[prefix] &4The sound &6[sound] &4was not found! Please check the settings.")); }}, new HashMap<>() {{ - put(T2C_LanguageEnum.german, List.of("Diese Meldung wird angezeigt, wenn ein Sound über die T2CodeLib abgespielt werden soll, den es nicht gibt")); - put(T2C_LanguageEnum.english, List.of()); + put(T2C_LanguageEnum.german, List.of("Diese Meldung wird angezeigt, wenn ein Sound über die T2CodeLib abgespielt werden soll, den es nicht gibt.")); + put(T2C_LanguageEnum.english, List.of("This message is displayed if a sound is to be played via the T2CodeLib that does not exist.")); }}), ; private final String path; private Object value; - private final HashMap lang; + private final HashMap> lang; private final HashMap> comments; - VALUES(String path, Object value, @NonNull HashMap lang, HashMap> comments) { + VALUES(String path, Object value, @NonNull HashMap> lang, HashMap> comments) { this.path = path; this.value = value; this.lang = lang; @@ -86,7 +86,7 @@ public class T2CLibLanguages { } @Override - public HashMap getLanguage() { + public HashMap> getLanguage() { return lang; } diff --git a/src/main/java/net/t2code/t2codelib/VELOCITY/api/yml/T2CV_ConfigWriter.java b/src/main/java/net/t2code/t2codelib/VELOCITY/api/yml/T2CV_ConfigWriter.java index 3dc3d41..2591cb4 100644 --- a/src/main/java/net/t2code/t2codelib/VELOCITY/api/yml/T2CV_ConfigWriter.java +++ b/src/main/java/net/t2code/t2codelib/VELOCITY/api/yml/T2CV_ConfigWriter.java @@ -147,12 +147,20 @@ public class T2CV_ConfigWriter { // Add value with proper indentation // builder.append(indent).append(key.getKey()).append(": ").append(value).append("\n"); if (value instanceof List) { - builder.append(indent).append(key.getKey()).append(": ").append("\n"); - List zw = (List) value; - for (Object s : zw) { - if (s instanceof String) { - builder.append(indent).append("- \"").append(s).append("\"\n"); - } else builder.append(indent).append("- ").append(s).append("\n"); + List list = (List) value; + if (list.size() == 1){ + for (Object s : list) { + if (s instanceof String) { + builder.append(indent).append(key.getKey()).append(": \"").append(value).append("\"\n"); + } else builder.append(indent).append(key.getKey()).append(": ").append(value).append("\n"); + } + }else { + builder.append(indent).append(key.getKey()).append(": ").append("\n"); + for (Object s : list) { + if (s instanceof String) { + builder.append(indent).append("- \"").append(s).append("\"\n"); + } else builder.append(indent).append("- ").append(s).append("\n"); + } } } else { if (value instanceof String) { diff --git a/src/main/java/net/t2code/t2codelib/util/T2C_ConfigItemLanguages.java b/src/main/java/net/t2code/t2codelib/util/T2C_ConfigItemLanguages.java index 544bb16..9627d46 100644 --- a/src/main/java/net/t2code/t2codelib/util/T2C_ConfigItemLanguages.java +++ b/src/main/java/net/t2code/t2codelib/util/T2C_ConfigItemLanguages.java @@ -19,7 +19,7 @@ public interface T2C_ConfigItemLanguages { */ Object getValue(); - HashMap getLanguage(); + HashMap> getLanguage(); /** diff --git a/src/main/java/net/t2code/t2codelib/util/T2C_GenerateFrame.java b/src/main/java/net/t2code/t2codelib/util/T2C_GenerateFrame.java index 8b7ce75..34e7a7b 100644 --- a/src/main/java/net/t2code/t2codelib/util/T2C_GenerateFrame.java +++ b/src/main/java/net/t2code/t2codelib/util/T2C_GenerateFrame.java @@ -131,7 +131,6 @@ public class T2C_GenerateFrame { if (console && T2C_PlatformDetector.detectPlatform == T2C_PlatformDetector.PlatformType.VELOCITY) { - System.out.println("conole & velo"); colorCode = ""; nextLine = "\n"; } @@ -185,7 +184,6 @@ public class T2C_GenerateFrame { // String miniMessageRegex = "<(?!br)(color:#([A-Fa-f0-9]{6})|[a-zA-Z_]+)(:[a-zA-Z0-9_]+)?>|"; // return text.replaceAll("§[a-f0-9k-oK-O]", "").replaceAll(miniMessageRegex, ""); String s = MiniMessage.miniMessage().stripTags(text).replaceAll("§[a-f0-9k-oK-O]", ""); - System.out.println(s); return s; } } diff --git a/src/main/java/net/t2code/t2codelib/util/T2C_Util.java b/src/main/java/net/t2code/t2codelib/util/T2C_Util.java index d5709e8..b8218ca 100644 --- a/src/main/java/net/t2code/t2codelib/util/T2C_Util.java +++ b/src/main/java/net/t2code/t2codelib/util/T2C_Util.java @@ -27,7 +27,7 @@ public class T2C_Util { private static Integer bstatsID = 12518; @Getter - private static String spigot = "https://www.spigotmc.org/resources/" + getSpigotID(); + private static String spigot = "https://spigotmc.org/resources/" + getSpigotID(); @Getter private static String discord = "http://dc.t2code.net";