Bukkit
  1. Bukkit
  2. BUKKIT-2390

unloadWorld should completely unload region files

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Bukkit API
    • Security Level: Public (Viewable by everyone)

      Description

      EDIT: This appears to be a bug, as there probably aren't any reasons to leave files open after closing a world, and I change the suggestion to not have a boolean, but to just close the region files when unloading a world.

      Old post:
      The unload world command in org.bukkit.Server.unloadWorld should have a boolean such as "fullunload" which would allow the world to be completely unloaded from the server as if the server had been shut down (ie no more objects in memory referencing the world's region files, etc)

      This would allow plugins to modify the entire world folder and region files quickly without worrying about concurrent modification.

        Issue Links

          Activity

          Hide
          Brendan added a comment -

          I've confirmed the code addition does work on Win 7 with 1.6.2. It just requires using the NMS calls which is less stable but it works most of the time.

          Show
          Brendan added a comment - I've confirmed the code addition does work on Win 7 with 1.6.2. It just requires using the NMS calls which is less stable but it works most of the time.
          Hide
          Biel Simon Rojas added a comment -

          So, we have to do that manually?

          Show
          Biel Simon Rojas added a comment - So, we have to do that manually?
          Hide
          Brendan added a comment -

          Yes, I've added the code from cybertiger's git pull request which goes through the region files and closes them to my own plugin. Then you also have to add craftbukkit as a reference to your project, just make sure your project still references bukkit, and bukkit first.

          Then, if/when this is fixed, you should be able to remove the code from your plugin and the craftbukkit reference, if you don't use NMS calls anywhere else

          Show
          Brendan added a comment - Yes, I've added the code from cybertiger's git pull request which goes through the region files and closes them to my own plugin. Then you also have to add craftbukkit as a reference to your project, just make sure your project still references bukkit, and bukkit first. Then, if/when this is fixed, you should be able to remove the code from your plugin and the craftbukkit reference, if you don't use NMS calls anywhere else
          Hide
          Wesley Wolfe added a comment -

          Unloading a world when saving to disk correctly purges open file handles. Minecraft is not designed to release a file of which it had read and expects to write to. From the called methods, it's safe to assume references to said world (therefor file handles) may still be accessible, therefor, closing files is still an invalid course of action.

          Show
          Wesley Wolfe added a comment - Unloading a world when saving to disk correctly purges open file handles. Minecraft is not designed to release a file of which it had read and expects to write to. From the called methods, it's safe to assume references to said world (therefor file handles) may still be accessible, therefor, closing files is still an invalid course of action.
          Hide
          Biel Simon Rojas added a comment -

          It HAVE to be fixed! That you said is for the vanilla minecraft server, but the bukkit servers maybe want to reset a world without closing the server (a world loaded with Bukkit.createWorld()). Why you don't want fix it?? An other user have created the code to fix it!

          Show
          Biel Simon Rojas added a comment - It HAVE to be fixed! That you said is for the vanilla minecraft server, but the bukkit servers maybe want to reset a world without closing the server (a world loaded with Bukkit.createWorld()). Why you don't want fix it?? An other user have created the code to fix it!

            People

            • Votes:
              21 Vote for this issue
              Watchers:
              16 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: