Solved [WorldGuard API] No regions ?

Discussion in 'Plugin Development' started by Ryzzzen, Sep 20, 2015.

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

    Ryzzzen

    Hi, i have a problem with WorldGuard and it's API.

    When i'm doing this in a command:

    Code:
    getWorldGuard().getRegionManager(world).getRegion(str[0]);
    it returns null.

    And i tried this code:

    Code:
            for (ProtectedRegion region : wgManager.getWorldGuard().getRegionManager(world).getRegions().values()) {
                Bukkit.getPlayer("Sowkild").sendMessage(region.getId());
            }
    
    But it sends nothing?
    That's strange because i have two regions.

    I used this command for the regions: /region claim, and when i do /region list they're in.

    Is this a bug ?
    (Sorry for my english)
     
  2. Offline

    nlthijs48

    @Ryzzzen Check that the world you are asking the RegionManager for is correct, print out the name of that. Also print out the name of str[0] and check if that is the correct region you are trying to get. Because you are not getting a nullpointer I guess that your region name is incorrect, which will indeed let the getRegion() call return null.
     
  3. Offline

    Ryzzzen

    Actually, my code throws a NullPointerException now:

    Code:
            for (ProtectedRegion region : wgManager.getWorldGuard().getRegionManager(Bukkit.getWorld("world")).getRegions().values()) {
                Bukkit.getPlayer("Sowkild").sendMessage(region.getId());
            }
    
            for (ProtectedRegion region : wgManager.getWorldGuard().getRegionManager(world).getRegions().values()) {
                Bukkit.getPlayer("Sowkild").sendMessage(region.getId());
            }
    
    I don't understand why it's doing this..
     
  4. Offline

    nlthijs48

    Paste the nullpointer exception on pastebin.com and send the link to that here.

    Simply check which thing is null, first check 'wgManager', then check the result of getWorldGuard(), etc.
     
Thread Status:
Not open for further replies.

Share This Page