public interface PlayerInjectionHandler
| Modifier and Type | Interface and Description |
|---|---|
static class |
PlayerInjectionHandler.ConflictStrategy
How to handle a previously existing player injection.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addPacketHandler(PacketType type,
Set<ListenerOptions> options)
Add an underlying packet handler of the given type.
|
boolean |
canRecievePackets()
Whether or not this player injection handler can also receive packets.
|
void |
checkListener(PacketListener listener)
Determine if a listener is valid or not.
|
void |
checkListener(Set<PacketListener> listeners)
Determine if the given listeners are valid.
|
void |
close()
Close any lingering proxy injections.
|
io.netty.channel.Channel |
getChannel(org.bukkit.entity.Player player) |
org.bukkit.entity.Player |
getPlayerByConnection(DataInputStream inputStream)
Retrieve a player by its DataInput connection.
|
PlayerInjectHooks |
getPlayerHook()
Retrieves how the server packets are read.
|
PlayerInjectHooks |
getPlayerHook(GamePhase phase)
Retrieves how the server packets are read.
|
int |
getProtocolVersion(org.bukkit.entity.Player player)
Retrieve the protocol version of the given player.
|
Set<PacketType> |
getSendingFilters()
Retrieve the current list of registered sending listeners.
|
void |
handleDisconnect(org.bukkit.entity.Player player)
Invoke special routines for handling disconnect before a player is uninjected.
|
PacketEvent |
handlePacketRecieved(PacketContainer packet,
InputStream input,
byte[] buffered)
Invoked if this player injection handler can process received packets.
|
boolean |
hasMainThreadListener(PacketType type)
Determine if we have packet listeners with the given type that must be executed on the main thread.
|
void |
injectPlayer(org.bukkit.entity.Player player,
PlayerInjectionHandler.ConflictStrategy strategy)
Initialize a player hook, allowing us to read server packets.
|
void |
recieveClientPacket(org.bukkit.entity.Player player,
Object mcPacket)
Process a packet as if it were sent by the given player.
|
void |
removePacketHandler(PacketType type)
Remove an underlying packet handler of this type.
|
void |
sendServerPacket(org.bukkit.entity.Player receiver,
PacketContainer packet,
NetworkMarker marker,
boolean filters)
Send the given packet to the given receiver.
|
void |
setPlayerHook(GamePhase phase,
PlayerInjectHooks playerHook)
Sets how the server packets are read.
|
void |
setPlayerHook(PlayerInjectHooks playerHook)
Sets how the server packets are read.
|
boolean |
uninjectPlayer(InetSocketAddress address)
Unregisters a player by the given address.
|
boolean |
uninjectPlayer(org.bukkit.entity.Player player)
Uninject the given player.
|
void |
updatePlayer(org.bukkit.entity.Player player)
Ensure that packet readers are informed of this player reference.
|
int getProtocolVersion(org.bukkit.entity.Player player)
player - - the player.Integer.MIN_VALUE.PlayerInjectHooks getPlayerHook()
PlayerInjectHooks getPlayerHook(GamePhase phase)
phase - - the current game phase.void setPlayerHook(PlayerInjectHooks playerHook)
playerHook - - the new injection method for reading server packets.void setPlayerHook(GamePhase phase, PlayerInjectHooks playerHook)
phase - - the current game phase.playerHook - - the new injection method for reading server packets.void addPacketHandler(PacketType type, Set<ListenerOptions> options)
type - - packet type to register.options - - any specified listener options.void removePacketHandler(PacketType type)
type - - packet type to unregister.org.bukkit.entity.Player getPlayerByConnection(DataInputStream inputStream) throws InterruptedException
inputStream - - the associated DataInput connection.InterruptedException - If the thread was interrupted during the wait.void injectPlayer(org.bukkit.entity.Player player,
PlayerInjectionHandler.ConflictStrategy strategy)
This call will be ignored if there's no listener that can receive the given events.
player - - player to hook.strategy - - how to handle injection conflicts.void handleDisconnect(org.bukkit.entity.Player player)
player - - player to process.boolean uninjectPlayer(org.bukkit.entity.Player player)
player - - player to uninject.boolean uninjectPlayer(InetSocketAddress address)
If the server handler has been created before we've gotten a chance to unject the player, the method will try a workaround to remove the injected hook in the NetServerHandler.
address - - address of the player to unregister.void sendServerPacket(org.bukkit.entity.Player receiver,
PacketContainer packet,
NetworkMarker marker,
boolean filters)
throws InvocationTargetException
receiver - - the player receiver.packet - - the packet to send.marker - - network marker.filters - - whether or not to invoke the packet filters.InvocationTargetException - If an error occurred during sending.void recieveClientPacket(org.bukkit.entity.Player player,
Object mcPacket)
throws IllegalAccessException,
InvocationTargetException
player - - the sender.mcPacket - - the packet to process.IllegalAccessException - If the reflection machinery failed.InvocationTargetException - If the underlying method caused an error.void updatePlayer(org.bukkit.entity.Player player)
player - - the player to update.void checkListener(Set<PacketListener> listeners)
listeners - - listeners to check.void checkListener(PacketListener listener)
If not, a warning will be printed to the console.
listener - - listener to check.Set<PacketType> getSendingFilters()
boolean canRecievePackets()
PacketEvent handlePacketRecieved(PacketContainer packet, InputStream input, byte[] buffered)
packet - - the received packet.input - - the input stream.buffered - - the buffered packet.void close()
boolean hasMainThreadListener(PacketType type)
This only applies for onPacketSending(), as it makes certain guarantees.
type - - the packet type.io.netty.channel.Channel getChannel(org.bukkit.entity.Player player)
Copyright © 2012–2017 Comphenix and dmulloy2. Licensed under the GNU GPL v2.