diff --git a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java index 76c0e0b..0a80fa4 100644 --- a/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java +++ b/BankEconomyMod/src/me/kaZep/Base/PlayerListener.java @@ -11000,71 +11000,114 @@ public void onEntityExpode(ExplosionPrimeEvent e) { @EventHandler public void onPlayerDeath(PlayerDeathEvent e) { - Player p = e.getEntity(); + //Delay this for 5 ticks. See if Fatal Survivor kicked in in time. (Or you got healed). + //Bukkit.broadcastMessage("Player Death: "+e.getEntity().getHealth()+" HP, Last Damage: -"+e.getEntity().getLastDamage()+" from "+e.getEntity().getLastDamageCause()); + //If we have Fatal Survivor, use the force! Otherwise, uh, you're dead. + + final Player p = e.getEntity(); e.setDeathMessage(e.getDeathMessage().replace(p.getScoreboard().getTeam(p.getName()).getPrefix()+p.getName()+p.getScoreboard().getTeam(p.getName()).getSuffix(),p.getName())); p.getScoreboard().getTeam(p.getName()).setSuffix(""); - for (int i=0;i=10) { + //Check to see if our "fatal s urvivor" effect is available. + for (int i=0;i drops = new ArrayList(); + for (int i=0;i=20) { + finalcost*=0.25; + } + if (mymoney>=mincost) { + p.sendMessage("You died. It will cost you $"+df.format(finalcost)+" to revive. To revive, type /revive me."); + } else { + p.sendMessage("You died. You do not have enough money in your bank to revive."); + p.sendMessage("Cost: $"+df.format(finalcost)+". If you want to revive, type "+ChatColor.AQUA+"/revive me"+ChatColor.WHITE+" when you have enough."); } - p.sendMessage(message); - } - if (this.plugin.PlayerinJob(p,"Explorer")) { - PersistentExplorerList eve = new PersistentExplorerList(p.getName()); - eve.event=2; - eve.expiretime=Main.SERVER_TICK_TIME+3600; - this.plugin.explorers.add(eve); } - DecimalFormat df = new DecimalFormat("#0.00"); - double deathX = p.getLocation().getX(); - double deathY = p.getLocation().getY(); - double deathZ = p.getLocation().getZ(); - String deathWorld = p.getLocation().getWorld().getName(); - this.plugin.getAccountsConfig().set(p.getName() + ".deathpointX",Double.valueOf(deathX)); - this.plugin.getAccountsConfig().set(p.getName() + ".deathpointY",Double.valueOf(deathY)); - this.plugin.getAccountsConfig().set(p.getName() + ".deathpointZ",Double.valueOf(deathZ)); - this.plugin.getAccountsConfig().set(p.getName() + ".deathworld",String.valueOf(deathWorld)); - this.plugin.getAccountsConfig().set(p.getName() + ".revived",Boolean.valueOf(false)); - this.plugin.getAccountsConfig().set(p.getName() + ".revivetime",Long.valueOf(Main.SERVER_TICK_TIME)); - this.plugin.saveAccountsConfig(); - double mincost = this.plugin.getConfig().getDouble("revive-cost-rate"); - if (p.getBedSpawnLocation()!=null) { - mincost *= Math.abs(p.getBedSpawnLocation().getX()-deathX)+Math.abs(p.getBedSpawnLocation().getY()-deathY)+Math.abs(p.getBedSpawnLocation().getZ()-deathZ); - } else { - mincost *= Math.abs(Bukkit.getWorld("world").getSpawnLocation().getX()-deathX)+Math.abs(Bukkit.getWorld("world").getSpawnLocation().getY()-deathY)+Math.abs(Bukkit.getWorld("world").getSpawnLocation().getZ()-deathZ); - } - double mymoney = this.plugin.getAccountsConfig().getDouble(p.getName() + ".money"); - double finalcost = (mincost*this.plugin.getConfig().getDouble("revive-cost-rate")) + (mymoney*this.plugin.getConfig().getDouble("revive-cost-tax")); - if (this.plugin.PlayerinJob(p, "Explorer") && this.plugin.getJobLv("Explorer", p)>=20) { - finalcost*=0.25; - } - if (mymoney>=mincost) { - p.sendMessage("You died. It will cost you $"+df.format(finalcost)+" to revive. To revive, type /revive me."); - } else { - p.sendMessage("You died. You do not have enough money in your bank to revive."); - p.sendMessage("Cost: $"+df.format(finalcost)+". If you want to revive, type "+ChatColor.AQUA+"/revive me"+ChatColor.WHITE+" when you have enough."); - } } @EventHandler