diff --git a/src/main/java/com/alttd/fishingevent/config/NPCLocationConfig.java b/src/main/java/com/alttd/fishingevent/config/NPCLocationConfig.java index 8b08183..074f577 100644 --- a/src/main/java/com/alttd/fishingevent/config/NPCLocationConfig.java +++ b/src/main/java/com/alttd/fishingevent/config/NPCLocationConfig.java @@ -27,7 +27,7 @@ public class NPCLocationConfig extends AbstractConfig{ public static class NPC_LOCATION { private static final String prefix = "npc."; - public static Map ALL = new HashMap<>(); + public static Map> ALL = new HashMap<>(); @SuppressWarnings("unused") private static void load() { @@ -38,9 +38,11 @@ public class NPCLocationConfig extends AbstractConfig{ Set npcKeys = configurationSection.getKeys(false); for (String key : npcKeys) { Optional location = getLocation(prefix + key + ".location."); - if (location.isEmpty()) + if (location.isEmpty()) { continue; - ALL.put(key, location.get()); + } + String villagerId = config.getString(prefix + key + ".", "villager-id", "villager1"); + ALL.computeIfAbsent(villagerId, list -> new ArrayList<>()).add(location.get()); } } diff --git a/src/main/java/com/alttd/fishingevent/npc/NPCManager.java b/src/main/java/com/alttd/fishingevent/npc/NPCManager.java index 2fa3e8b..4816008 100644 --- a/src/main/java/com/alttd/fishingevent/npc/NPCManager.java +++ b/src/main/java/com/alttd/fishingevent/npc/NPCManager.java @@ -13,14 +13,14 @@ public class NPCManager { private static Set loaded = new HashSet<>(); public static void spawnNPCs(FishingEvent fishingEvent, Logger logger) { - NPCLocationConfig.NPC_LOCATION.ALL.forEach((name, location) -> { + NPCLocationConfig.NPC_LOCATION.ALL.forEach((name, locations) -> { NPC npc = Config.NPC_DATA.NPC_MAP.getOrDefault(name, null); if (npc == null) { logger.warning("Found npc location entry without matching npc for [%]", name); return; } logger.info("Spawning daily NPC " + name); - npc.spawnNPC(fishingEvent, location); + locations.forEach(location -> npc.spawnNPC(fishingEvent, location)); loaded.add(npc); });