Creating WorldGuard Regions?

Discussion in 'Plugin Development' started by Adamki11s, Feb 5, 2012.

Thread Status:
Not open for further replies.
  1. Hey I'm having some trouble creating world guard regions.

    I'm using the ProtectedCuboidRegion constructor found in the javadocs.

    Code:java
    1.  
    2. ProtectedCuboidRegion pr = new ProtectedCuboidRegion("region_name" , l1.toVector().toBlockVector(), l2.toVector().toBlockVector());
    3.  


    Where l1 and l2 are locations.

    However it keeps telling me The constructor ProtectedCuboidRegion(String, BlockVector, BlockVector) is undefined

    Could someone please show how this is done as there is hardly any documentation and I am getting no response on their IRC. Thanks in advance.
     
  2. Offline

    AgentME

    The arguments to the constructor need to be of type com.sk89q.worldedit.BlockVector, not Bukkit's
    org.bukkit.util.BlockVector type.
     
  3. Offline

    Roadkill909

    AgentMe is correct.

    Also be sure to grab the world's RegionManager and use the addRegion(ProtectedRegion region) method, otherwise the world won't save the region. Tag/pm me if you need more questions answered, I've had a lot of experience hooking into WorldGuard and its extremely useful API.
     
  4. Ok I did try that earlier but maybe I was creating the Object wrong. How do I create a worldedit block vector?
     
  5. Offline

    Roadkill909

    In one of my plugins I have a method like this one that comes in handy:

    Code:Java
    1.  
    2. public com.sk89q.worldedit.BlockVector convertToSk89qBV(Location location){
    3. return new com.sk89q.worldedit.BlockVector(location.getX(),location.getY(),location.getZ);
    4. }


    Imports make that code a lot nicer to look at. Also documentation is here:
    http://www.sk89q.com/docs/worldedit/api/com/sk89q/worldedit/BlockVector.html
     
  6. Ok thanks for all your help :)
     
  7. Hey could you help me out with setting flags to a region as there is again no documentation for it besides from the Javadocs which do not help much and I can't figure it out :/.

    Thanks in advance.
     
Thread Status:
Not open for further replies.

Share This Page