mirror of
https://code.chipmunk.land/ChomeNS/chipmunkmod.git
synced 2025-11-13 22:16:14 +00:00
refactor: remove racist filter
This commit is contained in:
parent
86ebdb1eea
commit
6264013c6b
1 changed files with 2 additions and 13 deletions
|
|
@ -26,8 +26,6 @@ public class CustomChat {
|
||||||
|
|
||||||
public static final CustomChat INSTANCE = new CustomChat(MinecraftClient.getInstance());
|
public static final CustomChat INSTANCE = new CustomChat(MinecraftClient.getInstance());
|
||||||
|
|
||||||
public static final Pattern RACIST_PATTERN = Pattern.compile("nigga|nigger|i hate black", Pattern.CASE_INSENSITIVE);
|
|
||||||
|
|
||||||
public boolean enabled = true;
|
public boolean enabled = true;
|
||||||
|
|
||||||
public String format;
|
public String format;
|
||||||
|
|
@ -85,16 +83,7 @@ public class CustomChat {
|
||||||
public void chat (String message) {
|
public void chat (String message) {
|
||||||
final ClientPlayerEntity player = client.player;
|
final ClientPlayerEntity player = client.player;
|
||||||
|
|
||||||
try {
|
if (player != null) return;
|
||||||
final Matcher racistMatcher = RACIST_PATTERN.matcher(message);
|
|
||||||
if (racistMatcher.matches()) {
|
|
||||||
player.sendMessage(Text.literal("racism bad"), false);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!enabled || !player.hasPermissionLevel(2) || !player.isCreative()) {
|
if (!enabled || !player.hasPermissionLevel(2) || !player.isCreative()) {
|
||||||
Chat.sendChatMessage(message, true);
|
Chat.sendChatMessage(message, true);
|
||||||
|
|
@ -147,7 +136,7 @@ public class CustomChat {
|
||||||
CommandCore.INSTANCE.run((KaboomCheck.INSTANCE.isKaboom ? "minecraft:tellraw @a " : "tellraw @a ") + sanitizedFormat);
|
CommandCore.INSTANCE.run((KaboomCheck.INSTANCE.isKaboom ? "minecraft:tellraw @a " : "tellraw @a ") + sanitizedFormat);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (client.player == null) return;
|
if (client.player == null) return;
|
||||||
((Audience) client.player).sendMessage(Component.text(e.toString()).color(NamedTextColor.RED));
|
client.player.sendMessage(Component.text(e.toString()).color(NamedTextColor.RED));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue