From f7254d3492853fce27d93f9f97acd281e9691d7f Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 23 Dec 2010 18:24:51 -0800 Subject: [PATCH] Players will now properly move to their home location when they die, death messages are working now but are only random messages. --- vMinecraftListener.java | 46 ++++++----------------------------------- 1 file changed, 6 insertions(+), 40 deletions(-) diff --git a/vMinecraftListener.java b/vMinecraftListener.java index f6f89ad9c..bc71019b7 100644 --- a/vMinecraftListener.java +++ b/vMinecraftListener.java @@ -86,14 +86,19 @@ public class vMinecraftListener extends PluginListener { //Use: Checks for exploits and runs the commands //===================================================================== public boolean onHealthChange(Player player,int oldValue,int newValue){ + //Sets a player as dead + if (player.getHealth() < 1){ + vMinecraftUsers.getProfile(player).isDead(true); + } if (player.getHealth() > 1 && vMinecraftUsers.getProfile(player).isDead()){ - vMinecraftUsers.getProfile(player).isDead(false); if(vMinecraftSettings.getInstance().playerspawn()) { Warp home = null; home = etc.getDataSource().getHome(player.getName()); player.teleportTo(home.Location); } + vMinecraftUsers.getProfile(player).isDead(false); + vMinecraftChat.gmsg(Colors.Gray + player.getName() + " " + vMinecraftSettings.randomDeathMsg()); } return false; } @@ -120,46 +125,7 @@ public class vMinecraftListener extends PluginListener { } public boolean onDamage(PluginLoader.DamageType type, BaseEntity attacker, BaseEntity defender, int amount) { - Player defend = null; - if(defender != null && defender.isPlayer()) - { - defend = defender.getPlayer(); - if (vMinecraftSettings.getInstance().isEzModo(defend.getName())) { - return true; - } - - if (defend.getHealth() > 0) - return false; - if (vMinecraftUsers.getProfile(defend).isDead()) - return false; - - vMinecraftUsers.getProfile(defend).isDead(true); - Player attack = null; - if(attacker != null && attacker.isPlayer()) - attack = attacker.getPlayer(); - if(attack != null) - { - vMinecraftChat.gmsg(defend.getName() + " was slain by " + attack.getName()); - } - if (type == type.CREEPER_EXPLOSION) { - vMinecraftChat.gmsg(defend.getName() + Colors.Rose + " was blown to bits by a creeper"); - } else if(type == type.FALL){ - vMinecraftChat.gmsg(defend.getName() + Colors.Rose + " fell to death!"); - } else if(type == type.FIRE){ - vMinecraftChat.gmsg(defend.getName() + Colors.Rose + " was incinerated"); - } else if (type == type.FIRE_TICK){ - vMinecraftChat.gmsg(defend.getName() + Colors.Rose + " Stop drop and roll, not scream, run, and burn "); - } else if (type == type.LAVA){ - vMinecraftChat.gmsg(defend.getName() + Colors.Rose + " drowned in lava"); - } else if (type == type.WATER){ - log.log(Level.INFO, "Water"); - vMinecraftChat.gmsg(defend.getName() + Colors.Rose + " should've attended that swimming class"); - } else { - vMinecraftChat.gmsg(Colors.Gray + defend.getName() + " " + vMinecraftSettings.randomDeathMsg()); - } - - } return false; } } \ No newline at end of file