Method made static and moved to manager.
This commit is contained in:
1 parent
6d3050f08a
commit
c913618dc3
4 files changed
+29
-27
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user