Generating hollow cube at a certain location

Discussion in 'Spigot Plugin Development' started by EvanTheSurfer, May 18, 2016.

  1. I was wondering if there is anyway ( using the world edit api ) that I could generate a hollow cube at a certain location? Is this possible? I want it so when u do /unraidable create, it makes a hollow cube in a specified world. I'm not asking for the code, I just need a link to maybe somewhere I could learn what I need.
     
  2. It's pretty easy to create a hollow cube without the world edit API. Would you rather know how to do that or to use the WorldEdit API which doesn't have very much documentation...?
     
  3. Any way works for me :)
     
  4. Code (Text):
        public static void pasteHollowCube(Location loc, int w, int h, int l, Material type){
         
            for(int i = 0; i < w;i++){
                for(int j = 0; j < h;j++){
                    for(int k = 0;k < l;k++){
                     
                        Block bl = loc.getBlock().getRelative(i, j, k);
                     
                        if(i == 0 || j == 0 || k  == 0){
                            if(i == w-1 || j == h-1 || k == l-1){
                                bl.setType(type);
                            }
                        }
                     
                    }
                }
            }
         
        }
     
    #4 bowser123467, May 18, 2016
    Last edited: May 18, 2016
  5. @bowser123467 that won't work.

    Replace all && with || and put them in the same if statement
     
  6. Oh your right