Search in sources :

Example 1 with EliteEntity

use of com.magmaguy.elitemobs.mobconstructor.EliteEntity in project EliteMobs by MagmaGuy.

the class LightningBolts method setLightiningPaths.

private static void setLightiningPaths(EliteEntity eliteEntity) {
    if (eliteEntity.getLivingEntity() == null)
        return;
    eliteEntity.getLivingEntity().setAI(false);
    for (Entity entity : eliteEntity.getLivingEntity().getNearbyEntities(20, 20, 20)) {
        if (entity.getType().equals(EntityType.PLAYER)) {
            Location playerLocationClone = entity.getLocation().clone();
            Location powerLocation = eliteEntity.getLivingEntity().getLocation().clone();
            Vector powerDirection = playerLocationClone.clone().subtract(powerLocation).toVector().normalize();
            int counter = 0;
            while (playerLocationClone.distance(powerLocation) > 0.55) {
                counter++;
                powerLocation.add(powerDirection);
                lightningTask(powerLocation.clone(), counter);
            }
        }
    }
    new BukkitRunnable() {

        @Override
        public void run() {
            if (eliteEntity != null && eliteEntity.getLivingEntity() != null)
                eliteEntity.getLivingEntity().setAI(true);
        }
    }.runTaskLater(MetadataHandler.PLUGIN, 4L * 20);
}
Also used : Entity(org.bukkit.entity.Entity) EliteEntity(com.magmaguy.elitemobs.mobconstructor.EliteEntity) BukkitRunnable(org.bukkit.scheduler.BukkitRunnable) Vector(org.bukkit.util.Vector) Location(org.bukkit.Location)

Example 2 with EliteEntity

use of com.magmaguy.elitemobs.mobconstructor.EliteEntity in project EliteMobs by MagmaGuy.

the class KillHandler method killAggressiveMobs.

// TODO: FIX NPE ISSUE YOU FUCKING MORON
public static void killAggressiveMobs(CommandSender commandSender) {
    int counter = 0;
    for (EliteEntity eliteEntity : new ArrayList<>(EntityTracker.getEliteMobEntities().values())) {
        eliteEntity.remove(RemovalReason.REMOVE_COMMAND);
        counter++;
    }
    commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Killed " + counter + " Elite Mobs."));
}
Also used : EliteEntity(com.magmaguy.elitemobs.mobconstructor.EliteEntity) ArrayList(java.util.ArrayList)

Example 3 with EliteEntity

use of com.magmaguy.elitemobs.mobconstructor.EliteEntity in project EliteMobs by MagmaGuy.

the class PreventEndermanHeightExploit method onDamage.

@EventHandler(priority = EventPriority.HIGHEST)
public void onDamage(EliteMobDamagedByPlayerAntiExploitEvent event) {
    if (!AntiExploitConfig.isEndermanHeightAntiExploit())
        return;
    if (!event.getEntity().getType().equals(EntityType.ENDERMAN))
        return;
    EliteEntity eliteEntity = EntityTracker.getEliteMobEntity(event.getEntity());
    if (eliteEntity == null)
        return;
    Block block = event.getEliteMobDamagedByPlayerEvent().getPlayer().getLocation().getBlock().getLocation().add(new Vector(0, 2, 0)).getBlock();
    if (block.getType().equals(Material.AIR) || block.getType().equals(Material.WATER))
        return;
    eliteEntity.incrementAntiExploit(9, "enderman height");
    event.setTriggered(true);
}
Also used : EliteEntity(com.magmaguy.elitemobs.mobconstructor.EliteEntity) Block(org.bukkit.block.Block) Vector(org.bukkit.util.Vector) EventHandler(org.bukkit.event.EventHandler)

Example 4 with EliteEntity

use of com.magmaguy.elitemobs.mobconstructor.EliteEntity in project EliteMobs by MagmaGuy.

the class DebugScreen method openBossScreen.

private static void openBossScreen(Player player, String argument) {
    TextComponent[] pages = new TextComponent[100];
    int counter = 0;
    for (EliteEntity eliteEntity : EntityTracker.getEliteMobEntities().values()) if (!(eliteEntity instanceof RegionalBossEntity))
        if (eliteEntity instanceof CustomBossEntity) {
            TextComponent textComponent = generateEntry((CustomBossEntity) eliteEntity, argument, player);
            if (textComponent == null)
                continue;
            pages[counter] = textComponent;
            counter++;
        }
    for (RegionalBossEntity regionalBossEntity : RegionalBossEntity.getRegionalBossEntities()) {
        TextComponent textComponent = generateEntry(regionalBossEntity, argument, player);
        if (textComponent == null)
            continue;
        pages[counter] = textComponent;
        counter++;
    }
    BookMaker.generateBook(player, pages);
}
Also used : TextComponent(net.md_5.bungee.api.chat.TextComponent) EliteEntity(com.magmaguy.elitemobs.mobconstructor.EliteEntity) CustomBossEntity(com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity) RegionalBossEntity(com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity)

Example 5 with EliteEntity

use of com.magmaguy.elitemobs.mobconstructor.EliteEntity in project EliteMobs by MagmaGuy.

the class VanillaReinforcementsCanceller method onSpawn.

@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onSpawn(CreatureSpawnEvent event) {
    if (!event.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.REINFORCEMENTS))
        return;
    EliteEntity eliteEntity = EntityTracker.getEliteMobEntity(event.getEntity());
    if (eliteEntity == null)
        return;
    event.setCancelled(true);
}
Also used : EliteEntity(com.magmaguy.elitemobs.mobconstructor.EliteEntity) EventHandler(org.bukkit.event.EventHandler)

Aggregations

EliteEntity (com.magmaguy.elitemobs.mobconstructor.EliteEntity)29 Entity (org.bukkit.entity.Entity)16 LivingEntity (org.bukkit.entity.LivingEntity)12 BukkitRunnable (org.bukkit.scheduler.BukkitRunnable)10 EventHandler (org.bukkit.event.EventHandler)8 Vector (org.bukkit.util.Vector)8 CustomBossEntity (com.magmaguy.elitemobs.mobconstructor.custombosses.CustomBossEntity)7 Location (org.bukkit.Location)7 Player (org.bukkit.entity.Player)6 ArrayList (java.util.ArrayList)3 Block (org.bukkit.block.Block)3 RegionalBossEntity (com.magmaguy.elitemobs.mobconstructor.custombosses.RegionalBossEntity)2 ElitePower (com.magmaguy.elitemobs.powers.meta.ElitePower)2 PotionEffect (org.bukkit.potion.PotionEffect)2 ChatColorConverter.convert (com.magmaguy.elitemobs.ChatColorConverter.convert)1 MetadataHandler (com.magmaguy.elitemobs.MetadataHandler)1 EliteExplosionEvent (com.magmaguy.elitemobs.api.EliteExplosionEvent)1 EliteMobDamagedByPlayerEvent (com.magmaguy.elitemobs.api.EliteMobDamagedByPlayerEvent)1 EliteMobExitCombatEvent (com.magmaguy.elitemobs.api.EliteMobExitCombatEvent)1 EliteProjectile (com.magmaguy.elitemobs.combatsystem.EliteProjectile)1