GStefanowich / MC-Server-Protection

A (Minecraft) Fabric server administration mod
MIT License
27 stars 14 forks source link

Commands still available after being disabled in the config #65

Open Anthony-Mariotti opened 2 years ago

Anthony-Mariotti commented 2 years ago

I'm currently using another mod to implement a warping and home system, and when I disabled warping in the configuration, the commands still were enabled for the server. This is causing a conflict with the commands that are registered for the other mod.

I would expect that when a feature is disabled in the configuration, the commands are no longer registered on the server so that they do not conflict with other items or display in the suggested commands.

GStefanowich commented 2 years ago

The /home command, along with some others become disabled and aren't sent to the client if the commands.warp_tpa setting is disabled.

However, yes, they are still registered on the server. This is only because of support for hot-reloading the config rather than having to restart the server for making changes to the config.

There is no way to unregister a command once it has been registered, so all mod commands become registered and then disable when not enabled.

Anthony-Mariotti commented 2 years ago

Ah, the support for hot-reloading. I know that it is possible to unregister commands at runtime, but I believe it is unstable. Would it be possible to have the hot-reload plus the combination of needing a reboot if a player changed something that would require a reboot?

"Config has been reloaded, but a change was made that will apply after a server reboot" something like that?

Most of the rebooting would require if an entire module was disabled during runtime, say money, warps, fun commands, nick commands, etc. Changing properties and settings within those groups wouldn't require a reboot as those are just data-driven values, if possible