ForgeManager manager created.
This commit is contained in:
@@ -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() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,15 +1,36 @@
|
|||||||
package engine.loot;
|
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 npcUUID;
|
||||||
public int slotCount;
|
public int slotCount;
|
||||||
public int itemCount;
|
public int itemCount;
|
||||||
public String prefix;
|
public String prefix;
|
||||||
public String suffix;
|
public String suffix;
|
||||||
public LocalDateTime completionTime;
|
public long completionTime;
|
||||||
public boolean canceled;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user