diff --git a/core/src/main/java/com/nisovin/magicspells/spells/passive/StartPoseListener.java b/core/src/main/java/com/nisovin/magicspells/spells/passive/StartPoseListener.java index f737d868e..7baa7284a 100644 --- a/core/src/main/java/com/nisovin/magicspells/spells/passive/StartPoseListener.java +++ b/core/src/main/java/com/nisovin/magicspells/spells/passive/StartPoseListener.java @@ -14,14 +14,15 @@ public class StartPoseListener extends PassiveListener { - private final Set poses = EnumSet.noneOf(Pose.class); + private Set poses; @Override public void initialize(String var) { if (var == null || var.isEmpty()) return; - String[] split = var.split(","); - for (String pose : split) { + poses = EnumSet.noneOf(Pose.class); + + for (String pose : var.split(",")) { try { poses.add(Pose.valueOf(pose.trim().toUpperCase())); } catch (IllegalArgumentException e) { @@ -34,7 +35,7 @@ public void initialize(String var) { @EventHandler public void onPoseChange(EntityPoseChangeEvent event) { if (!(event.getEntity() instanceof LivingEntity caster) || !canTrigger(caster) || !hasSpell(caster)) return; - if (!poses.isEmpty() && !poses.contains(event.getPose())) return; + if (poses != null && !poses.contains(event.getPose())) return; passiveSpell.activate(caster); } diff --git a/core/src/main/java/com/nisovin/magicspells/spells/passive/StopPoseListener.java b/core/src/main/java/com/nisovin/magicspells/spells/passive/StopPoseListener.java index f8d9d82d3..df731e1ff 100644 --- a/core/src/main/java/com/nisovin/magicspells/spells/passive/StopPoseListener.java +++ b/core/src/main/java/com/nisovin/magicspells/spells/passive/StopPoseListener.java @@ -14,14 +14,15 @@ public class StopPoseListener extends PassiveListener { - private final Set poses = EnumSet.noneOf(Pose.class); + private Set poses; @Override public void initialize(String var) { if (var == null || var.isEmpty()) return; - String[] split = var.split(","); - for (String pose : split) { + poses = EnumSet.noneOf(Pose.class); + + for (String pose : var.split(",")) { try { poses.add(Pose.valueOf(pose.trim().toUpperCase())); } catch (IllegalArgumentException e) { @@ -34,7 +35,7 @@ public void initialize(String var) { @EventHandler public void onPoseChange(EntityPoseChangeEvent event) { if (!(event.getEntity() instanceof LivingEntity caster) || !canTrigger(caster) || !hasSpell(caster)) return; - if (!poses.isEmpty() && !poses.contains(caster.getPose())) return; + if (poses != null && !poses.contains(caster.getPose())) return; passiveSpell.activate(caster); }