Add way too many debug messages to antichatspam cause this makes 0 sense

This commit is contained in:
blackilykat 2024-11-04 13:19:03 +01:00
parent 9e6b14de91
commit dcfbdfc544

View file

@ -18,6 +18,7 @@ public class AntiChatSpamModule extends Module {
private static final String debugTickedCaller = debugCallerPrefix + "tick";
private static final String debugLevenshteinDistanceCaller = debugCallerPrefix + "levenshtein_distance";
private static final String debugLevenshteinDistanceCallerSpamless = debugCallerPrefix + "levenshtein_distance_spamless";
private static final String debugLevenshteinDistanceCallerSpamful = debugCallerPrefix + "levenshtein_distance_spamful";
public AntiChatSpamModule() {
super("Anti chat spam");
@ -39,17 +40,28 @@ public class AntiChatSpamModule extends Module {
public int timer = ChipmunkMod.CONFIG.antiSpam.messageTimeInTicks;
public ChatMessage(String content) {
Debug.debug("AAAA", debugLevenshteinDistanceCallerSpamful);
this.content = content;
Debug.debug("AAAA", debugLevenshteinDistanceCallerSpamful);
ArrayList<ChatMessage> chatMessages = instance.messages;
Debug.debug("AAAA", debugLevenshteinDistanceCallerSpamful);
int similarMessages = 0;
Debug.debug("AAAA", debugLevenshteinDistanceCallerSpamful);
LevenshteinDistance ld = new LevenshteinDistance(); // thanks maniaplay fo r teaching me about levenshtein distance
Debug.debug("AAAA", debugLevenshteinDistanceCallerSpamful);
for (int i = 0; i < chatMessages.size(); i++) {
Debug.debug("BBBBB1", debugLevenshteinDistanceCallerSpamful);
ChatMessage message = chatMessages.get(i);
Debug.debug("BBBBB2", debugLevenshteinDistanceCallerSpamful);
if(message == null) continue;
Debug.debug("BBBBB3", debugLevenshteinDistanceCallerSpamful);
int distance = ld.apply(content, message.content);
Debug.debug("BBBBB4", debugLevenshteinDistanceCallerSpamful);
Debug.debug("Distance: " + distance, debugLevenshteinDistanceCaller);
Debug.debug("BBBBB5", debugLevenshteinDistanceCallerSpamful);
if (distance <= ChipmunkMod.CONFIG.antiSpam.minimumLevenshteinDistanceToBeSpam) similarMessages++;
Debug.debug("BBBBB6", debugLevenshteinDistanceCallerSpamful);
// Pattern pattern = getPattern(new ComparableString(this.content()), new ComparableString(message.content()));
// int matching = 0;
// ArrayList<ChatMessage> chatMessageArrayList = instance.messages;
@ -61,12 +73,15 @@ public class AntiChatSpamModule extends Module {
// instance.patterns.add(new BlockedPattern(pattern));
// }
}
Debug.debug("CCCC", debugLevenshteinDistanceCallerSpamful);
Debug.debug("Similar messages: " + similarMessages, debugLevenshteinDistanceCaller);
Debug.debug("Similar messages: " + similarMessages, debugLevenshteinDistanceCallerSpamless);
if (similarMessages >= ChipmunkMod.CONFIG.antiSpam.matchingMessagesToBeSpam) hidden = true;
Debug.debug("CCCC", debugLevenshteinDistanceCallerSpamful);
Debug.debug("Hidden: " + hidden, debugLevenshteinDistanceCaller);
Debug.debug("Hidden: " + hidden, debugLevenshteinDistanceCallerSpamless);
instance.messages.add(this);
Debug.debug("CCCC", debugLevenshteinDistanceCallerSpamful);
// threadQueue.add(() -> {
// // code above used to be here but i cant decide if i should show it or not depending on the thread cuz i cant make it wait
// });