Removing obfuscated chars from names
This commit is contained in:
parent
0ba39e3e30
commit
7e5ab8cbbd
1 changed files with 8 additions and 2 deletions
|
@ -228,7 +228,7 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
|
|||
}
|
||||
try {
|
||||
if (channel == chatchannel)
|
||||
MCChatListener.resetLastMessage(); //If this is a chat message, it'll be set again
|
||||
MCChatListener.resetLastMessage(); // If this is a chat message, it'll be set again
|
||||
final String content = TBMCCoreAPI.IsTestServer() && channel != chatchannel
|
||||
? "*The following message is from a test server*\n" + message : message;
|
||||
return embed == null ? channel.sendMessage(content) : channel.sendMessage(content, embed, false);
|
||||
|
@ -269,10 +269,16 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
|
|||
/** Removes §[char] colour codes from strings */
|
||||
public static String sanitizeString(String string) {
|
||||
String sanitizedString = "";
|
||||
boolean random = false;
|
||||
for (int i = 0; i < string.length(); i++) {
|
||||
if (string.charAt(i) == '§') {
|
||||
i++;// Skips the data value, the 4 in "§4Alisolarflare"
|
||||
if (string.charAt(i) == 'k')
|
||||
random = true;
|
||||
else
|
||||
random = false;
|
||||
} else {
|
||||
if (!random) // Skip random/obfuscated characters
|
||||
sanitizedString += string.charAt(i);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue