Fixed overzealous CAPS and similar message filters.
This commit is contained in:
parent
e1a02d2ee7
commit
f0deef80aa
|
|
@ -350,7 +350,7 @@ class PlayerEventHandler implements Listener
|
||||||
//if two strings are 75% identical, they're too close to follow each other in the chat
|
//if two strings are 75% identical, they're too close to follow each other in the chat
|
||||||
private boolean stringsAreSimilar(String message, String lastMessage)
|
private boolean stringsAreSimilar(String message, String lastMessage)
|
||||||
{
|
{
|
||||||
//determine which is shorter
|
//determine which is shorter
|
||||||
String shorterString, longerString;
|
String shorterString, longerString;
|
||||||
if(lastMessage.length() < message.length())
|
if(lastMessage.length() < message.length())
|
||||||
{
|
{
|
||||||
|
|
@ -373,16 +373,18 @@ class PlayerEventHandler implements Listener
|
||||||
|
|
||||||
//compare forward
|
//compare forward
|
||||||
int identicalCount = 0;
|
int identicalCount = 0;
|
||||||
for(int i = 0; i < shorterString.length(); i++)
|
int i;
|
||||||
|
for(i = 0; i < shorterString.length(); i++)
|
||||||
{
|
{
|
||||||
if(shorterString.charAt(i) == longerString.charAt(i)) identicalCount++;
|
if(shorterString.charAt(i) == longerString.charAt(i)) identicalCount++;
|
||||||
if(identicalCount > maxIdenticalCharacters) return true;
|
if(identicalCount > maxIdenticalCharacters) return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//compare backward
|
//compare backward
|
||||||
for(int i = 0; i < shorterString.length(); i++)
|
int j;
|
||||||
|
for(j = 0; j < shorterString.length() - i; j++)
|
||||||
{
|
{
|
||||||
if(shorterString.charAt(shorterString.length() - i - 1) == longerString.charAt(longerString.length() - i - 1)) identicalCount++;
|
if(shorterString.charAt(shorterString.length() - j - 1) == longerString.charAt(longerString.length() - j - 1)) identicalCount++;
|
||||||
if(identicalCount > maxIdenticalCharacters) return true;
|
if(identicalCount > maxIdenticalCharacters) return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user