From 68f8a3fd7727f9c4bdea81dbbcfa9e6e9796ebcf Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Sat, 26 Nov 2016 00:18:53 -0500 Subject: [PATCH] Removed Cannon Bow's Damaging effect --- .../components/magic/MagicComponent.java | 2 +- .../magic/tricks/CannonBowListener.java | 20 ++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/alisolarflare/components/magic/MagicComponent.java b/src/alisolarflare/components/magic/MagicComponent.java index 8d5dcc9..d49f08b 100644 --- a/src/alisolarflare/components/magic/MagicComponent.java +++ b/src/alisolarflare/components/magic/MagicComponent.java @@ -15,6 +15,6 @@ public class MagicComponent extends Component{ registerListener(plugin, new AliArrowListener(plugin)); registerListener(plugin, new BoomBowDeathListener()); registerListener(plugin, new BoomBowListener(plugin)); - registerListener(plugin, new CannonBowListener()); + registerListener(plugin, new CannonBowListener(plugin)); } } diff --git a/src/alisolarflare/components/magic/tricks/CannonBowListener.java b/src/alisolarflare/components/magic/tricks/CannonBowListener.java index efabd5e..0dcc7be 100644 --- a/src/alisolarflare/components/magic/tricks/CannonBowListener.java +++ b/src/alisolarflare/components/magic/tricks/CannonBowListener.java @@ -10,14 +10,18 @@ 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.EntityExplodeEvent; import org.bukkit.event.entity.ProjectileLaunchEvent; import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.java.JavaPlugin; public class CannonBowListener implements Listener { - - public CannonBowListener(){ + JavaPlugin plugin; + public CannonBowListener(JavaPlugin plugin){ + this.plugin = plugin; } + @SuppressWarnings("deprecation") @EventHandler public void onProjectileLaunch(ProjectileLaunchEvent event){ if(event.getEntity().getType() != EntityType.ARROW) @@ -46,8 +50,18 @@ public class CannonBowListener implements Listener { player.getWorld().playSound(player.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0, 0); player.getWorld().playEffect(player.getLocation(), Effect.EXPLOSION, 1); arrow.remove(); - return; } + + @EventHandler + public void onTnTExplode(EntityExplodeEvent event) { + if (event.getEntityType() != EntityType.PRIMED_TNT) + return; + if (!event.getEntity().getCustomName().equals("CANNON BOW TNT")) + return; + event.setYield(0); + + + } } \ No newline at end of file