public static class CommandFilter.Filter extends Object
| Constructor and Description |
|---|
Filter(String name,
String predicate,
Set<PacketType> packets)
Construct a new immutable filter.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close(ScriptEngine context)
Clean up all associated code from this filter in the provided script engine.
|
void |
compile(ScriptEngine context)
Force the compilation of a specific filter.
|
boolean |
evaluate(ScriptEngine context,
PacketEvent event)
Evaluate the current filter using the provided ScriptEngine as context.
|
String |
getName()
Retrieve the unique name of the filter.
|
String |
getPredicate()
Retrieve the JavaScript predicate that will be used to filter packet events.
|
Set<PacketType> |
getRanges()
Retrieve a copy of the set of packets this filter applies to.
|
public Filter(String name, String predicate, Set<PacketType> packets)
name - - the unique name of the filter.predicate - - the JavaScript predicate that will be used to filter packet events.packets - - a list of packet types this filter applies to.public String getName()
public String getPredicate()
public Set<PacketType> getRanges()
public boolean evaluate(ScriptEngine context, PacketEvent event) throws ScriptException
This context may be modified with additional code.
context - - the current script context.event - - the packet event to evaluate.ScriptException - If the compilation failed or the filter is not valid.public void compile(ScriptEngine context) throws ScriptException
context - - the current script context.ScriptException - If the compilation failed.public void close(ScriptEngine context)
context - - the current script context.Copyright © 2012–2017 Comphenix and dmulloy2. Licensed under the GNU GPL v2.