From 8f05d5c677053ce53e40635200451b77342fb572 Mon Sep 17 00:00:00 2001 From: JaTiTV Date: Fri, 8 Jul 2022 19:06:22 +0200 Subject: [PATCH] 12.4 --- .idea/misc.xml | 2 +- pom.xml | 2 +- .../lib/Spigot/Lib/messages/HoverModule.java | 23 +++++++--- .../t2code/lib/Spigot/Lib/messages/send.java | 4 +- .../lib/Spigot/Lib/replace/Replace.java | 46 +++++++++---------- .../lib/Spigot/Lib/update/UpdateAPI.java | 12 ++--- .../t2code/lib/Spigot/system/T2CodeMain.java | 5 +- .../Spigot/system/config/ConfigCreate.java | 2 - .../Spigot/system/config/SelectLibConfig.java | 5 -- 9 files changed, 51 insertions(+), 50 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index df3b2af..9573c79 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -13,7 +13,7 @@ - + diff --git a/pom.xml b/pom.xml index 4f2455d..1830d0c 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - 12.4_dev-1 + 12.4 net.t2code diff --git a/src/main/java/net/t2code/lib/Spigot/Lib/messages/HoverModule.java b/src/main/java/net/t2code/lib/Spigot/Lib/messages/HoverModule.java index d38c1cf..9919e51 100644 --- a/src/main/java/net/t2code/lib/Spigot/Lib/messages/HoverModule.java +++ b/src/main/java/net/t2code/lib/Spigot/Lib/messages/HoverModule.java @@ -7,25 +7,36 @@ import net.md_5.bungee.api.chat.ClickEvent; import net.t2code.lib.Spigot.Lib.replace.Replace; import net.t2code.lib.Spigot.system.T2CodeMain; -import net.t2code.lib.Spigot.system.config.SelectLibConfig; +import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; public class HoverModule { - public static void module(String text, String hover, String action, String actionValue, Player player) { - module((text != null ? text : "null") + "/*/" + (hover != null ? hover : "null") + "/*/" + (action != null ? action : "null") + 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); } + private static final MiniMessage mm = MiniMessage.miniMessage(); - public static void module(String msg, Player player) { - if (msg.contains("/*/") || !SelectLibConfig.getMiniMessage()) { + public static void modulePlayer(String msg, Player player) { + if (msg.contains("/*/")) { t2cmodule(msg, player); return; } - MiniMessage mm = MiniMessage.miniMessage(); + miniMessage(msg,player); + } + public static void moduleSender(String msg, CommandSender sender) { + miniMessage(msg,sender); + } + + public static void miniMessage(String msg, Player player){ Component parsed = mm.deserialize(Replace.convertColorCode(msg)); T2CodeMain.adventure.player(player).sendMessage(parsed); } + public static void miniMessage(String msg, CommandSender sender){ + Component parsed = mm.deserialize(Replace.convertColorCode(msg)); + T2CodeMain.adventure.sender(sender).sendMessage(parsed); + } private static void t2cmodule(String msg, Player player) { String[] split = msg.split("/\\*/"); diff --git a/src/main/java/net/t2code/lib/Spigot/Lib/messages/send.java b/src/main/java/net/t2code/lib/Spigot/Lib/messages/send.java index 192f178..0b70dba 100644 --- a/src/main/java/net/t2code/lib/Spigot/Lib/messages/send.java +++ b/src/main/java/net/t2code/lib/Spigot/Lib/messages/send.java @@ -20,7 +20,7 @@ public class send { public static void player( Player player, String msg) { if (msg == null || msg.contains("[empty]")) return; - HoverModule.module(msg, player); + HoverModule.modulePlayer(msg, player); } public static void title( Player player, String msg, String msg2) { @@ -37,7 +37,7 @@ public class send { public static void sender( CommandSender sender, String msg) { if (msg == null || msg.contains("[empty]")) return; - sender.sendMessage(msg); + HoverModule.moduleSender(msg, sender); } public static void debug( Plugin plugin, String msg) { diff --git a/src/main/java/net/t2code/lib/Spigot/Lib/replace/Replace.java b/src/main/java/net/t2code/lib/Spigot/Lib/replace/Replace.java index 47a6536..3e73ce9 100644 --- a/src/main/java/net/t2code/lib/Spigot/Lib/replace/Replace.java +++ b/src/main/java/net/t2code/lib/Spigot/Lib/replace/Replace.java @@ -118,28 +118,28 @@ public class Replace { .replace("&o", "§o").replace("&r", "§r"); } - public static String convertColorCode(String msg) { - return msg.replace("§0", "") - .replace("§1", "") - .replace("§2", "") - .replace("§3", "") - .replace("§4", "") - .replace("§5", "") - .replace("§6", "") - .replace("§7", "") - .replace("§8", "") - .replace("§9", "") - .replace("§a", "") - .replace("§b", "") - .replace("§c", "") - .replace("§d", "") - .replace("§e", "") - .replace("§f", "") - .replace("§k", "") - .replace("§l", "") - .replace("§m", "") - .replace("§n", "") - .replace("§o", "") - .replace("§r", ""); + public static String convertColorCode(String text) { + return text.replace("&0", "").replace("§0", "") + .replace("&1", "").replace("§1", "") + .replace("&2", "").replace("§2", "") + .replace("&3", "").replace("§3", "") + .replace("&4", "").replace("§4", "") + .replace("&5", "").replace("§5", "") + .replace("&6", "").replace("§6", "") + .replace("&7", "").replace("§7", "") + .replace("&8", "").replace("§8", "") + .replace("&9", "").replace("§9", "") + .replace("&a", "").replace("§a", "") + .replace("&b", "").replace("§b", "") + .replace("&c", "").replace("§c", "") + .replace("&d", "").replace("§d", "") + .replace("&e", "").replace("§e", "") + .replace("&f", "").replace("§f", "") + .replace("&k", "").replace("§k", "") + .replace("&l", "").replace("§l", "") + .replace("&m", "").replace("§m", "") + .replace("&n", "").replace("§n", "") + .replace("&o", "").replace("§o", "") + .replace("&r", "").replace("§r", ""); } } diff --git a/src/main/java/net/t2code/lib/Spigot/Lib/update/UpdateAPI.java b/src/main/java/net/t2code/lib/Spigot/Lib/update/UpdateAPI.java index 9fa4085..f8e5da4 100644 --- a/src/main/java/net/t2code/lib/Spigot/Lib/update/UpdateAPI.java +++ b/src/main/java/net/t2code/lib/Spigot/Lib/update/UpdateAPI.java @@ -81,19 +81,19 @@ public class UpdateAPI { send.player(player, Prefix); if (publicVersion.toLowerCase().contains("dev") || publicVersion.toLowerCase().contains("beta") || publicVersion.toLowerCase().contains("snapshot")) { if (publicVersion.toLowerCase().contains("dev")) { - HoverModule.module(Prefix + " §6A new §4DEV§6 version was found!", "§6You can download it here: §e" + Spigot, "OPEN_URL", Spigot, player); + HoverModule.modulePlayer(Prefix + " §6A new §4DEV§6 version was found!", "§6You can download it here: §e" + Spigot, "OPEN_URL", Spigot, player); } if (publicVersion.toLowerCase().contains("beta")) { - HoverModule.module(Prefix + " §6A new §2BETA§6 version was found!", "§6You can download it here: §e" + Spigot, "OPEN_URL", Spigot, player); + HoverModule.modulePlayer(Prefix + " §6A new §2BETA§6 version was found!", "§6You can download it here: §e" + Spigot, "OPEN_URL", Spigot, player); } if (publicVersion.toLowerCase().contains("snapshot")) { - HoverModule.module(Prefix + " §6A new §eSNAPSHOT§6 version was found!", "§6You can download it here: §e" + Spigot, "OPEN_URL", Spigot, player); + HoverModule.modulePlayer(Prefix + " §6A new §eSNAPSHOT§6 version was found!", "§6You can download it here: §e" + Spigot, "OPEN_URL", Spigot, player); } } else { - HoverModule.module(Prefix + " §6A new version was found!", "§6You can download it here: §e" + Spigot, "OPEN_URL", Spigot, player); + HoverModule.modulePlayer(Prefix + " §6A new version was found!", "§6You can download it here: §e" + Spigot, "OPEN_URL", Spigot, player); } - HoverModule.module(Prefix + " §c" + pluginVersion + " §7-> §a" + publicVersion, "§6You can download it here: §e" + Spigot, "OPEN_URL", Spigot, player); - HoverModule.module(Prefix + " §6You can find more information on Discord.", "§e" + Discord, "OPEN_URL", Discord, player); + HoverModule.modulePlayer(Prefix + " §c" + pluginVersion + " §7-> §a" + publicVersion, "§6You can download it here: §e" + Spigot, "OPEN_URL", Spigot, player); + HoverModule.modulePlayer(Prefix + " §6You can find more information on Discord.", "§e" + Discord, "OPEN_URL", Discord, player); send.player(player, Prefix); } diff --git a/src/main/java/net/t2code/lib/Spigot/system/T2CodeMain.java b/src/main/java/net/t2code/lib/Spigot/system/T2CodeMain.java index 09625c5..3dfc3fc 100644 --- a/src/main/java/net/t2code/lib/Spigot/system/T2CodeMain.java +++ b/src/main/java/net/t2code/lib/Spigot/system/T2CodeMain.java @@ -18,7 +18,6 @@ import net.t2code.lib.Spigot.system.languages.SelectLibMsg; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; -import org.checkerframework.checker.nullness.qual.NonNull; import java.io.File; import java.util.List; @@ -128,7 +127,7 @@ public final class T2CodeMain extends JavaPlugin { if (MCVersion.minecraft1_19) { send.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!"); send.console(prefix ); - send.warning(this, "The 1.19 is a very fresh / new version. If there are any bugs in our plugins, please report them to us via our Discord: http://dc.t2code.net"); + send.warning(this, "The 1.19.* is a very fresh / new version. If there are any bugs in our plugins, please report them to us via our Discord: http://dc.t2code.net"); send.console(prefix); send.console(prefix + " §4!!!!!!!!!!!!!!!!!!!!"); try { @@ -172,8 +171,6 @@ public final class T2CodeMain extends JavaPlugin { Bukkit.getServer().getPluginManager().registerEvents(new JoinEvent(), plugin); T2CodeTemplate.onLoadFooter(prefix, long_); } - - @Override public void onDisable() { // Plugin shutdown logic diff --git a/src/main/java/net/t2code/lib/Spigot/system/config/ConfigCreate.java b/src/main/java/net/t2code/lib/Spigot/system/config/ConfigCreate.java index 93a97b2..dbc7886 100644 --- a/src/main/java/net/t2code/lib/Spigot/system/config/ConfigCreate.java +++ b/src/main/java/net/t2code/lib/Spigot/system/config/ConfigCreate.java @@ -29,8 +29,6 @@ public class ConfigCreate { Config.set("BungeeCord.ThisServer", "server", yamlConfiguration); Config.set("Player.Inventories.CloseByServerStop", true, yamlConfiguration); - Config.set("PlayerMessage.MiniMessage", false,yamlConfiguration); - try { yamlConfiguration.save(config); } catch (IOException e) { diff --git a/src/main/java/net/t2code/lib/Spigot/system/config/SelectLibConfig.java b/src/main/java/net/t2code/lib/Spigot/system/config/SelectLibConfig.java index 5ccb2cd..c431a2b 100644 --- a/src/main/java/net/t2code/lib/Spigot/system/config/SelectLibConfig.java +++ b/src/main/java/net/t2code/lib/Spigot/system/config/SelectLibConfig.java @@ -14,7 +14,6 @@ public class SelectLibConfig { private static Boolean Debug; private static String language; private static Boolean InventoriesCloseByServerStop; - private static Boolean miniMessage; public static void onSelect() { File config = new File(T2CodeMain.getPath(), "config.yml"); @@ -26,7 +25,6 @@ public class SelectLibConfig { Debug = yamlConfiguration.getBoolean("Plugin.Debug"); language = yamlConfiguration.getString("Plugin.language"); InventoriesCloseByServerStop = yamlConfiguration.getBoolean("Player.Inventories.CloseByServerStop"); - miniMessage = yamlConfiguration.getBoolean("PlayerMessage.MiniMessage"); } public static Boolean getUpdateCheckOnJoin() { @@ -53,7 +51,4 @@ public class SelectLibConfig { return InventoriesCloseByServerStop; } - public static Boolean getMiniMessage() { - return miniMessage; - } }