feat: add region lifecycle events (add, delete, redefine, flag, membe… - #2299
Open
1wairesd wants to merge 1 commit into
Open
feat: add region lifecycle events (add, delete, redefine, flag, membe…#22991wairesd wants to merge 1 commit into
1wairesd wants to merge 1 commit into
Conversation
…r, priority) Add six cancellable Bukkit events that fire before key region operations, allowing third-party plugins to intercept and cancel them cleanly without resorting to reflection hacks or command interception. New events in worldguard-bukkit/.../event/region/: - RegionAddEvent - fired before /rg define - RegionDeleteEvent - fired before /rg remove - RegionRedefineEvent - fired before /rg redefine - RegionFlagChangeEvent - fired before /rg flag (set or clear) - RegionMemberChangeEvent - fired before addmember/addowner/removemember/removeowner (async) - RegionPriorityChangeEvent - fired before /rg setpriority All events carry: - World - the world the region belongs to - ProtectedRegion - the affected region - CommandSender (nullable) - the actor who triggered the operation, or null for API calls - setCancelled(true) - cancels the operation - setCancelMessage(String) - optional custom feedback message Architecture: - Six default methods added to WorldGuardPlatform (return true by default, so no existing platform implementations break) - BukkitWorldGuardPlatform overrides all six, adapts WE World to Bukkit World, fires the event via Bukkit.getPluginManager().callEvent() - RegionCommands wired for define/redefine/remove/flag/setPriority - MemberCommands wired for addMember/addOwner/removeMember/removeOwner; success message is only sent when the event is not cancelled This eliminates the need for plugins to use reflection into RegionManager internals or intercept raw commands in order to protect regions from deletion.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…r, priority)
Add six cancellable Bukkit events that fire before key region operations, allowing third-party plugins to intercept and cancel them cleanly without resorting to reflection hacks or command interception.
New events in worldguard-bukkit/.../event/region/:
All events carry:
Architecture:
This eliminates the need for plugins to use reflection into RegionManager internals or intercept raw commands in order to protect regions from deletion.