forked from ChomeNS/chipmunkmod
Add way too many debug messages to antichatspam cause this makes 0 sense
This commit is contained in:
parent
9e6b14de91
commit
dcfbdfc544
1 changed files with 15 additions and 0 deletions
|
@ -18,6 +18,7 @@ public class AntiChatSpamModule extends Module {
|
||||||
private static final String debugTickedCaller = debugCallerPrefix + "tick";
|
private static final String debugTickedCaller = debugCallerPrefix + "tick";
|
||||||
private static final String debugLevenshteinDistanceCaller = debugCallerPrefix + "levenshtein_distance";
|
private static final String debugLevenshteinDistanceCaller = debugCallerPrefix + "levenshtein_distance";
|
||||||
private static final String debugLevenshteinDistanceCallerSpamless = debugCallerPrefix + "levenshtein_distance_spamless";
|
private static final String debugLevenshteinDistanceCallerSpamless = debugCallerPrefix + "levenshtein_distance_spamless";
|
||||||
|
private static final String debugLevenshteinDistanceCallerSpamful = debugCallerPrefix + "levenshtein_distance_spamful";
|
||||||
|
|
||||||
public AntiChatSpamModule() {
|
public AntiChatSpamModule() {
|
||||||
super("Anti chat spam");
|
super("Anti chat spam");
|
||||||
|
@ -39,17 +40,28 @@ public class AntiChatSpamModule extends Module {
|
||||||
public int timer = ChipmunkMod.CONFIG.antiSpam.messageTimeInTicks;
|
public int timer = ChipmunkMod.CONFIG.antiSpam.messageTimeInTicks;
|
||||||
|
|
||||||
public ChatMessage(String content) {
|
public ChatMessage(String content) {
|
||||||
|
Debug.debug("AAAA", debugLevenshteinDistanceCallerSpamful);
|
||||||
this.content = content;
|
this.content = content;
|
||||||
|
|
||||||
|
Debug.debug("AAAA", debugLevenshteinDistanceCallerSpamful);
|
||||||
ArrayList<ChatMessage> chatMessages = instance.messages;
|
ArrayList<ChatMessage> chatMessages = instance.messages;
|
||||||
|
Debug.debug("AAAA", debugLevenshteinDistanceCallerSpamful);
|
||||||
int similarMessages = 0;
|
int similarMessages = 0;
|
||||||
|
Debug.debug("AAAA", debugLevenshteinDistanceCallerSpamful);
|
||||||
LevenshteinDistance ld = new LevenshteinDistance(); // thanks maniaplay fo r teaching me about levenshtein distance
|
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++) {
|
for (int i = 0; i < chatMessages.size(); i++) {
|
||||||
|
Debug.debug("BBBBB1", debugLevenshteinDistanceCallerSpamful);
|
||||||
ChatMessage message = chatMessages.get(i);
|
ChatMessage message = chatMessages.get(i);
|
||||||
|
Debug.debug("BBBBB2", debugLevenshteinDistanceCallerSpamful);
|
||||||
if(message == null) continue;
|
if(message == null) continue;
|
||||||
|
Debug.debug("BBBBB3", debugLevenshteinDistanceCallerSpamful);
|
||||||
int distance = ld.apply(content, message.content);
|
int distance = ld.apply(content, message.content);
|
||||||
|
Debug.debug("BBBBB4", debugLevenshteinDistanceCallerSpamful);
|
||||||
Debug.debug("Distance: " + distance, debugLevenshteinDistanceCaller);
|
Debug.debug("Distance: " + distance, debugLevenshteinDistanceCaller);
|
||||||
|
Debug.debug("BBBBB5", debugLevenshteinDistanceCallerSpamful);
|
||||||
if (distance <= ChipmunkMod.CONFIG.antiSpam.minimumLevenshteinDistanceToBeSpam) similarMessages++;
|
if (distance <= ChipmunkMod.CONFIG.antiSpam.minimumLevenshteinDistanceToBeSpam) similarMessages++;
|
||||||
|
Debug.debug("BBBBB6", debugLevenshteinDistanceCallerSpamful);
|
||||||
// Pattern pattern = getPattern(new ComparableString(this.content()), new ComparableString(message.content()));
|
// Pattern pattern = getPattern(new ComparableString(this.content()), new ComparableString(message.content()));
|
||||||
// int matching = 0;
|
// int matching = 0;
|
||||||
// ArrayList<ChatMessage> chatMessageArrayList = instance.messages;
|
// ArrayList<ChatMessage> chatMessageArrayList = instance.messages;
|
||||||
|
@ -61,12 +73,15 @@ public class AntiChatSpamModule extends Module {
|
||||||
// instance.patterns.add(new BlockedPattern(pattern));
|
// instance.patterns.add(new BlockedPattern(pattern));
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
Debug.debug("CCCC", debugLevenshteinDistanceCallerSpamful);
|
||||||
Debug.debug("Similar messages: " + similarMessages, debugLevenshteinDistanceCaller);
|
Debug.debug("Similar messages: " + similarMessages, debugLevenshteinDistanceCaller);
|
||||||
Debug.debug("Similar messages: " + similarMessages, debugLevenshteinDistanceCallerSpamless);
|
Debug.debug("Similar messages: " + similarMessages, debugLevenshteinDistanceCallerSpamless);
|
||||||
if (similarMessages >= ChipmunkMod.CONFIG.antiSpam.matchingMessagesToBeSpam) hidden = true;
|
if (similarMessages >= ChipmunkMod.CONFIG.antiSpam.matchingMessagesToBeSpam) hidden = true;
|
||||||
|
Debug.debug("CCCC", debugLevenshteinDistanceCallerSpamful);
|
||||||
Debug.debug("Hidden: " + hidden, debugLevenshteinDistanceCaller);
|
Debug.debug("Hidden: " + hidden, debugLevenshteinDistanceCaller);
|
||||||
Debug.debug("Hidden: " + hidden, debugLevenshteinDistanceCallerSpamless);
|
Debug.debug("Hidden: " + hidden, debugLevenshteinDistanceCallerSpamless);
|
||||||
instance.messages.add(this);
|
instance.messages.add(this);
|
||||||
|
Debug.debug("CCCC", debugLevenshteinDistanceCallerSpamful);
|
||||||
// threadQueue.add(() -> {
|
// 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
|
// // 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
|
||||||
// });
|
// });
|
||||||
|
|
Loading…
Reference in a new issue