Adjusted the Style of the cannon bows

This commit is contained in:
alisolarflare 2016-11-25 23:58:00 -05:00
parent 1bb5453b04
commit 4c0dae261a

View file

@ -1,11 +1,13 @@
package alisolarflare.components.magic.tricks; package alisolarflare.components.magic.tricks;
import org.bukkit.Effect;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Arrow; import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.entity.ProjectileLaunchEvent; import org.bukkit.event.entity.ProjectileLaunchEvent;
@ -36,10 +38,14 @@ public class CannonBowListener implements Listener {
if (!player.getInventory().contains(Material.TNT)) if (!player.getInventory().contains(Material.TNT))
return; return;
Entity tnt = arrow.getWorld().spawnEntity(arrow.getLocation(), EntityType.PRIMED_TNT); TNTPrimed tnt = (TNTPrimed) arrow.getWorld().spawnEntity(arrow.getLocation(), EntityType.PRIMED_TNT);
tnt.setVelocity(arrow.getVelocity()); tnt.setVelocity(arrow.getVelocity().normalize().multiply(3.0));
arrow.remove(); 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; return;