mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-08-02 12:35:27 +02:00
2.1.228
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
package com.gmail.nossr50.runnables.skills;
|
||||
|
||||
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.events.skills.rupture.McMMOEntityDamageByRuptureEvent;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.CancellableRunnable;
|
||||
import com.gmail.nossr50.util.MetadataConstants;
|
||||
import com.gmail.nossr50.util.MobHealthbarUtils;
|
||||
import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
||||
import com.google.common.base.Objects;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@@ -82,15 +85,21 @@ public class RuptureTask extends CancellableRunnable {
|
||||
|
||||
//Ensure victim has health
|
||||
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;
|
||||
}
|
||||
|
||||
double damagedHealth = healthBeforeRuptureIsApplied - damage;
|
||||
|
||||
targetEntity.setHealth(damagedHealth); //Hurt entity without the unwanted side effects of damage()}
|
||||
MobHealthbarUtils.handleMobHealthbars(targetEntity, damage, mcMMO.p);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user