-
-
Notifications
You must be signed in to change notification settings - Fork 1
Motivation
(aka why this thing exists)
Many plugins, such as WorldGuard and PlotSquared, restrict certain actions to only players with sufficient permissions.
These restricted actions usually include things like interacting with blocks, placing blocks, breaking blocks, and so
on. Normally, when a plugin prevents a Bukkit event from occurring, it cancels the event
using Event#setCancelled(true). Then, other plugins can choose to ignore events which have been cancelled, thereby
allowing them to respect restricted actions without caring which plugin is preventing which action.
For whatever reason, many popular protection plugins nowadays are choosing to forego cancelling events, which forces other plugins to either become incompatible with that plugin or use the plugin's proprietary API to check building restrictions. The latter is what I chose to do in my own plugins. However, 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, out of frustration, RestrictionHelper was born.
This small dependency aims to make it easier 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 them when needed.