Fixed double death message bug.

This commit is contained in:
sigonasr2 2017-06-14 22:46:24 -05:00
parent abe745c0ac
commit 15e872803f
5 changed files with 237 additions and 230 deletions

Binary file not shown.

View File

@ -804,6 +804,7 @@ public class CustomDamage {
damage = preventPoisonDamageFromKilling(p, damage, reason); damage = preventPoisonDamageFromKilling(p, damage, reason);
if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) { if (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER) {
TwosideKeeper.log("Is a Slayer.", 2);
//PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); //PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (damage>2) { if (damage>2) {
damage=2; damage=2;
@ -827,8 +828,8 @@ public class CustomDamage {
damage=0; damage=0;
} }
if (p.getHealth()-damage<0) { /*(if (p.getHealth()-damage<0) {
p.damage(damage); p.damage(p.getHealth());
final double DMG = damage; final double DMG = damage;
Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{ Bukkit.getScheduler().runTaskLater(TwosideKeeper.plugin, ()->{
if (p!=null && !p.isDead()) { if (p!=null && !p.isDead()) {
@ -837,7 +838,7 @@ public class CustomDamage {
TwosideKeeper.log("WARNING!! Player "+p.getName()+" was supposed to die! ["+TwosideKeeper.getServerTickTime()+"] Damage Taken: "+DMG+" from "+damagesource+",Reason: "+reasoning, 1); TwosideKeeper.log("WARNING!! Player "+p.getName()+" was supposed to die! ["+TwosideKeeper.getServerTickTime()+"] Damage Taken: "+DMG+" from "+damagesource+",Reason: "+reasoning, 1);
} }
}, 1); }, 1);
} }*/
//pd.customtitle.updateTitle(p); //pd.customtitle.updateTitle(p);
pd.customtitle.updateCombatBar(p, getDamagerEntity(damager)); pd.customtitle.updateCombatBar(p, getDamagerEntity(damager));

View File

@ -3707,6 +3707,7 @@ public class GenericFunctions {
boolean revived=false; boolean revived=false;
boolean fromRoom=false; boolean fromRoom=false;
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
DebugUtils.showStackTrace();
if (p.getHealth()<=dmg || (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER && pd.slayermodehp<=dmg)) { if (p.getHealth()<=dmg || (PlayerMode.getPlayerMode(p)==PlayerMode.SLAYER && pd.slayermodehp<=dmg)) {
//This means we would die from this attack. Attempt to revive the player. //This means we would die from this attack. Attempt to revive the player.
//Check all artifact armor for a perk. //Check all artifact armor for a perk.
@ -3801,7 +3802,6 @@ public class GenericFunctions {
if (!fromRoom) { if (!fromRoom) {
RandomlyBreakBaubles(p); RandomlyBreakBaubles(p);
} }
runServerHeartbeat.UpdatePlayerScoreboardAndHealth(p);
} }
return revived; return revived;
} }

View File

@ -127,7 +127,7 @@ public enum PlayerMode {
} }
public static PlayerMode getPlayerMode(Player p) { public static PlayerMode getPlayerMode(Player p) {
if (p!=null && p.isValid() && p.isOnline()) { if (p!=null && p.isValid() && p.isOnline() && !p.isDead()) {
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); PlayerStructure pd = PlayerStructure.GetPlayerStructure(p);
if (needsUpdating(pd)) { if (needsUpdating(pd)) {
if (Check_isSlayer(p)) { if (Check_isSlayer(p)) {

View File

@ -481,7 +481,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static final int REJUVENATE_COOLDOWN=6000; public static final int REJUVENATE_COOLDOWN=6000;
public static final int ASSASSINATE_COOLDOWN=200; public static final int ASSASSINATE_COOLDOWN=200;
public static final int LIFESAVER_COOLDOWN=6000; public static final int LIFESAVER_COOLDOWN=6000;
public static final int ARROWBARRAGE_COOLDOWN=200; public static final int ARROWBARRAGE_COOLDOWN=2400;
public static final int SIPHON_COOLDOWN = 900; public static final int SIPHON_COOLDOWN = 900;
public static final int MOCK_COOLDOWN = 400; public static final int MOCK_COOLDOWN = 400;
public static final int ICEWAND_COOLDOWN = 1200; public static final int ICEWAND_COOLDOWN = 1200;
@ -7854,6 +7854,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
Player p = (Player)ev.getEntity(); Player p = (Player)ev.getEntity();
};*/ };*/
CustomDamage.setupTrueDamage(ev); CustomDamage.setupTrueDamage(ev);
if (dmgdealt>0) {
ev.setDamage(DamageModifier.BASE, dmgdealt); ev.setDamage(DamageModifier.BASE, dmgdealt);
log("Damage from this event is "+dmgdealt,4); log("Damage from this event is "+dmgdealt,4);
@ -7874,6 +7875,9 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
} }
} }
} }
} else {
ev.setCancelled(true);
}
if (ev.getEntity() instanceof Player) { if (ev.getEntity() instanceof Player) {
Player p = (Player)ev.getEntity(); Player p = (Player)ev.getEntity();
runServerHeartbeat.UpdatePlayerScoreboardAndHealth(p); runServerHeartbeat.UpdatePlayerScoreboardAndHealth(p);
@ -11666,6 +11670,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
public static void setPlayerMaxHealth(Player p, Double ratio, boolean force) { public static void setPlayerMaxHealth(Player p, Double ratio, boolean force) {
//Determine player max HP based on armor being worn. //Determine player max HP based on armor being worn.
if (!p.isDead() && p.getHealth()>0) {
if (EquipmentUpdated(p) || force) { if (EquipmentUpdated(p) || force) {
TwosideKeeper.log("Equipment updated. Checking health...", 5); TwosideKeeper.log("Equipment updated. Checking health...", 5);
double hp=10; //Get the base max health. double hp=10; //Get the base max health.
@ -11892,6 +11897,7 @@ public class TwosideKeeper extends JavaPlugin implements Listener {
runServerHeartbeat.UpdatePlayerScoreboardAndHealth(p); runServerHeartbeat.UpdatePlayerScoreboardAndHealth(p);
} }
} }
}