use of com.magmaguy.elitemobs.npcs.NPCEntity in project EliteMobs by MagmaGuy.
the class NPCCommands method set.
public static void set(Player player, String npcFileName) {
NPCsConfigFields npCsConfigFields = NPCsConfig.getNpcEntities().get(npcFileName);
if (npCsConfigFields == null) {
player.sendMessage("[EliteMobs] Invalid NPC filename.");
return;
}
Location playerLocation = player.getLocation();
String location = playerLocation.getWorld().getName() + "," + Round.twoDecimalPlaces(playerLocation.getX()) + "," + Round.twoDecimalPlaces(playerLocation.getY()) + "," + Round.twoDecimalPlaces(playerLocation.getZ()) + "," + Round.twoDecimalPlaces(playerLocation.getYaw()) + "," + Round.twoDecimalPlaces(playerLocation.getPitch());
try {
for (NPCEntity npcEntity : EntityTracker.getNpcEntities().values()) if (npcEntity.npCsConfigFields.equals(npCsConfigFields))
npcEntity.remove(RemovalReason.REMOVE_COMMAND);
} catch (Exception ex) {
}
npCsConfigFields.setEnabled(true);
npCsConfigFields.setLocation(location);
new NPCEntity(npCsConfigFields);
}
use of com.magmaguy.elitemobs.npcs.NPCEntity in project EliteMobs by MagmaGuy.
the class EntityTracker method unregisterNPCEntity.
public static void unregisterNPCEntity(Entity entity, RemovalReason removalReason) {
NPCEntity npcEntity = getNPCEntity(entity);
if (npcEntity == null)
return;
// Removal from the hashmap is not guaranteed here as some forms of removal don't completely wipe the elite entity out
npcEntity.remove(removalReason);
}
use of com.magmaguy.elitemobs.npcs.NPCEntity in project EliteMobs by MagmaGuy.
the class EntityTracker method wipeShutdown.
public static void wipeShutdown() {
for (EliteEntity eliteEntity : ((HashMap<UUID, EliteEntity>) eliteMobEntities.clone()).values()) eliteEntity.remove(RemovalReason.SHUTDOWN);
getEliteMobEntities().clear();
for (NPCEntity npcEntity : ((HashMap<UUID, NPCEntity>) npcEntities.clone()).values()) npcEntity.remove(RemovalReason.SHUTDOWN);
getNpcEntities().clear();
for (Block block : temporaryBlocks) block.setType(Material.AIR);
temporaryBlocks.clear();
// Necessary for things such as visual effects which are not stored in memory, only tagged
for (World world : Bukkit.getWorlds()) for (Entity entity : world.getEntities()) unregister(entity, RemovalReason.SHUTDOWN);
SimplePersistentEntity.getPersistentEntities().clear();
CustomBossEntity.getTrackableCustomBosses().clear();
CrashFix.knownSessionChunks.clear();
}
Aggregations