skip update check for jenkins and dev builds, add default users (power 0) to permissions as examples

This commit is contained in:
NikkyAI 2018-02-19 16:25:52 +01:00
parent 82c550f37f
commit 0f3ebeb67d
3 changed files with 18 additions and 9 deletions

View File

@ -3,17 +3,15 @@ package matterlink.config
import com.google.gson.Gson import com.google.gson.Gson
import com.google.gson.GsonBuilder import com.google.gson.GsonBuilder
import com.google.gson.JsonSyntaxException import com.google.gson.JsonSyntaxException
import com.google.gson.stream.MalformedJsonException
import matterlink.bridge.command.CommandType import matterlink.bridge.command.CommandType
import matterlink.bridge.command.CustomCommand import matterlink.bridge.command.CustomCommand
import matterlink.bridge.command.IBridgeCommand
import matterlink.instance import matterlink.instance
import java.io.File import java.io.File
object CommandConfig { object CommandConfig {
private val gson: Gson = GsonBuilder().setPrettyPrinting().create() private val gson: Gson = GsonBuilder().setPrettyPrinting().create()
private val configFile: File = cfg.cfgDirectory.resolve("commands.json") private val configFile: File = cfg.cfgDirectory.resolve("commands.json")
private val default = arrayOf<CustomCommand>( private val default = arrayOf(
CustomCommand( CustomCommand(
alias = "tps", alias = "tps",
type = CommandType.PASSTHROUGH, type = CommandType.PASSTHROUGH,

View File

@ -13,7 +13,12 @@ object PermissionConfig {
private val gson: Gson = GsonBuilder().setPrettyPrinting().create() private val gson: Gson = GsonBuilder().setPrettyPrinting().create()
private val configFile: File = cfg.cfgDirectory.resolve("permissions.json") private val configFile: File = cfg.cfgDirectory.resolve("permissions.json")
private val default = PermissionMap() private val default: PermissionMap = hashMapOf(
"irc.esper" to hashMapOf(
"~nikky@nikky.moe" to 0,
"user@example.com" to 0
)
)
var perms: PermissionMap = default var perms: PermissionMap = default

View File

@ -14,14 +14,19 @@ import java.io.BufferedReader
class UpdateChecker : Runnable { class UpdateChecker : Runnable {
override fun run() { override fun run() {
if (instance.modVersion.contains("-build")) {
instance.debug("Not checking updates on Jenkins build")
return
}
if (instance.modVersion.contains("-dev")) {
instance.debug("Not checking updates on developer build")
return
}
val gson = Gson() val gson = Gson()
instance.info("Checking for new versions...") instance.info("Checking for new versions...")
if (instance.modVersion.endsWith("-dev")) {
}
val client: HttpClient = HttpClients.createDefault() val client: HttpClient = HttpClients.createDefault()
val request = HttpGet("https://goo.gl/5CMc1N") val request = HttpGet("https://goo.gl/5CMc1N")
@ -49,7 +54,8 @@ class UpdateChecker : Runnable {
} }
val modVersionChunks = instance.modVersion val modVersionChunks = instance.modVersion
.replace("-dev", "") .substringBefore("-dev")
.substringBefore("-build")
.split('.') .split('.')
.map { .map {
it.toInt() it.toInt()