public class PlayerInjectionHandler
extends java.lang.Object
Constructor and Description |
---|
PlayerInjectionHandler(java.lang.ClassLoader classLoader,
java.util.logging.Logger logger,
ListenerInvoker invoker,
org.bukkit.Server server) |
Modifier and Type | Method and Description |
---|---|
void |
addPacketHandler(int packetID)
Add an underlying packet handler of the given ID.
|
void |
checkListener(PacketListener listener)
Determine if a listener is valid or not.
|
void |
checkListener(java.util.Set<PacketListener> listeners)
Determine if the given listeners are valid.
|
void |
close() |
java.util.logging.Logger |
getLogger()
Retrieve the current logger.
|
org.bukkit.entity.Player |
getPlayerByConnection(java.io.DataInputStream inputStream) |
PacketFilterManager.PlayerInjectHooks |
getPlayerHook()
Retrieves how the server packets are read.
|
java.util.Set<java.lang.Integer> |
getSendingFilters()
Retrieve the current list of registered sending listeners.
|
void |
injectPlayer(org.bukkit.entity.Player player)
Initialize a player hook, allowing us to read server packets.
|
void |
processPacket(org.bukkit.entity.Player player,
net.minecraft.server.Packet mcPacket)
Process a packet as if it were sent by the given player.
|
void |
removePacketHandler(int packetID)
Remove an underlying packet handler of ths ID.
|
void |
sendServerPacket(org.bukkit.entity.Player reciever,
PacketContainer packet,
boolean filters) |
void |
setPlayerHook(PacketFilterManager.PlayerInjectHooks playerHook)
Sets how the server packets are read.
|
void |
uninjectPlayer(org.bukkit.entity.Player player)
Unregisters the given player.
|
public PlayerInjectionHandler(java.lang.ClassLoader classLoader, java.util.logging.Logger logger, ListenerInvoker invoker, org.bukkit.Server server)
public PacketFilterManager.PlayerInjectHooks getPlayerHook()
public void addPacketHandler(int packetID)
packetID
- - packet ID to register.public void removePacketHandler(int packetID)
packetID
- - packet ID to unregister.public void setPlayerHook(PacketFilterManager.PlayerInjectHooks playerHook)
playerHook
- - the new injection method for reading server packets.public org.bukkit.entity.Player getPlayerByConnection(java.io.DataInputStream inputStream)
public void injectPlayer(org.bukkit.entity.Player player)
player
- - player to hook.public void uninjectPlayer(org.bukkit.entity.Player player)
player
- - player to unregister.public void sendServerPacket(org.bukkit.entity.Player reciever, PacketContainer packet, boolean filters) throws java.lang.reflect.InvocationTargetException
java.lang.reflect.InvocationTargetException
public void checkListener(java.util.Set<PacketListener> listeners)
listeners
- - listeners to check.public void checkListener(PacketListener listener)
listener
- - listener to check.java.lang.IllegalStateException
- If the given listener's whitelist cannot be fulfilled.public void processPacket(org.bukkit.entity.Player player, net.minecraft.server.Packet mcPacket) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
player
- - the sender.mcPacket
- - the packet to process.java.lang.IllegalAccessException
- If the reflection machinery failed.java.lang.reflect.InvocationTargetException
- If the underlying method caused an error.public java.util.Set<java.lang.Integer> getSendingFilters()
public java.util.logging.Logger getLogger()
public void close()