Package com.comphenix.protocol
Class CommandFilter
java.lang.Object
com.comphenix.protocol.CommandFilter
- All Implemented Interfaces:
org.bukkit.command.CommandExecutor
A command to apply JavaScript filtering to the packet command.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA filter that will be used to process a packet event.static interface -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringName of this command.static final Stringstatic final ReportTypestatic final ReportTypestatic final ReportTypestatic final ReportTypestatic final ReportTypestatic final ReportTypestatic final ReportTypeprotected ErrorReporter -
Constructor Summary
ConstructorsConstructorDescriptionCommandFilter(ErrorReporter reporter, org.bukkit.plugin.Plugin plugin, ProtocolConfig config) -
Method Summary
Modifier and TypeMethodDescriptionbooleanfilterEvent(PacketEvent event) Determine whether to pass the given packet event to the packet listeners.booleanfilterEvent(PacketEvent event, CommandFilter.FilterFailedHandler handler) Determine whether to pass the given packet event to the packet listeners.getName()Retrieve the primary name of this command.Retrieve the permission necessary to execute this command.protected ErrorReporterRetrieve the error reporter.protected booleanhandleCommand(org.bukkit.command.CommandSender sender, String[] args) Main implementation of this command.booleanDetermine if the filter engine has been successfully initialized.final booleanonCommand(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, String label, String[] args) protected BooleanparseBoolean(Deque<String> arguments, String parameterName) Parse a boolean value at the head of the queue.Create a queue from a sublist of a given array.
-
Field Details
-
REPORT_FALLBACK_ENGINE
-
REPORT_CANNOT_LOAD_FALLBACK_ENGINE
-
REPORT_PACKAGES_UNSUPPORTED_IN_ENGINE
-
REPORT_FILTER_REMOVED_FOR_ERROR
-
REPORT_CANNOT_HANDLE_CONVERSATION
-
NAME
Name of this command.- See Also:
-
REPORT_COMMAND_ERROR
-
REPORT_UNEXPECTED_COMMAND
-
PERMISSION_ADMIN
- See Also:
-
reporter
-
-
Constructor Details
-
CommandFilter
public CommandFilter(ErrorReporter reporter, org.bukkit.plugin.Plugin plugin, ProtocolConfig config)
-
-
Method Details
-
isInitialized
public boolean isInitialized()Determine if the filter engine has been successfully initialized.- Returns:
- TRUE if it has, FALSE otherwise.
-
filterEvent
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
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
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:
onCommandin interfaceorg.bukkit.command.CommandExecutor
-
parseBoolean
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
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
Retrieve the permission necessary to execute this command.- Returns:
- The permission, or NULL if not needed.
-
getName
Retrieve the primary name of this command.- Returns:
- Primary name.
-
getReporter
Retrieve the error reporter.- Returns:
- Error reporter.
-