ChatFilter: Only filters on 2b2t & 9b9t

This commit is contained in:
noil 2021-01-15 22:09:08 -05:00
parent ee4d9db06c
commit a2e8ba70ff
1 changed files with 36 additions and 40 deletions

View File

@ -53,6 +53,7 @@ public final class ChatFilterModule extends Module {
}
}
if (is9b9tOr2b2t) {
if (this.death.getValue()) {
if (packet.getChatComponent().getFormattedText().contains("\2474") || packet.getChatComponent().getFormattedText().contains("\247c")) {
event.setCanceled(true);
@ -64,12 +65,10 @@ public final class ChatFilterModule extends Module {
event.setCanceled(true);
}
if (is9b9tOr2b2t) {
if (packet.getChatComponent().getFormattedText().contains("\2472")) {
event.setCanceled(true);
}
}
}
if (this.spam.getValue()) {
final String chat = packet.getChatComponent().getUnformattedText();
@ -91,36 +90,6 @@ public final class ChatFilterModule extends Module {
}
}
if (this.unicode.getValue()) {
if (packet.getChatComponent() instanceof TextComponentString) {
final TextComponentString component = (TextComponentString) packet.getChatComponent();
final StringBuilder sb = new StringBuilder();
boolean containsUnicode = false;
for (String s : component.getFormattedText().split(" ")) {
String line = "";
for (char c : s.toCharArray()) {
if (c >= 0xFEE0) {
c -= 0xFEE0;
containsUnicode = true;
}
line += c;
}
sb.append(line + " ");
}
if (containsUnicode) {
packet.chatComponent = new TextComponentString(sb.toString());
}
}
}
if (this.blue.getValue()) {
if (packet.getChatComponent().getFormattedText().contains(ChatFormatting.BLUE + "")) {
event.setCanceled(true);
@ -133,6 +102,33 @@ public final class ChatFilterModule extends Module {
}
}
}
if (this.unicode.getValue()) {
if (packet.getChatComponent() instanceof TextComponentString) {
final TextComponentString component = (TextComponentString) packet.getChatComponent();
final StringBuilder sb = new StringBuilder();
boolean containsUnicode = false;
for (String s : component.getFormattedText().split(" ")) {
StringBuilder line = new StringBuilder();
for (char c : s.toCharArray()) {
if (c >= 0xFEE0) {
c -= 0xFEE0;
containsUnicode = true;
}
line.append(c);
}
sb.append(line).append(" ");
}
if (containsUnicode) {
packet.chatComponent = new TextComponentString(sb.toString());
}
}
}
}
}
}