Class CommandFilter

java.lang.Object
com.comphenix.protocol.CommandFilter
All Implemented Interfaces:
org.bukkit.command.CommandExecutor

public class CommandFilter extends Object
A command to apply JavaScript filtering to the packet command.
  • Field Details

    • REPORT_FALLBACK_ENGINE

      public static final ReportType REPORT_FALLBACK_ENGINE
    • REPORT_CANNOT_LOAD_FALLBACK_ENGINE

      public static final ReportType REPORT_CANNOT_LOAD_FALLBACK_ENGINE
    • REPORT_PACKAGES_UNSUPPORTED_IN_ENGINE

      public static final ReportType REPORT_PACKAGES_UNSUPPORTED_IN_ENGINE
    • REPORT_FILTER_REMOVED_FOR_ERROR

      public static final ReportType REPORT_FILTER_REMOVED_FOR_ERROR
    • REPORT_CANNOT_HANDLE_CONVERSATION

      public static final ReportType REPORT_CANNOT_HANDLE_CONVERSATION
    • NAME

      public static final String NAME
      Name of this command.
      See Also:
    • REPORT_COMMAND_ERROR

      public static final ReportType REPORT_COMMAND_ERROR
    • REPORT_UNEXPECTED_COMMAND

      public static final ReportType REPORT_UNEXPECTED_COMMAND
    • PERMISSION_ADMIN

      public static final String PERMISSION_ADMIN
      See Also:
    • reporter

      protected ErrorReporter reporter
  • Constructor Details

  • Method Details

    • isInitialized

      public boolean isInitialized()
      Determine if the filter engine has been successfully initialized.
      Returns:
      TRUE if it has, FALSE otherwise.
    • filterEvent

      public boolean filterEvent(PacketEvent event)
      Determine whether to pass the given packet event to the packet listeners.

      Uses a default filter failure handler that simply prints the error message and removes the filter.

      Parameters:
      event - - the event.
      Returns:
      TRUE if we should, FALSE otherwise.
    • filterEvent

      public boolean filterEvent(PacketEvent event, CommandFilter.FilterFailedHandler handler)
      Determine whether to pass the given packet event to the packet listeners.
      Parameters:
      event - - the event.
      handler - - failure handler.
      Returns:
      TRUE if we should, FALSE otherwise.
    • handleCommand

      protected boolean handleCommand(org.bukkit.command.CommandSender sender, String[] args)
      Main implementation of this command.
      Parameters:
      sender - - command sender.
      args - - input arguments.
      Returns:
      TRUE if the command was successfully handled, FALSE otherwise.
    • onCommand

      public final boolean onCommand(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args)
      Specified by:
      onCommand in interface org.bukkit.command.CommandExecutor
    • parseBoolean

      protected Boolean parseBoolean(Deque<String> arguments, String parameterName)
      Parse a boolean value at the head of the queue.
      Parameters:
      arguments - - the queue of arguments.
      parameterName - - the parameter name we will match.
      Returns:
      The parsed boolean, or NULL if not valid.
    • toQueue

      protected Deque<String> toQueue(String[] args, int start)
      Create a queue from a sublist of a given array.
      Parameters:
      args - - the source array.
      start - - the starting index.
      Returns:
      A queue that contains every element in the array, starting at the given index.
    • getPermission

      public String getPermission()
      Retrieve the permission necessary to execute this command.
      Returns:
      The permission, or NULL if not needed.
    • getName

      public String getName()
      Retrieve the primary name of this command.
      Returns:
      Primary name.
    • getReporter

      protected ErrorReporter getReporter()
      Retrieve the error reporter.
      Returns:
      Error reporter.