Manually merge master -> dev
This commit is contained in:
@@ -103,7 +103,7 @@ interface WorkerScope : Timed {
|
|||||||
fun setProgress(progress: Double)
|
fun setProgress(progress: Double)
|
||||||
}
|
}
|
||||||
|
|
||||||
private interface WorkerContinuation : Worker, WorkerScope {
|
interface WorkerInternal : Worker, WorkerScope {
|
||||||
/**
|
/**
|
||||||
* Start or resumes the execution of this worker
|
* Start or resumes the execution of this worker
|
||||||
* and returns true if the worker completed
|
* and returns true if the worker completed
|
||||||
@@ -126,18 +126,17 @@ class TickWorktimeLimiter(private val plugin: ParcelsPlugin, var options: TickWo
|
|||||||
// The currently registered bukkit scheduler task
|
// The currently registered bukkit scheduler task
|
||||||
private var bukkitTask: BukkitTask? = null
|
private var bukkitTask: BukkitTask? = null
|
||||||
// The workers.
|
// The workers.
|
||||||
private val _workers = LinkedList<WorkerContinuation>()
|
private val _workers = LinkedList<WorkerInternal>()
|
||||||
override val workers: List<Worker> = _workers
|
override val workers: List<Worker> = _workers
|
||||||
|
|
||||||
override fun submit(task: TimeLimitedTask): Worker {
|
override fun submit(task: TimeLimitedTask): Worker {
|
||||||
val worker: WorkerContinuation = WorkerImpl(plugin, task)
|
val worker: WorkerInternal = WorkerImpl(plugin, task)
|
||||||
|
|
||||||
if (bukkitTask == null) {
|
if (bukkitTask == null) {
|
||||||
val completed = worker.resume(options.workTime.toLong())
|
val completed = worker.resume(options.workTime.toLong())
|
||||||
if (completed) return worker
|
if (completed) return worker
|
||||||
bukkitTask = plugin.scheduleRepeating(0, options.tickInterval) { tickJobs() }
|
bukkitTask = plugin.scheduleRepeating(0, options.tickInterval) { tickJobs() }
|
||||||
}
|
}
|
||||||
|
|
||||||
_workers.addFirst(worker)
|
_workers.addFirst(worker)
|
||||||
return worker
|
return worker
|
||||||
}
|
}
|
||||||
@@ -183,7 +182,7 @@ class TickWorktimeLimiter(private val plugin: ParcelsPlugin, var options: TickWo
|
|||||||
private class WorkerImpl(
|
private class WorkerImpl(
|
||||||
val scope: CoroutineScope,
|
val scope: CoroutineScope,
|
||||||
val task: TimeLimitedTask
|
val task: TimeLimitedTask
|
||||||
) : WorkerContinuation, CoroutineScope by scope {
|
) : WorkerInternal, CoroutineScope by scope {
|
||||||
override var job: Job? = null; private set
|
override var job: Job? = null; private set
|
||||||
|
|
||||||
override val elapsedTime
|
override val elapsedTime
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import org.jetbrains.exposed.sql.statements.UpdateBuilder
|
|||||||
import org.joda.time.DateTime
|
import org.joda.time.DateTime
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
||||||
sealed class IdTransactionsTable<TableT : IdTransactionsTable<TableT, QueryObj>, QueryObj>(tableName: String, columnName: String)
|
abstract class IdTransactionsTable<TableT : IdTransactionsTable<TableT, QueryObj>, QueryObj>(tableName: String, columnName: String)
|
||||||
: Table(tableName) {
|
: Table(tableName) {
|
||||||
val id = integer(columnName).autoIncrement().primaryKey()
|
val id = integer(columnName).autoIncrement().primaryKey()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user