[Solved] Protect a region with worldguard

Discussion in 'Plugin Development' started by se1by, Dec 16, 2011.

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

    se1by

    Hey, I try to protect a set region per worldguard with my plugin.
    I used this method:

    Code:JAVA
    1.  
    2. public void protect (String id, Location mini, Location maxi) throws CommandException{
    3. com.sk89q.worldedit.Vector Min = toVector(mini);
    4. com.sk89q.worldedit.Vector Max = toVector(mini);
    5.  
    6. BlockVector min = Min.toBlockVector();
    7. BlockVector max = Max.toBlockVector();
    8. ProtectedRegion region = new ProtectedCuboidRegion(id, min, max);
    9. WorldGuardPlugin pl = getWorldGuard();
    10.  
    11. RegionManager mgr = pl.getGlobalRegionManager().get(mini.getWorld());
    12.  
    13. mgr.addRegion(region);
    14. try
    15. {
    16. mgr.save();
    17. p.sendMessage(ChatColor.YELLOW + "Region saved as " + id + ".");
    18. } catch (IOException e) {
    19. throw new CommandException("Failed to write regions file: " + e.getMessage());
    20. }
    21. }
    22.  


    it says "Region saved as examplename" but the region isn't protected.
    Anything I didn't mentioned?

    Perhaps @sk89q can help me?

    Thanks :)
     
  2. Offline

    fireball1725

    How did u get it to work?

    Thanks
     
  3. Offline

    Sir Savary

    se1by
    Always post the solution when you find it please.
     
Thread Status:
Not open for further replies.

Share This Page