Fixed Fatal Survivor
This commit is contained in:
parent
0f0841386d
commit
83ae98dcad
@ -11318,16 +11318,35 @@ public void onEntityExpode(ExplosionPrimeEvent e) {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerDeath(PlayerDeathEvent e) {
|
public void onPlayerDeath(PlayerDeathEvent e) {
|
||||||
//Delay this for 5 ticks. See if Fatal Survivor kicked in in time. (Or you got healed).
|
//Delay this for 5 ticks. See if Fatal Survivor kicked in in time. (Or you got healed).
|
||||||
final PlayerDeathEvent e2 = e;
|
//Bukkit.broadcastMessage("Player Death: "+e.getEntity().getHealth()+" HP, Last Damage: -"+e.getEntity().getLastDamage()+" from "+e.getEntity().getLastDamageCause());
|
||||||
e2.getEntity().setHealth(1);
|
//If we have Fatal Survivor, use the force! Otherwise, uh, you're dead.
|
||||||
Bukkit.broadcastMessage("Player Death: "+e2.getEntity().getHealth()+" HP, Last Damage: -"+e2.getEntity().getLastDamage()+" from "+e2.getEntity().getLastDamageCause());
|
|
||||||
final Main plugin = this.plugin;
|
Player p = e.getEntity();
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() {
|
e.setDeathMessage(e.getDeathMessage().replace(p.getScoreboard().getTeam(p.getName()).getPrefix()+p.getName()+p.getScoreboard().getTeam(p.getName()).getSuffix(),p.getName()));
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
Player p = e2.getEntity();
|
|
||||||
e2.setDeathMessage(e2.getDeathMessage().replace(p.getScoreboard().getTeam(p.getName()).getPrefix()+p.getName()+p.getScoreboard().getTeam(p.getName()).getSuffix(),p.getName()));
|
|
||||||
p.getScoreboard().getTeam(p.getName()).setSuffix("");
|
p.getScoreboard().getTeam(p.getName()).setSuffix("");
|
||||||
|
boolean survivor=false;
|
||||||
|
if (this.plugin.PlayerinJob(p, "Explorer")) {
|
||||||
|
if (this.plugin.getJobLv("Explorer", p)>=10) {
|
||||||
|
//Check to see if our "fatal s urvivor" effect is available.
|
||||||
|
for (int i=0;i<this.plugin.explorers.size();i++) {
|
||||||
|
if (this.plugin.explorers.get(i).event==0 && this.plugin.explorers.get(i).name.compareTo(p.getName())==0) {
|
||||||
|
survivor=true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PersistentExplorerList eve = new PersistentExplorerList(p.getName());
|
||||||
|
eve.event=1;
|
||||||
|
eve.data=p.getExp();
|
||||||
|
eve.data2=p.getLevel();
|
||||||
|
eve.expiretime=Main.SERVER_TICK_TIME+1200;
|
||||||
|
this.plugin.explorers.add(eve);
|
||||||
|
if (!survivor) {
|
||||||
|
FatalSurvivor(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (survivor || !this.plugin.PlayerinJob(p, "Explorer")) {
|
||||||
|
//You are dead buddy.
|
||||||
for (int i=0;i<plugin.explorerlist.size();i++) {
|
for (int i=0;i<plugin.explorerlist.size();i++) {
|
||||||
if (Bukkit.getPlayer(plugin.explorerlist.get(i).player)!=null) {
|
if (Bukkit.getPlayer(plugin.explorerlist.get(i).player)!=null) {
|
||||||
Player p2 =Bukkit.getPlayer(plugin.explorerlist.get(i).player);
|
Player p2 =Bukkit.getPlayer(plugin.explorerlist.get(i).player);
|
||||||
@ -11385,13 +11404,12 @@ public void onEntityExpode(ExplosionPrimeEvent e) {
|
|||||||
finalcost*=0.25;
|
finalcost*=0.25;
|
||||||
}
|
}
|
||||||
if (mymoney>=mincost) {
|
if (mymoney>=mincost) {
|
||||||
p.sendMessage("You died. It will cost you $"+df.format(finalcost)+" to revive2. To revive, type /revive me2.");
|
p.sendMessage("You died. It will cost you $"+df.format(finalcost)+" to revive. To revive, type /revive me.");
|
||||||
} else {
|
} else {
|
||||||
p.sendMessage("You died. You do not have enough money in your bank to revive2.");
|
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("Cost: $"+df.format(finalcost)+". If you want to revive, type "+ChatColor.AQUA+"/revive me"+ChatColor.WHITE+" when you have enough.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
Loading…
x
Reference in New Issue
Block a user