Fix bug with Poison killing players.
This commit is contained in:
parent
8752760670
commit
f1cc45e9e5
@ -259,7 +259,7 @@ public class CustomDamage {
|
||||
}
|
||||
TwosideKeeper.log("Damage: "+dmg+", Armor Pen Damage: "+armorpendmg, 3);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -2462,10 +2462,16 @@ public class CustomDamage {
|
||||
return lifestealpct;
|
||||
}
|
||||
|
||||
private static double hardCapDamage(double damage) {
|
||||
private static double hardCapDamage(double damage, LivingEntity target, String reason) {
|
||||
if (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);
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ public class ItemCubeUtils {
|
||||
public static boolean SomeoneHasAFilterCubeOpen() {
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user