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.

    2. ProtectedCuboidRegion pr = new ProtectedCuboidRegion("region_name" , l1.toVector().toBlockVector(), l2.toVector().toBlockVector());

    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


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


    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


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

    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:
  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