From d18533f0f6dec11c448d58b588658347c283bbdb Mon Sep 17 00:00:00 2001 From: alisolarflare Date: Sat, 5 Nov 2016 05:30:24 -0400 Subject: [PATCH] Coded Death Listener --- src/alisolarflare/magic/MagicModule.java | 4 ++-- .../magic/tricks/AliArrowDeathListener.java | 17 ----------------- .../magic/tricks/BoomBowDeathListener.java | 18 ++++++++++++++++++ .../magic/tricks/BoomBowListener.java | 2 +- 4 files changed, 21 insertions(+), 20 deletions(-) delete mode 100644 src/alisolarflare/magic/tricks/AliArrowDeathListener.java create mode 100644 src/alisolarflare/magic/tricks/BoomBowDeathListener.java diff --git a/src/alisolarflare/magic/MagicModule.java b/src/alisolarflare/magic/MagicModule.java index fff9034..82e3802 100644 --- a/src/alisolarflare/magic/MagicModule.java +++ b/src/alisolarflare/magic/MagicModule.java @@ -3,8 +3,8 @@ package alisolarflare.magic; import org.bukkit.plugin.java.JavaPlugin; import alisolarflare.Module; -import alisolarflare.magic.tricks.AliArrowDeathListener; import alisolarflare.magic.tricks.AliArrowListener; +import alisolarflare.magic.tricks.BoomBowDeathListener; import alisolarflare.magic.tricks.BoomBowListener; public class MagicModule extends Module{ @@ -12,7 +12,7 @@ public class MagicModule extends Module{ @Override public void register(JavaPlugin plugin) { registerListener(plugin, new AliArrowListener(plugin)); - registerListener(plugin, new AliArrowDeathListener()); + registerListener(plugin, new BoomBowDeathListener()); registerListener(plugin, new BoomBowListener()); } } diff --git a/src/alisolarflare/magic/tricks/AliArrowDeathListener.java b/src/alisolarflare/magic/tricks/AliArrowDeathListener.java deleted file mode 100644 index 388e1e1..0000000 --- a/src/alisolarflare/magic/tricks/AliArrowDeathListener.java +++ /dev/null @@ -1,17 +0,0 @@ -package alisolarflare.magic.tricks; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.PlayerDeathEvent; - -public class AliArrowDeathListener implements Listener{ - @EventHandler - public void onBoomBowDeath(PlayerDeathEvent event){ - Player player = event.getEntity(); - if (player.getKiller() != player) - return; - player.sendMessage(player.getLastDamageCause().toString()); - player.sendMessage(event.getEventName()); - } -} diff --git a/src/alisolarflare/magic/tricks/BoomBowDeathListener.java b/src/alisolarflare/magic/tricks/BoomBowDeathListener.java new file mode 100644 index 0000000..d62986d --- /dev/null +++ b/src/alisolarflare/magic/tricks/BoomBowDeathListener.java @@ -0,0 +1,18 @@ +package alisolarflare.magic.tricks; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.PlayerDeathEvent; + +public class BoomBowDeathListener implements Listener{ + @EventHandler + public void onBoomBowDeath(PlayerDeathEvent event){ + Player player = event.getEntity(); + if (player.getLastDamage() == 7.000042) + event.setDeathMessage(player.getCustomName() + player.getDisplayName() + player.getPlayerListName() + player.getName() + "got trigger happy with the Boom Bow"); + if (player.getLastDamage() < 7.000041 || player.getLastDamage() > 7.000043) + player.sendMessage("meaning of lyyyyyyfffe"); + + } +} diff --git a/src/alisolarflare/magic/tricks/BoomBowListener.java b/src/alisolarflare/magic/tricks/BoomBowListener.java index dbbc977..a5fb608 100644 --- a/src/alisolarflare/magic/tricks/BoomBowListener.java +++ b/src/alisolarflare/magic/tricks/BoomBowListener.java @@ -89,7 +89,7 @@ public class BoomBowListener implements Listener { //CREATE - Explosion + damage player.getWorld().playSound(playerLocation, Sound.ENTITY_GENERIC_EXPLODE, 10, -20); player.getWorld().spawnParticle(Particle.EXPLOSION_HUGE, playerLocation, 2); - player.damage(7.0, player); + player.damage(7.000042, player); boomBow.setDurability((short) (boomBow.getDurability() + 3)); if(boomBow.getDurability() < 0){ player.getInventory().setItemInMainHand(null);