mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-11-04 11:03:43 +01:00 
			
		
		
		
	final damage values of 0 are only ignored in certain circumstances, fixes a few bugs
This commit is contained in:
		@@ -411,7 +411,6 @@ public class EntityListener implements Listener {
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        /*
 | 
			
		||||
         * This was put here to solve a plugin conflict with a mod called Project Korra
 | 
			
		||||
         * Project Korra sends out a damage event with exactly 0 damage
 | 
			
		||||
@@ -421,7 +420,7 @@ public class EntityListener implements Listener {
 | 
			
		||||
         * Surprising this kind of thing
 | 
			
		||||
         *
 | 
			
		||||
         */
 | 
			
		||||
        if(damage <= 0) {
 | 
			
		||||
        if(event.getDamage() <= 0 && !CombatUtils.isDamageLikelyFromNormalCombat(event.getCause())) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -42,6 +42,18 @@ import java.util.Map;
 | 
			
		||||
public final class CombatUtils {
 | 
			
		||||
    private CombatUtils() {}
 | 
			
		||||
 | 
			
		||||
    //Likely.. because who knows what plugins are throwing around
 | 
			
		||||
    public static boolean isDamageLikelyFromNormalCombat(DamageCause damageCause) {
 | 
			
		||||
        switch (damageCause) {
 | 
			
		||||
            case ENTITY_ATTACK:
 | 
			
		||||
            case ENTITY_SWEEP_ATTACK:
 | 
			
		||||
            case PROJECTILE:
 | 
			
		||||
                return true;
 | 
			
		||||
            default:
 | 
			
		||||
                return false;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static void processSwordCombat(LivingEntity target, Player player, EntityDamageByEntityEvent event) {
 | 
			
		||||
        if (event.getCause() == DamageCause.THORNS) {
 | 
			
		||||
            return;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user