Fix bug with Poison killing players.

This commit is contained in:
sigonasr2 2016-12-13 18:16:43 -06:00
parent 8752760670
commit f1cc45e9e5
2 changed files with 9 additions and 3 deletions

View File

@ -259,7 +259,7 @@ public class CustomDamage {
} }
TwosideKeeper.log("Damage: "+dmg+", Armor Pen Damage: "+armorpendmg, 3); TwosideKeeper.log("Damage: "+dmg+", Armor Pen Damage: "+armorpendmg, 3);
setupDamagePropertiesForPlayer(damager,((crit)?IS_CRIT:0)|((headshot)?IS_HEADSHOT:0)|((preemptive)?IS_PREEMPTIVE:0)); setupDamagePropertiesForPlayer(damager,((crit)?IS_CRIT:0)|((headshot)?IS_HEADSHOT:0)|((preemptive)?IS_PREEMPTIVE:0));
dmg = hardCapDamage(dmg+armorpendmg); dmg = hardCapDamage(dmg+armorpendmg,target,reason);
return dmg; return dmg;
} }
@ -2462,10 +2462,16 @@ public class CustomDamage {
return lifestealpct; return lifestealpct;
} }
private static double hardCapDamage(double damage) { private static double hardCapDamage(double damage, LivingEntity target, String reason) {
if (damage<0) { if (damage<0) {
damage=0; damage=0;
} }
if (reason.equalsIgnoreCase("POISON")) {
if (damage>=target.getHealth()) {
damage=0;
target.setHealth(Math.min(target.getHealth(),1));
}
}
return Math.min(damage, TwosideKeeper.CUSTOM_DAMAGE_IDENTIFIER-1); return Math.min(damage, TwosideKeeper.CUSTOM_DAMAGE_IDENTIFIER-1);
} }

View File

@ -75,7 +75,7 @@ public class ItemCubeUtils {
public static boolean SomeoneHasAFilterCubeOpen() { public static boolean SomeoneHasAFilterCubeOpen() {
for (Player p : Bukkit.getOnlinePlayers()) { for (Player p : Bukkit.getOnlinePlayers()) {
if (p.getOpenInventory()!=null && p.getOpenInventory().getTopInventory()!=null && p.getOpenInventory().getTopInventory().getType()==InventoryType.HOPPER) { if (p.getOpenInventory()!=null && p.getOpenInventory().getTopInventory()!=null && p.getOpenInventory().getTopInventory().getType()==InventoryType.HOPPER) {
TwosideKeeper.log("Keep this open! "+p.getName()+" is using it!", 0); TwosideKeeper.log("Keep this open! "+p.getName()+" is using it!", 5);
return true; return true;
} }
} }