Skip to content

Commit

Permalink
Fix bugs, enable releases
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobwgillespie committed Mar 18, 2016
1 parent 7ec719d commit a096a78
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 6 additions & 4 deletions src/main/kotlin/gg/obsidian/discoursewhitelist/Plugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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() {
Expand All @@ -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)
}
}
}
Expand All @@ -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<Int>()

for (g in customGroups) {
for (g in groups) {
val group = g as JSONObject
val id = group.get("id") as Long
discourseGroups.add(id.toInt())
Expand Down

0 comments on commit a096a78

Please sign in to comment.