Class CommandFilter.Filter

java.lang.Object
com.comphenix.protocol.CommandFilter.Filter
Enclosing class:
CommandFilter

public static class CommandFilter.Filter extends Object
A filter that will be used to process a packet event.
  • Constructor Details

    • Filter

      public Filter(String name, String predicate, Set<PacketType> packets)
      Construct a new immutable filter.
      Parameters:
      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.
  • Method Details

    • getName

      public String getName()
      Retrieve the unique name of the filter.
      Returns:
      Unique name of the filter.
    • getPredicate

      public String getPredicate()
      Retrieve the JavaScript predicate that will be used to filter packet events.
      Returns:
      Predicate itself.
    • getRanges

      public Set<PacketType> getRanges()
      Retrieve a copy of the set of packets this filter applies to.
      Returns:
      Set of packets this filter applies to.
    • evaluate

      public boolean evaluate(ScriptEngine context, PacketEvent event) throws ScriptException
      Evaluate the current filter using the provided ScriptEngine as context.

      This context may be modified with additional code.

      Parameters:
      context - - the current script context.
      event - - the packet event to evaluate.
      Returns:
      TRUE to pass this packet event on to the debug listeners, FALSE otherwise.
      Throws:
      ScriptException - If the compilation failed or the filter is not valid.
    • compile

      public void compile(ScriptEngine context) throws ScriptException
      Force the compilation of a specific filter.
      Parameters:
      context - - the current script context.
      Throws:
      ScriptException - If the compilation failed.
    • close

      public void close(ScriptEngine context)
      Clean up all associated code from this filter in the provided script engine.
      Parameters:
      context - - the current script context.