|
|
@ -17,7 +17,18 @@ class GenerationManager(private val chunkmaster: Chunkmaster, private val server
|
|
|
|
val worldProperties = chunkmaster.sqliteManager.worldProperties
|
|
|
|
val worldProperties = chunkmaster.sqliteManager.worldProperties
|
|
|
|
private val pendingChunksTable = chunkmaster.sqliteManager.pendingChunks
|
|
|
|
private val pendingChunksTable = chunkmaster.sqliteManager.pendingChunks
|
|
|
|
private val generationTasks = chunkmaster.sqliteManager.generationTasks
|
|
|
|
private val generationTasks = chunkmaster.sqliteManager.generationTasks
|
|
|
|
private val unloadingPeriod = chunkmaster.config.getLong("generation.unloading-period")
|
|
|
|
private val unloadingPeriod: Long
|
|
|
|
|
|
|
|
get() {
|
|
|
|
|
|
|
|
return chunkmaster.config.getLong("generation.unloading-period")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private val pauseOnPlayerCount: Int
|
|
|
|
|
|
|
|
get () {
|
|
|
|
|
|
|
|
return chunkmaster.config.getInt("generation.pause-on-player-count")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private val autostart: Boolean
|
|
|
|
|
|
|
|
get () {
|
|
|
|
|
|
|
|
return chunkmaster.config.getBoolean("generation.autostart")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
val loadedChunkCount: Int
|
|
|
|
val loadedChunkCount: Int
|
|
|
|
get() {
|
|
|
|
get() {
|
|
|
@ -30,7 +41,7 @@ class GenerationManager(private val chunkmaster: Chunkmaster, private val server
|
|
|
|
get() {
|
|
|
|
get() {
|
|
|
|
if (this.tasks.isEmpty() && this.pausedTasks.isEmpty()) {
|
|
|
|
if (this.tasks.isEmpty() && this.pausedTasks.isEmpty()) {
|
|
|
|
this.startAll()
|
|
|
|
this.startAll()
|
|
|
|
if (server.onlinePlayers.size >= chunkmaster.config.getInt("generation.pause-on-player-count")) {
|
|
|
|
if (server.onlinePlayers.size >= pauseOnPlayerCount) {
|
|
|
|
this.pauseAll()
|
|
|
|
this.pauseAll()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -155,7 +166,10 @@ class GenerationManager(private val chunkmaster: Chunkmaster, private val server
|
|
|
|
}, 600, 600)
|
|
|
|
}, 600, 600)
|
|
|
|
server.scheduler.runTaskLater(chunkmaster, Runnable {
|
|
|
|
server.scheduler.runTaskLater(chunkmaster, Runnable {
|
|
|
|
this.startAll()
|
|
|
|
this.startAll()
|
|
|
|
if (!server.onlinePlayers.isEmpty()) {
|
|
|
|
if (server.onlinePlayers.count() >= pauseOnPlayerCount || !autostart) {
|
|
|
|
|
|
|
|
if (!autostart) {
|
|
|
|
|
|
|
|
chunkmaster.logger.info(chunkmaster.langManager.getLocalized("NO_AUTOSTART"))
|
|
|
|
|
|
|
|
}
|
|
|
|
this.pauseAll()
|
|
|
|
this.pauseAll()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, 20)
|
|
|
|
}, 20)
|
|
|
|