Setting positions, saving them and getting them later

Discussion in 'Plugin Development' started by diamondcodes, Jan 8, 2015.

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



    I am wondering what the best way of setting and saving positions that a player sets and then getting those locations later and setting all block between those positions with Stone

    Example.. The player will type /pos1 and /pos2 to set 2 positions and then /create will set all blocks between those 2 points with stone
  2. Offline


  3. Offline


    you could look at the source of world edit
  4. Offline


    @Skionz Okay so use a config file to save the positions, But how would I get all blocks between? (In the most efficient way)
  5. Offline


    @diamondcodes Use three nested for loops incrementing the x, y, z coordinates.
  6. Offline


    @Skionz So something like
            int maxX = (l1.getBlockX() < l2.getBlockX() ? l2.getBlockX() : l1.getBlockX());
            int minX = (l1.getBlockX() > l2.getBlockX() ? l2.getBlockX() : l1.getBlockX());
            int maxY = (l1.getBlockY() < l2.getBlockY() ? l2.getBlockY() : l1.getBlockY());
            int minY = (l1.getBlockY() > l2.getBlockY() ? l2.getBlockY() : l1.getBlockY());
            int maxZ = (l1.getBlockZ() < l2.getBlockZ() ? l2.getBlockZ() : l1.getBlockZ());
            int minZ = (l1.getBlockZ() > l2.getBlockZ() ? l2.getBlockZ() : l1.getBlockZ());
            for(int x = minX; x <= maxX; x++) {
                for(int y = minY; y <= maxY; y++) {
                    for(int z = minZ; z <= maxZ; z++) {
Thread Status:
Not open for further replies.

Share This Page