Skip to content

Commit

Permalink
Fix RoseStacker spawner mobs not working with spawner_multiplier
Browse files Browse the repository at this point in the history
  • Loading branch information
Archy-X committed Jun 2, 2024
1 parent e669d7b commit 7796e6f
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 7796e6f

Please sign in to comment.