diff --git a/src/main/kotlin/net/trivernis/chunkmaster/lib/generation/GenerationManager.kt b/src/main/kotlin/net/trivernis/chunkmaster/lib/generation/GenerationManager.kt index fffa129..830db4d 100644 --- a/src/main/kotlin/net/trivernis/chunkmaster/lib/generation/GenerationManager.kt +++ b/src/main/kotlin/net/trivernis/chunkmaster/lib/generation/GenerationManager.kt @@ -12,6 +12,12 @@ class GenerationManager(private val chunkmaster: Chunkmaster, private val server val pausedTasks: HashSet = HashSet() val allTasks: HashSet get() { + if (this.tasks.isEmpty() && this.pausedTasks.isEmpty()) { + this.startAll() + if (!server.onlinePlayers.isEmpty()) { + this.pauseAll() + } + } val all = HashSet() all.addAll(pausedTasks) all.addAll(tasks) @@ -141,8 +147,9 @@ class GenerationManager(private val chunkmaster: Chunkmaster, private val server saveProgress() // save progress every 30 seconds }, 600, 600) server.scheduler.runTaskLater(chunkmaster, Runnable { - if (server.onlinePlayers.isEmpty()) { - startAll() // run startAll after 10 seconds if empty + this.startAll() + if (!server.onlinePlayers.isEmpty()) { + this.pauseAll() } }, 600) }