Events
When using an official platform-implementation of the LabyMod Server API, you can listen to the following events that are fired by the API:
LabyModPlayerJoinEvent
The LabyModPlayerJoinEvent
is fired after a player has sent
the VersionLoginPacket to the server.
Important Note
The LabyModPlayer
object of the player is not available before this event is fired. It is fired after the join event of the respective server platform (f.e. PlayerJoinEvent
on Bukkit).
The following methods are available in this event:
#labyModPlayer()
- Returns theLabyModPlayer
object of the player.#protocolService()
- Returns theLabyModProtocolService
instance.
LabyModPacketSentEvent
The LabyModPacketSentEvent
is fired after a packet has been sent to a player.
The following methods are available in this event:
#packet()
- Returns the packet that has been sent.#protocolService()
- Returns theLabyModProtocolService
instance.#protocol()
- The protocol that the packet has been sent with.#getReceiver()
- Returns the unique id player that the packet has been sent to.#getLabyModPlayer()
- Returns theLabyModPlayer
object of the player that the packet has been sent to. Can benull
if it's not a LabyMod player.
LabyModPacketReceiveEvent
The LabyModPacketReceiveEvent
is fired after a packet has been received from a player (and after all registered
packet handlers have handled the packet).
The following methods are available in this event:
#packet()
- Returns the packet that was sent by the player.#protocolService()
- Returns theLabyModProtocolService
instance.#protocol()
- The protocol that the packet was received on.#getSender()
- Returns the unique id player that has sent the packet.#getLabyModPlayer()
- Returns theLabyModPlayer
object of the player that has sent the packet. Can benull
if it's not a LabyMod player.
LabyModInstalledAddonsUpdateEvent
The LabyModInstalledAddonsUpdateEvent
is fired either after the server received InstalledAddonsResponsePacket
or AddonStateChangedPacket
.
The following methods are available in this event:
#protocolService()
- Returns theLabyModProtocolService
instance.#labyModPlayer()
- Returns theLabyModPlayer
object of the player.#installedAddons()
- Returns the already updatedInstalledAddonsResponse
object which can also be accessed viaLabyModPlayer#installedAddons
.