feat: hook into land claim commands via CommandHook

This commit is contained in:
2026-06-29 07:31:51 +02:00
parent a46c0ea8a8
commit ba9d4d992b
2 changed files with 45 additions and 1 deletions
+21 -1
View File
@@ -1,7 +1,27 @@
using Vintagestory.API.Common; using CommandHook;
using Vintagestory.API.Common;
using Vintagestory.API.Server;
namespace ClaimLink; namespace ClaimLink;
public class ClaimLinkModSystem : ModSystem public class ClaimLinkModSystem : ModSystem
{ {
internal ClaimLinkCommandListener? cmdListener;
public override bool ShouldLoad(EnumAppSide forSide) => forSide == EnumAppSide.Server;
public override void StartServerSide(ICoreServerAPI api)
{
cmdListener = new ClaimLinkCommandListener();
CommandHookModSystem.Register(cmdListener);
}
public override void Dispose()
{
if (cmdListener == null)
return;
CommandHookModSystem.Unregister(cmdListener);
}
} }
+24
View File
@@ -0,0 +1,24 @@
using Vintagestory.API.Common;
using System.Collections.Generic;
using CommandHook;
namespace ClaimLink;
public class ClaimLinkCommandListener : ICommandHookListener
{
public string ModId => "claimlink";
public IReadOnlyList<string> Commands => new[] { "land" };
public CommandRegistration Registration => new(Before, After);
private TextCommandResult? Before(TextCommandCallingArgs args)
{
return null;
}
private void After(TextCommandCallingArgs args, TextCommandResult result)
{
}
}