Have the server set a block

Discussion in 'Plugin Development' started by theninthworldix, Jan 18, 2011.

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

    theninthworldix

    Pretty simple question here, I cant seem to find the answer on the javadoc's or in these forums, so I might as well ask. In hMod the way to set a block from the server was
    Code:
     etc.getServer().setBlockAt(blockType, x, y, z);
    What is the way to do this on bukkit?
     
  2. Offline

    MadMichi

  3. Offline

    Taco

    Try:

    event.getBlock().setTypeId(ID);

    Replace ID with the Id of course. Or use:

    Block newBlock = event.getPlayer().getWorld().getBlockAt(x, y, z);
    newBlock.setTypeId(ID);

    for a more specific block.
     
  4. Offline

    MadMichi

    But that would alter an already existing block and not add a new block, or did i get something wrong?
     
  5. Offline

    apexearth

    See his newBlock variable? That gets the Block at a particular point in the world. If that Block happens to be AIR then you can set it to be whatever you want. Just because there is nothing there, it doesn't mean there isn't a Block there.
     
  6. Offline

    MadMichi

    Now i understood. Even used it already in ma plugin ^^
     
Thread Status:
Not open for further replies.

Share This Page