How to get region from event location in 7.0?

Discussion in 'Programming Help' started by uncovery, Nov 2, 2018.

  1. uncovery

    uncovery New Member

    Hey guys, I am working on a plugin that should determine the region from an event location.

    so I have this code here:

    @@EventHandler
    public void onCreatureSpawnEvent(CreatureSpawnEvent event) {
    event.setCancelled(checkCancel(event.getEntity(),event.getLocation(),event.getSpawnReason()));
    }

    and I am then trying to get the region from that event.getLocation.

    I went through the docs here: http://worldguard.enginehub.org/en/latest/developer/regions/spatial-queries/
    and I read this here: https://blog.me4502.com/updating-worldguard-to-minecraft-113.html

    So I want to retrieve the ApplicableRegionSet via ApplicableRegionSet set = query.getApplicableRegions(location);

    but I do not know how to get a WorldGuard location instead of a BukkitLocation.

    Any suggestions?