WorldGuard

WorldGuard

8M Downloads

WorldGuard 1.14+ API for Bukkit/Spigot

LemADEC opened this issue ยท 1 comments

commented

Versions
WorldEdit version: worldedit-bukkit-7.2.4

WorldGuard version: worldguard-bukkit-7.0.4

Platform version: spigot-1.16.5-build3040

Describe the bug
Back in 1.12.2, I had several plugin features relying on regions defined in WorldGuard. The typical code would something like that:

WorldGuardPlugin worldGuard = (WorldGuardPlugin) getServer().getPluginManager().getPlugin("WorldGuard");
List<World> worlds = Bukkit.getWorlds();
    for (World world : worlds) {
        RegionManager regionManager = worldGuard.getRegionManager(world);
        ProtectedRegion region = regionManager.getRegion(nameRegion);
        if (region.contains(location.getBlockX(), location.getBlockY(), location.getBlockZ())) {
	        // do something
        }
    }

I can't find an equivalent in 1.14+. The plugin class doesn't seem to expose access to regions anymore.
Is there another way to do that nowadays?

To Reproduce
see code snippet above

Expected behavior
Provide API to access regions from other plugins.

Screenshots
n/a

Additional context
n/a

commented

That's all covered by the docs. You should take a look at RegionQuery / ApplicableRegionSet
https://worldguard.readthedocs.io/en/latest/developer/

For further support I suggest to join our discord. ( https://discord.gg/enginehub )