Solved Fill blocks between to coordinates?

Discussion in 'Plugin Development' started by Josh014, Dec 16, 2013.

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

    Josh014

    Hey,
    How can I select 2 coordinates (with a command or an item) to get the blocks between those coordinates, then save the blocks and then set the blocks back in the same position with a command? Like the copy and paste command of worldedit.

    Thank you,
     
  2. Offline

    Garris0n

    Well, this is the easy way. For the hard way, read worldedit's source and figure it out. Or use worldedit's selection system.
     
  3. Offline

    Josh014

    Garris0n alright thank you.

    Garris0n Uhm I read the post it sounds really simple but still I don't know how to save the blocks and replace them later.

    edit: Or just place blocks between those 2 coordinates....

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

    Garris0n

    How much later? Create a class that holds the location, material, data, and any other inventory/state stuff you want. Add a method to this class to rebuild the block. Make this class take a constructor of a block and set everything up. Then loop through your blocks and create one of these special classes for each. Save them in a HashMap somewhere. Then, later when you need them, loop through and call the method that rebuilds the block. If you need to save them for long periods of time, create a yml file and add a serialization method as well as a constructor that takes a string to deserialize. Serialize each into a string and save it in your yml file, then later load them all back. This is only needed if you must preserve these blocks through restarts. And no, just in case, I'm not going to give you the code to do it, however, should you write code and have it fail to work, I'd be happy to assist you in fixing it.
     
  5. Offline

    Josh014

    Garris0n,
    Hmm.. I'm not that good at developing and I'm just trying something news to get more experience with it. And I never thought it would be that hard to place blocks between 2 coordinates. :confused:
     
  6. Offline

    Garris0n

    It's not as hard as it sounds, as long as you know Java, which you should learn before using Bukkit.
     
  7. Offline

    Josh014

    Garris0n I do know a bit about java, but some parts I never really used before. I always made some little plugins for friends etc. Not that advanced or so.
    Is there a more easy way to only place one blocks between coordinates instead of saving the blocks there were before?

    It can sound a bit silly this all.
     
  8. Offline

    Garris0n

    If you only want to set blocks, simply loop through each location and location.getBlock().setType(Material.TYPEHERE).
     
  9. Offline

    Josh014

    Garris0n
    But yea nvm this post. Thank you for your help so far :)
     
Thread Status:
Not open for further replies.

Share This Page