[Tutorial]Multiple selectable server.properties-files

Discussion in 'Resources' started by n0m0n, Nov 23, 2011.

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

    n0m0n

    Disclaimer: I couldn't decide the best place to post this, if any mod thinks it is in the wrong place, feel free to move it (or ask me to repost elsewhere).

    Purpose:
    I really like minecraft, especially playing it with my friends and most of the time I do this on a private server. I do however, not always won't to run the same world everytime I run the server.

    The easiest way to switch worlds afaik is by editing the parameter in the server.config file. However, I must confess I a a lazy person, and I figured there must be a simple way to just automate the process. I looked around the wikis and forums a bit, but when I didn't find anything published I figured it out myself.

    Description:
    The way I do this is by simply adding one line of code to the top of my batch-file, then copying and renaming the said file (editing that one line of code for each individual .bat).

    This simply copies the content of a file with any name and extension (I use .txt, since I like to use notepad as default editor) to the server.properties file.

    The process:
    1. Backup the content of your current server.properties (I named my backup CFG_WORLD.txt just because my default world was simply called 'World' and I find it easy this way)

    2. Copy that file and name the copy so you can identify it easy (I named this one CFG_NEWWORLD.txt).

    3. Edit your new config-file to your liking (I changed world=NewWorld and spawn-monsters=true). This step can be repeated if you want more than two alternative configs.

    4. Open your bukkit starter batchfile (.bat) in the text editor of your choice and add the highlighted line (note: your .bat might not look identical, but this deosn't matter much as long as the COPY line is placed before the java call to start the server):

      @ECHO OFF
      COPY /Y CFG_WORLD.txt server.properties
      SET BINDIR=%~dp0
      CD /D "%BINDIR%"
      "%ProgramFiles%\Java\jre7\bin\java.exe" -Xincgc -Xmx1536M -jar craftbukkit-1.0.0-SNAPSHOT.jar
      PAUSE


    5. Replace the blue file name with whatever you named your backup server.properties configruation file then save this new batch file with a name that makes it easy for you to identify (I named my first one BukkitWorld.bat).

    6. Copy and rename the .bat for each config file, replacing the blue filename for each alternative configruation file (for me CFG_NEWWORLD.txt.

    7. All done! By selecting which *.bat file you start bukkit with you will now load the defined configration file as server.properties. Note: running your default batch-file will now always load the most recent settings which is why we backed up the original settings.
    Final Notes:
    The COPY /Y FILE1.EXTENSION FILE2.EXTENSION batch-command works by copying file1 to file2 overwriting any previous file2 without prompting. It is as simple as that and works lightning fast so you won't notice any difference in loading time on your server.
     
    erasermaster likes this.
  2. Offline

    NuclearW

    Moved to a more appropriate forum.
     
  3. Offline

    n0m0n

    As I said in the top disclaimer in the original post; I don't mind you moving it, but how is this in any way related to plugin development? This subforum seems to make very close to no sense at all to me...
     
  4. Offline

    shadrxninga

    I agree with you , this isn't related to Plugin Development, but there isn't really a forum suited for it.
    The Bukkit Wiki is probably a better place to post tutorials like these. They will be seen by a lot more people over time as your thread won't get lost with all the other threads.
    http://wiki.bukkit.org/Main_Page
     
  5. Offline

    NuclearW

    I know, but this was the closes that I could find that suited this. I could perhaps move it to resources...
     
Thread Status:
Not open for further replies.

Share This Page