Skip to content

Commit

Permalink
Fix permission level
Browse files Browse the repository at this point in the history
  • Loading branch information
Kieaer committed Jun 14, 2021
1 parent f7e3ad5 commit 17b42fc
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/main/kotlin/korea/command/ClientCommandThread.kt
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ class ClientCommandThread(private val type: Command, private val arg: Array<Stri
val target = Groups.player.find { e -> e.name.equals(arg[1], true) }
if(target != null) {
sendMessage("${player.name()} 에 의해 ${target.name()} 에 대한 강퇴 투표가 시작 되었습니다.")
if(target.admin() || playerData.find{e -> e.uuid == target.uuid()}.permission.equals("owner", true)){
val t = playerData.find{e -> e.uuid == target.uuid()}.permission
if(target.admin() || t.equals("owner", true) || t.equals("admin", true)){
sendMessage("하지만 ${target.name()} 유저는 서버 관리자입니다.\n이걸 노리고 투표를 시작한 ${player.name()} 유저는 제정신이 아닌 것 같군요.\n잠시 나갔다 오세요.")
kick(player, "관리자를 대상으로 투표하는 행위는 금지되어 있습니다. 3분간 강퇴 처리.")
} else {
Expand Down Expand Up @@ -595,7 +596,8 @@ class ClientCommandThread(private val type: Command, private val arg: Array<Stri
Groups.player.find { e -> e.name.contains(arg[1]) }
}
if(other != null) {
if (playerData.find{e -> e.uuid == other.uuid()}.permission.equals("owner", true)){
val t = playerData.find{e -> e.uuid == other.uuid()}.permission
if (t.equals("owner", true) || t.equals("admin", true)){
sendMessage["권한이 없습니다."]
} else {
setPosition(target, other.x, other.y)
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/korea/command/ServerCommandThread.kt
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class ServerCommandThread(private val type: ServerCommand.Command, private val a
"t" -> {
Core.app.post{
val message = "[scarlet][[서버]:[] " + arg[1]
Call.infoToast(message, 1f)
Call.infoToast(message, 16f)
}
}
else -> {
Expand Down
5 changes: 4 additions & 1 deletion src/main/kotlin/korea/data/auth/Discord.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,17 @@ import mindustry.game.EventType
import org.hjson.JsonObject
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
import kotlin.system.exitProcess

object Discord {
val pin: JsonObject = JsonObject()
lateinit var catnip: Catnip

init {
if(Config.discordBotToken.isNotEmpty()) {
if(Config.discordBotToken.isNotEmpty() && Config.discordChannelToken.isNotEmpty()) {
catnip = Catnip.catnip(Config.discordBotToken)
} else {
exitProcess(0)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/korea/event/EventThread.kt
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class EventThread(private val type: EventTypes, private val event: Any) {

if(data != null) {
if(PluginData.voting.size == 1)
if(data.permission == "owner") {
if(data.permission.equals("owner", true)) {
if(e.message.equals("y")) {
sendMessage("[sky]서버 운영자[]가 투표를 바로 [green]통과[] 시켰습니다.")
PluginData.voting.first().passed(false)
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"author": "Kieaer",
"main": "korea.Main",
"description": "KR-Plugin",
"version": 1
"version": 2
}

0 comments on commit 17b42fc

Please sign in to comment.