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."));
}
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!"));
}
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."));
}
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));
}
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));
}
Aggregations