Solved How to offload a map and load a new one

Discussion in 'Plugin Development' started by voltywolty, Jan 19, 2024.

  1. Offline


    So I am making a game mode and eventually want 24/7 support. How could I make it where while the server is still online, it offloads a map, and then loads another one? Would I be able to load a config from this as well, and could I get the map to load from a directory that also has that config as well?

    For example: C:/Desktop:/Maps/Map1
    Map 1 Contents:
    Map 1 Map File
    pluginName Folder - inside the config.

    It doesn't need all of this exactly, but if someone could help me out on how to make this happen, that would be greatly appreciated! I've been trying to figure it out for the longest and can't get it to work exactly.
  2. Online

    timtower Administrator Administrator Moderator

    Why not just have both loaded?
  3. Offline


    Would it be better to have all the maps loaded? What if I want to cycle between maps that have already been played. I'd need them reset.
  4. Online

    timtower Administrator Administrator Moderator

    All is not needed, but a lobby and a game map.
    Need to always have a world loaded
  5. Offline


    To load a world you can use
    getServer().createWorld(new WorldCreator("WorldName");
    (If a folder named "WorldName" already exists in your server's main directory, it will load it instead of creating it)

    Afterward you can use
    getServer().unloadWorld("WorldName", false);
    (the true/false parameter is whether you want to save chunks, but for minigame maps you probably want it to reset each time)

Share This Page