Code cleanup, Version correction

- changed version from 0.10-beta-SNAPSHOT to 0.10-beta
pull/1/head
Trivernis 5 years ago
parent 5a5fe74d9c
commit 638ae07fe5

@ -6,17 +6,19 @@ import org.bukkit.event.Listener
import org.bukkit.event.player.PlayerJoinEvent import org.bukkit.event.player.PlayerJoinEvent
import org.bukkit.event.player.PlayerQuitEvent import org.bukkit.event.player.PlayerQuitEvent
class ChunkmasterEvents(private val chunkmaster: Chunkmaster, private val server: Server): Listener { class ChunkmasterEvents(private val chunkmaster: Chunkmaster, private val server: Server) : Listener {
private val pauseOnJoin = chunkmaster.config.getBoolean("generation.pause-on-join") private val pauseOnJoin = chunkmaster.config.getBoolean("generation.pause-on-join")
/** /**
* Autostart generation tasks * Autostart generation tasks
*/ */
@EventHandler fun onPlayerQuit(event: PlayerQuitEvent) { @EventHandler
fun onPlayerQuit(event: PlayerQuitEvent) {
if (pauseOnJoin) { if (pauseOnJoin) {
if (server.onlinePlayers.size == 1 && server.onlinePlayers.contains(event.player) || if (server.onlinePlayers.size == 1 && server.onlinePlayers.contains(event.player) ||
server.onlinePlayers.isEmpty()) { server.onlinePlayers.isEmpty()
) {
if (!chunkmaster.generationManager.paused) { if (!chunkmaster.generationManager.paused) {
chunkmaster.generationManager.startAll() chunkmaster.generationManager.startAll()
chunkmaster.logger.info("Server is empty. Starting chunk generation tasks.") chunkmaster.logger.info("Server is empty. Starting chunk generation tasks.")
@ -28,7 +30,8 @@ class ChunkmasterEvents(private val chunkmaster: Chunkmaster, private val server
/** /**
* Autostop generation tasks * Autostop generation tasks
*/ */
@EventHandler fun onPlayerJoin(event: PlayerJoinEvent) { @EventHandler
fun onPlayerJoin(event: PlayerJoinEvent) {
if (pauseOnJoin) { if (pauseOnJoin) {
if (server.onlinePlayers.size == 1 || server.onlinePlayers.isEmpty()) { if (server.onlinePlayers.size == 1 || server.onlinePlayers.isEmpty()) {
chunkmaster.generationManager.stopAll() chunkmaster.generationManager.stopAll()

@ -62,7 +62,7 @@ class SqlUpdateManager(private val connnection: Connection, private val chunkmas
stmt.execute() stmt.execute()
stmt.close() stmt.close()
} catch (err: Exception) { } catch (err: Exception) {
chunkmaster.logger.severe("Error creating table $table."); chunkmaster.logger.severe("Error creating table $table.")
} }
} }
for (table in needUpdate) { for (table in needUpdate) {

@ -2,5 +2,4 @@ package net.trivernis.chunkmaster.lib.generation
import org.bukkit.scheduler.BukkitTask import org.bukkit.scheduler.BukkitTask
data class TaskEntry(val id: Int, val task: BukkitTask, val generationTask: GenerationTask) { data class TaskEntry(val id: Int, val task: BukkitTask, val generationTask: GenerationTask)
}

@ -1,6 +1,6 @@
main: net.trivernis.chunkmaster.Chunkmaster main: net.trivernis.chunkmaster.Chunkmaster
name: Chunkmaster name: Chunkmaster
version: '0.10-beta-SNAPSHOT' version: '0.10-beta'
description: Chunk commands plugin. description: Chunk commands plugin.
author: Trivernis author: Trivernis
website: trivernis.net website: trivernis.net

Loading…
Cancel
Save