WorldEdit API Pasting/Copying

Discussion in 'Plugin Development' started by LazerAspect, Aug 13, 2016.

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

    LazerAspect

    Code:
    public static void regenArena(CuboidSelection selection, Vector newPoint, BlockVector min, BlockVector max){
            LocalWorld world = BukkitUtil.getLocalWorld(Bukkit.getWorld("KitPVP"));
            EditSession editSession = new EditSession(world, Integer.MAX_VALUE);
          
            selection = selectionArenaOne;
          
            Bukkit.broadcastMessage(String.valueOf(min) + String.valueOf(max));
          
            Vector size = new Vector(selection.getLength(), selection.getHeight(), selection.getWidth());
          
            Bukkit.broadcastMessage(String.valueOf(selection.getLength()) + String.valueOf(selection.getHeight()) + String.valueOf(selection.getWidth()));
            Bukkit.broadcastMessage(String.valueOf(size));
          
            Vector origin = selection.getNativeMinimumPoint();
            Vector offset = selection.getNativeMaximumPoint();
          
          
            CuboidClipboard clipboard = new CuboidClipboard(size, origin, offset);
            clipboard.setOrigin(min);
            clipboard.copy(editSession);
          
          
          
            //Paste it
          
            try {
                clipboard.paste(editSession, newPoint, true, false);
                //This broadcast is sent
            } catch (MaxChangedBlocksException e) {
                e.printStackTrace();
            }
        }
    I did made a post on here about a month ago about other issues with the API. I was able to partially resolve the issue by changing the size variable. It DOES paste a structure but it copies the wrong locations and pastes it at the wrong place..

    Here's the CuboidSelection:

    Code:
    World KitPVP = Bukkit.getWorld("KitPVP");
        Location arenaOnePoint1 = new Location(KitPVP, -70, 4, -440);
        Location arenaOnePoint2 = new Location(KitPVP, -124, 54, -362);
      
    Location arenaOneRadius = new Location(KitPVP, -43, 31, -245);
      
    CuboidSelection selectionArenaOne = new CuboidSelection(KitPVP, arenaOnePoint1, arenaOnePoint2);
     
    Last edited: Aug 14, 2016
Thread Status:
Not open for further replies.

Share This Page