Solved WorldEdit Selection

Discussion in 'Plugin Development' started by ItsOneAndTwo, Mar 8, 2014.

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

    ItsOneAndTwo

    Hello Bukkit community!

    I want to loop through every block in a WorldEdit selection, but I don't know how.
    I currently have this:
    Code:java
    1. WorldEditPlugin worldEdit = (WorldEditPlugin) Bukkit.getServer().getPluginManager().getPlugin("WorldEdit");
    2. Selection selection = worldEdit.getSelection(player);
    3.  
    4. if (selection != null) {
    5. World world = selection.getWorld();
    6. Location min = selection.getMinimumPoint();
    7. Location max = selection.getMaximumPoint();
    8.  
    9. // Do something with min/max
    10. } else {
    11. // No selection available
    12. }


    Now I need to loop through the min and max, how?
     
  2. Offline

    amhokies

    Something like this...

    Code:java
    1. for(int x = min.getBlockX(); x <= max.getBlockX(); x++) {
    2. for(int y = min.getBlockY(); y <= max.getBlockY(); y++) {
    3. for(int z = min.getBlockZ(); z <= max.getBlockZ(); z++) {
    4. //do whatever
    5. }
    6. }
    7. }
     
    ItsOneAndTwo likes this.
  3. Offline

    ItsOneAndTwo

Thread Status:
Not open for further replies.

Share This Page