Skip to content

Commit a096a78

Browse files
Fix bugs, enable releases
1 parent 7ec719d commit a096a78

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ deploy:
99
provider: releases
1010
api_key:
1111
secure: KJd23J+YlpBuUs+5//5BjYlSQ9mVOsYnpfanE03ZQ4E9Qp+pGpMSaH60d/CXkSkDVr32QL5jk0VRDNVl0wvTZpRJfNclQgh3fh2iPkaBDmjun0YkGHfE6VeRzJZVuIF/F34pkziEC01B7Tq2loms+RSm9pNeWgN+ulaajNENUT2J4nmb33yyKbGN9I4EdjcMCQmgdnxn/4QNXV6T3Xls9S9X7AwA9pg4WNpdACqJ0oWj2YlSWKmAdcKw0iLQtRbQfbiqj6waOLODdxieIu0KVWEVQnTdcv7ElGl9BgDrHzXBjfS+9G112TBqsNIPx60o8Z7ThR02DYPWYXrRyfvaHM0FqXrBSaUZUxfHpGn5F4CRQLZh/jOnIOZ9hHmCSDD69pcS254tVCoB+hRuS7PBstuh8iUO7VGJASb5Mv34LZYLAxfvNDAKLeY60xdz/Uiku9JW0dpLQC+FWAvFZWdQ3IvCMYRnaT1fmjDJKanYvCw31l5ypACjfhIQfnwG7FKeLdh6BJx9CG/eHV2URO4do5OCLBkuL2IYQQXqlj6jU4QpXjfWDf7XCAW3MBthjwe5lnLeNZTkcwttQqIOZdCn7Qa/zaG+HJM62tnV9uhLpj4fhaGmf7tapdUWJ5cuUUGLA3MNmSqsZ3ohF5wGlKsGwFVOb6UhoB9szmA9p7zQGpw=
12-
file: build/DiscordBridge-*.jar
12+
file: build/DiscourseWhitelist-*.jar
1313
file_glob: true
1414
on:
15-
repo: the-obsidian/DiscordBridge
15+
repo: the-obsidian/DiscourseWhitelist
1616
tags: true

src/main/kotlin/gg/obsidian/discoursewhitelist/Plugin.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package gg.obsidian.discoursewhitelist
22

33
import okhttp3.OkHttpClient
44
import okhttp3.Request
5+
import org.bukkit.ChatColor
56
import org.bukkit.event.EventHandler
67
import org.bukkit.event.Listener
78
import org.bukkit.event.player.PlayerLoginEvent
@@ -21,7 +22,7 @@ class Plugin : JavaPlugin(), Listener {
2122

2223

2324
server.pluginManager.registerEvents(this, this)
24-
getCommand("discord").executor = CommandHandler(this)
25+
getCommand("discoursewhitelist").executor = CommandHandler(this)
2526
}
2627

2728
fun reload() {
@@ -36,7 +37,8 @@ class Plugin : JavaPlugin(), Listener {
3637
if (configuration.GROUP_ID != 0) {
3738
val discourdGroups = getDiscordGroupIds(e.player.name)
3839
if (!discourdGroups.contains(configuration.GROUP_ID)) {
39-
e.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, configuration.MESSAGE)
40+
val message = ChatColor.translateAlternateColorCodes('&', configuration.MESSAGE)
41+
e.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, message)
4042
}
4143
}
4244
}
@@ -63,11 +65,11 @@ class Plugin : JavaPlugin(), Listener {
6365
val bodyString = response.body().string()
6466
val body = JSONValue.parse(bodyString) as JSONObject
6567
val user = body["user"] as JSONObject
66-
val customGroups = user["custom_groups"] as JSONArray
68+
val groups = user["groups"] as JSONArray
6769

6870
val discourseGroups = HashSet<Int>()
6971

70-
for (g in customGroups) {
72+
for (g in groups) {
7173
val group = g as JSONObject
7274
val id = group.get("id") as Long
7375
discourseGroups.add(id.toInt())

0 commit comments

Comments
 (0)