package de.tails.bedwars.shop; import java.util.ArrayList; import java.util.HashMap; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.entity.Player; import de.tails.bedwars.configs.ConfigMaps; import de.tails.bedwars.listeners.APlayerJoinQuit; public class SpawnNPC { public static HashMap npcs = new HashMap(); public static ArrayList npcids = new ArrayList(); public static void NpcSpawn(Player player) { for(Integer ids : npcids) { if(npcs.containsKey(player.getUniqueId().toString() + " : " + ids)) { NPC npc = npcs.get(player.getUniqueId().toString() + " : " + ids); npc.spawn(player); } else { World world = Bukkit.getWorld(ConfigMaps.config.getString(APlayerJoinQuit.randommap + ".Shops." + ids.toString() + ".World")); double x = ConfigMaps.config.getDouble(APlayerJoinQuit.randommap + ".Shops." + ids.toString() + ".X"); double y = ConfigMaps.config.getDouble(APlayerJoinQuit.randommap + ".Shops." + ids.toString() + ".Y"); double z = ConfigMaps.config.getDouble(APlayerJoinQuit.randommap + ".Shops." + ids.toString() + ".Z"); float yaw = (float) ConfigMaps.config.getDouble(APlayerJoinQuit.randommap + ".Shops." + ids.toString() + ".Yaw"); float pitch = (float) ConfigMaps.config.getDouble(APlayerJoinQuit.randommap + ".Shops." + ids.toString() + ".Pitch"); Location location = new Location(world, x, y, z, yaw, pitch); NPC npc = new NPC("§2§lShop", location, player); npc.spawn(player); npcs.put(player.getUniqueId().toString() + " : " + ids, npc); } } } public static void setNpcIds(String mapname) { int i = 1; for(String key : ConfigMaps.config.getKeys(true)) { if(key.equals(mapname + ".Shops." + i)) { if(!npcids.contains(i)) { npcids.add(i); } i = i + 1; } } } }