Skip to content

Commit

Permalink
fix shoot command bug with script arg and no shooter input
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Feb 12, 2021
1 parent ea2fe09 commit f7d997b
Showing 1 changed file with 6 additions and 3 deletions.
Expand Up @@ -25,6 +25,7 @@
import org.bukkit.entity.Entity;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
Expand Down Expand Up @@ -235,8 +236,10 @@ public void execute(final ScriptEntry scriptEntry) {
entity.spawnAt(originLocation);
}
entityList.addObject(entity);
if (entity.isProjectile() && (shooter != null || originEntity != null)) {
entity.setShooter(shooter != null ? shooter : originEntity);
if (entity.isProjectile()) {
if (shooter != null || originEntity != null) {
entity.setShooter(shooter != null ? shooter : originEntity);
}
if (script != null) {
arrows.put(entity.getUUID(), null);
}
Expand Down Expand Up @@ -362,7 +365,7 @@ else if (lastLocation != null && lastVelocity != null && !(lastEntity.getBukkitE
}
}

@EventHandler
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void projectileHit(ProjectileHitEvent event) {
if (!arrows.containsKey(event.getEntity().getUniqueId())) {
return;
Expand Down

0 comments on commit f7d997b

Please sign in to comment.