Browse Source

Workorder to json work

combat-2
MagicBot 7 months ago
parent
commit
c09ae5d32f
  1. 3
      src/engine/gameManager/ForgeManager.java
  2. 7
      src/engine/loot/WorkOrder.java

3
src/engine/gameManager/ForgeManager.java

@ -142,6 +142,9 @@ public enum ForgeManager implements Runnable { @@ -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 {

7
src/engine/loot/WorkOrder.java

@ -11,6 +11,7 @@ package engine.loot; @@ -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 { @@ -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) {

Loading…
Cancel
Save