Solved WorldGuard copy region from one world to another

Discussion in 'Plugin Development' started by Xp10d3, Apr 19, 2021.

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


    I'm attempting to copy a region from on world (ex. lets say, TreeHouseDummy to TreeHouse) but am unfamiliar with WorldGuard and had some issues with player not being able to break blocks in the correct area outside of the region. Is there a better way to do this?
    2. public static void regionManagement(World world, String regionId, String currentWorld) {
    3. RegionContainer container = core.getWorldGuard().getRegionContainer();
    4. RegionManager regionWorld = container.get(world);
    5. ProtectedRegion regionWorldID = regionWorld.getRegion(regionId);
    6. RegionManager targetWorld = container.get(Bukkit.getWorld(currentWorld));
    7. targetWorld.addRegion(regionWorldID);
    8. }
  2. Offline

    Mathias Eklund

    Shouldn't you be able to just directly create a new region in the target world and copy over the flags, instead of copying it in full like you are trying to do here?
  3. Offline


    mb. i kinda gave up on using worldguard however and instead just compared different values. ex.
    2. if (player.getWorld().getName().contains("Mineshaft")) {
    3. if (block.getLocation().getX() > 50 || block.getLocation().getX() < -7) {
    4. player.sendMessage(ChatColor.RED + "You can't place blocks here!");
    5. event.setCancelled(true);
    6. }
    7. }
Thread Status:
Not open for further replies.

Share This Page