diff --git a/src/engine/db/handlers/dbWarehouseHandler.java b/src/engine/db/handlers/dbWarehouseHandler.java index f9976885..843113d0 100644 --- a/src/engine/db/handlers/dbWarehouseHandler.java +++ b/src/engine/db/handlers/dbWarehouseHandler.java @@ -171,4 +171,16 @@ public class dbWarehouseHandler extends dbHandlerBase { } return false; } + + public void DELETE_WORKORDER(WorkOrder workOrder) { + try (Connection connection = DbManager.getConnection(); + PreparedStatement preparedStatement = connection.prepareStatement("DELETE FROM `dyn_workorders` WHERE `workorderID` = ?;")) { + preparedStatement.setInt(1, workOrder.workOrderID); + preparedStatement.executeUpdate(); + + } catch (SQLException e) { + Logger.error(e); + } + + } } diff --git a/src/engine/gameManager/ForgeManager.java b/src/engine/gameManager/ForgeManager.java index bef56746..6f17cfab 100644 --- a/src/engine/gameManager/ForgeManager.java +++ b/src/engine/gameManager/ForgeManager.java @@ -57,6 +57,10 @@ public enum ForgeManager implements Runnable { } workOrder.runCompleted = true; + + // Update workorder to disk + + DbManager.WarehouseQueries.UPDATE_WORKORDER(workOrder); } if (workOrder.runCompleted) @@ -328,6 +332,11 @@ public enum ForgeManager implements Runnable { DispatchMessage.dispatchMsgToInterestArea(workOrder.vendor, outMsg, mbEnums.DispatchChannel.SECONDARY, 700, false, false); workOrder.total_produced = workOrder.total_produced + 1; } + + // Save updated status to disk + + DbManager.WarehouseQueries.UPDATE_WORKORDER(workOrder); + } public static int calcRandomMod(NPC vendor, mbEnums.ItemModType itemModType, int modTable) {