Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compile errror #29

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/com/nisovin/magicspells/spells/targeted/AreaEffectSpell.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<Entity> entities = new ArrayList<Entity>(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;
Expand Down
8 changes: 4 additions & 4 deletions src/com/nisovin/magicspells/spells/targeted/DotSpell.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down