From 05762e0bc7b12e465cc7124138ea20130b57b9fc Mon Sep 17 00:00:00 2001 From: Aust1n46 Date: Sat, 6 Jan 2024 19:56:34 -0600 Subject: [PATCH] Bugfix use 1.20.4 json boolean type for urls --- pom.xml | 2 +- .../mineverse/Aust1n46/chat/utilities/Format.java | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index eaf9cb6..615a6ea 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 mineverse.Aust1n46.chat VentureChat - 3.7.0 + 3.7.1 https://bitbucket.org/Aust1n46/venturechat/src/master https://bitbucket.org/Aust1n46/venturechat/src/master diff --git a/src/main/java/mineverse/Aust1n46/chat/utilities/Format.java b/src/main/java/mineverse/Aust1n46/chat/utilities/Format.java index c5a5d0b..6e365f5 100644 --- a/src/main/java/mineverse/Aust1n46/chat/utilities/Format.java +++ b/src/main/java/mineverse/Aust1n46/chat/utilities/Format.java @@ -190,8 +190,8 @@ public class Format { if (ChatColor.stripColor(link).contains("https://")) https = "s"; temp += convertToJsonColors(lastCode + link, - ",\"underlined\":\"" + underlineURLs() - + "\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"http" + https + "://" + ",\"underlined\":" + underlineURLs() + + ",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"http" + https + "://" + ChatColor.stripColor(link.replace("http://", "").replace("https://", "")) + "\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[" + convertToJsonColors(lastCode + link) + "]}}") @@ -811,8 +811,13 @@ public class Format { .replace(")", "\\)").replace("|", "\\|").replace("+", "\\+").replace("*", "\\*"); } - public static boolean underlineURLs() { - return getInstance().getConfig().getBoolean("underlineurls", true); + public static String underlineURLs() { + final boolean configValue = getInstance().getConfig().getBoolean("underlineurls", true); + if (VersionHandler.isAtLeast_1_20_4()) { + return String.valueOf(configValue); + } else { + return "\"" + configValue + "\""; + } } public static String parseTimeStringFromMillis(long millis) {