Removing obfuscated chars from names
This commit is contained in:
parent
0ba39e3e30
commit
7e5ab8cbbd
1 changed files with 8 additions and 2 deletions
|
@ -269,10 +269,16 @@ public class DiscordPlugin extends JavaPlugin implements IListener<ReadyEvent> {
|
||||||
/** Removes §[char] colour codes from strings */
|
/** Removes §[char] colour codes from strings */
|
||||||
public static String sanitizeString(String string) {
|
public static String sanitizeString(String string) {
|
||||||
String sanitizedString = "";
|
String sanitizedString = "";
|
||||||
|
boolean random = false;
|
||||||
for (int i = 0; i < string.length(); i++) {
|
for (int i = 0; i < string.length(); i++) {
|
||||||
if (string.charAt(i) == '§') {
|
if (string.charAt(i) == '§') {
|
||||||
i++;// Skips the data value, the 4 in "§4Alisolarflare"
|
i++;// Skips the data value, the 4 in "§4Alisolarflare"
|
||||||
|
if (string.charAt(i) == 'k')
|
||||||
|
random = true;
|
||||||
|
else
|
||||||
|
random = false;
|
||||||
} else {
|
} else {
|
||||||
|
if (!random) // Skip random/obfuscated characters
|
||||||
sanitizedString += string.charAt(i);
|
sanitizedString += string.charAt(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue