From ca472f69f27c2fa73e070762606cda670d62bb9e Mon Sep 17 00:00:00 2001 From: John Pascoe Date: Sun, 20 Dec 2015 18:31:24 -0500 Subject: [PATCH 1/2] fix build --- src/com/nisovin/magicspells/spells/targeted/DotSpell.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/com/nisovin/magicspells/spells/targeted/DotSpell.java b/src/com/nisovin/magicspells/spells/targeted/DotSpell.java index 59fcc28d8..7baffa63e 100644 --- a/src/com/nisovin/magicspells/spells/targeted/DotSpell.java +++ b/src/com/nisovin/magicspells/spells/targeted/DotSpell.java @@ -123,10 +123,10 @@ public void run() { if (preventKnockback) { // bukkit doesn't call a damage event here, so we'll do it ourselves @SuppressWarnings("deprecation") - EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(caster, target, DamageCause.ENTITY_ATTACK, damage); - Bukkit.getPluginManager().callEvent(event); - if (!event.isCancelled()) { - target.damage(event.getDamage()); + EntityDamageByEntityEvent event2 = new EntityDamageByEntityEvent(caster, target, DamageCause.ENTITY_ATTACK, damage); + Bukkit.getPluginManager().callEvent(event2); + if (!event2.isCancelled()) { + target.damage(event2.getDamage()); } } else { target.damage(dam, caster); From 4238678f977bd6490d1ddda955f171aa33fa6a99 Mon Sep 17 00:00:00 2001 From: John Pascoe Date: Mon, 21 Dec 2015 20:00:06 -0500 Subject: [PATCH 2/2] Fix area of effect when cast from command --- .../spells/targeted/AreaEffectSpell.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/com/nisovin/magicspells/spells/targeted/AreaEffectSpell.java b/src/com/nisovin/magicspells/spells/targeted/AreaEffectSpell.java index 6e64ed96f..68ba2a4da 100644 --- a/src/com/nisovin/magicspells/spells/targeted/AreaEffectSpell.java +++ b/src/com/nisovin/magicspells/spells/targeted/AreaEffectSpell.java @@ -141,18 +141,19 @@ public PostCastAction castSpell(Player player, SpellCastState state, float power private boolean doAoe(Player player, Location location, float basePower) { int count = 0; - Vector facing = player.getLocation().getDirection(); - Vector vLoc = player.getLocation().toVector(); - BoundingBox box = new BoundingBox(location, radius, verticalRadius); List entities = new ArrayList(location.getWorld().getEntitiesByClasses(LivingEntity.class)); Collections.shuffle(entities); for (Entity e : entities) { if (e instanceof LivingEntity && box.contains(e)) { - if (pointBlank && cone > 0) { - Vector dir = e.getLocation().toVector().subtract(vLoc); - if (Math.abs(dir.angle(facing)) > cone) { - continue; + if (player != null) { + Vector facing = player.getLocation().getDirection(); + Vector vLoc = player.getLocation().toVector(); + if (pointBlank && cone > 0) { + Vector dir = e.getLocation().toVector().subtract(vLoc); + if (Math.abs(dir.angle(facing)) > cone) { + continue; + } } } LivingEntity target = (LivingEntity)e;