Add escape for Discord syntax (#41)

1.16
Etzelia 2019-10-05 04:22:50 +02:00 committed by Gitea
parent 6d73df72a3
commit ee0867d5cc
1 changed files with 37 additions and 22 deletions

View File

@ -45,6 +45,20 @@ public class AsyncPlayerChatListener implements Listener {
// Discord syntax for font emphasis
if (player.hasPermission("qol.discord")) {
String chat = event.getMessage();
boolean escape = false;
// Escape
if (chat.startsWith("\\")) {
escape = true;
event.setMessage(chat.substring(1));
// Escape the escape, this monster wants to start their message with a backslash
if (chat.startsWith("\\\\")) {
escape = false;
}
}
if (!escape) {
Pattern syntax;
Matcher matcher;
for (int i = 0; i < discordSyntax.size(); i++) {
@ -71,6 +85,7 @@ public class AsyncPlayerChatListener implements Listener {
event.setMessage(ChatColor.translateAlternateColorCodes('&', chat));
}
}
}