anth64 Posted Sunday at 05:23 PM Report Posted Sunday at 05:23 PM (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 Sunday at 05:33 PM by anth64
anth64 Posted 1 hour ago Author Report Posted 1 hour ago 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.
Recommended Posts