save a world like mobarena?

Discussion in 'Plugin Development' started by okami35, Nov 16, 2011.

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

    okami35

    Hello,
    For my new plugin, i would like to save a territory and restore it later. But, how do you do? I don't find any methods to do it.
    Maybe i must save all the blocks breaked/placed in an array?
    Or is there a method to do it in bukkit?

    Thank you for your help
     
  2. Offline

    halley

    See if you can call the functionality in the WorldEdit plugin, rather than invent it yourself. If you must reinvent the wheel, please learn about the MC Edit "schematic" file format.
     
  3. Offline

    okami35

    Thank you for your help.
    Ad another question, do you know how to "spawn" a given block in a given world?

    Thank you
     
  4. Offline

    DDoS

    Get the block state for a block, set its material, and update it.
     
  5. Offline

    okami35

    Thank you for your help, so I have:
    Code:
    public ArrayList<BlockState> blocks_break = new ArrayList<BlockState>();
    
    for(int i = 0 ; i < blocks_break.size(); i++) //on met tous les block places a 0
                    blocks_break.get(i).update();
    But, it doesn't work, there isn't a new block...
     
  6. Offline

    ItsHarry

    First change the data of the block then update it.
     
  7. Offline

    okami35

    Thank you for your help, but when a player breaks a block, i put in in the arrayList:
    Code:
    plugin.blocks_break.add(event.getBlock().getState());
    And I just want to restore all of these blocks.
     
  8. Offline

    okami35

    up, no ideas?

    Thank you
     
  9. Offline

    okami35

    nobody knows how to spawn a block?
     
  10. Offline

    DDoS

    Get the block, use setType(Material) to set it to whatever you want.

    If it doesn't work, try this:
    Get the location, get it's block, and get it's state (save it to a variable).
    Now set the material for that state to whatever you desire, and call the update method for the state.
     
  11. Offline

    okami35

    Thank you for your help.
    But it works with update(true)

    Thank you
     
Thread Status:
Not open for further replies.

Share This Page