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