From 01a8ab639837d66f8fbc0852b43628e7d7f3ff63 Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Mon, 18 Nov 2013 14:29:34 -0700 Subject: [PATCH] Fix unkillable super zombies. --- BankEconomyMod/src/me/kaZep/Base/PlayerListener.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java index 5ec75f0..23aab91 100644 --- a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java +++ b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java @@ -6755,10 +6755,9 @@ public ItemStack getGoodie() { } if (e.getEntity().getType()==EntityType.ZOMBIE) { Zombie z = (Zombie)e.getEntity(); - if (z.getCustomName()==null && z.getMaxHealth()>65) { - //If it's a normal zombie with too much HP, something wrong. Lower it. - z.setMaxHealth(65); - z.setHealth(z.getMaxHealth()); + if (z.getCustomName()==null && z.getHealth()>65) { + //If it's a normal zombie with too much HP, something's wrong. Lower it. + z.setHealth(65-z.getMaxHealth()/2); } } if (e.getDamager() instanceof Projectile) { @@ -10329,7 +10328,7 @@ public ItemStack getGoodie() { @EventHandler public void onMinecartExit(VehicleExitEvent e) { - if (e.getVehicle().getType()==EntityType.MINECART && e.getVehicle().getPassenger().getType()==EntityType.PLAYER && ((Player)e.getVehicle().getPassenger()).isOnline()) { + if (e.getVehicle().getType()==EntityType.MINECART && e.getVehicle().getPassenger().getType()==EntityType.PLAYER) { Bukkit.getWorld("world").dropItemNaturally(e.getVehicle().getLocation(),new ItemStack(Material.MINECART)); e.getVehicle().remove(); } @@ -10848,6 +10847,9 @@ public void onEntityExpode(ExplosionPrimeEvent e) { @EventHandler public void onPlayerLeave(PlayerQuitEvent e) { Player p = e.getPlayer(); + if (p.isInsideVehicle()) { + p.leaveVehicle(); + } for (int i=0;i