Skip to content

Commit

Permalink
Fix for #264
Browse files Browse the repository at this point in the history
Bees coming from hives trigger creature spawn event with SpawnReason BEEHIVE, however when using Paper's Entity#getEntitySpawnReason they retain their original spawn reason.

We could change it so that the spawn event uses the Paper method for checking blacklists etc, but there would be problems for spigot users, requiring checks for use of Paper. But if an entity was previously destacked - they would become stacked again.
  • Loading branch information
ploppyperson committed Apr 15, 2023
1 parent 01c721c commit 50d6ee0
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package uk.antiperson.stackmob.listeners;

import org.bukkit.entity.Bee;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Mob;
Expand All @@ -23,6 +24,11 @@ public void onSpawn(CreatureSpawnEvent event) {
if (!(event.getEntity() instanceof Mob)) {
return;
}
if (event.getEntity() instanceof Bee) {
if (event.getSpawnReason() == CreatureSpawnEvent.SpawnReason.BEEHIVE) {
return;
}
}
sm.getServer().getScheduler().runTask(sm, () -> {
if (sm.getEntityManager().isStackedEntity(event.getEntity())) {
StackEntity stackEntity = sm.getEntityManager().getStackEntity(event.getEntity());
Expand Down

0 comments on commit 50d6ee0

Please sign in to comment.