A common question amongst Minecraft server administrators is whether WorldGuard, or a similar protection plugin, will work on modded platforms such as Forge or Fabric. If you look around or go searching for alternatives, you’ll quickly find that very few exist and the ones that do are very limited in features. While server plugin frameworks such as Paper or Spigot have many options available, this isn’t the case for modded platforms. Due to the way modded platforms like Forge and Fabric work compared to ones like Paper and Spigot, it’s nearly impossible for a protection mod to provide the same level of compatibility and functionality. In this article I’ll explain why, and what would have to change to make it possible.
To understand why WorldGuard won’t work on Forge, we need to first cover why it can work on Paper, or the Bukkit API which Paper is built on.
Bukkit provides a layer that allows plugins to work without ever directly interfacing with Minecraft. It does this by providing “events” that get forwarded to plugins whenever different actions occur. As plugins can’t easily bypass Bukkit to interface with the game, it provides an extremely large number of events to allow plugins to listen to almost any action in the game. Plugins can then cancel these events to prevent them occurring in game, which is what protection plugins like WorldGuard do. If an action that isn’t allowed in that area happens, WorldGuard will cancel the event that Bukkit fires for that action. For most actions caused by plugins, Bukkit will still send events, and in other cases plugin developers generally call events when necessary.
Forge and Fabric on the other hand, provide full access to directly interface and modify the code of the game. They do provide a limited number of events, but these are generally to reduce mod conflicts rather than allowing mods to not directly interface with the game code. As the events are mostly to reduce conflicts, mods are less likely to actually call the events when they perform relevant actions. Due to the small number of events and less likelihood of mods calling events, any protection mod would require every single other mod to respect protections.
For protections that aren’t covered by the basic events provided by Forge, which covers a majority of the non-building flags, it becomes an even messier situation. A protection mod would need to add its own events to cover these situations, which increases chances of mod conflicts while also substantially increasing the burden on other mod developers to support protection plugins. This would mean every single mod author would not only have to correctly fire Forge events, but also fire the events of every protection plugin too. While this might work okay with one single popular protection plugin, the second multiple are introduced it would create fragmentation in which mods support which protections.
Without substantial changes to the culture around mod development, this can’t easily be solved. Most other methods to solve this problem aren’t feasible, such as adding a similar level of event coverage to Forge/Fabric as Bukkit has. The simplest way would be for all mod developers to choose a single protection mod (or protection mod API for protection mods to build on top of), and add in support within their mods. This still wouldn’t be 100% perfect due to it being easier for bugs to slip in with the deeper levels of control that Forge provides, but a cultural shift towards allowing protection mods would be necessary. This could even be normalized within tutorials for beginner modders, to get the idea of protection plugin support ingrained from the very start.
The easiest way to solve this problem would be for an “official” or “officially recommended” API for both Forge and Fabric that allows consolidation of protection systems within the game. Protection plugins would implement their checks on top of this framework, and mods would check with that framework whether actions are allowed. Due to the complexity of protection systems however, this would have some drawbacks in limiting the capabilities of the various different systems. Despite this, it would vastly improve the situation from what it is currently. This would also be a vast undertaking, making it unlikely that these platforms could dedicate time to it. It’d be much more likely a community project would become officially recommended and the de facto standard, akin to the Vault project on Bukkit-based platforms that handles interoperability of numerous systems.
Overall, the current state of the Forge ecosystem and modding to a wider degree makes it difficult for these kinds of platforms to support protection systems like WorldGuard. While it’s possible to implement the basics with the Forge and Fabric APIs, the raw power that mods can make use of when modifying the game means it’s vastly easier for them to accidentally bypass protections. While an officially recommended protections API for interoperability could work, it’d be a vast undertaking and would still not provide the same level of power as platforms such as Paper.