From c09ae5d32fa5ac8507d3870df7d164d2f186efc4 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Mon, 22 Apr 2024 08:35:58 -0400 Subject: [PATCH] Workorder to json work --- src/engine/gameManager/ForgeManager.java | 3 +++ src/engine/loot/WorkOrder.java | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/src/engine/gameManager/ForgeManager.java b/src/engine/gameManager/ForgeManager.java index b0e3ee61..a7ae3dbb 100644 --- a/src/engine/gameManager/ForgeManager.java +++ b/src/engine/gameManager/ForgeManager.java @@ -142,6 +142,9 @@ public enum ForgeManager implements Runnable { vendorWorkOrderLookup.get(workOrder.vendor).add(workOrder); forge.add(workOrder); + String jsonWorkOrder = workOrder.toString(); + jsonWorkOrder = jsonWorkOrder.trim(); + } catch (Exception e) { Logger.error(e); } finally { diff --git a/src/engine/loot/WorkOrder.java b/src/engine/loot/WorkOrder.java index 72baeab5..c90f9a15 100644 --- a/src/engine/loot/WorkOrder.java +++ b/src/engine/loot/WorkOrder.java @@ -11,6 +11,7 @@ package engine.loot; import engine.mbEnums; import engine.objects.Item; import engine.objects.NPC; +import org.json.simple.JSONValue; import java.time.Duration; import java.time.Instant; @@ -49,6 +50,12 @@ public class WorkOrder implements Delayed { } + public static String toJson(WorkOrder workOrder) { + + String jsonString = JSONValue.toJSONString(workOrder); + return jsonString; + } + @Override public long getDelay(TimeUnit unit) {