How to place a block

Discussion in 'Spigot Plugin Development' started by TheGamerPlayz, May 21, 2016.

  1. I'm trying
    Code (Text):


            Location loc_0 = new Location(w, 0, 82, 14);
            Block a = w.getBlockAt(loc_0);
                a.setType(Material.SPRUCE_FENCE);
     
    But it is not doing anything, So am I using it wrong or is it the wrong method
     
  2. do Block a = loc_0.getBlock() ?

    Also name your variables better lol
     
    • Funny Funny x 2
  3. They aren't my final names, and anyways it is my plugin, so I'll code it in the way that makes the most sense to me.
     
  4. What dafaq do you mean they arent your final names lol? also how does a relate to a block to you?
     
  5. You'll code the way that makes sense to you, I guess that's why some people should code in bytecode huh
     
  6. because they are over 20 blocks that i am trying to place and it made most sense to organize them by letter at the time and by not being final, I mean that i will change the names to the acceptable way after i get it working.
     
  7. There are these things called loops. They are absolutely magical and make code much nicer and more efficient. >.>
    If you hard code the placement of 20 blocks I'm going to cry.
     
    • Agree Agree x 1
  8. Try:
    Code (Text):
    Location loc = new Location(w, 0, 82, 14);

    w.getBlockAt(loc).setType(Material.SPRUCE_FENCE);