@@ -2,6 +2,7 @@ package gg.obsidian.discoursewhitelist
2
2
3
3
import okhttp3.OkHttpClient
4
4
import okhttp3.Request
5
+ import org.bukkit.ChatColor
5
6
import org.bukkit.event.EventHandler
6
7
import org.bukkit.event.Listener
7
8
import org.bukkit.event.player.PlayerLoginEvent
@@ -21,7 +22,7 @@ class Plugin : JavaPlugin(), Listener {
21
22
22
23
23
24
server.pluginManager.registerEvents(this , this )
24
- getCommand(" discord " ).executor = CommandHandler (this )
25
+ getCommand(" discoursewhitelist " ).executor = CommandHandler (this )
25
26
}
26
27
27
28
fun reload () {
@@ -36,7 +37,8 @@ class Plugin : JavaPlugin(), Listener {
36
37
if (configuration.GROUP_ID != 0 ) {
37
38
val discourdGroups = getDiscordGroupIds(e.player.name)
38
39
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)
40
42
}
41
43
}
42
44
}
@@ -63,11 +65,11 @@ class Plugin : JavaPlugin(), Listener {
63
65
val bodyString = response.body().string()
64
66
val body = JSONValue .parse(bodyString) as JSONObject
65
67
val user = body[" user" ] as JSONObject
66
- val customGroups = user[" custom_groups " ] as JSONArray
68
+ val groups = user[" groups " ] as JSONArray
67
69
68
70
val discourseGroups = HashSet <Int >()
69
71
70
- for (g in customGroups ) {
72
+ for (g in groups ) {
71
73
val group = g as JSONObject
72
74
val id = group.get(" id" ) as Long
73
75
discourseGroups.add(id.toInt())
0 commit comments