From 4c0dae261a8d0bdad806bf12df97de4cbf61092b Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Fri, 25 Nov 2016 23:58:00 -0500 Subject: [PATCH] Adjusted the Style of the cannon bows --- .../components/magic/tricks/CannonBowListener.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/alisolarflare/components/magic/tricks/CannonBowListener.java b/src/alisolarflare/components/magic/tricks/CannonBowListener.java index 83cf9f1..efabd5e 100644 --- a/src/alisolarflare/components/magic/tricks/CannonBowListener.java +++ b/src/alisolarflare/components/magic/tricks/CannonBowListener.java @@ -1,11 +1,13 @@ package alisolarflare.components.magic.tricks; +import org.bukkit.Effect; import org.bukkit.Material; +import org.bukkit.Sound; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Arrow; -import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import org.bukkit.entity.TNTPrimed; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.entity.ProjectileLaunchEvent; @@ -36,10 +38,14 @@ public class CannonBowListener implements Listener { if (!player.getInventory().contains(Material.TNT)) return; - Entity tnt = arrow.getWorld().spawnEntity(arrow.getLocation(), EntityType.PRIMED_TNT); - tnt.setVelocity(arrow.getVelocity()); - arrow.remove(); + TNTPrimed tnt = (TNTPrimed) arrow.getWorld().spawnEntity(arrow.getLocation(), EntityType.PRIMED_TNT); + tnt.setVelocity(arrow.getVelocity().normalize().multiply(3.0)); + tnt.setCustomName("CANNON BOW TNT"); + player.setVelocity(arrow.getVelocity().multiply(-1).normalize()); + player.getWorld().playSound(player.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0, 0); + player.getWorld().playEffect(player.getLocation(), Effect.EXPLOSION, 1); + arrow.remove(); return;