Cherry pick: * Move to more maintainable PotionEffectTypeCategory for potion handling
This commit is contained in:
parent
6f2a02d610
commit
40152b5dd9
|
|
@ -96,6 +96,7 @@ import org.bukkit.metadata.MetadataValue;
|
|||
import org.bukkit.persistence.PersistentDataType;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.potion.PotionEffectTypeCategory;
|
||||
import org.bukkit.projectiles.BlockProjectileSource;
|
||||
import org.bukkit.projectiles.ProjectileSource;
|
||||
import org.bukkit.util.Vector;
|
||||
|
|
@ -1456,7 +1457,7 @@ public class EntityEventHandler implements Listener
|
|||
if (thrower == null) return;
|
||||
|
||||
//otherwise, no restrictions for positive effects
|
||||
if (positiveEffects.contains(effectType)) continue;
|
||||
if (effectType.getCategory() == PotionEffectTypeCategory.BENEFICIAL) continue;
|
||||
|
||||
for (LivingEntity effected : event.getAffectedEntities())
|
||||
{
|
||||
|
|
@ -1577,22 +1578,4 @@ public class EntityEventHandler implements Listener
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
public static final HashSet<PotionEffectType> positiveEffects = new HashSet<>(Arrays.asList
|
||||
(
|
||||
PotionEffectType.ABSORPTION,
|
||||
PotionEffectType.RESISTANCE,
|
||||
PotionEffectType.HASTE,
|
||||
PotionEffectType.FIRE_RESISTANCE,
|
||||
PotionEffectType.REGENERATION,
|
||||
PotionEffectType.HEALTH_BOOST,
|
||||
PotionEffectType.STRENGTH,
|
||||
PotionEffectType.INVISIBILITY,
|
||||
PotionEffectType.JUMP_BOOST,
|
||||
PotionEffectType.NIGHT_VISION,
|
||||
PotionEffectType.REGENERATION,
|
||||
PotionEffectType.SATURATION,
|
||||
PotionEffectType.SPEED,
|
||||
PotionEffectType.WATER_BREATHING
|
||||
));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user