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

    Xp10d3

    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?
    Code:java
    1.  
    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. }
    9.  
     
  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

    Xp10d3

    mb. i kinda gave up on using worldguard however and instead just compared different values. ex.
    Code:java
    1.  
    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. }
    8.  
     
Thread Status:
Not open for further replies.

Share This Page