public class NetworkServerInjector
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 java.lang.Object |
serverHandler |
protected static java.lang.reflect.Field |
serverHandlerField |
protected VolatileField |
serverHandlerRef |
Constructor and Description |
---|
NetworkServerInjector(org.bukkit.entity.Player player,
PacketFilterManager manager,
java.util.Set<java.lang.Integer> sendingFilters,
com.comphenix.protocol.injector.InjectedServerConnection serverInjection) |
Modifier and Type | Method and Description |
---|---|
void |
checkListener(PacketListener listener)
Invoked before a new listener is registered.
|
void |
cleanupAll()
Remove all hooks and modifications.
|
protected net.minecraft.server.EntityPlayer |
getEntityPlayer()
Retrieve the notch (NMS) entity player object.
|
java.io.DataInputStream |
getInputStream(boolean cache)
Retrieve the current player's input stream.
|
protected java.lang.Object |
getNetHandler()
Retrieves the current net handler for this player.
|
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 VolatileField serverHandlerRef
protected java.lang.Object networkManager
protected java.lang.Object serverHandler
protected java.lang.Object netHandler
protected PacketFilterManager manager
protected java.util.Set<java.lang.Integer> sendingFilters
protected java.io.DataInputStream cachedInput
public NetworkServerInjector(org.bukkit.entity.Player player, PacketFilterManager manager, java.util.Set<java.lang.Integer> sendingFilters, com.comphenix.protocol.injector.InjectedServerConnection serverInjection) throws java.lang.IllegalAccessException
java.lang.IllegalAccessException
protected void initialize() 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()
public void checkListener(PacketListener listener)
The player injector should throw an exception if this listener cannot be properly supplied with packet events.
listener
- - the listener that is about to be registered.protected net.minecraft.server.EntityPlayer getEntityPlayer()
protected java.lang.Object getNetHandler() throws java.lang.IllegalAccessException
java.lang.IllegalAccessException
- Unable to find or retrieve net handler.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.