|
@@ -1,9 +1,12 @@
|
|
package com.gmail.nossr50.runnables.skills;
|
|
package com.gmail.nossr50.runnables.skills;
|
|
|
|
|
|
|
|
+import com.gmail.nossr50.datatypes.MobHealthbarType;
|
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
|
|
|
+import com.gmail.nossr50.events.skills.rupture.McMMOEntityDamageByRuptureEvent;
|
|
import com.gmail.nossr50.mcMMO;
|
|
import com.gmail.nossr50.mcMMO;
|
|
import com.gmail.nossr50.util.CancellableRunnable;
|
|
import com.gmail.nossr50.util.CancellableRunnable;
|
|
import com.gmail.nossr50.util.MetadataConstants;
|
|
import com.gmail.nossr50.util.MetadataConstants;
|
|
|
|
+import com.gmail.nossr50.util.MobHealthbarUtils;
|
|
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
|
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
|
import com.google.common.base.Objects;
|
|
import com.google.common.base.Objects;
|
|
import org.bukkit.entity.LivingEntity;
|
|
import org.bukkit.entity.LivingEntity;
|
|
@@ -82,15 +85,21 @@ public class RuptureTask extends CancellableRunnable {
|
|
|
|
|
|
//Ensure victim has health
|
|
//Ensure victim has health
|
|
if (healthBeforeRuptureIsApplied > 0.01) {
|
|
if (healthBeforeRuptureIsApplied > 0.01) {
|
|
- // TODO: Needs updating for new spigot API
|
|
|
|
- double damage = calculateAdjustedTickDamage(); //Use raw damage for Rupture
|
|
|
|
|
|
+ //Send a fake damage event
|
|
|
|
+ McMMOEntityDamageByRuptureEvent event =
|
|
|
|
+ new McMMOEntityDamageByRuptureEvent(ruptureSource, targetEntity, calculateAdjustedTickDamage());
|
|
|
|
+ mcMMO.p.getServer().getPluginManager().callEvent(event);
|
|
|
|
|
|
- if (damage <= 0 || healthBeforeRuptureIsApplied - damage <= 0) {
|
|
|
|
|
|
+ //Ensure the event wasn't cancelled and damage is still greater than 0
|
|
|
|
+ double damage = event.getDamage(); //Use raw damage for Rupture
|
|
|
|
+
|
|
|
|
+ if (event.isCancelled() || damage <= 0 || healthBeforeRuptureIsApplied - damage <= 0)
|
|
return true;
|
|
return true;
|
|
- }
|
|
|
|
|
|
|
|
double damagedHealth = healthBeforeRuptureIsApplied - damage;
|
|
double damagedHealth = healthBeforeRuptureIsApplied - damage;
|
|
|
|
+
|
|
targetEntity.setHealth(damagedHealth); //Hurt entity without the unwanted side effects of damage()}
|
|
targetEntity.setHealth(damagedHealth); //Hurt entity without the unwanted side effects of damage()}
|
|
|
|
+ MobHealthbarUtils.handleMobHealthbars(targetEntity, damage, mcMMO.p);
|
|
}
|
|
}
|
|
|
|
|
|
return false;
|
|
return false;
|