Permalink
Browse files

Pre-calculate shooter and item for projectile CommandItems.

  • Loading branch information...
me4502 committed Jan 23, 2017
1 parent 6c13a98 commit 5551774a953fd9599214cf748e7e658f84fbf207
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/main/java/com/sk89q/craftbook/mechanics/items/CommandItems.java
@@ -260,10 +260,13 @@ public void onProjectileHit(final ProjectileHitEvent event) {
if(((Player) event.getEntity().getShooter()).getItemInHand() == null)
return;
+ final ItemStack item = ((Player) event.getEntity().getShooter()).getItemInHand();
+ final Player shooter = (Player) event.getEntity().getShooter();
+
Bukkit.getScheduler().runTaskLater(CraftBookPlugin.inst(), new Runnable() {
@Override
public void run () {
- performCommandItems(((Player) event.getEntity().getShooter()).getItemInHand(), (Player) event.getEntity().getShooter(), event);
+ performCommandItems(item, shooter, event);
}
}, 5L);
}

0 comments on commit 5551774

Please sign in to comment.