Worldedit Polygonal region

Discussion in 'Plugin Development' started by plarsootje, Oct 27, 2018.

Thread Status:
Not open for further replies.
  1. Hello Guys,

    So for a minigame plugin i'm trying to get a worldedit Polygonal region. Later on i will save the region to a Yml file and then load, But for now i'm just trying to test to see if i got the region

    Problem: I only get the border of the poly region. not the inside(see picture)

    Code:
        if(sender instanceof Player) {
            Player player = (Player) sender;
            Region sel = null;
            try {
                sel = worldEdit.getSession(player).getSelection(BukkitAdapter.adapt(player.getWorld()));
            } catch (IncompleteRegionException e) {
                e.printStackTrace();
            }
    
             
            if(sel != null) {
                if (sel instanceof Polygonal2DRegion) {
                    Polygonal2DRegion polygon = (Polygonal2DRegion) sel;
                    int maxY = polygon.getMaximumPoint().getBlockY();
                   
                    List<BlockVector2D> points = polygon.getPoints();
                   
                    for(BlockVector2D point : points) {
                        int x = point.getBlockX();
                        int z = point.getBlockZ();
                        Location loc = new Location(player.getWorld(), x, maxY, z);
                        loc.getBlock().setType(Material.STONE);
                       
                    }
                }
            }
            }
    
    Picture:
    View attachment 31923
     
Thread Status:
Not open for further replies.

Share This Page