diff --git a/.travis.yml b/.travis.yml index 5948683..2d45259 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,8 +9,8 @@ deploy: provider: releases api_key: secure: KJd23J+YlpBuUs+5//5BjYlSQ9mVOsYnpfanE03ZQ4E9Qp+pGpMSaH60d/CXkSkDVr32QL5jk0VRDNVl0wvTZpRJfNclQgh3fh2iPkaBDmjun0YkGHfE6VeRzJZVuIF/F34pkziEC01B7Tq2loms+RSm9pNeWgN+ulaajNENUT2J4nmb33yyKbGN9I4EdjcMCQmgdnxn/4QNXV6T3Xls9S9X7AwA9pg4WNpdACqJ0oWj2YlSWKmAdcKw0iLQtRbQfbiqj6waOLODdxieIu0KVWEVQnTdcv7ElGl9BgDrHzXBjfS+9G112TBqsNIPx60o8Z7ThR02DYPWYXrRyfvaHM0FqXrBSaUZUxfHpGn5F4CRQLZh/jOnIOZ9hHmCSDD69pcS254tVCoB+hRuS7PBstuh8iUO7VGJASb5Mv34LZYLAxfvNDAKLeY60xdz/Uiku9JW0dpLQC+FWAvFZWdQ3IvCMYRnaT1fmjDJKanYvCw31l5ypACjfhIQfnwG7FKeLdh6BJx9CG/eHV2URO4do5OCLBkuL2IYQQXqlj6jU4QpXjfWDf7XCAW3MBthjwe5lnLeNZTkcwttQqIOZdCn7Qa/zaG+HJM62tnV9uhLpj4fhaGmf7tapdUWJ5cuUUGLA3MNmSqsZ3ohF5wGlKsGwFVOb6UhoB9szmA9p7zQGpw= - file: build/DiscordBridge-*.jar + file: build/DiscourseWhitelist-*.jar file_glob: true on: - repo: the-obsidian/DiscordBridge + repo: the-obsidian/DiscourseWhitelist tags: true diff --git a/src/main/kotlin/gg/obsidian/discoursewhitelist/Plugin.kt b/src/main/kotlin/gg/obsidian/discoursewhitelist/Plugin.kt index 30bc7f6..2cfc602 100644 --- a/src/main/kotlin/gg/obsidian/discoursewhitelist/Plugin.kt +++ b/src/main/kotlin/gg/obsidian/discoursewhitelist/Plugin.kt @@ -2,6 +2,7 @@ package gg.obsidian.discoursewhitelist import okhttp3.OkHttpClient import okhttp3.Request +import org.bukkit.ChatColor import org.bukkit.event.EventHandler import org.bukkit.event.Listener import org.bukkit.event.player.PlayerLoginEvent @@ -21,7 +22,7 @@ class Plugin : JavaPlugin(), Listener { server.pluginManager.registerEvents(this, this) - getCommand("discord").executor = CommandHandler(this) + getCommand("discoursewhitelist").executor = CommandHandler(this) } fun reload() { @@ -36,7 +37,8 @@ class Plugin : JavaPlugin(), Listener { if (configuration.GROUP_ID != 0) { val discourdGroups = getDiscordGroupIds(e.player.name) if (!discourdGroups.contains(configuration.GROUP_ID)) { - e.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, configuration.MESSAGE) + val message = ChatColor.translateAlternateColorCodes('&', configuration.MESSAGE) + e.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, message) } } } @@ -63,11 +65,11 @@ class Plugin : JavaPlugin(), Listener { val bodyString = response.body().string() val body = JSONValue.parse(bodyString) as JSONObject val user = body["user"] as JSONObject - val customGroups = user["custom_groups"] as JSONArray + val groups = user["groups"] as JSONArray val discourseGroups = HashSet() - for (g in customGroups) { + for (g in groups) { val group = g as JSONObject val id = group.get("id") as Long discourseGroups.add(id.toInt())