Annotation Interface EventHandler


@Retention(RUNTIME) @Target(METHOD) public @interface EventHandler
Marks a method as an event handler.

Methods annotated with @EventHandler will automatically be registered as event listeners when the plugin is enabled. The method must have exactly one parameter which is the event type to listen for.

Usage Example:


@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
    getLogger().info("Player joined: " + event.getPlayerName());
}

@EventHandler(priority = EventPriority.HIGH)
public void onPlayerChat(PlayerChatEvent event) {
    // This handler runs with HIGH priority
}

Since:
1.0.0
Version:
1.0.4
Author:
HytaleLoader
See Also:
  • EventPriority
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    com.hypixel.hytale.event.EventPriority
    The priority of this event handler.
  • Element Details

    • priority

      com.hypixel.hytale.event.EventPriority priority
      The priority of this event handler.

      Higher priority handlers are executed first. Default is EventPriority.NORMAL.

      Returns:
      the event priority
      Default:
      NORMAL