Need some help with plot maths

Discussion in 'Spigot Plugin Development' started by Arjan, May 15, 2015.

  1. Alright, so I'm working on a plot system in which users can create their own plot.
    The outline is traced with golden blocks as shown below:
    Now when the player tries to expand his block it will look something like this:
    My question is, if it is possible to remove the inner lines and only keep the outer ones.
  2. This is what Im using for the complete square:
    Code (Text):
    Block center = origin.getBlock().getRelative(BlockFace.DOWN);
    int maxRadius = 8;
            for (int r = 0; r < maxRadius; r++) {
                Block b = center.getRelative(BlockFace.NORTH, r).getRelative(BlockFace.WEST, r);
                for (BlockFace f : new BlockFace[] {BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST, BlockFace.NORTH}) {
                    for (int i = 0; i < 2*r + 1; i++) {
                        b = b.getRelative(f);
    For now I use the same code as above online maxRadius minus 1 to set the inner part to grass. (this should be changed though)
  3. Could check if there is a claim inside the area where it is trying to place blocks, then skip it.
  4. Thanks!
    Why didn't I think of this before :/