feat: hook into land claim commands via CommandHook
This commit is contained in:
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user