Game Events
Catching Events
To catch an event, you can use the executeEvents
method.
The index 0 of the events array will be a GameEvent
enum. The index 1 will be the event itself.
Here's an example of how you can listen to an event where the holder attacks another player:
There's no need to worry about casting the Player
class to event.getEntity()
as HOLDER_DAMAGE_PLAYER
will ensure the method is run only when a player attacks another player.
Last updated