# Events

## Events

All of them are ordinary Bukkit events in `com.phoenixplugins.phoenixholograms.api.events`. Every event but `HologramsLoadEvent` carries the hologram's id with `getIdentifier()`.

| Event | Fired when | Also carries | Cancellable |
| ----- | ---------- | ------------ | ----------- |
| `HologramClickEvent` | A player clicks a hologram, before any action runs | `getPlayer()`, `getPage()` and `getLine()` counted from 0, `isLeftClick()` | Yes |
| `HologramCreateEvent` | A hologram is created | | No |
| `HologramEditEvent` | A hologram changes | `getChange()`, the name of what changed | No |
| `HologramDeleteEvent` | A hologram is deleted | | No |
| `HologramShowEvent` | A player comes into view of a hologram and is about to see it | `getPlayer()`, `getPage()` counted from 1 | Yes |
| `HologramHideEvent` | A player stops seeing a hologram: out of range, no longer allowed, or hidden | `getPlayer()`, `getPage()` counted from 1 | No |
| `HologramsLoadEvent` | The plugin has loaded every hologram | | No |

Cancelling `HologramClickEvent` stops the click: no action runs and the cooldown does not start.

Cancelling `HologramShowEvent` keeps the hologram hidden from that player. It fires again on the next visibility check, so the decision can change later. Both events fire on the thread that owns the player, the main thread outside Folia. A redraw after an edit fires neither, and removing or disabling a hologram fires `HologramDeleteEvent` or `HologramEditEvent` instead of a hide per player. A change synced from another server fires `HologramEditEvent` with the change `sync`.

```java
@EventHandler
public void onHologramClick(HologramClickEvent event) {
    if (event.getIdentifier().equals("arena_join") && inMatch(event.getPlayer())) {
        event.setCancelled(true);
    }
}
```

Source: https://www.phoenixplugins.com/docs/phoenix-holograms/api/events