From cc8c616c5f02c9443630ccb855c17cccf71eb4b5 Mon Sep 17 00:00:00 2001 From: Fernando Pettinelli Date: Sat, 2 Jan 2021 09:03:04 -0300 Subject: [PATCH] Re-added the spawn reason set metadata. --- .../listeners/entity/EntityListeners.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/songoda/ultimatestacker/listeners/entity/EntityListeners.java b/src/main/java/com/songoda/ultimatestacker/listeners/entity/EntityListeners.java index 3c58959..bfc0f1f 100644 --- a/src/main/java/com/songoda/ultimatestacker/listeners/entity/EntityListeners.java +++ b/src/main/java/com/songoda/ultimatestacker/listeners/entity/EntityListeners.java @@ -22,11 +22,9 @@ import org.bukkit.entity.TNTPrimed; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityExplodeEvent; -import org.bukkit.event.entity.EntityTransformEvent; -import org.bukkit.event.entity.ItemSpawnEvent; +import org.bukkit.event.entity.*; import org.bukkit.inventory.ItemStack; +import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.util.Vector; import java.util.ArrayList; @@ -89,7 +87,11 @@ public class EntityListeners implements Listener { } } - + @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) + public void onSpawn(CreatureSpawnEvent event) { + event.getEntity().setMetadata("US_REASON", new FixedMetadataValue(plugin, event.getSpawnReason().name())); + } + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBlow(EntityExplodeEvent event) { if (!plugin.spawnersEnabled()) return;