mirror of
https://github.com/Aust1n46/VentureChat.git
synced 2025-05-22 18:09:06 +00:00
Fixed issue with experimental VentureChatBungee setting from DiscordSRV.
Created helper method for escaping JSON chars.
This commit is contained in:
parent
87b49cec2b
commit
2ec0439581
@ -53,8 +53,8 @@ public class Format {
|
||||
*/
|
||||
public static String convertToJson(MineverseChatPlayer sender, String format, String chat) {
|
||||
JsonFormat JSONformat = MineverseChat.jfInfo.getJsonFormat(sender.getJsonFormat());
|
||||
String f = format.replace("\\", "\\\\").replace("\"", "\\\"");
|
||||
String c = chat.replace("\\", "\\\\").replace("\"", "\\\"");
|
||||
String f = escapeJsonChars(format);
|
||||
String c = escapeJsonChars(chat);
|
||||
String json = "[\"\",{\"text\":\"\",\"extra\":[";
|
||||
String prefix = "";
|
||||
String suffix = "";
|
||||
@ -426,12 +426,17 @@ public class Format {
|
||||
}
|
||||
|
||||
public static String convertPlainTextToJson(String s, boolean convertURL) {
|
||||
s = escapeJsonChars(s);
|
||||
if (convertURL) {
|
||||
return "[" + Format.convertLinks(s) + "]";
|
||||
} else {
|
||||
return "[" + convertToJsonColors(DEFAULT_COLOR_CODE + s) + "]";
|
||||
}
|
||||
}
|
||||
|
||||
private static String escapeJsonChars(String s) {
|
||||
return s.replace("\\", "\\\\").replace("\"", "\\\"");
|
||||
}
|
||||
|
||||
public static String formatModerationGUI(String json, Player player, String sender, String channelName, int hash) {
|
||||
if (player.hasPermission("venturechat.gui")) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user