commands/ward-admin.ts
587 B · sha256:431b61b75870f36789fe0707babb3953408af39123ce2ffcbb79c682d91e0ed3
import { err, requirePerm } from "../lib/format";
import { PERM } from "./ward";
import { openAdminMenu } from "../menus/index";
function isPlayer(sender: CommandSender): sender is Player {
return typeof (sender as Player).openInventory === "function";
}
@Command("ward admin", {
description: "Open the Ward admin GUI",
})
export class WardAdmin {
@Run
run(ctx: CommandCtx) {
if (!requirePerm(ctx, PERM.admin)) return;
if (!isPlayer(ctx.sender)) {
err(ctx.sender, "Only players can open the admin GUI.");
return;
}
openAdminMenu(ctx.sender);
}
}