Skip to content

Motivation

Brian edited this page Oct 23, 2021 · 7 revisions

Protection plugins, such as WorldGuard and PlotSquared, restrict certain actions to only players with sufficient permission. These restricted actions usually include interacting with blocks, placing blocks, breaking blocks, and so on.

Normally, when a plugin prevents an event from occurring, it cancels the event. Then, other plugins can choose to ignore cancelled events, thereby allowing them to respect restricted actions without caring which plugin is preventing them or why.

However, many protection plugins do not catch all possible events that a player can trigger. Worse, commands that modify potentially-restricted blocks must directly interface with the protection plugin. This forces other plugins to either become incompatible with that plugin or use the plugin's API to check building restrictions.

Since there are so many popular protection plugins out there, each with their own API, it became incredibly tedious to program for each one across all of my plugins, and so RestrictionHelper was born.

RestrictionHelper aims to be a bridge between the protection plugins and other plugins. It provides an easy-to-use API to check whether a player should be able to perform an action according to all the protection plugins enabled on the server. Rather than muddying your plugin's code with tons of API checks for other plugins, simply get an instance of RestrictionHelper, register the appropriate restrictions, and check when needed.

Clone this wiki locally