|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wyvern.lib.classes.filters.SpeechFilter
A generic mechanism for filtering things people say. Subclasses decide exactly how to filter the text.
Nested Class Summary | |
class |
SpeechFilter.Replacement
Keeps track of a pattern and its replacement. |
Field Summary | |
protected java.util.HashSet |
agents_
The set of players this filter is currently acting on. |
Constructor Summary | |
SpeechFilter()
Constructs a new SpeechFilter |
|
SpeechFilter(Commandable agent)
Constructs a new SpeechFilter to filter the specified agent. |
Method Summary | |
void |
addGlobalPattern(java.lang.String regex,
java.lang.String replacement)
Adds a regex to replace globally. |
void |
addSinglePattern(java.lang.String regex,
java.lang.String replacement)
Adds a regex to replace one time. |
java.lang.String |
applyFilter(java.lang.String text)
Subclasses should use this method to change the message. |
void |
detachFromAgent(Commandable agent)
Stops filtering the specified agent. |
void |
filterAgent(Commandable agent)
Attaches the filter to the specified agent. |
boolean |
filterSay()
Determines whether the filter filters "say" messages. |
boolean |
filterShout()
Determines whether the filter filters "shout" messages. |
boolean |
filterTell()
Determines whether the filter filters "tell" messages. |
boolean |
filterWhisper()
Determines whether the filter filters "whisper" messages. |
java.util.List |
getGlobalPatterns()
Returns a list of the replace-all patterns for this filter, if any. |
java.util.List |
getSinglePatterns()
Returns a list of the replace-one-time patterns for this filter, if any. |
void |
hookEvent(java.lang.String hookName,
CommandEvent ev)
Called when the player's trying to say something. |
void |
notifyAdd(PropertyList obj)
Notifies the property that it's being added. |
void |
notifyRemove(PropertyList obj)
Notifies the property that it's being removed. |
void |
shutdown()
Turns the filter off and removes it. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface wyvern.lib.properties.MutableProperty |
createClone |
Field Detail |
protected java.util.HashSet agents_
Constructor Detail |
public SpeechFilter()
public SpeechFilter(Commandable agent)
Method Detail |
public void notifyAdd(PropertyList obj)
notifyAdd
in interface AddRemoveNotify
obj
- the GameObject whose property list we're being
added topublic void notifyRemove(PropertyList obj)
notifyRemove
in interface AddRemoveNotify
obj
- the GameObject whose property list we're being
removed frompublic void filterAgent(Commandable agent)
public void shutdown()
public void detachFromAgent(Commandable agent)
public void hookEvent(java.lang.String hookName, CommandEvent ev)
hookEvent
in interface HookCallback
hookName
- the hook, e.g. "sayPreHook"ev
- the CommandEvent encapsulating the event parameterspublic java.lang.String applyFilter(java.lang.String text)
text
- the initial text of the say/shout/tell
public boolean filterSay()
public boolean filterTell()
public boolean filterShout()
public boolean filterWhisper()
public void addGlobalPattern(java.lang.String regex, java.lang.String replacement)
regex
- a Perl5 regular expressionpublic void addSinglePattern(java.lang.String regex, java.lang.String replacement)
regex
- a Perl5 regular expressionpublic java.util.List getSinglePatterns()
public java.util.List getGlobalPatterns()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |