Search in sources :

Example 1 with AIR

use of org.bukkit.Material.AIR in project InfernalMobs by NyaaCat.

the class AbilityGravity method perCycleEffect.

@Override
public void perCycleEffect(LivingEntity mobEntity, Mob mob) {
    if (!Helper.possibility(0.2))
        return;
    Location mobLocation = mobEntity.getLocation();
    mobLocation.getWorld().getPlayers().stream().filter(p -> p.getLocation().distanceSquared(mobLocation) <= EFFECTIVE_RANGE_SQUARED).filter(p -> p.getGameMode() != GameMode.CREATIVE).filter(p -> {
        Location t = p.getLocation().clone();
        t.add(0, -2, 0);
        Block b = p.getWorld().getBlockAt(t);
        return b != null && b.getType() != AIR;
    }).filter(p -> Helper.possibility(0.2)).forEach(p -> levitate(p, ConfigReader.getGravityLevitateLength()));
}
Also used : Helper(com.jacob_vejvoda.infernal_mobs.Helper) Entity(org.bukkit.entity.Entity) Mob(com.jacob_vejvoda.infernal_mobs.persist.Mob) BukkitRunnable(org.bukkit.scheduler.BukkitRunnable) Player(org.bukkit.entity.Player) LivingEntity(org.bukkit.entity.LivingEntity) ConfigReader(com.jacob_vejvoda.infernal_mobs.ConfigReader) PotionEffect(org.bukkit.potion.PotionEffect) Vector(org.bukkit.util.Vector) GameMode(org.bukkit.GameMode) Block(org.bukkit.block.Block) Location(org.bukkit.Location) InfernalMobs(com.jacob_vejvoda.infernal_mobs.InfernalMobs) AIR(org.bukkit.Material.AIR) PotionEffectType(org.bukkit.potion.PotionEffectType) Block(org.bukkit.block.Block) Location(org.bukkit.Location)

Aggregations

ConfigReader (com.jacob_vejvoda.infernal_mobs.ConfigReader)1 Helper (com.jacob_vejvoda.infernal_mobs.Helper)1 InfernalMobs (com.jacob_vejvoda.infernal_mobs.InfernalMobs)1 Mob (com.jacob_vejvoda.infernal_mobs.persist.Mob)1 GameMode (org.bukkit.GameMode)1 Location (org.bukkit.Location)1 AIR (org.bukkit.Material.AIR)1 Block (org.bukkit.block.Block)1 Entity (org.bukkit.entity.Entity)1 LivingEntity (org.bukkit.entity.LivingEntity)1 Player (org.bukkit.entity.Player)1 PotionEffect (org.bukkit.potion.PotionEffect)1 PotionEffectType (org.bukkit.potion.PotionEffectType)1 BukkitRunnable (org.bukkit.scheduler.BukkitRunnable)1 Vector (org.bukkit.util.Vector)1