Developer API

Environment Setup

SupremeSpawners clients can download the API jar in #FAQ. Developers should ONLY have access to the API jar as everything required to use the API is included. Developers will NEVER need the real SupremeSpawners.jar to make addons. To setup your development environment you'll need to import the folliowing.

<!-- Import for SupremeSpawners -->

<!-- Import for SupremeCommons -->

Since we do not shade commons into each plugin jar you'll need to import it separately.

Spawner API Usage

// Get a Spawner Object
// You can also get spawners by Block, Id, Chunk, and nearby a player
Spawner spawner = Spawners.getInstance().getByLocation(org.bukkit.Location);

Spawner Events

CachePreSpawnEvent - Called before the server spawn a cache of entities from the last tick. This even is cancellable, and includes a reference to the cache itself & all the entities it contains.

SpawnerBreakEvent - Called when a spawner is broken by a player.

SpawnerExplodeEvent - Called when a spawner block is broken by an explosion.

SpawnerPlaceEvent - Called when a spawner is placed by a player.

SpawnerUpgradeEvent - Called when a spawner is upgraded by a player.

Stacker API Usage

// Get a stacked entities reference by Entity
StackedObject object = StackedEntities.of(entity);

if (object instanceOf StackedEntity) {
    StackedEntity stackedEntity = (StackedEntity) object;
    stackedEntity.incrementStack(10); // Adds 10 to the stack size
    stackedEntity.decrementStack(11); // Removed 10 from the stack
    // If removeAmount > stackSize the entity is removed.

if (object instanceOf StackedItem) {
    StackedItem stackedItem = (StackedItem) object;
    stackedItem.incrementStack(10); // Adds 10 to the stack size
    stackedItem.decrementStack(11); // Removed 10 from the stack
    // If removeAmount > stackSize the entity is removed.

Stacker Events

StackedEntityDeathEvent - Called when a stacked entities size is <= 0 and the entity is removed.

StackedEntityDecayEvent - Called when a stacked entity is decremented.

Last updated