From 795f0fa59524cde2248b0d578d5f944b676d85a7 Mon Sep 17 00:00:00 2001 From: Gureumi Date: Fri, 12 Apr 2024 17:58:21 +0900 Subject: [PATCH] Fix unban in-game command --- src/main/kotlin/essentials/Commands.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/kotlin/essentials/Commands.kt b/src/main/kotlin/essentials/Commands.kt index b27a749a..cc71fa98 100644 --- a/src/main/kotlin/essentials/Commands.kt +++ b/src/main/kotlin/essentials/Commands.kt @@ -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() } }