sk89q/worldguard — pull request #284 by AgentME (2013-10-04 07:01:32+00:00)
Title: Alert a user whenever they take advantage of their bypass permission

Alert a user whenever they're allowed to do an action because of their worldguard.region.bypass. permission.
Allows staff to realize when they may be unknowingly intruding into a protected region and to avoid awkward situations.

This pull request is sort of proof-of-concept quality admittedly.
I added some overload forms of the hasBypass method on GlobalRegionManager so an ApplicableRegionSet could be passed too, and an optional silent flag which causes no warning to be shown. The hasBypass method does the alert itself, and names the first region in the ApplicableRegionSet if there is one given.

The hasBypass method used to be called before any permissions checks were done, so I re-ordered all of the calls to it to be after the permissions checks so that the alert would only be shown only if the other permissions checks failed.
Since hasBypass is a public method and other plugins might have used it the same way, I left the old two-parameter forms as always silent.

I think the bypassWarning and bypassWarningString methods I added ought not to be inside GlobalRegionManager, but I wasn't yet sure where to put them. This behavior probably should be optional via a config setting. Some single actions in regions with certain protections can cause multiple messages at once (ie: opening a chest in a region where chest-access and use are both denied). Doing a lot of actions in a region can cause bypass warnings to quickly fill the screen, so I think a good solution to both of these problems would be to not display the warning if one had already been displayed within the last 5 seconds or so.