From 28a89056e6f391224d28c13b84fce30d864fb99e Mon Sep 17 00:00:00 2001 From: anth64 Date: Wed, 1 Jul 2026 20:04:00 +0200 Subject: [PATCH] feat: add admin management surface --- ClaimLink/ClaimLinkChatCommand.cs | 48 +++++++++++++++++++++++++++++-- ClaimLink/modinfo.json | 2 +- 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/ClaimLink/ClaimLinkChatCommand.cs b/ClaimLink/ClaimLinkChatCommand.cs index bfc1d2b..b7678d2 100644 --- a/ClaimLink/ClaimLinkChatCommand.cs +++ b/ClaimLink/ClaimLinkChatCommand.cs @@ -12,59 +12,103 @@ public static class ClaimLinkChatCommand var root = api.ChatCommands.Create("claimlink") .WithAlias("clink") .WithDescription("Link vanilla land claims into shared, derived protective territory.") - .RequiresPrivilege(Privilege.chat) - .RequiresPlayer(); + .RequiresPrivilege(Privilege.chat); root.BeginSubCommands("new", "n") .WithDescription("Promote a group you own into a claim link (enters pending state).") .WithArgs(p.Word("groupname")) + .RequiresPlayer() .HandleWith(_ => TextCommandResult.Success("stub: claimlink new")) .EndSubCommand(); root.BeginSubCommands("link", "l") .WithDescription("Link a claim you own into the pending or committed claim link.") .WithArgs(p.Word("claim")) + .RequiresPlayer() .HandleWith(_ => TextCommandResult.Success("stub: claimlink link")) .EndSubCommand(); root.BeginSubCommands("confirm", "c") .WithDescription("Commit your pending claim link.") + .RequiresPlayer() .HandleWith(_ => TextCommandResult.Success("stub: claimlink confirm")) .EndSubCommand(); root.BeginSubCommand("cancel") .WithDescription("Discard your pending claim link.") + .RequiresPlayer() .HandleWith(_ => TextCommandResult.Success("stub: claimlink cancel")) .EndSubCommand(); root.BeginSubCommands("unlink", "ul") .WithDescription("Remove a claim you own from its claim link.") .WithArgs(p.Word("claim")) + .RequiresPlayer() .HandleWith(_ => TextCommandResult.Success("stub: claimlink unlink")) .EndSubCommand(); root.BeginSubCommand("kick") .WithDescription("Force-unlink another player's claim from the link (Owner/Op).") .WithArgs(p.OnlinePlayer("playername"), p.Word("claim")) + .RequiresPlayer() .HandleWith(_ => TextCommandResult.Success("stub: claimlink kick")) .EndSubCommand(); root.BeginSubCommand("delete") .WithDescription("Delete the claim link entirely (Owner).") .WithArgs(p.Word("groupname")) + .RequiresPlayer() .HandleWith(_ => TextCommandResult.Success("stub: claimlink delete")) .EndSubCommand(); root.BeginSubCommands("transferownership", "transfer", "to") .WithDescription("Transfer ownership of the claim link to another player (Owner).") .WithArgs(p.Word("groupname"), p.OnlinePlayer("playername")) + .RequiresPlayer() .HandleWith(_ => TextCommandResult.Success("stub: claimlink transferownership")) .EndSubCommand(); root.BeginSubCommands("info", "i") .WithDescription("Show a claim link's linked claims, members, and territory (Owner/Op or admin).") .WithArgs(p.Word("groupname")) + .RequiresPlayer() .HandleWith(_ => TextCommandResult.Success("stub: claimlink info")) .EndSubCommand(); + + var admin = root.BeginSubCommand("admin") + .WithDescription("Admin management for any claim link (op or console).") + .RequiresPrivilege(Privilege.controlserver); + + admin.BeginSubCommands("delete", "del") + .WithDescription("Delete any claim link entirely (claims and group untouched).") + .WithArgs(p.Word("groupname")) + .HandleWith(_ => TextCommandResult.Success("stub: claimlink admin delete")) + .EndSubCommand(); + + admin.BeginSubCommand("unlink") + .WithDescription("Force a single claim out of its link by player and claim (claim untouched).") + .WithArgs(p.OnlinePlayer("playername"), p.Word("claim")) + .HandleWith(_ => TextCommandResult.Success("stub: claimlink admin unlink")) + .EndSubCommand(); + + admin.BeginSubCommand("kick") + .WithDescription("Force-unlink all of a player's claims from a link (claims untouched).") + .WithArgs(p.Word("groupname"), p.OnlinePlayer("playername")) + .HandleWith(_ => TextCommandResult.Success("stub: claimlink admin kick")) + .EndSubCommand(); + + admin.BeginSubCommands("transferownership", "transfer", "to") + .WithDescription("Transfer ownership of any claim link to another player.") + .WithArgs(p.Word("groupname"), p.OnlinePlayer("playername")) + .HandleWith(_ => TextCommandResult.Success("stub: claimlink admin transferownership")) + .EndSubCommand(); + + admin.BeginSubCommands("info", "i") + .WithDescription("Show any claim link's linked claims, members, and territory.") + .WithArgs(p.Word("groupname")) + .HandleWith(_ => TextCommandResult.Success("stub: claimlink admin info")) + .EndSubCommand(); + + admin.EndSubCommand(); } } diff --git a/ClaimLink/modinfo.json b/ClaimLink/modinfo.json index 1964e1b..8a9138b 100644 --- a/ClaimLink/modinfo.json +++ b/ClaimLink/modinfo.json @@ -8,7 +8,7 @@ "anth64" ], "description": "Link claims together with groups.", - "version": "0.0.1", + "version": "0.0.2", "dependencies": { "game": "1.22.3", "commandhook": "2.1.0"