public class NetworkObjectInjector
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.io.DataInputStream |
cachedInput |
protected boolean |
hasInitialized |
protected static java.lang.reflect.Field |
inputField |
protected PacketFilterManager |
manager |
protected java.lang.Object |
netHandler |
protected static java.lang.reflect.Field |
netHandlerField |
protected java.lang.Object |
networkManager |
protected static java.lang.reflect.Field |
networkManagerField |
protected VolatileField |
networkManagerRef |
protected static StructureModifier<java.lang.Object> |
networkModifier |
protected org.bukkit.entity.Player |
player |
protected static java.lang.reflect.Method |
processMethod |
protected static java.lang.reflect.Method |
queueMethod |
protected java.util.Set<java.lang.Integer> |
sendingFilters |
protected static java.lang.reflect.Field |
serverHandlerField |
Constructor and Description |
---|
NetworkObjectInjector(org.bukkit.entity.Player player,
PacketFilterManager manager,
java.util.Set<java.lang.Integer> sendingFilters) |
Modifier and Type | Method and Description |
---|---|
void |
cleanupAll()
Remove all hooks and modifications.
|
java.io.DataInputStream |
getInputStream(boolean cache)
Retrieve the current player's input stream.
|
protected void |
initialize() |
void |
injectManager()
Inject a hook to catch packets sent to the current player.
|
void |
processPacket(net.minecraft.server.Packet packet)
Processes the given packet as if it was transmitted by the current player.
|
void |
sendServerPacket(net.minecraft.server.Packet packet,
boolean filtered)
Send a packet to the client.
|
protected static java.lang.reflect.Field serverHandlerField
protected static java.lang.reflect.Field networkManagerField
protected static java.lang.reflect.Field inputField
protected static java.lang.reflect.Field netHandlerField
protected static StructureModifier<java.lang.Object> networkModifier
protected static java.lang.reflect.Method queueMethod
protected static java.lang.reflect.Method processMethod
protected org.bukkit.entity.Player player
protected boolean hasInitialized
protected VolatileField networkManagerRef
protected java.lang.Object networkManager
protected java.lang.Object netHandler
protected PacketFilterManager manager
protected java.util.Set<java.lang.Integer> sendingFilters
protected java.io.DataInputStream cachedInput
public NetworkObjectInjector(org.bukkit.entity.Player player, PacketFilterManager manager, java.util.Set<java.lang.Integer> sendingFilters) throws java.lang.IllegalAccessException
java.lang.IllegalAccessException
public void sendServerPacket(net.minecraft.server.Packet packet, boolean filtered) throws java.lang.reflect.InvocationTargetException
packet
- - server packet to send.filtered
- - whether or not the packet will be filtered by our listeners.java.lang.reflect.InvocationTargetException
public void injectManager()
public void cleanupAll()
protected void initialize() throws java.lang.IllegalAccessException
java.lang.IllegalAccessException
public void processPacket(net.minecraft.server.Packet packet) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
packet
- - packet to process.java.lang.IllegalAccessException
- If the reflection machinery failed.java.lang.reflect.InvocationTargetException
- If the underlying method caused an error.public java.io.DataInputStream getInputStream(boolean cache)
cache
- - whether or not to cache the result of this method.