Updated Packet listeners and adapters (markdown)
parent
6f16b30b72
commit
fd84bdfe34
|
@ -20,7 +20,7 @@ This is a rather trivial example to listen for incoming chat packets and block t
|
|||
## PacketType
|
||||
PacketType is an enum-like class that contains every packet supported by ProtocolLib. PacketTypes are formatted as `PacketType.[Game Phase].[Direction].[Packet Name]`. The game phase is one of `Handshake`, `Play` (you'll probably mostly be working with play), `Status`, and `Login`. The direction is either `Client` (**incoming** packets) or `Server` (**outgoing** packets)
|
||||
|
||||
You can find a list of all packets in the JavaDocs: http://ci.dmulloy2.net/job/ProtocolLib/javadoc/com/comphenix/protocol/PacketType.html
|
||||
You can find a list of all packets in the JavaDocs: https://ci.dmulloy2.net/job/ProtocolLib/javadoc/com/comphenix/protocol/PacketType.html
|
||||
|
||||
## PacketContainer
|
||||
PacketContainer is how plugins can modify packets with ProtocolLib. It contains accessors for every type of field present in Minecraft packets. In this example, `packet.getStrings()` returns a modifier for each String field in the chat packet.
|
||||
|
@ -29,4 +29,4 @@ You can read more about PacketContainers on the wiki page: [insert]
|
|||
|
||||
## Odds and Ends
|
||||
* Every packet can be cancelled with `event.setCancelled(true)` (that doesn't mean you _should_, but you _can_)
|
||||
* In some game phases (non-play ones), `event.getPlayer()` will sometimes return a TemporaryPlayer when a Bukkit player is not available. They have a reduced set of available methods and can be checked for with [`event.isPlayerTemporary()`](http://ci.dmulloy2.net/job/ProtocolLib/javadoc/com/comphenix/protocol/events/PacketEvent.html#isPlayerTemporary--)
|
||||
* In some game phases (non-play ones), `event.getPlayer()` will sometimes return a TemporaryPlayer when a Bukkit player is not available. They have a reduced set of available methods and can be checked for with [`event.isPlayerTemporary()`](https://ci.dmulloy2.net/job/ProtocolLib/javadoc/com/comphenix/protocol/events/PacketEvent.html#isPlayerTemporary--)
|
Loading…
Reference in New Issue