1. We are planning scheduled maintenance on this website on Friday 5 March at 4:00 am UTC. It is estimated that this maintenance will last 15 minutes. You can view this time in your local timezone here. Thanks.
    Dismiss Notice

WorldGuard Events 1.16.4

Easy way to get per-player region entry/departure events.

  1. Weby
    Native Minecraft Version:
    Tested Minecraft Versions:
    • 1.15
    • 1.16
    Source Code:
    WorldGuard Events
    For server admins
    This plugin may be required by some other plugins. If so, simply drop the JAR in the plugins folder of your server, reload it, and you're set.

    It doesn't do anything on its own and is useless unless required by another plugin.

    For developers
    This plugin provides you with the following events :
    • RegionsChangedEvent
    • RegionsEnteredEvent
    • RegionsLeftEvent
    • RegionEnteredEvent
    • RegionLeftEvent
    All of those are fired upon each player movement into a new set of regions, in that order.

    They are all pretty self-explainatory. You can use any event interchangeably : the events returning a single ProtectedRegion are fired at the same time as the events returning a Set of ProtectedRegions (which is useful if you have multiple overlapping/neighbouring regions).

    Cancelling any of the events will prevent the movement from happening.

    On top of events, and since version 1.15.2 of this plugin, we now provide you with a small API to get the most basic informations out of WorldGuard :
    • getRegions
    • getRegionNames
    • isPlayerInRegion
    • isPlayerInAnyRegion
    • isPlayerInAllRegions
    All of those use the UUID of the player to fetch information about him from WorldGuard.

    Be aware that those region names are case insensitive, just like WorldGuard, and that they are checked for the world the player is currently in.

    Usage example
    Code (Java):

    import net.raidstone.wgevents.WorldGuardEvents;
    import net.raidstone.wgevents.events.RegionEnteredEvent;
    import net.raidstone.wgevents.events.RegionsLeftEvent;
    import org.bukkit.Bukkit;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.plugin.java.JavaPlugin;
    import java.util.Set;

    public class TestPLugin extends JavaPlugin implements Listener {
        public void onEnable() {
            Bukkit.getPluginManager().registerEvents(this, this);
            // On plugin activation, send a message to players that are located in a jail.
            for(Player p : Bukkit.getOnlinePlayers())
                if(WorldGuardEvents.isPlayerInAnyRegion(p.getUniqueId(), "jail", "cell"))
                    p.sendMessage("You are in jail ! Did you do something bad ?");
       public void onRegionEntered(RegionEnteredEvent event)
           Player player = Bukkit.getPlayer(event.getUUID());
           if (player == null) return;
           String regionName = event.getRegionName();
               player.sendMessage("You are now in jail !");

       public void onRegionsLeft(RegionsLeftEvent event)
           Player player = Bukkit.getPlayer(event.getUUID());
           if(player == null) return;
           Set<String> regionsNames = event.getRegionsNames();
           if(regionsNames.contains("jail") || regionsNames.contains("cell"))
               player.sendMessage("You are in jail, you can't escape !");
    Maven dependency
    This plugin is located in the Maven Central repository, so you simply need to add it as dependency.
    Code (HTML5):
    If you like this plugin, don't forget to rate it, to help other people discover it !

    Also, please use the Github's page to report bugs and ask for features !

Recent Updates

  1. Updated to 1.16.4
  2. New API methods and efficiency update !
  3. Java 8

Recent Reviews

  1. Dead_Light
    Version: 1.15.2
    Thanks for this great API, really helped me out. Just hope you keep it up for the latest versions.
  2. zVortexGG
    Version: 1.15.2
    Add 1.8.9 world guard support please
    ' ' ' ' '
  3. Q21R
    Version: 1.15.2
    The API is good, except that it isn't maintaned anymore. If the developer now could like update & maintain the api it would've been a 5/5 for me.
  4. ethwal22
    Version: 1.15.2
    Amazing API. Recommend for all plugin devs! Was struggling for so long with other APIs
  5. eliasboy0202
    Version: 1.15.2
    Best api so far, talked to WorldGuard itself and aparently they don't want to add them.
    Amazing job !
  6. dinoboss2001
    Version: 1.15.2
    podrias aƱadir schrmatics ?????????????????????????????????????????????? es para mi plugin de SuperTowersDefenser
    1. Weby
      Author's Response
      This is a simple WorldGuard helper, it has nothing to do with WorldEdit, or schematics.
  7. Zastrix
    Version: 1.15.1
    I had not tested it yet but I can't really rate more than 3 stars because this is compiled on Java 10 while the standard is Java 8.
    1. Weby
      Author's Response
      So instead of asking for a Java 8 JAR, you rate 3 stars without even trying the plugin ?
      Not cool.
  8. Halflove
    Version: 1.13.2-R0.2
    Great up to date replacement for WGRegionEvents API for developers, thanks for putting this out there and making it easier to code for people like me ;)
    1. Weby
      Author's Response
      With pleasure !