Fix dynmap version being null when dynmap doesn't support the minecraft versio

- Fixes #69
pull/95/head
trivernis 4 years ago
parent 65e3e090bb
commit 9b618eccc2

@ -9,6 +9,8 @@ import org.bstats.bukkit.Metrics
import org.bukkit.plugin.java.JavaPlugin
import org.bukkit.scheduler.BukkitTask
import org.dynmap.DynmapAPI
import java.lang.IllegalStateException
import java.lang.NullPointerException
class Chunkmaster : JavaPlugin() {
lateinit var sqliteManager: SqliteManager
@ -103,12 +105,16 @@ class Chunkmaster : JavaPlugin() {
}
private fun getDynmap(): DynmapAPI? {
return try {
val dynmap = server.pluginManager.getPlugin("dynmap")
return if (dynmap != null && dynmap is DynmapAPI) {
if (dynmap != null && dynmap is DynmapAPI) {
logger.info(langManager.getLocalized("PLUGIN_DETECTED", "dynmap", dynmap.dynmapVersion))
dynmap
} else {
null
}
} catch (e: IllegalStateException) {
null
}
}
}
Loading…
Cancel
Save