public class CommandFilter
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
CommandFilter.Filter
A filter that will be used to process a packet event.
|
static interface |
CommandFilter.FilterFailedHandler |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME
Name of this command.
|
static java.lang.String |
PERMISSION_ADMIN |
static ReportType |
REPORT_CANNOT_HANDLE_CONVERSATION |
static ReportType |
REPORT_CANNOT_LOAD_FALLBACK_ENGINE |
static ReportType |
REPORT_COMMAND_ERROR |
static ReportType |
REPORT_FALLBACK_ENGINE |
static ReportType |
REPORT_FILTER_REMOVED_FOR_ERROR |
static ReportType |
REPORT_PACKAGES_UNSUPPORTED_IN_ENGINE |
static ReportType |
REPORT_UNEXPECTED_COMMAND |
protected ErrorReporter |
reporter |
Constructor and Description |
---|
CommandFilter(ErrorReporter reporter,
org.bukkit.plugin.Plugin plugin,
ProtocolConfig config) |
Modifier and Type | Method and Description |
---|---|
boolean |
filterEvent(PacketEvent event)
Determine whether or not to pass the given packet event to the packet listeners.
|
boolean |
filterEvent(PacketEvent event,
CommandFilter.FilterFailedHandler handler)
Determine whether or not to pass the given packet event to the packet listeners.
|
java.lang.String |
getName()
Retrieve the primary name of this command.
|
java.lang.String |
getPermission()
Retrieve the permission necessary to execute this command.
|
protected ErrorReporter |
getReporter()
Retrieve the error reporter.
|
protected boolean |
handleCommand(org.bukkit.command.CommandSender sender,
java.lang.String[] args)
Main implementation of this command.
|
boolean |
isInitialized()
Determine if the filter engine has been successfully initialized.
|
boolean |
onCommand(org.bukkit.command.CommandSender sender,
org.bukkit.command.Command command,
java.lang.String label,
java.lang.String[] args) |
protected java.lang.Boolean |
parseBoolean(java.util.Deque<java.lang.String> arguments,
java.lang.String parameterName)
Parse a boolean value at the head of the queue.
|
protected java.util.Deque<java.lang.String> |
toQueue(java.lang.String[] args,
int start)
Create a queue from a sublist of a given array.
|
public static final ReportType REPORT_FALLBACK_ENGINE
public static final ReportType REPORT_CANNOT_LOAD_FALLBACK_ENGINE
public static final ReportType REPORT_PACKAGES_UNSUPPORTED_IN_ENGINE
public static final ReportType REPORT_FILTER_REMOVED_FOR_ERROR
public static final ReportType REPORT_CANNOT_HANDLE_CONVERSATION
public static final java.lang.String NAME
public static final ReportType REPORT_COMMAND_ERROR
public static final ReportType REPORT_UNEXPECTED_COMMAND
public static final java.lang.String PERMISSION_ADMIN
protected ErrorReporter reporter
public CommandFilter(ErrorReporter reporter, org.bukkit.plugin.Plugin plugin, ProtocolConfig config)
public boolean isInitialized()
public boolean filterEvent(PacketEvent event)
Uses a default filter failure handler that simply prints the error message and removes the filter.
event
- - the event.public boolean filterEvent(PacketEvent event, CommandFilter.FilterFailedHandler handler)
event
- - the event.handler
- - failure handler.FilterFailedException
- If one of the filters failed.protected boolean handleCommand(org.bukkit.command.CommandSender sender, java.lang.String[] args)
sender
- - command sender.args
- - input arguments.public final boolean onCommand(org.bukkit.command.CommandSender sender, org.bukkit.command.Command command, java.lang.String label, java.lang.String[] args)
onCommand
in interface org.bukkit.command.CommandExecutor
protected java.lang.Boolean parseBoolean(java.util.Deque<java.lang.String> arguments, java.lang.String parameterName)
arguments
- - the queue of arguments.parameterName
- - the parameter name we will match.protected java.util.Deque<java.lang.String> toQueue(java.lang.String[] args, int start)
args
- - the source array.start
- - the starting index.public java.lang.String getPermission()
public java.lang.String getName()
protected ErrorReporter getReporter()