Method made static and moved to manager.

This commit is contained in:
2023-08-15 08:50:02 -04:00
parent 6d3050f08a
commit c913618dc3
4 changed files with 29 additions and 27 deletions
+25
View File
@@ -293,4 +293,29 @@ public enum NPCManager {
return nameList.get(ThreadLocalRandom.current().nextInt(nameList.size()));
}
public static ArrayList<Building> getProtectedBuildings(NPC npc) {
ArrayList<Building> protectedBuildings = new ArrayList<>();
if (npc.building == null)
return protectedBuildings;
if (npc.building.getCity() == null)
return protectedBuildings;
for (Building b : npc.building.getCity().getParent().zoneBuildingSet) {
if (b.getBlueprint() == null)
continue;
if (b.getProtectionState().equals(Enum.ProtectionState.CONTRACT))
protectedBuildings.add(b);
if (b.getProtectionState().equals(Enum.ProtectionState.PENDING))
protectedBuildings.add(b);
}
return protectedBuildings;
}
}