Skip to content

Commit

Permalink
possible fix for spawner spawn event dup
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Dec 27, 2020
1 parent 475af32 commit 5c5214c
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ public void onEntitySpawn(EntitySpawnEvent event) {
this.entity = new EntityTag(entity);
location = new LocationTag(event.getLocation());
if (event instanceof CreatureSpawnEvent) {
reason = new ElementTag(((CreatureSpawnEvent) event).getSpawnReason().name());
CreatureSpawnEvent.SpawnReason creatureReason = ((CreatureSpawnEvent) event).getSpawnReason();
if (creatureReason == CreatureSpawnEvent.SpawnReason.SPAWNER) {
return; // Let the SpawnerSpawnEvent happen and handle it instead
}
reason = new ElementTag(creatureReason.name());
}
else if (event instanceof SpawnerSpawnEvent) {
reason = new ElementTag("SPAWNER");
Expand Down

0 comments on commit 5c5214c

Please sign in to comment.