public class ProtocolInjector extends Object implements ChannelListener
| Modifier and Type | Field and Description |
|---|---|
static ReportType |
REPORT_CANNOT_INJECT_INCOMING_CHANNEL |
| Constructor and Description |
|---|
ProtocolInjector(org.bukkit.plugin.Plugin plugin,
ListenerInvoker invoker,
ErrorReporter reporter) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Clean up any remaning injections.
|
PacketInjector |
getPacketInjector()
Retrieve a view of this protocol injector as a packet injector.
|
PlayerInjectionHandler |
getPlayerInjector() |
ErrorReporter |
getReporter()
Retrieve the current error reporter.
|
boolean |
hasListener(Class<?> packetClass)
Determine if there is a packet listener for the given packet.
|
boolean |
hasMainThreadListener(Class<?> packetClass)
Determine if there is a server packet listener that must be executed on the main thread.
|
boolean |
includeBuffer(Class<?> packetClass)
Determine if we need the buffer data of a given client side packet.
|
void |
inject()
Inject into the spigot connection class.
|
void |
injectPlayer(org.bukkit.entity.Player player)
Inject our packet handling into a specific player.
|
boolean |
isDebug()
Determine if debug mode is enabled.
|
PacketEvent |
onPacketReceiving(Injector injector,
Object packet,
NetworkMarker marker)
Invoked when a packet is being received from a client.
|
PacketEvent |
onPacketSending(Injector injector,
Object packet,
NetworkMarker marker)
Invoked when a packet is being sent to the client.
|
void |
setDebug(boolean debug)
Set whether or not the debug mode is enabled.
|
public static final ReportType REPORT_CANNOT_INJECT_INCOMING_CHANNEL
public ProtocolInjector(org.bukkit.plugin.Plugin plugin,
ListenerInvoker invoker,
ErrorReporter reporter)
public boolean isDebug()
ChannelListenerisDebug in interface ChannelListenerpublic void setDebug(boolean debug)
debug - - TRUE if it is, FALSE otherwise.public void inject()
public boolean hasListener(Class<?> packetClass)
ChannelListenerhasListener in interface ChannelListenerpacketClass - - the packet class to check.public boolean hasMainThreadListener(Class<?> packetClass)
ChannelListenerhasMainThreadListener in interface ChannelListenerpacketClass - - the packet class to check.public ErrorReporter getReporter()
ChannelListenergetReporter in interface ChannelListenerpublic void injectPlayer(org.bukkit.entity.Player player)
player - Player to inject intopublic void close()
public PacketEvent onPacketSending(Injector injector, Object packet, NetworkMarker marker)
ChannelListenerThis is invoked on the main thread.
onPacketSending in interface ChannelListenerinjector - - the channel injector.packet - - the packet.marker - - the network marker.public PacketEvent onPacketReceiving(Injector injector, Object packet, NetworkMarker marker)
ChannelListenerThis is invoked on an asynchronous worker thread.
onPacketReceiving in interface ChannelListenerinjector - - the channel injector.packet - - the packet.marker - - the associated network marker, if any.public boolean includeBuffer(Class<?> packetClass)
ChannelListenerincludeBuffer in interface ChannelListenerpacketClass - - the packet class.public PlayerInjectionHandler getPlayerInjector()
public PacketInjector getPacketInjector()
Copyright © 2012–2017 Comphenix and dmulloy2. Licensed under the GNU GPL v2.