Solved Set Block at location

Discussion in 'Plugin Development' started by victor2748, Oct 4, 2014.

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

    victor2748

    Hello. I have a Block object, and I simply want to set that block at coords (x, y, z).
    Something like:

    Code:java
    1. Block block;
    2. World world;
    3. // ...
    4. world.setBlock(block);
    5.  
    6. // or
    7.  
    8. world.setBlock(location, block);

    is there a methor in bukkit like that, or a way to do this?
     
  2. victor2748
    Code:
    block.setType(Material material);
     
  3. Offline

    Skionz

    World#getBlockAt(Location).setType(Material);
     
    Hawktasard likes this.
  4. Offline

    victor2748

    What if I have blocks with special metadata (like chests, player heads, or signs)?

    and btw, how do I get all meta data of a block?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 14, 2016
  5. Offline

    Skionz

    Cast it to a Chest
     
  6. Offline

    victor2748

    But the metadata won't save. I need the metadata (contents etc.) to be saved too.
     
  7. Offline

    Skionz

    loop through the contents and save them and their location in the chest
     
Thread Status:
Not open for further replies.

Share This Page