|
|
|
@ -19,6 +19,7 @@ import engine.objects.Transaction;
@@ -19,6 +19,7 @@ import engine.objects.Transaction;
|
|
|
|
|
import engine.objects.Warehouse; |
|
|
|
|
import engine.server.MBServerStatics; |
|
|
|
|
import org.joda.time.DateTime; |
|
|
|
|
import org.json.simple.JSONArray; |
|
|
|
|
import org.json.simple.JSONObject; |
|
|
|
|
import org.json.simple.parser.JSONParser; |
|
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
@ -85,7 +86,17 @@ public class dbWarehouseHandler extends dbHandlerBase {
@@ -85,7 +86,17 @@ public class dbWarehouseHandler extends dbHandlerBase {
|
|
|
|
|
|
|
|
|
|
public boolean UPDATE_WAREHOUSE(Warehouse warehouse) { |
|
|
|
|
|
|
|
|
|
JSONObject warehouseJSON = new JSONObject(warehouse.resources); |
|
|
|
|
JSONObject warehouseJSON = new JSONObject(); |
|
|
|
|
|
|
|
|
|
JSONObject resources = new JSONObject(warehouse.resources); |
|
|
|
|
warehouseJSON.put("resources", resources); |
|
|
|
|
|
|
|
|
|
JSONArray locks = new JSONArray(); |
|
|
|
|
|
|
|
|
|
for (Enum.ResourceType resource : warehouse.locked) |
|
|
|
|
locks.add(resource.name()); |
|
|
|
|
|
|
|
|
|
warehouseJSON.put("locks", locks); |
|
|
|
|
|
|
|
|
|
try (Connection connection = DbManager.getConnection(); |
|
|
|
|
PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO `dyn_warehouse` (`cityUUID`, `warehouse`) VALUES (?, ?) " + |
|
|
|
|