|
|
@ -35,6 +35,21 @@ public class Warehouse { |
|
|
|
public ArrayList<Transaction> transactions = new ArrayList<>(); |
|
|
|
public ArrayList<Transaction> transactions = new ArrayList<>(); |
|
|
|
public ConcurrentHashMap<Enum.ResourceType, Integer> resources = new ConcurrentHashMap<>(); |
|
|
|
public ConcurrentHashMap<Enum.ResourceType, Integer> resources = new ConcurrentHashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Warehouse(Building building) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.buildingUID = building.objectUUID; |
|
|
|
|
|
|
|
this.city = building.getCity(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// New empty warehouse
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Enum.ResourceType resourceType : EnumSet.allOf(Enum.ResourceType.class)) |
|
|
|
|
|
|
|
this.resources.put(resourceType, 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// With no locks
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.locked = EnumSet.noneOf(Enum.ResourceType.class); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Warehouse(JSONObject warehouse) throws SQLException { |
|
|
|
public Warehouse(JSONObject warehouse) throws SQLException { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|