feat: implement claimlink new
This commit is contained in:
@@ -113,7 +113,23 @@ public static class ClaimLinkChatCommand
|
|||||||
admin.EndSubCommand();
|
admin.EndSubCommand();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TextCommandResult New(TextCommandCallingArgs args) => TextCommandResult.Success("stub: claimlinknew");
|
public static TextCommandResult New(TextCommandCallingArgs args)
|
||||||
|
{
|
||||||
|
string groupName = (string)args[0];
|
||||||
|
|
||||||
|
PlayerGroup? group = ClaimLinkModSystem.Groups.GetPlayerGroupByName(groupName);
|
||||||
|
if (group == null)
|
||||||
|
return TextCommandResult.Error($"No group named '{groupName}' exists.");
|
||||||
|
|
||||||
|
if (group.OwnerUID != args.Caller.Player.PlayerUID)
|
||||||
|
return TextCommandResult.Error($"You do not own the group '{groupName}'.");
|
||||||
|
|
||||||
|
if (ClaimLinkModSystem.Registry.Get(group.Uid) != null)
|
||||||
|
return TextCommandResult.Error($"'{groupName}' is already a claim link.");
|
||||||
|
|
||||||
|
ClaimLinkModSystem.Registry.Add(new ClaimLink { GroupId = group.Uid });
|
||||||
|
return TextCommandResult.Success($"'{groupName}' is now a claim link.");
|
||||||
|
}
|
||||||
public static TextCommandResult Link(TextCommandCallingArgs args) => TextCommandResult.Success("stub: claimlink link");
|
public static TextCommandResult Link(TextCommandCallingArgs args) => TextCommandResult.Success("stub: claimlink link");
|
||||||
public static TextCommandResult Confirm(TextCommandCallingArgs args) => TextCommandResult.Success("stub: claimlink confirm");
|
public static TextCommandResult Confirm(TextCommandCallingArgs args) => TextCommandResult.Success("stub: claimlink confirm");
|
||||||
public static TextCommandResult Cancel(TextCommandCallingArgs args) => TextCommandResult.Success("stub: claimlink cancel");
|
public static TextCommandResult Cancel(TextCommandCallingArgs args) => TextCommandResult.Success("stub: claimlink cancel");
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ public class ClaimLinkModSystem : ModSystem
|
|||||||
internal static ILandClaimAPI LandClaimAPI = null!;
|
internal static ILandClaimAPI LandClaimAPI = null!;
|
||||||
internal static ILogger Logger = null!;
|
internal static ILogger Logger = null!;
|
||||||
internal static ClaimLinkRegistry Registry = null!;
|
internal static ClaimLinkRegistry Registry = null!;
|
||||||
|
internal static IGroupManager Groups = null!;
|
||||||
internal ClaimLinkCommandListener? cmdListener;
|
internal ClaimLinkCommandListener? cmdListener;
|
||||||
|
|
||||||
public override bool ShouldLoad(EnumAppSide forSide) => forSide == EnumAppSide.Server;
|
public override bool ShouldLoad(EnumAppSide forSide) => forSide == EnumAppSide.Server;
|
||||||
@@ -18,6 +19,7 @@ public class ClaimLinkModSystem : ModSystem
|
|||||||
LandClaimAPI = api.World.Claims;
|
LandClaimAPI = api.World.Claims;
|
||||||
Logger = api.Logger;
|
Logger = api.Logger;
|
||||||
Registry = new ClaimLinkRegistry(api.WorldManager.SaveGame);
|
Registry = new ClaimLinkRegistry(api.WorldManager.SaveGame);
|
||||||
|
Groups = api.Groups;
|
||||||
|
|
||||||
cmdListener = new ClaimLinkCommandListener();
|
cmdListener = new ClaimLinkCommandListener();
|
||||||
CommandHookModSystem.Register(cmdListener);
|
CommandHookModSystem.Register(cmdListener);
|
||||||
|
|||||||
Reference in New Issue
Block a user