ChatFilter: No longer have null pointer for the UnicodeBlock

This commit is contained in:
noil 2021-03-18 14:58:03 -04:00
parent 9eae8d00ac
commit a38b34e7f2
1 changed files with 8 additions and 1 deletions

View File

@ -107,7 +107,11 @@ public final class ChatFilterModule extends Module {
if (this.russian.getValue()) {
for (int i = 0; i < packet.getChatComponent().getFormattedText().length(); i++) {
if (Character.UnicodeBlock.of(packet.getChatComponent().getFormattedText().charAt(i)).equals(Character.UnicodeBlock.CYRILLIC)) {
final Character.UnicodeBlock block = Character.UnicodeBlock.of(packet.getChatComponent().getFormattedText().charAt(i));
if (block == null)
continue;
if (block.equals(Character.UnicodeBlock.CYRILLIC)) {
event.setCanceled(true);
break;
}
@ -117,6 +121,9 @@ public final class ChatFilterModule extends Module {
if (this.asian.getValue()) {
for (int i = 0; i < packet.getChatComponent().getFormattedText().length(); i++) {
final Character.UnicodeBlock block = Character.UnicodeBlock.of(packet.getChatComponent().getFormattedText().charAt(i));
if (block == null)
continue;
if (block.equals(Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS) ||
block.equals(Character.UnicodeBlock.HIRAGANA) ||
block.equals(Character.UnicodeBlock.KATAKANA) ||