public abstract class CurseFilter extends Object implements ChatFilter
| Modifier and Type | Class and Description |
|---|---|
static class |
CurseFilter.Mode
Indicates how messages should be handled.
|
| Constructor and Description |
|---|
CurseFilter(String curseWords,
String stopWords)
Creates a curse filter.
|
| Modifier and Type | Method and Description |
|---|---|
static String |
comicChars(int length)
Return a comicy replacement of the specified length.
|
String |
filter(String msg,
Name otherUser,
boolean outgoing)
Filter a chat message.
|
abstract CurseFilter.Mode |
getFilterMode()
The client will need to provide a way to look up our current chat filter mode.
|
public CurseFilter(String curseWords, String stopWords)
*penis*=John_Thomas shit*=barnacle muff=britchesThe key/value pairs are separated by spaces, * matches word characters and the value after the = is the string into which to convert the text when converting to the vernacular. Underscores in the target string will be turned into spaces.
And stopWords should be in the following format:
*faggot* rape rapes raped rapingWords are separated by spaces and * matches any other word characters.
public static String comicChars(int length)
public abstract CurseFilter.Mode getFilterMode()
public String filter(String msg, Name otherUser, boolean outgoing)
ChatFilterfilter in interface ChatFiltermsg - the message text to be filtered.otherUser - an optional argument that represents the target or the speaker, depending
on 'outgoing', and can be considered in filtering if it is provided.outgoing - true if the message is going out to the server.Copyright © 2015. All rights reserved.