ArenaLegends
  • GENERAL USE
    • Getting Started
    • Commands
    • Permissions
    • Placeholders
    • Common Questions
    • Troubleshooting
    • Useful Links
  • GUIDES
    • Games
    • Arenas
    • Round Builder
    • Augments
    • Anvil Stats
    • Shopkeeper
    • Resource Pack
    • Data & MySQL
  • MENUS
    • Item Builders
    • Event Triggers
    • Player Heads
    • Click Commands
  • DEVELOPER API
    • Creating Augments
      • Game Events
      • Simple Augment
Powered by GitBook
On this page
  1. DEVELOPER API
  2. Creating Augments

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:

@Override
public Object executeEvents(Object... events) {
    if (!GameEvent.HOLDER_DAMAGE_PLAYER.equals(events[0])) return null;

    EntityDamageByEntityEvent event = (EntityDamageByEntityEvent) events[1];
    Player victim = (Player) event.getEntity();

    // Do stuff with the event.
    return null;
}

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.

PreviousCreating AugmentsNextSimple Augment

Last updated 8 months ago