Search in sources :

Example 1 with NPCsConfigFields

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);
}
Also used : NPCsConfigFields(com.magmaguy.elitemobs.config.npcs.NPCsConfigFields) NPCEntity(com.magmaguy.elitemobs.npcs.NPCEntity) Location(org.bukkit.Location)

Aggregations

NPCsConfigFields (com.magmaguy.elitemobs.config.npcs.NPCsConfigFields)1 NPCEntity (com.magmaguy.elitemobs.npcs.NPCEntity)1 Location (org.bukkit.Location)1