Skip to content

Minestom helpers

The typed listen extension adds an event listener and returns the same EventNode, which keeps listener setup concise and chainable:

inventory.eventNode()
.listen { event: InventoryPreClickEvent ->
// Handle the event with its inferred concrete type.
}

The helper delegates directly to EventNode.addListener. It does not introduce a second event bus or change Minestom’s event propagation model.

The reified setPlayListener extension removes the class token from Kotlin packet-listener setup:

MinecraftServer.getPacketListenerManager()
.setPlayListener<ClientPlayerLoadedPacket> { packet, player ->
// Handle the packet with its concrete type.
}

This delegates to PacketListenerManager.setPlayListener(Class, PacketPlayListenerConsumer). Like the Minestom method, it replaces the listener for that packet type; it does not add another listener alongside the existing one.