Developer API
Reading spawners and reacting to spawner events from your own plugin.
EliteSpawner exposes an API for other plugins: look up, create and remove spawners, read their live state, and hook into five cancellable events.
Getting the API
EliteSpawnerAPI api = EliteSpawnerProvider.get();
SpawnerHandle handle = api.getSpawner(location);Add EliteSpawner as a depend or softdepend in your plugin.yml so it loads before your plugin.
EliteSpawnerAPI
Look up, create and remove spawners by location.
SpawnerHandle
A spawner's live state: entity type, stack size, stored loot and experience. No internal types are exposed.
Events
All five events are cancellable.
| Event | Fired when |
|---|---|
SpawnerPlaceEvent | A spawner is placed |
SpawnerBreakEvent | A spawner is broken. Also exposes whether an item will drop |
SpawnerStackEvent | A spawner's stack size is about to change |
SpawnerLootGenerateEvent | A generation cycle is about to apply its drops and experience |
SpawnerSellEvent | A sale is about to go through |
Mutable events
SpawnerLootGenerateEvent lets you change the drops and experience before they're stored, and SpawnerSellEvent lets you change the sale price.
The API may change before 1.0
EliteSpawner is in early development. Expect API changes between early versions and check the changelog when updating.
Last updated on