Need help interacting with worldguard.

Discussion in 'Plugin Development' started by Typhoon5, Jan 24, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    Typhoon5

    Hey guys. I'm having some trouble trying to figure out how to get the region and owner of said region that a player is standing in, or is this even possible?

    or if i wrote that bad...

    is there a way to get the region and owner of said region that a player is standing in from worldguard?

    Thanks!
     
  2. Code:java
    1. Location loc = player.getLocation();
    2. for(ProtectedRegion region: worldGuard.getRegionManager(loc.getWorld()).getApplicableRegions(BukkitUtil.toVector(loc))) //BukkitUtil is from WorldEdit!
    3. {
    4. player.sendMessage("Region: "+region.getId());
    5. DefaultDomain owners = region.getOwners();
    6. for(String owner: owners.getPlayers())
    7. player.sendMessage("Owner: "+owner);
    8. }
     
  3. Offline

    boardinggamer

    V10lator
    to.getWorld()
    whats the to?
     
  4. @boardinggamer: Sorry, copy&paste issue, to == loc. Edited last post. ;)
     
  5. Offline

    boardinggamer

    V10lator
    worldGuard.getRegionManager
    Do you have to define the "worldGuard" part somewhere?
     
  6. @boardinggamer: Sure, it is WorldGuards instance:
    WorldGuard worldGuard = (WorldGuard)getServer().getPluginManager().getPlugin("WorldGuard");

    Also you have to be sure that WorldGuard is there, this can be done with the depends line in your plugin.yml.
     
  7. Offline

    Typhoon5

    Thanks i think it works now!
     
Thread Status:
Not open for further replies.

Share This Page