Unloading Main World

Discussion in 'Plugin Development' started by MaxTheGinus, Jun 22, 2020.

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

    MaxTheGinus

    I'm developing a plugin that will replace all of a server's worlds with files stored in another folder. If I understand correctly, the only to modify these files using a plugin is to first unload the worlds.

    Unfortunately, I haven't been able to unload these worlds. I've looked at other threads and have tried a multitude of fixes, unloading chunks first, saving the world first, etc. I read that the unloadWorld() method will fail if the world is the main one (index 0). Is there another way to unload the main world?

    Please note that since I am replacing all of the worlds at the same time, I can kick players but can't teleport them to another world.

    Thanks!
     
  2. Online

    timtower Administrator Administrator Moderator

    @MaxTheGinus Why not do it world for world and teleport the players around?
     
  3. Offline

    MaxTheGinus

    @timtower The plugin might modify other files on the Minecraft server, and I'm afraid something bad may happen if there are players online, which may make the server write to those files.
     
  4. Online

    timtower Administrator Administrator Moderator

    Then stop the server, modify worlds, start server.
     
  5. Offline

    MaxTheGinus

    @timtower Doesn't the server need to be running for plugins to work?
     
  6. Online

    timtower Administrator Administrator Moderator

    You can copy files from batch scripts though
     
  7. Offline

    MaxTheGinus

    @timtower It needs to run from a plugin.

    Would it be best or even possible to run a bash script from the plugin before the server goes online?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 23, 2020
  8. Online

    timtower Administrator Administrator Moderator

    Plugin isn't running then.
    Need to modify the start script for it.
    Or add a small lobby world
     
  9. Offline

    MaxTheGinus

  10. Online

    timtower Administrator Administrator Moderator

    @MaxTheGinus That does not say anything about the main world though.
     
Thread Status:
Not open for further replies.

Share This Page