Fix bleed tasks invoking ruptures

Also, made the mcmmo custom damage checks handle nested calls
This commit is contained in:
Shane Freeder 2019-08-21 01:03:32 +01:00
parent 4f6706b664
commit e8165321e1
No known key found for this signature in database
GPG Key ID: A3F61EA5A085289C

View File

@ -539,7 +539,11 @@ public final class CombatUtils {
if(newHealth == 0)
{
// TODO: This is horrible, but there is no cleaner way to do this without potentially breaking existing code right now
boolean wasMetaSet = target.getMetadata(mcMMO.CUSTOM_DAMAGE_METAKEY).size() != 0;
target.setMetadata(mcMMO.CUSTOM_DAMAGE_METAKEY, mcMMO.metadataValue);
target.damage(9999, attacker);
if (!wasMetaSet) target.removeMetadata(mcMMO.CUSTOM_DAMAGE_METAKEY, mcMMO.p);
}
else
target.setHealth(newHealth);
@ -550,9 +554,11 @@ public final class CombatUtils {
return;
}
// This is horrible, but there is no cleaner way to do this without potentially breaking existing code
boolean wasMetaSet = target.getMetadata(mcMMO.CUSTOM_DAMAGE_METAKEY).size() != 0;
target.setMetadata(mcMMO.CUSTOM_DAMAGE_METAKEY, mcMMO.metadataValue);
target.damage(damage, attacker);
target.removeMetadata(mcMMO.CUSTOM_DAMAGE_METAKEY, mcMMO.p);
if (!wasMetaSet) target.removeMetadata(mcMMO.CUSTOM_DAMAGE_METAKEY, mcMMO.p);
// //IFrame storage
//// int noDamageTicks = target.getNoDamageTicks();