39 lines
1.2 KiB
Java
39 lines
1.2 KiB
Java
package com.zerohighdef.geoffrey.Models;
|
|
|
|
import com.google.gson.JsonElement;
|
|
import com.google.gson.JsonObject;
|
|
|
|
import java.util.LinkedList;
|
|
import java.util.List;
|
|
|
|
public class GeoffreyMarket extends GeoffreyLocation{
|
|
private LinkedList<GeoffreyLocation> shops;
|
|
|
|
public GeoffreyMarket(JsonObject locationJSON) {
|
|
super(locationJSON);
|
|
this.shops = new LinkedList<>();
|
|
for (JsonElement json : locationJSON.get("shops").getAsJsonArray()) {
|
|
this.shops.add(new GeoffreyLocation(json.getAsJsonObject()));
|
|
}
|
|
}
|
|
|
|
public GeoffreyMarket(int xCoord, int zCoord, String locationName, List<GeoffreyPlayer> owners, String dimension, LinkedList<GeoffreyLocation> shops) {
|
|
super(xCoord, zCoord, locationName, owners, dimension);
|
|
this.shops = shops;
|
|
}
|
|
|
|
@Override
|
|
public String getInfoString() {
|
|
StringBuilder infoString = new StringBuilder();
|
|
infoString.append(super.getInfoString());
|
|
infoString.append("\nShops:");
|
|
|
|
for (GeoffreyLocation shop: shops) {
|
|
infoString.append("\n");
|
|
infoString.append(shop.getFormattedLocationString());
|
|
}
|
|
|
|
return infoString.toString();
|
|
}
|
|
}
|