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.
1
<!-- Import for SupremeSpawners -->
2
<dependency>
3
<groupId>life.savag3</groupId>
4
<artifactId>SupremeFactions</artifactId>
5
<version>1.0.0</version>
6
<scope>system</scope>
7
<systemPath>${project.basedir}/dependencies/SupremeSpawners-API.jar</systemPath>
8
</dependency>
9
10
<!-- Import for SupremeCommons -->
11
<dependency>
12
<groupId>me.savag3</groupId>
13
<artifactId>Commons</artifactId>
14
<version>1.0.0</version>
15
<scope>system</scope>
16
<systemPath>${project.basedir}/dependencies/SupremeCommons-API.jar</systemPath>
17
</dependency>
Copied!
Since we do not shade commons into each plugin jar you'll need to import it separately.

Spawner API Usage

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

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

1
// Get a stacked entities reference by Entity
2
StackedObject object = StackedEntities.of(entity);
3
4
if (object instanceOf StackedEntity) {
5
StackedEntity stackedEntity = (StackedEntity) object;
6
stackedEntity.incrementStack(10); // Adds 10 to the stack size
7
stackedEntity.decrementStack(11); // Removed 10 from the stack
8
// If removeAmount > stackSize the entity is removed.
9
}
10
11
if (object instanceOf StackedItem) {
12
StackedItem stackedItem = (StackedItem) object;
13
stackedItem.incrementStack(10); // Adds 10 to the stack size
14
stackedItem.decrementStack(11); // Removed 10 from the stack
15
// If removeAmount > stackSize the entity is removed.
16
}
Copied!

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 modified 1mo ago