Skip to content

Commit

Permalink
Bugfix use 1.20.4 json boolean type for urls
Browse files Browse the repository at this point in the history
  • Loading branch information
Aust1n46 committed Jan 7, 2024
1 parent d87c255 commit 05762e0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>mineverse.Aust1n46.chat</groupId>
<artifactId>VentureChat</artifactId>
<version>3.7.0</version>
<version>3.7.1</version>
<url>https://bitbucket.org/Aust1n46/venturechat/src/master</url>
<scm>
<url>https://bitbucket.org/Aust1n46/venturechat/src/master</url>
Expand Down
13 changes: 9 additions & 4 deletions src/main/java/mineverse/Aust1n46/chat/utilities/Format.java
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ private static String convertLinks(String s) {
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) + "]}}")
Expand Down Expand Up @@ -811,8 +811,13 @@ public static String escapeAllRegex(String input) {
.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) {
Expand Down

0 comments on commit 05762e0

Please sign in to comment.