From 24c7f0e155758b1bbb04d15fa03136698f5d7d64 Mon Sep 17 00:00:00 2001 From: memetrollsXD Date: Sat, 24 Sep 2022 11:20:53 +0200 Subject: [PATCH] Implement kickall command --- src/commands/kickall.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/commands/kickall.ts diff --git a/src/commands/kickall.ts b/src/commands/kickall.ts new file mode 100644 index 0000000..4be2536 --- /dev/null +++ b/src/commands/kickall.ts @@ -0,0 +1,14 @@ +import SRServer from "../server/kcp/SRServer"; +import Logger from "../util/Logger"; +import { Command } from "./Interface"; +const c = new Logger("/kickall", "blue"); + +export default async function handle(command: Command) { + const hard = command.args[0]; + + for (const [key, session] of SRServer.getInstance().sessions) { + session.kick(!!hard); + } + + c.log(`Kicked all players. Hard kick: ${!!hard}`); +} \ No newline at end of file