public interface ProtocolManager extends PacketStream
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.
|
AsynchronousManager |
getAsynchronousManager()
Retrieve the current asyncronous packet manager.
|
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 |
removePacketListener(PacketListener listener)
Removes a given packet listener.
|
void |
removePacketListeners(org.bukkit.plugin.Plugin plugin)
Removes every listener associated with the given plugin.
|
void |
updateEntity(org.bukkit.entity.Entity entity,
java.util.List<org.bukkit.entity.Player> observers)
Completely refresh all clients about an entity.
|
recieveClientPacket, recieveClientPacket, sendServerPacket, sendServerPacket
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.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
Note that this method is NOT thread safe. If you call this method from anything but the main thread, it will throw an exception.
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()
AsynchronousManager getAsynchronousManager()