Search in sources :

Example 21 with EliteEntity

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

the class KillHandler method radiusKillSpecificMobs.

public static void radiusKillSpecificMobs(Player player, EntityType entityType, int radius) {
    int counter = 0;
    for (Entity entity : player.getNearbyEntities(radius, radius, radius)) {
        if (entity.getType().equals(entityType) && (EntityTracker.isEliteMob(entity))) {
            ((EliteEntity) entity).remove(RemovalReason.KILL_COMMAND);
            counter++;
        } else if (entity.getType().equals(entityType) && EntityTracker.isSuperMob(entity)) {
            EntityTracker.unregister(entity, RemovalReason.KILL_COMMAND);
            counter++;
        }
    }
    player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Killed " + counter + " Elite Mobs."));
}
Also used : Entity(org.bukkit.entity.Entity) EliteEntity(com.magmaguy.elitemobs.mobconstructor.EliteEntity) LivingEntity(org.bukkit.entity.LivingEntity) EliteEntity(com.magmaguy.elitemobs.mobconstructor.EliteEntity)

Example 22 with EliteEntity

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

the class KillHandler method killEntityType.

public static void killEntityType(CommandSender commandSender, EntityType entityType) {
    if (EliteMobProperties.getValidMobTypes().contains(entityType)) {
        int counter = 0;
        for (EliteEntity eliteEntity : EntityTracker.getEliteMobEntities().values()) {
            if (!eliteEntity.getLivingEntity().getType().equals(entityType))
                continue;
            eliteEntity.remove(RemovalReason.REMOVE_COMMAND);
            counter++;
        }
        commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Killed " + counter + " Elite " + entityType.toString() + "."));
    } else if (SuperMobProperties.superMobTypeList.contains(entityType)) {
        int counter = 0;
        for (LivingEntity superMobEntity : EntityTracker.getSuperMobs()) {
            if (!superMobEntity.getType().equals(entityType))
                continue;
            superMobEntity.remove();
            counter++;
        }
        commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Killed " + counter + " Super " + entityType.toString() + "."));
    } else
        commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &cNot a valid entity type for EliteMobs!"));
}
Also used : LivingEntity(org.bukkit.entity.LivingEntity) EliteEntity(com.magmaguy.elitemobs.mobconstructor.EliteEntity)

Example 23 with EliteEntity

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

the class KillHandler method radiusKillAggressiveMobs.

public static void radiusKillAggressiveMobs(Player player, int radius) {
    int counter = 0;
    for (Entity entity : player.getNearbyEntities(radius, radius, radius)) {
        EliteEntity eliteEntity = EntityTracker.getEliteMobEntity(entity);
        if (eliteEntity != null)
            eliteEntity.remove(RemovalReason.REMOVE_COMMAND);
    }
    player.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Killed " + counter + " Elite Mobs."));
}
Also used : Entity(org.bukkit.entity.Entity) EliteEntity(com.magmaguy.elitemobs.mobconstructor.EliteEntity) LivingEntity(org.bukkit.entity.LivingEntity) EliteEntity(com.magmaguy.elitemobs.mobconstructor.EliteEntity)

Example 24 with EliteEntity

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

the class SpawnCommand method spawnEliteEntityTypeCommand.

public static void spawnEliteEntityTypeCommand(CommandSender commandSender, Location location, EntityType entityType, Integer level, Optional<String[]> powers) {
    if (!EliteMobProperties.getValidMobTypes().contains(entityType)) {
        commandSender.sendMessage(ChatColorConverter.convert("&8[EliteMobs] &4Entity type " + entityType.toString() + " can't be an Elite!"));
        return;
    }
    LivingEntity livingEntity = (LivingEntity) location.getWorld().spawnEntity(location, entityType);
    HashSet<ElitePower> mobPowers = new HashSet<>();
    if (powers.isPresent())
        mobPowers = getPowers(powers.get(), commandSender);
    EliteEntity eliteEntity = new EliteEntity();
    eliteEntity.setLevel(level);
    eliteEntity.setLivingEntity(livingEntity, CreatureSpawnEvent.SpawnReason.CUSTOM);
    if (!mobPowers.isEmpty())
        eliteEntity.applyPowers(mobPowers);
    else
        eliteEntity.randomizePowers(EliteMobProperties.getPluginData(livingEntity));
}
Also used : LivingEntity(org.bukkit.entity.LivingEntity) EliteEntity(com.magmaguy.elitemobs.mobconstructor.EliteEntity) ElitePower(com.magmaguy.elitemobs.powers.meta.ElitePower) HashSet(java.util.HashSet)

Example 25 with EliteEntity

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

the class SpawnCommand method spawnEliteEntityTypeCommand.

public static void spawnEliteEntityTypeCommand(Player player, EntityType entityType, Integer level, String[] powers) {
    LivingEntity livingEntity = (LivingEntity) player.getLocation().getWorld().spawnEntity(getLocation(player), entityType);
    HashSet<ElitePower> mobPowers = getPowers(powers, player);
    EliteEntity eliteEntity = new EliteEntity();
    eliteEntity.setLevel(level);
    eliteEntity.setLivingEntity(livingEntity, CreatureSpawnEvent.SpawnReason.CUSTOM);
    if (!mobPowers.isEmpty())
        eliteEntity.applyPowers(mobPowers);
    else
        eliteEntity.randomizePowers(EliteMobProperties.getPluginData(livingEntity));
}
Also used : LivingEntity(org.bukkit.entity.LivingEntity) EliteEntity(com.magmaguy.elitemobs.mobconstructor.EliteEntity) ElitePower(com.magmaguy.elitemobs.powers.meta.ElitePower)

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