public interface ProtocolManager
Modifier and Type | Method and Description |
---|---|
void |
addPacketListener(PacketListener listener)
Adds a packet listener.
|
PacketContainer |
createPacket(int id)
Constructs a new encapsulated Minecraft packet with the given ID.
|
PacketContainer |
createPacket(int id,
boolean forceDefaults)
Constructs a new encapsulated Minecraft packet with the given ID.
|
PacketConstructor |
createPacketConstructor(int id,
java.lang.Object... arguments)
Construct a packet using the special builtin Minecraft constructors.
|
com.google.common.collect.ImmutableSet<PacketListener> |
getPacketListeners()
Retrieves a list of every registered packet listener.
|
java.util.Set<java.lang.Integer> |
getReceivingFilters()
Retrieves a immutable set containing the ID of the recieved client packets that will be observed by listeners.
|
java.util.Set<java.lang.Integer> |
getSendingFilters()
Retrieves a immutable set containing the ID of the sent server packets that will be observed by listeners.
|
boolean |
isClosed()
Determines whether or not this protocol mananger has been disabled.
|
void |
recieveClientPacket(org.bukkit.entity.Player sender,
PacketContainer packet)
Simulate recieving a certain packet from a given player.
|
void |
recieveClientPacket(org.bukkit.entity.Player sender,
PacketContainer packet,
boolean filters)
Simulate recieving a certain packet from a given player.
|
void |
removePacketListener(PacketListener listener)
Removes a given packet listener.
|
void |
removePacketListeners(org.bukkit.plugin.Plugin plugin)
Removes every listener associated with the given plugin.
|
void |
sendServerPacket(org.bukkit.entity.Player reciever,
PacketContainer packet)
Send a packet to the given player.
|
void |
sendServerPacket(org.bukkit.entity.Player reciever,
PacketContainer packet,
boolean filters)
Send a packet to the given player.
|
void |
updateEntity(org.bukkit.entity.Entity entity,
java.util.List<org.bukkit.entity.Player> observers)
Completely refresh all clients about an entity.
|
com.google.common.collect.ImmutableSet<PacketListener> getPacketListeners()
void addPacketListener(PacketListener listener)
Adding an already registered listener has no effect. If you need to change the packets the current listener is observing, you must first remove the packet listener before you can register it again.
listener
- - new packet listener.void removePacketListener(PacketListener listener)
Attempting to remove a listener that doesn't exist has no effect.
listener
- - the packet listener to remove.void removePacketListeners(org.bukkit.plugin.Plugin plugin)
plugin
- - the plugin to unload.void sendServerPacket(org.bukkit.entity.Player reciever, PacketContainer packet) throws java.lang.reflect.InvocationTargetException
reciever
- - the reciever.packet
- - packet to send.java.lang.reflect.InvocationTargetException
- - if an error occured when sending the packet.void sendServerPacket(org.bukkit.entity.Player reciever, PacketContainer packet, boolean filters) throws java.lang.reflect.InvocationTargetException
reciever
- - the reciever.packet
- - packet to send.filters
- - whether or not to invoke any packet filters.java.lang.reflect.InvocationTargetException
- - if an error occured when sending the packet.void recieveClientPacket(org.bukkit.entity.Player sender, PacketContainer packet) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
sender
- - the sender.packet
- - the packet that was sent.java.lang.reflect.InvocationTargetException
- If the reflection machinery failed.java.lang.IllegalAccessException
- If the underlying method caused an error.void recieveClientPacket(org.bukkit.entity.Player sender, PacketContainer packet, boolean filters) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
sender
- - the sender.packet
- - the packet that was sent.filters
- - whether or not to invoke any packet filters.java.lang.reflect.InvocationTargetException
- If the reflection machinery failed.java.lang.IllegalAccessException
- If the underlying method caused an error.PacketContainer createPacket(int id)
id
- - packet ID.PacketContainer createPacket(int id, boolean forceDefaults)
If set to true, the forceDefaults option will force the system to automatically give non-primitive fields in the packet sensible default values. For instance, certain packets - like Packet60Explosion - require a List or Set to be non-null. If the forceDefaults option is true, the List or Set will be automatically created.
id
- - packet ID.forceDefaults
- - TRUE to use sensible defaults in most fields, FALSE otherwise.PacketConstructor createPacketConstructor(int id, java.lang.Object... arguments)
id
- - the packet ID.arguments
- - arguments that will be passed to the constructor.void updateEntity(org.bukkit.entity.Entity entity, java.util.List<org.bukkit.entity.Player> observers) throws FieldAccessException
entity
- - entity to refresh.observers
- - the clients to update.FieldAccessException
java.util.Set<java.lang.Integer> getSendingFilters()
java.util.Set<java.lang.Integer> getReceivingFilters()
boolean isClosed()