mirror of
https://github.com/Aust1n46/VentureChat.git
synced 2025-05-23 10:39:05 +00:00
Added API method for checking if URL's should be underlined in chat
This commit is contained in:
parent
2ceb87f28e
commit
57c791e997
@ -143,7 +143,7 @@ public class Format {
|
|||||||
String https = "";
|
String https = "";
|
||||||
if(ChatColor.stripColor(link).contains("https://"))
|
if(ChatColor.stripColor(link).contains("https://"))
|
||||||
https = "s";
|
https = "s";
|
||||||
temp += convertToJsonColors(lastCode + link, ",\"underlined\":\"" + plugin.getConfig().getBoolean("underlineurls", true) + "\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"http" + https + "://" + ChatColor.stripColor(link.replace("http://", "").replace("https://", "")) + "\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[" + convertToJsonColors(lastCode + link) + "]}}") + ",";
|
temp += convertToJsonColors(lastCode + link, ",\"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) + "]}}") + ",";
|
||||||
lastCode = getLastCode(lastCode + link);
|
lastCode = getLastCode(lastCode + link);
|
||||||
remaining = remaining.substring(indexLinkEnd);
|
remaining = remaining.substring(indexLinkEnd);
|
||||||
}
|
}
|
||||||
@ -478,4 +478,8 @@ public class Format {
|
|||||||
public static String escapeAllRegex(String input) {
|
public static String escapeAllRegex(String input) {
|
||||||
return input.replace("[", "\\[").replace("]", "\\]").replace("{", "\\{").replace("}", "\\}").replace("(", "\\(").replace(")", "\\)").replace("|", "\\|").replace("+", "\\+").replace("*", "\\*");
|
return input.replace("[", "\\[").replace("]", "\\]").replace("{", "\\{").replace("}", "\\}").replace("(", "\\(").replace(")", "\\)").replace("|", "\\|").replace("+", "\\+").replace("*", "\\*");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean underlineURLs() {
|
||||||
|
return plugin.getConfig().getBoolean("underlineurls", true);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user