Iterating through the whole world?

Discussion in 'Plugin Development' started by Baba43, Mar 11, 2014.

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

    Baba43

    Hi, want to write a plugin that removes items in chests and other inventory-blocks.

    Is there any way to get all chunks or to iterate through all blocks without making the server generating any new chunks?

    This plugin should just run one time so removing items on chunk load is an idea that I don't like.

    Thank you.
     
  2. Offline

    Garris0n

    You're best off using MCEdit, loading and scanning every chunk on the server will probably lag it out for quite a long time, possibly breaking things.
     
  3. Offline

    Baba43

    Lags are no problem since nobody will be playing when I run this plugin.
     
  4. Offline

    Superbee29

    There may be another option. You can watch for chunk loading and then scan the chunk. So when any player enters the area, it will clear chests. You could also make a list, where scanned chunks will be saved (not whole chunk, maybe just a position or id - I'm not sure if chunks have an id), so it will not run when not needed. This way the lag should be minimal/none.
     
  5. Can't lag also be reduced with running it on a separate thread, or is this unsafe?

    To get the loaded chunks of a world: world#getLoadedChunks();
     
Thread Status:
Not open for further replies.

Share This Page