ChatFilter: Adds Russian value
This commit is contained in:
parent
711a97168a
commit
65552f2a96
|
@ -22,6 +22,7 @@ public final class ChatFilterModule extends Module {
|
||||||
|
|
||||||
public final Value<Boolean> unicode = new Value<>("Unicode", new String[]{"uc"}, "Reverts \"Fancy Chat\" characters back into normal ones. ", true);
|
public final Value<Boolean> unicode = new Value<>("Unicode", new String[]{"uc"}, "Reverts \"Fancy Chat\" characters back into normal ones. ", true);
|
||||||
public final Value<Boolean> broadcasts = new Value<>("Broadcasts", new String[]{"broadcast", "broad", "bc"}, "Prevents displaying chat messages that begin with [SERVER].", false);
|
public final Value<Boolean> broadcasts = new Value<>("Broadcasts", new String[]{"broadcast", "broad", "bc"}, "Prevents displaying chat messages that begin with [SERVER].", false);
|
||||||
|
public final Value<Boolean> russian = new Value<>("Russian", new String[]{"russiantext", "rus", "r"}, "Prevents displaying russian-character containing messages.", false);
|
||||||
public final Value<Boolean> spam = new Value<>("Spam", new String[]{"sp", "s"}, "Attempts to prevent spam by checking recent chat messages for duplicates.", true);
|
public final Value<Boolean> spam = new Value<>("Spam", new String[]{"sp", "s"}, "Attempts to prevent spam by checking recent chat messages for duplicates.", true);
|
||||||
public final Value<Boolean> death = new Value<>("Death", new String[]{"dead", "d"}, "Attempts to prevent death messages.", false);
|
public final Value<Boolean> death = new Value<>("Death", new String[]{"dead", "d"}, "Attempts to prevent death messages.", false);
|
||||||
public final Value<Boolean> blue = new Value<>("BlueText", new String[]{"Blue", "b"}, "Cancels blue-text containing messages.", false);
|
public final Value<Boolean> blue = new Value<>("BlueText", new String[]{"Blue", "b"}, "Cancels blue-text containing messages.", false);
|
||||||
|
@ -103,6 +104,14 @@ 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)) {
|
||||||
|
event.setCanceled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (this.unicode.getValue()) {
|
if (this.unicode.getValue()) {
|
||||||
if (packet.getChatComponent() instanceof TextComponentString) {
|
if (packet.getChatComponent() instanceof TextComponentString) {
|
||||||
final TextComponentString component = (TextComponentString) packet.getChatComponent();
|
final TextComponentString component = (TextComponentString) packet.getChatComponent();
|
||||||
|
|
Loading…
Reference in New Issue