Repository for lakemenbane
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
package engine.loot;
|
|
|
|
|
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
|
|
|
|
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 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);
|
|
|
|
}
|
|
|
|
}
|