mirror of
https://github.com/Aust1n46/VentureChat.git
synced 2025-05-23 10:39:05 +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) {
|
public static String convertToJson(MineverseChatPlayer sender, String format, String chat) {
|
||||||
JsonFormat JSONformat = MineverseChat.jfInfo.getJsonFormat(sender.getJsonFormat());
|
JsonFormat JSONformat = MineverseChat.jfInfo.getJsonFormat(sender.getJsonFormat());
|
||||||
String f = format.replace("\\", "\\\\").replace("\"", "\\\"");
|
String f = escapeJsonChars(format);
|
||||||
String c = chat.replace("\\", "\\\\").replace("\"", "\\\"");
|
String c = escapeJsonChars(chat);
|
||||||
String json = "[\"\",{\"text\":\"\",\"extra\":[";
|
String json = "[\"\",{\"text\":\"\",\"extra\":[";
|
||||||
String prefix = "";
|
String prefix = "";
|
||||||
String suffix = "";
|
String suffix = "";
|
||||||
@ -426,6 +426,7 @@ public class Format {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String convertPlainTextToJson(String s, boolean convertURL) {
|
public static String convertPlainTextToJson(String s, boolean convertURL) {
|
||||||
|
s = escapeJsonChars(s);
|
||||||
if (convertURL) {
|
if (convertURL) {
|
||||||
return "[" + Format.convertLinks(s) + "]";
|
return "[" + Format.convertLinks(s) + "]";
|
||||||
} else {
|
} else {
|
||||||
@ -433,6 +434,10 @@ public class Format {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String escapeJsonChars(String s) {
|
||||||
|
return s.replace("\\", "\\\\").replace("\"", "\\\"");
|
||||||
|
}
|
||||||
|
|
||||||
public static String formatModerationGUI(String json, Player player, String sender, String channelName, int hash) {
|
public static String formatModerationGUI(String json, Player player, String sender, String channelName, int hash) {
|
||||||
if (player.hasPermission("venturechat.gui")) {
|
if (player.hasPermission("venturechat.gui")) {
|
||||||
json = json.substring(0, json.length() - 1);
|
json = json.substring(0, json.length() - 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user