|
|
|
@ -726,9 +726,8 @@ public class CustomDamage { |
|
|
|
|
|
|
|
|
|
private static double modifyFateBasedOnHolidayTreats(Player p, double damage) { |
|
|
|
|
PlayerStructure pd = PlayerStructure.GetPlayerStructure(p); |
|
|
|
|
if (pd.lastcandyconsumed+40<TwosideKeeper.getServerTickTime()) { |
|
|
|
|
boolean consumed=false; |
|
|
|
|
if (p.getHealth()-damage<=0) { |
|
|
|
|
boolean consumed=false,consumed2=false; |
|
|
|
|
if (p.getHealth()-damage<=0 && pd.lastrevivecandyconsumed+200<TwosideKeeper.getServerTickTime()) { |
|
|
|
|
for (int i=0;i<9;i++) { |
|
|
|
|
ItemStack item = p.getInventory().getItem(i); |
|
|
|
|
if (item!=null) { |
|
|
|
@ -743,13 +742,13 @@ public class CustomDamage { |
|
|
|
|
GenericFunctions.RevivePlayer(p,p.getMaxHealth()); |
|
|
|
|
ItemStack[] hotbar = GenericFunctions.getHotbarItems(p); |
|
|
|
|
GenericFunctions.RandomlyBreakBaubles(p, hotbar); |
|
|
|
|
consumed=true; |
|
|
|
|
consumed2=true; |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else |
|
|
|
|
if (p.getHealth()-damage<p.getMaxHealth()/2) { |
|
|
|
|
if (p.getHealth()-damage<p.getMaxHealth()/2 && pd.lastcandyconsumed+40<TwosideKeeper.getServerTickTime()) { |
|
|
|
|
//See if we can activate any treats. Check the hotbar.
|
|
|
|
|
for (int i=0;i<9;i++) { |
|
|
|
|
ItemStack item = p.getInventory().getItem(i); |
|
|
|
@ -820,7 +819,13 @@ public class CustomDamage { |
|
|
|
|
if (consumed) { |
|
|
|
|
SoundUtils.playLocalSound(p, Sound.ENTITY_GENERIC_EAT, 1.0f, 1.0f); |
|
|
|
|
pd.lastcandyconsumed=TwosideKeeper.getServerTickTime(); |
|
|
|
|
aPlugin.API.sendCooldownPacket(p, Material.GOLDEN_CARROT, 40); |
|
|
|
|
aPlugin.API.sendCooldownPacket(p, Material.RAW_FISH, 40); |
|
|
|
|
} |
|
|
|
|
if (consumed2) { |
|
|
|
|
SoundUtils.playLocalSound(p, Sound.ENTITY_GENERIC_EAT, 1.0f, 1.0f); |
|
|
|
|
pd.lastrevivecandyconsumed=TwosideKeeper.getServerTickTime(); |
|
|
|
|
aPlugin.API.sendCooldownPacket(p, Material.GOLDEN_APPLE, 200); |
|
|
|
|
} |
|
|
|
|
return damage; |
|
|
|
|
} |
|
|
|
|