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 theLabyModPlayerobject of the player.#protocolService()- Returns theLabyModProtocolServiceinstance.
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 theLabyModProtocolServiceinstance.#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 theLabyModPlayerobject of the player that the packet has been sent to. Can benullif 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 theLabyModProtocolServiceinstance.#protocol()- The protocol that the packet was received on.#getSender()- Returns the unique id player that has sent the packet.#getLabyModPlayer()- Returns theLabyModPlayerobject of the player that has sent the packet. Can benullif 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 theLabyModProtocolServiceinstance.#labyModPlayer()- Returns theLabyModPlayerobject of the player.#installedAddons()- Returns the already updatedInstalledAddonsResponseobject which can also be accessed viaLabyModPlayer#installedAddons.