From 7796e6ff5e56fb80d7ec63ae08ce126079812852 Mon Sep 17 00:00:00 2001 From: Archy-X <63976867+Archy-X@users.noreply.github.com> Date: Sun, 2 Jun 2024 16:15:21 -0700 Subject: [PATCH] Fix RoseStacker spawner mobs not working with spawner_multiplier --- .../auraskills/bukkit/source/EntityLeveler.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bukkit/src/main/java/dev/aurelium/auraskills/bukkit/source/EntityLeveler.java b/bukkit/src/main/java/dev/aurelium/auraskills/bukkit/source/EntityLeveler.java index d6ff91d65..50788f0b9 100644 --- a/bukkit/src/main/java/dev/aurelium/auraskills/bukkit/source/EntityLeveler.java +++ b/bukkit/src/main/java/dev/aurelium/auraskills/bukkit/source/EntityLeveler.java @@ -35,10 +35,12 @@ public class EntityLeveler extends SourceLeveler { private final NamespacedKey SPAWNER_MOB_KEY; + private final NamespacedKey ROSE_STACKER_SPAWNER; public EntityLeveler(AuraSkills plugin) { super(plugin, SourceTypes.ENTITY); this.SPAWNER_MOB_KEY = new NamespacedKey(plugin, "is_spawner_mob"); + this.ROSE_STACKER_SPAWNER = NamespacedKey.fromString("rosestacker:spawner_spawned"); } @EventHandler(priority = EventPriority.HIGHEST) @@ -283,13 +285,20 @@ public void onMobSplit(EntityTransformEvent event) { } private double getSpawnerMultiplier(Entity entity, Skill skill) { - if (entity.getPersistentDataContainer().has(SPAWNER_MOB_KEY, PersistentDataType.INTEGER)) { // Is spawner mob + if (isSpawnerSpawned(entity)) { return skill.optionDouble("spawner_multiplier", 1.0); } else { return 1.0; } } + private boolean isSpawnerSpawned(Entity entity) { + PersistentDataContainer container = entity.getPersistentDataContainer(); + if (container.has(SPAWNER_MOB_KEY, PersistentDataType.INTEGER)) { + return true; + } else return container.has(ROSE_STACKER_SPAWNER, PersistentDataType.INTEGER); + } + @Nullable private Player getBleedDamager(Entity entity) { PersistentDataContainer container = entity.getPersistentDataContainer();