feat: implement claimlink delete
This commit is contained in:
@@ -291,7 +291,30 @@ public static class ClaimLinkChatCommand
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TextCommandResult Delete(TextCommandCallingArgs args) => TextCommandResult.Success("stub: claimlink delete");
|
public static TextCommandResult Delete(TextCommandCallingArgs args)
|
||||||
|
{
|
||||||
|
string groupName = (string)args[0];
|
||||||
|
string playerUid = args.Caller.Player.PlayerUID;
|
||||||
|
|
||||||
|
TextCommandResult? err = TryResolveGroup(groupName, out PlayerGroup group);
|
||||||
|
if (err != null) return err;
|
||||||
|
|
||||||
|
err = TryResolveClaimLink(group, out ClaimLink link);
|
||||||
|
if (err != null) return err;
|
||||||
|
|
||||||
|
err = RequireOwner(args.Caller.Player, group);
|
||||||
|
if (err != null) return err;
|
||||||
|
|
||||||
|
int groupId = group.Uid;
|
||||||
|
return Stage(playerUid, $"'{groupName}' will be deleted as a claim link.", () =>
|
||||||
|
{
|
||||||
|
foreach (ClaimLinkMember member in link.Members)
|
||||||
|
RemovePending(member.OwnerPlayerUid);
|
||||||
|
|
||||||
|
ClaimLinkModSystem.Registry.Remove(groupId);
|
||||||
|
return TextCommandResult.Success($"'{groupName}' is no longer a claim link.");
|
||||||
|
});
|
||||||
|
}
|
||||||
public static TextCommandResult TransferOwnership(TextCommandCallingArgs args) => TextCommandResult.Success("stub: claimlink transferownership");
|
public static TextCommandResult TransferOwnership(TextCommandCallingArgs args) => TextCommandResult.Success("stub: claimlink transferownership");
|
||||||
|
|
||||||
public static TextCommandResult Info(TextCommandCallingArgs args)
|
public static TextCommandResult Info(TextCommandCallingArgs args)
|
||||||
|
|||||||
Reference in New Issue
Block a user