WorldGuard Region Events
Description
WorldGuard Region Events allows modders to trigger function if a player enters or leaves a region. It adds four events that you can use to trigger your functions: RegionEnterEvent, RegionEnteredEvent, RegionLeaveEvent and RegionLeftEvent. They can be used just as any other Bukkit event (for more information look here .)
The RegionEnteredEvent and RegionLeftEvent are triggered a short time after a player entered/left a region so you cannot cancel them, but use the to check the flags of the regions the player is in.
The JavaDoc of WGRegionEvents can be found here.
Example
If you don't want to create a plugin ignore this
To send a player a text whenever he enters a region:
import com.mewin.WGRegionEvents.events.RegionEnterEvent; ... @EventHandler public void onRegionEnter(RegionEnterEvent e) { e.getPlayer().sendMessage("You just entered " + e.getRegion().getId()); }
Or to quit players from escaping from jail:
import com.mewin.WGRegionEvents.events.RegionLeaveEvent ... @EventHandler public void onRegionLeave(RegionLeaveEvent e) { if (e.getRegion().getId().equals("jail") && e.isCancellable()) // you cannot cancel the event if the player left the region because he died { e.setCancelled(true); e.getPlayer().sendMessage("You cannot leave the jail!"); } }
Please add:
Needed to add it by myself
Anyone interested with an 1.13 version :
https://www.spigotmc.org/resources/worldguard-events.65176/
I noticed this was updated in 2016 is it being continued or do we use SpencerRyanC's "WGRegionEvents-Continued"?
Found this error in 1.13.1 - https://pastebin.com/4sSwMhU2
ATTENTION ATTENTION ATTENTION ATTENTION
I have continued the project on Spigot! https://www.spigotmc.org/resources/wgregionevents-continued.15946/
ATTENTION ATTENTION ATTENTION ATTENTION
@Keyman1986
It breaks it even in the old WG6.0. :(
Could someone recompile this for Spigot 1.8.7 and fix the "enderpearl deny" flag that's been broken since forever? Please!
This plugin is having problems with the new WG 6.1. It allows denied enderpearl flags.
@Peter234
Works for me
Any chance on a 1.8 update?
Uhh, maybe this will be a better way of showing/explaining it.
I have two test Regions defined;
TestParent(Blue with a priority of 5) & a Greeting Flag.
TestChild(Red with a priority of 10) & a Greeting Flag.
I also have added (for debug purposes e.getPlayer().sendMessage("§aYou just entered " + e.getRegion().getId()); (in green)
When walking through the area I get TestParents Greeting + Debug TestParents THEN TestChilds Greeting + Debug TestChild AND FINALLY TestParents Greeting.
The issue is, the region event isn't fired again when entering from the child to the parent which we kind of need for our transitioning tiltes to work.
Any ideas? Ill leave two images below, one of the area and one of the text. Thanks guys!
Test Area: http://i.gyazo.com/cc962da1c61cb944ea6cd3bf2ffa655e.png
Region Text: http://i.gyazo.com/c6eb204612288dc06a72e0a2f8b86deb.png
-Snip- Explained it better above.
http://i.gyazo.com/ffcd2845203b0ab4fe233c8868ad6b39.png
@woutwoot
Thank you very much!
@LaughNgamez
I've made an update (recompile) for this plugin that works with WorldGuard 6 and Bukkit 1.8 You can download development builds of this update at the provided continuous integration server. These builds have not been approved by the BukkitDev staff. Use them at your own risk: WGRegionEvents
Please add support for World Guard 6.0
@liadm97
@der_mewin
You are using WorldGuard 6 aren't you? WorldGuard Region Events 1.2 is not compatible.
@liadm97
Good God. Why can you not just Pastebin your errors? It doesn't take more than 1 click extra, literally! Pastebin.com
I need help; I'm writing a plugin using those events so when you enter region you loose certain permissions (only while in that region)
I was up until 7am reading javadocs; nothing! I use essentials_groupmanager and while in a region I need two Permissions disabled
griefprevention.claims griefprevention.createclaims
Please help, my event's code: http://pastebin.com/7yMJPg1g
Thanks!
@TheDroneWolf
I agree with you, would love to see this plugin integrated or updated :)
@NathanWolf
Btw, you should fork my repository again and edit the current master-branch. When I created the test-branch I somehow broke the networking and it cannot be merged into master again ;) .