- Expose comicChars as a static function
This commit is contained in:
@@ -38,6 +38,20 @@ public abstract class CurseFilter implements ChatFilter
|
|||||||
/** Indicates how messages should be handled. */
|
/** Indicates how messages should be handled. */
|
||||||
public enum Mode { DROP, COMIC, VERNACULAR, UNFILTERED; }
|
public enum Mode { DROP, COMIC, VERNACULAR, UNFILTERED; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a comicy replacement of the specified length.
|
||||||
|
*/
|
||||||
|
public static String comicChars (int length)
|
||||||
|
{
|
||||||
|
StringBuilder buf = new StringBuilder();
|
||||||
|
for (int ii=0; ii < length; ii++) {
|
||||||
|
buf.append(RandomUtil.pickRandom(COMIC_CHARS));
|
||||||
|
}
|
||||||
|
|
||||||
|
return buf.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a curse filter. The curse words should be a string in the following format:
|
* Creates a curse filter. The curse words should be a string in the following format:
|
||||||
*
|
*
|
||||||
@@ -220,19 +234,6 @@ public abstract class CurseFilter implements ChatFilter
|
|||||||
return "\\b" + word.replace("*", "[A-Za-z]*") + "\\b";
|
return "\\b" + word.replace("*", "[A-Za-z]*") + "\\b";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a comicy replacement of the specified length.
|
|
||||||
*/
|
|
||||||
protected String comicChars (int length)
|
|
||||||
{
|
|
||||||
StringBuilder buf = new StringBuilder();
|
|
||||||
for (int ii=0; ii < length; ii++) {
|
|
||||||
buf.append(RandomUtil.pickRandom(COMIC_CHARS));
|
|
||||||
}
|
|
||||||
|
|
||||||
return buf.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** A matcher that will always cause a message to be dropped if it matches. */
|
/** A matcher that will always cause a message to be dropped if it matches. */
|
||||||
protected Matcher _stopMatcher;
|
protected Matcher _stopMatcher;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user