Skip to content

Commit

Permalink
Fix unban in-game command
Browse files Browse the repository at this point in the history
  • Loading branch information
Kieaer committed Apr 12, 2024
1 parent 34dda17 commit 795f0fa
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main/kotlin/essentials/Commands.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2288,14 +2288,24 @@ class Commands(var handler: CommandHandler, isClient: Boolean) {
return
}

fun removeJson() {
val json = JsonArray.readHjson(Fi(Config.banList).readString()).asArray()
json.removeAll { js ->
js.asObject().get("ip").asArray().contains(JsonValue.valueOf(arg[0])) || js.asObject().get("id").asString() == arg[0]
}
Fi(Config.banList).writeString(json.toString(Stringify.HJSON))
}

if (!netServer.admins.unbanPlayerID(arg[0])) {
if (!netServer.admins.unbanPlayerIP(arg[0])) {
err("player.not.found")
} else {
send("command.unban.ip", arg[0])
removeJson()
}
} else {
send("command.unban.id", arg[0])
removeJson()
}
}

Expand Down

0 comments on commit 795f0fa

Please # to comment.