use of com.magmaguy.elitemobs.config.npcs.NPCsConfigFields 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);
}
Aggregations