|
|
@ -8,14 +8,12 @@ import org.bstats.bukkit.Metrics
|
|
|
|
import org.bukkit.plugin.java.JavaPlugin
|
|
|
|
import org.bukkit.plugin.java.JavaPlugin
|
|
|
|
import org.bukkit.scheduler.BukkitTask
|
|
|
|
import org.bukkit.scheduler.BukkitTask
|
|
|
|
import java.lang.Exception
|
|
|
|
import java.lang.Exception
|
|
|
|
import java.sql.Connection
|
|
|
|
|
|
|
|
import java.sql.DriverManager
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Chunkmaster: JavaPlugin() {
|
|
|
|
class Chunkmaster: JavaPlugin() {
|
|
|
|
lateinit var sqliteManager: SqliteManager
|
|
|
|
lateinit var sqliteManager: SqliteManager
|
|
|
|
lateinit var generationManager: GenerationManager
|
|
|
|
lateinit var generationManager: GenerationManager
|
|
|
|
private lateinit var tpsTask: BukkitTask
|
|
|
|
private lateinit var tpsTask: BukkitTask
|
|
|
|
var mspt = 50L // keep track of the milliseconds per tick
|
|
|
|
var mspt = 20 // keep track of the milliseconds per tick
|
|
|
|
private set
|
|
|
|
private set
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -36,12 +34,18 @@ class Chunkmaster: JavaPlugin() {
|
|
|
|
|
|
|
|
|
|
|
|
server.pluginManager.registerEvents(ChunkmasterEvents(this, server), this)
|
|
|
|
server.pluginManager.registerEvents(ChunkmasterEvents(this, server), this)
|
|
|
|
|
|
|
|
|
|
|
|
tpsTask = server.scheduler.runTaskTimer(this, Runnable {
|
|
|
|
if (PaperLib.isPaper() && PaperLib.getMinecraftPatchVersion() >= 225) {
|
|
|
|
val start = System.currentTimeMillis()
|
|
|
|
tpsTask = server.scheduler.runTaskTimer(this, Runnable {
|
|
|
|
server.scheduler.runTaskLater(this, Runnable {
|
|
|
|
mspt = 1000/server.currentTick // use papers exposed tick rather than calculating it
|
|
|
|
mspt = System.currentTimeMillis() - start
|
|
|
|
}, 1, 300)
|
|
|
|
}, 1)
|
|
|
|
} else {
|
|
|
|
}, 1, 300)
|
|
|
|
tpsTask = server.scheduler.runTaskTimer(this, Runnable {
|
|
|
|
|
|
|
|
val start = System.currentTimeMillis()
|
|
|
|
|
|
|
|
server.scheduler.runTaskLater(this, Runnable {
|
|
|
|
|
|
|
|
mspt = (System.currentTimeMillis() - start).toInt()
|
|
|
|
|
|
|
|
}, 1)
|
|
|
|
|
|
|
|
}, 1, 300)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -64,6 +68,7 @@ class Chunkmaster: JavaPlugin() {
|
|
|
|
config.addDefault("generation.pause-on-join", true)
|
|
|
|
config.addDefault("generation.pause-on-join", true)
|
|
|
|
config.addDefault("generation.max-pending-chunks", 10)
|
|
|
|
config.addDefault("generation.max-pending-chunks", 10)
|
|
|
|
config.addDefault("generation.max-loaded-chunks", 10)
|
|
|
|
config.addDefault("generation.max-loaded-chunks", 10)
|
|
|
|
|
|
|
|
config.addDefault("generation.ignore-worldborder", false)
|
|
|
|
config.addDefault("database.filename", "chunkmaster.db")
|
|
|
|
config.addDefault("database.filename", "chunkmaster.db")
|
|
|
|
config.options().copyDefaults(true)
|
|
|
|
config.options().copyDefaults(true)
|
|
|
|
saveConfig()
|
|
|
|
saveConfig()
|
|
|
|