diff --git a/src/main/java/land/chipmunk/chipmunkmod/testclient/modules/anti_annoyances/AntiChatSpamModule.java b/src/main/java/land/chipmunk/chipmunkmod/testclient/modules/anti_annoyances/AntiChatSpamModule.java index f871726..12c5a54 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/testclient/modules/anti_annoyances/AntiChatSpamModule.java +++ b/src/main/java/land/chipmunk/chipmunkmod/testclient/modules/anti_annoyances/AntiChatSpamModule.java @@ -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 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 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 // });