Jump to content

Recommended Posts

Posted (edited)

First post here, and first mod, so go easy on me.

I wanted to build some mods for my server that would need to listen for commands, and quickly ran into the problem of not being able to do that easily without repeating the same patching logic every time I needed it in a new mod. So I built a small mod/library/api/whatever you want to call it, so anyone else running into the same issue can just use it instead.

So now we have CommandHook. A mod can ask to be notified before a chat command runs, after it runs, or both, and can stop the command from running if it needs to. Multiple mods can do this on the same command without stepping on each other. 

Repo, full usage docs, and a code example: https://git.forlornoutpost.ca/anth64/CommandHook

ModDB page: https://mods.vintagestory.at/show/mod/56633

I  am happy to answer questions or hear feedback, this being a first mod and all.

Edited by anth64
Posted

Just released the 2.0.0 version, I think I refined it quite a bit.

Mostly internal, big rework of how listeners get command data. Before/After
now take the engine's own TextCommandCallingArgs directly instead of a
wrapper I'd built, and cancelling a command actually lets you report a real
result back to the caller instead of just going silent.

It's a breaking change if you're already building on CommandHook... my apolgies, but it had to be done.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.