Browse Source

ForgeManager manager created.

feature-workorder
MagicBot 1 year ago
parent
commit
b6be8815a3
  1. 19
      src/engine/gameManager/ForgeManager.java
  2. 27
      src/engine/loot/WorkOrder.java

19
src/engine/gameManager/ForgeManager.java

@ -0,0 +1,19 @@ @@ -0,0 +1,19 @@
package engine.gameManager;
import engine.loot.WorkOrder;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.DelayQueue;
public enum ForgeManager implements Runnable {
FORGE_MANAGER;
private BlockingQueue<WorkOrder> workQueue = new DelayQueue();
;
@Override
public void run() {
}
}

27
src/engine/loot/WorkOrder.java

@ -1,15 +1,36 @@ @@ -1,15 +1,36 @@
package engine.loot;
import java.time.LocalDateTime;
import org.jetbrains.annotations.NotNull;
public class WorkOrder {
import java.util.concurrent.Delayed;
import java.util.concurrent.TimeUnit;
import static java.lang.Math.toIntExact;
public class WorkOrder implements Delayed {
public int npcUUID;
public int slotCount;
public int itemCount;
public String prefix;
public String suffix;
public LocalDateTime completionTime;
public long completionTime;
public boolean canceled;
public WorkOrder() {
}
@Override
public long getDelay(TimeUnit unit) {
long timeRemaining = completionTime - System.currentTimeMillis();
return unit.convert(timeRemaining, TimeUnit.MILLISECONDS);
}
@Override
public int compareTo(@NotNull Delayed o) {
return toIntExact(this.completionTime - ((WorkOrder) o).completionTime);
}
}

Loading…
Cancel
Save