From 93fe059754dfc49649f70131c78360b4e3d14d3f Mon Sep 17 00:00:00 2001 From: anth64 Date: Tue, 2 Jun 2026 23:24:55 +0200 Subject: [PATCH] feat: add registration dictionary and Register method --- CommandHook/CommandHookModSystem.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/CommandHook/CommandHookModSystem.cs b/CommandHook/CommandHookModSystem.cs index 191d800..c153a8e 100644 --- a/CommandHook/CommandHookModSystem.cs +++ b/CommandHook/CommandHookModSystem.cs @@ -1,14 +1,27 @@ -using Vintagestory.API.Server; +using System.Collections.Generic; using Vintagestory.API.Common; +using Vintagestory.API.Server; namespace CommandHook; public class CommandHookModSystem : ModSystem { + private readonly Dictionary> _registrations = new(); + public override bool ShouldLoad(EnumAppSide forSide) => forSide == EnumAppSide.Server; public override void StartServerSide(ICoreServerAPI api) { Mod.Logger.Notification("[CommandHook] Loaded"); } + + public void Register(string modId, CommandRegistration registration) + { + if (!_registrations.TryGetValue(modId, out var list)) + { + list = new List(); + _registrations[modId] = list; + } + list.Add(registration); + } }