GithubHelp home page GithubHelp logo

morlok8k / minecraftlandgenerator Goto Github PK

View Code? Open in Web Editor NEW
97.0 8.0 21.0 6.79 MB

Pregenerate Land in a SMP Minecraft Server

Home Page: http://www.minecraftforum.net/topic/187737-minecraft-land-generator/

License: Do What The F*ck You Want To Public License

Shell 12.14% Java 84.30% Batchfile 3.56%

minecraftlandgenerator's Introduction

Minecraft Land Generator version 1.7.6

Updated January 19, 2015
(BuildID: 1421666774000)

Original Code by Corrodias		November 2010
Enhanced Code by Morlok8k		Feb. 2011 to Now (or at least to January 19, 2015!)
Additional Code by pr0f1x		October 2011
Additional Code/Idea by jaseg    August 2012
Additional Code by Gallion       January 2015

Website: https://sites.google.com/site/minecraftlandgenerator/
Forum: http://www.minecraftforum.net/topic/187737-
Source: https://github.com/Morlok8k/MinecraftLandGenerator

-----------------------------------------------

This program lets you generate an area of land with your Minecraft SMP server (and is prossibly future-proof for newer versions). You set up your java command line and minecraft server paths in the MinecraftLandGenerator.conf file, set up the server's server.properties file with the name of the world you wish to use, and then run this program.
When a Minecraft server is launched, it automatically generates chunks within a square area of 25x25 chunks (400x400 blocks), centered on the current spawn point (formally 20x20 chunks, 320x320 blocks). When provided X and Z ranges as arguments, this program will launch the server repeatedly, editing the level.dat file between sessions, to generate large amounts of land without players having to explore them. The generated land will have about the X and Z ranges as requested by the arguments, though it will not be exact due to the spawn point typically not on the border of a chunk. (Because of this, MLG by default adds a slight overlap with each pass - 380x380 blocks) You can use the -x and -z switches to override the spawn offset and center the land generation on a different point.
The program makes a backup of level.dat as level_backup.dat before editing, and restores the backup at the end. In the event that a level_backup.dat file already exists, the program will refuse to proceed, leaving the user to determine why the level_backup.dat file exists and whether they would rather restore it or delete it, which must be done manually.

This program is free, and the source code is included in the .jar file.  (If accidently missing, like in 1.3.0 and 1.4.0, it is always available at Github.)

Copyright © 2010
This work is free. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.

The JNBT library is included (inside the .jar). It is not public domain. Its license is included, as LICENSE.TXT.
It is also available at: http://jnbt.sourceforge.net/ (Original) and at: https://github.com/Morlok8k/JNBT (Current)

The "unescape" method/function is also not Public Domain.  Its License is the W3C© Software License, and located here: http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
Other Public Domain code has been used in this program, and references to sources are included in the comments of Minecraft Land Generator's source code.
-----------------------------------------------

Usage: java -jar MinecraftLandGenerator.jar x z [serverpath] [switches]

Arguments:
              x : X range to generate
              z : Z range to generate
     serverpath : the path to the directory in which the server runs (takes precedence over the config file setting)

Switches:
       -verbose : causes the application to output the server's messages to the console
             -v : same as -verbose
             -w : Ignore [WARNING] and [SEVERE] messages.
           -alt : alternate server launch sequence
             -a : same as -alt
        -nowait : don't pause for anything
             -n : same as -nowait
            -i# : override the iteration spawn offset increment (default 380) (example: -i100)
            -x# : set the X offset to generate land around (example: -x0 or -x1000 or -x-500)
            -z# : set the Z offset to generate land around (example: -z0 or -z1000 or -z-500)

Other options:
  java -jar MinecraftLandGenerator.jar -update
        Checks for and downloads new versions of MLG online.

  java -jar MinecraftLandGenerator.jar -printspawn
  java -jar MinecraftLandGenerator.jar -ps
        Outputs the current world's spawn point coordinates.

  java -jar MinecraftLandGenerator.jar -conf
  java -jar MinecraftLandGenerator.jar -conf download
        Generates or downloads a MinecraftLandGenerator.conf file.

  java -jar MinecraftLandGenerator.jar -readme readme.txt
  java -jar MinecraftLandGenerator.jar -readme
        Generates a readme file using supplied name or the default _MLG_Readme.txt

  java -jar MinecraftLandGenerator.jar -downloadfile http://example.com/file.txt
        Downloads whatever file from the internet you give it.
  java -jar MinecraftLandGenerator.jar -downloadlist list.txt
        list.txt (or any other file) contains a URL on each line which will be downloaded.

  java -jar MinecraftLandGenerator.jar -version
  java -jar MinecraftLandGenerator.jar -help
  java -jar MinecraftLandGenerator.jar /?
        Prints this message.

When launched with the -conf switch, this application creates a MinecraftLandGenerator.conf file that contains configuration options.
If this file does not exist or does not contain all required properties, the application will not run.

MinecraftLandGenerator.conf properties:
           Java : The command line to use to launch the server
     ServerPath : The path to the directory in which the server runs (can be overridden by the serverpath argument)
      Done_Text : The output from the server that tells us that we are done
 Preparing_Text : The output from the server that tells us the percentage
Preparing_Level : The output from the server that tells us the level it is working on
        Level-0 : Name of Level 0: The Overworld
        Level-1 : Name of Level 1: The Nether
        Level-2 : Name of Level 2: The End
        Level-3 : Name of Level 3: (Future Level)
        Level-4 : Name of Level 4: (Future Level)
        Level-5 : Name of Level 5: (Future Level)
        Level-6 : Name of Level 6: (Future Level)
        Level-7 : Name of Level 7: (Future Level)
        Level-8 : Name of Level 8: (Future Level)
        Level-9 : Name of Level 9: (Future Level)
       WaitSave : Optional: Wait before saving.

-----------------------------------------------

Version History:
Morlok8k:
1.7.6
- Gallion: fixed null world name (minor bug) 
- Morlok8k: fixed elua bug
1.7.5
- Added "save-all" to alternate mode 
- Added fix for new style of java error messages
1.7.4
- Released Minecraft land Generator under the WTFPL.  (With the permission of Corrodias)
1.7.3
- Fixed a minor display bug (specifically when using Server Generation Fix Mod)
- Updated Readme text a bit.
1.7.2
- Fixed "1152 bug"
- Updated to JNBT 1.3
- adjusted archive integrity check to account for timezone-related bugs...
1.7.1
- Major Code Refactoring
- Updated to JNBT 1.2
- making code ready for a GUI
1.7.0
- Major Code Optimization
- Drastically reduced the amount of time it takes for MLG to expand a world after it has already done so before!
  (To do this, I rewrote the Main loop of the program, and add my own Coordinate object)
- Added Resume Functionality
- Updated Time Output yet again.
- Made xx% output nicer by rewriting previous existing line.
- Misc. Tweaks
- Misc. Additions
1.6.3
- Minor Code Optimization
- Finely got on the ball and added the JNBT source and everything (as an internal .zip) to be completely faithful to his license
- Also adding script files internally in the .jar for archive (or offline) purposes. (Manual Extract needed for use)
- Modified output of MLG slightly to show whats the server and whats MLG. (I may do more with this later.)
1.6.2
- Major Code Optimization
- Updated Time Output again.  Now says "1 Minute" instead of "1 Minutes".
- Updated Location Code - the center of the square is now truely centered, and it trys to get as close to the given size as possible.
- Added "-nowait" and its shorter version "-n"
- Added currently non-functional RCON code.  Will try to make functional in the future.

1.6.11
- Removed End-of-Generation ASCII-Graphic - It didn't really fit with MLG.
- Updated Time Output.
- Changed estimated time remaining to count all runs, not just the last four.
- Added the time it took to complete at the end of generation.

1.6.1
- Added some modifications for scripting  (Mainly for a new Initial setup script)
- Changed MLG's Y to Z.  Now it matches Minecraft.  Y in the game is Height.
- Renamed -y switch to -z.  MLG will remain backwards compatible if you use the old -y switch.
- Updated -printspawn to show X,Y,Z
- Added End-of-Generation ASCII-Graphic
- Slightly altered some text output

1.6.05
- MLG displays if the server is converting the Map format, when not in verbose mode. (McRegion -> Anvil, or Chunk-File -> McRegion)
- Minor fixes/edits/typos
- Added link to new MLG website to readme file
1.6.03
- added decoding of escape characters of URL's (so a space is a " " and not "%20")
- added "-downloadlist [list]" where [list] is a text file with URL's on each line

1.6.02
- small fix on caculating md5sum where old version didnt pad out to 32chars with zeros on the left side- quick Archive intergity fix after injecting source code into .jar after it compiled.- no new functionality, md5 issue doesnt affect -update on old versions.
1.6.0
- NOW DOES NOT NEED ANY SCRIPT FILES!
- Added the ability to download files from the internet
- Added a switch to download any file off the internet, if needed (useless for most people, but included it in case I wanted it in the future.)
- Added the ability to check what version the .jar is. (Using MD5 hashes, timestamps, and the BuildID file)
- Added "-update" to download new versions of MLG directly from github.
- Updated estimated time.  Now shows up on loop 2+ instead of loop 4+.
- Standard % output of the Server should look nicer now.
- Code Refactoring
- Code Formatting
- Code Optimization
- Duplicate sections of code have been turned into Methods/"Functions"

1.5.1
- pr0f1x: Added the "save-all" command to be sent to the server before shutting it down.
- pr0f1x: Added a 40 second wait before shutting down.
- Morlok8k: Made 40 second wait optional.
- Morlok8k: Changed the Dimensions code.  (I had assumed it would be DIM-1, DIM-2, etc.  but it turned out to be DIM-1 and DIM1. Change reflects Server output of "Level n")
- Morlok8k: Config file is automatically updated to reflect these changes.
- Morlok8k: Cleaned up code.

1.5.0
- Supports Server Beta 1.6.4 (& hopefully future versions as well, while remaining backward compatible.)
- Added "-a","-alt" to use alternate method (a slightly simplier version of 1.3.0's code - pure verbose only)
- Added world specific output for 9 dimensions (DIM-1 is the Nether, DIM-2 through DIM-9 dont exist yet, but if and when they do, you can configure it's text).  ("Level 0", the default world, is displayed as the worlds name)
- Updated Config File for these Dimensions.
- Reads and outputs the Seed to the output. (If you had used text for the Seed, Minecraft converts it into a number. This outputs the number.)
- Changed the default 300 blocks to 380.  The server now makes a 400x400 square block terrain instead of 320x320.  Thus it is faster because there are less loops.  To use the old way, use "-i300"
- Added total Percentage done (technically, it displays the % done once the server finishes...)
- Added debugging output vars of conf file (disabled - need to re-compile source to activate)

		+ (the goal is to have MLG be configureable, so it can work on any version of the server, past or present.)

*** 1.4.5 (pre 1.5.0) ***
- sorry!  I shouldn't release untested code...
*************************

1.4.4
- Added ablilty to ignore [WARNING] and [SEVERE] errors with "-w"

1.4.3
- Fixed "-ps","-printspawn" as I had forgot I had broken it in 1.4.0 - due to config file change.

1.4.2
- No New Features
- Changed non-verbose mode to display server progress on the same line, saving a lot of space.
	- This couldn't wait for 1.5.0 ...  I (Morlok8k) liked it too much.

1.4.0
- Future Proofing
- Configurble Server Message reading. (If server updates and breaks MLG, you can add the new text!)
- Updated config file, and auto updating from old format.
- Added % of spawn area to non-verbose output.
- Removed datetime stamps from server output in verbose mode
- Other Misc fixes.

1.3.0
- Fixed Problems with Minecraft Beta 1.3 -- Morlok8k

-----------------------------------------------

Corrodias:
1.2.0
- land generation now centers on the spawn point instead of [0, 0]
- the server is launched once before the spawn point is changed, to verify that it can run and to create a world if one doesn't exist
- added -printspawn [-ps] switch to print the current spawn coordinates to the console
- added -x and -y switches to override the X and Y offsets
- added -v switch, does the same as -verbose
- improved status message spacing to make things easier to read
- improved time estimation algorithm: it now averages the last 3 launches

1.1.0
- added MinecraftLandGenerator.conf file to hold the java command line and the server path
- added -conf solo switch to generate a .conf file
- added -verbose switch to output server output to the console (default is to ignore it)
- added -i switch to allow customizing the block increment size (default is 300)
- added instructions output in this version, i think
- improved status message output to include current iteration and total iterations

1.0.0
- initial release

-----------------------------------------------

Notes:
Due to changes in server beta 1.6, it now generates the nether as well as the world at the same time.
However, Since beta 1.9 and Minecraft 1.0, the nether or the end is no longer generated.
The "Server Generation Fix Mod" by Morlok8k can generate The Nether and The End.  Link: http://www.minecraftforum.net/topic/1378775-

I recommend using MCEDIT to relight the map after you generate it. This will take a long time, but should fix all those incorrectly dark spots in your level.

minecraftlandgenerator's People

Contributors

f-unk avatar gallion avatar morlok8k avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

minecraftlandgenerator's Issues

Generator Won't Run on 1.17.1 world - "SEVERE: Invalid level format."

So, I have a server being setup for my kids and their friends. Naturally, I figured I would pre-generate a large chunk of the terrain, so I came here, as I have in previous years.

The problem is now, with a vanilla 1.17.1 server, I only get errors when trying to run MLG. To start, I loaded the server from the terminal, then I logged in, set the world spawn, and logged out, figuring that should be enough to get MLG started with:

[14:07:24 INFO]: EvilSupahFly joined the game
[14:07:24 INFO]: EvilSupahFly[/127.0.0.1:35876] logged in with entity id 546 at ([SMP Of The Bee]224.5, 146.0, -223.5)
[14:07:57 INFO]: EvilSupahFly issued server command: /gamemode creative
[14:07:57 INFO]: [EvilSupahFly: Set own game mode to Creative Mode]
[14:09:57 INFO]: EvilSupahFly issued server command: /setworldspawn
[14:09:57 INFO]: [EvilSupahFly: Set the world spawn point to 379, 68, -113 [0.0]]
[14:11:30 INFO]: EvilSupahFly lost connection: Disconnected
[14:11:30 INFO]: EvilSupahFly left the game

Then I loaded MLG with basic starting instructions, but it fails every time. The first time, I got this:

evilsupahfly on black-beast Sun Dec 05 02:19 PM
[~/mc_server] $ java -jar MinecraftLandGenerator.jar 2000 2000 -i200 -x379 -z-113
[MLG] Minecraft Land Generator version 1.7.6
[MLG] BuildID: (1421666774000)
[MLG] This version was last modified on Monday, January 19, 2015 at 6:26 AM, Eastern Standard Time
[MLG] 
[MLG] Uses a Minecraft server to generate square land of a specified size.
[MLG] 
[MLG] 
[MLG] Notice: Non-Default Increment: 200
[MLG] Notice: X Offset: 379
[MLG] Notice: Z Offset: -113
[MLG] Processing world "./SMP Of The Bee", in 200 block increments, with: java -Djava.awt.headless=true -Djline.terminal=jline.UnsupportedTerminal -Duser.language=en -Xms1024m -Xmx1024m -Xincgc -jar server.jar nogui
[MLG] 
[MLG] 
[MLG] Backing up level.dat to level_backup.dat.
[MLG] 
Dec. 05, 2021 2:24:20 P.M. morlok8k.MinecraftLandGenerator.Main runCLI
SEVERE: Invalid level format.
java.io.IOException: Invalid level format.
	at morlok8k.MinecraftLandGenerator.SpawnPoint.getSpawn(SpawnPoint.java:77)
	at morlok8k.MinecraftLandGenerator.Main.runCLI(Main.java:207)
	at morlok8k.MinecraftLandGenerator.Main.main(Main.java:132)

evilsupahfly on black-beast Sun Dec 05 02:24 PM
[~/mc_server] $ 

On all subsequent attempts, there's two extra lines in the terminal, which makes sense, given the initial failure:

[MLG-ERROR] There is a level_backup.dat file left over from a previous attempt that failed.
[MLG] Resuming...

Does MLG not work with newer versions of Minecraft?

This code is broken

This is just my personal opinion. I started refactoring and rewriting your code, but I gave up. I will write a similar program from scratch (just not in java).
Here a list of Issues I found with your code (except for the ones for which I already submitted github issues), so you can improve:

  • A lot of variable names are upper case. In Java, it is convention to write variables in a camelCase beginning with a lower case letter.
  • A lot of constants are mixed_CASE. In Java, it is convention to use UPPER_CASE for any constants.
  • You use a lot of static methods, some of which access global variables in other classes. Java is strongly object oriented and I consider this really bad style. A static function is one that only accesses vm-wide stuff like the standard input. Anything requiring state beyond what you can manage with a return value and some params ought to be a member variable of some class.
  • You use distribute compiled stuff in a git repository, the correct place for jars and zips is the "downloads" section of your project's github page.
  • You do a lot of parsing the hard way, using manual string manipulation. A lot of that stuff would be way easier with some regular expressions thrown in. You may have a look at the "Coordinate.parseString" method in my fork of the repository to see how you could do it.
  • You keep unfinished code in the master branch. I am writing about that "rcon" feature. Since you use git, the appropriate place for such an unused, yet-in-development file is a separate branch.
  • I think that whole "upate" feature is not only useless, but harmful. On some platforms (like most linux distributions) you already have an automatic update function for software in the form of a full-blown package manager. Similar software even exists on other platforms: MacOS has homebrew, and M$ Windows has some msi-based tool coupled to the automatic system updater (I do not know how they call that, though). These tools will be more stable, more secure and better maintained than any of the thousands of self-made tools that evolve around every other project.
  • Since the addition of a /tp (teleport) command accepting coordinates with Minecraft 1.3 your code pretty much became obsolete, since now this reading-and-writing of map files coupled with repeated server restarts is a ridiculous way of doing the task.
  • You do the config parsing yourself. You could instead use one of the many quick ways of doing this the java platform provides you with, the easiest being a simple java .properties file. Have a look at http://commons.apache.org/configuration/
  • You include a custom implementatino of url encoding. You could just have used java.net.URLEncoder (http://docs.oracle.com/javase/1.5.0/docs/api/java/net/URLEncoder.html)

This is not meant as an insult or rant, I just want to encourage you to improve your coding skills!
thanks for your time,
jaseg

PS: One positive thing I want to note: You used https for the data transfer from github, so at least the update function is more or less secure against evildoers in teh internetz.

1.7.1 doesn’t work with 13w09c

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/jnbt/Tag : Unsupported major.minor version 51.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at morlok8k.MinecraftLandGenerator.Main.runCLI(Main.java:493)
    at morlok8k.MinecraftLandGenerator.Main.main(Main.java:120)

No such problem in 1.7.0. Will be using 1.7.0, but you might want to remove version checks to be future-proof.

Nether generation

Less of an issue, more of a question – is there any way to ask MLG to pre-generate the Nether? I know that it can be done with Bukkit and plugins, but I specifically use MLG on every vanilla test map, after a point-release of Minecraft is out… and I cannot pregen Nether on previous Bukkit because of Nether Quartz.

Is there anything that could be done to force Nether generation other than me flying around the Nether and loading chunks before I let 60 people in?

"[MLG-ERROR] Error in program arguments." when using MLG for anything other than generating worlds

During the setup I read that there was an error in program arguments and at the end, minecraft server wasn't launched.

Here's the output from MLG_Initial_Setup_Windows.cmd:

Click to expand

Minecraft Land Generator - Initial Setup - Windows
C:\Users\Enko\MinecraftLandGenerator_1.7.6_Vanilla_Server
[MLG] Minecraft Land Generator version 1.7.6
[MLG] BuildID: (1421666774000)
[MLG] This version was last modified on Monday, January 19, 2015 at 5:26 AM, Central Standard Time
[MLG]
[MLG] Uses a Minecraft server to generate square land of a specified size.
[MLG]
[MLG]
[MLG] Notice: Not waiting for anything...
[MLG] MLG-BuildID file downloaded.
[MLG] Archive Intergrity Check Passed. Offset: 7208sec.
[MLG-ERROR] Error in program arguments.
[MLG] Minecraft Land Generator version 1.7.6
[MLG] BuildID: (1421666774000)
[MLG] This version was last modified on Monday, January 19, 2015 at 5:26 AM, Central Standard Time
[MLG]
[MLG] Uses a Minecraft server to generate square land of a specified size.
[MLG]
[MLG]
[MLG] Notice: Not waiting for anything...
[MLG] _MLG_Readme.txt file created.
[MLG-ERROR] Error in program arguments.
[MLG] Minecraft Land Generator version 1.7.6
[MLG] BuildID: (1421666774000)
[MLG] This version was last modified on Monday, January 19, 2015 at 5:26 AM, Central Standard Time
[MLG]
[MLG] Uses a Minecraft server to generate square land of a specified size.
[MLG]
[MLG]
[MLG] Notice: Not waiting for anything...
[MLG] Downloading: https://raw.github.com/Morlok8k/MinecraftLandGenerator/master/scripts/MLG_Update_Files_Windows.txt
[MLG] Saving as: MLG_Update_Files_Windows.txt
[MLG] **
[MLG] 1369 byte(s) copied
[MLG] Elapsed Time: 1 Second
[MLG] Done
[MLG] Downloading: https://raw.github.com/Morlok8k/MinecraftLandGenerator/master/scripts/MLG_Update_Files.txt
[MLG] Saving as: MLG_Update_Files.txt
[MLG] ***
[MLG] 2928 byte(s) copied
[MLG] Elapsed Time: 0 Seconds
[MLG] Done
[MLG] Downloading: https://raw.github.com/Morlok8k/MinecraftLandGenerator/master/scripts/Run_MLG_Windows.cmd
[MLG] Saving as: Run_MLG_Windows.cmd
[MLG] **
[MLG] 760 byte(s) copied
[MLG] Elapsed Time: 0 Seconds
[MLG] Done
[MLG] Downloading: https://raw.github.com/Morlok8k/MinecraftLandGenerator/master/scripts/Run_Server_Windows.cmd
[MLG] Saving as: Run_Server_Windows.cmd
[MLG] **
[MLG] 865 byte(s) copied
[MLG] Elapsed Time: 0 Seconds
[MLG] Done
[MLG] Downloading: https://raw.github.com/Morlok8k/MinecraftLandGenerator/master/scripts/Update_MLG_Windows.cmd
[MLG] Saving as: Update_MLG_Windows.cmd
[MLG] **
[MLG] 833 byte(s) copied
[MLG] Elapsed Time: 0 Seconds
[MLG] Done
[MLG] Downloading: https://raw.github.com/Morlok8k/MinecraftLandGenerator/master/scripts/Update_Server_Windows.cmd
[MLG] Saving as: Update_Server_Windows.cmd
[MLG] **
[MLG] 863 byte(s) copied
[MLG] Elapsed Time: 0 Seconds
[MLG] Done
[MLG] Downloading: https://raw.github.com/Morlok8k/MinecraftLandGenerator/master/scripts/Update_MLG_Extra_Files_Windows.cmd
[MLG] Saving as: Update_MLG_Extra_Files_Windows.cmd
[MLG] **
[MLG] 820 byte(s) copied
[MLG] Elapsed Time: 0 Seconds
[MLG] Done
[MLG] Downloading: https://raw.github.com/Morlok8k/MinecraftLandGenerator/master/scripts/Update_MLG_Extra_Files_All-OS_Windows.cmd
[MLG] Saving as: Update_MLG_Extra_Files_All-OS_Windows.cmd
[MLG] **
[MLG] 819 byte(s) copied
[MLG] Elapsed Time: 0 Seconds
[MLG] Done
[MLG] Downloading: https://raw.github.com/Morlok8k/MinecraftLandGenerator/master/scripts/MLG_Printspawn_Windows.cmd
[MLG] Saving as: MLG_Printspawn_Windows.cmd
[MLG] **
[MLG] 776 byte(s) copied
[MLG] Elapsed Time: 0 Seconds
[MLG] Done
[MLG] Downloading: https://raw.github.com/Morlok8k/MinecraftLandGenerator/master/scripts/MLG_Initial_Setup_Linux.sh
[MLG] Saving as: MLG_Initial_Setup_Linux.sh
[MLG] **
[MLG] 1831 byte(s) copied
[MLG] Elapsed Time: 0 Seconds
[MLG] Done
[MLG] Downloading: https://raw.github.com/Morlok8k/MinecraftLandGenerator/master/scripts/MLG_Initial_Setup_Mac.command
[MLG] Saving as: MLG_Initial_Setup_Mac.command
[MLG] **
[MLG] 1845 byte(s) copied
[MLG] Elapsed Time: 0 Seconds
[MLG] Done
[MLG] Downloading: https://raw.github.com/Morlok8k/MinecraftLandGenerator/master/scripts/MLG_Initial_Setup_Windows.cmd
[MLG] Saving as: MLG_Initial_Setup_Windows.cmd
[MLG] **
[MLG] 1207 byte(s) copied
[MLG] Elapsed Time: 0 Seconds
[MLG] Done
[MLG] Downloading: https://raw.github.com/Morlok8k/MinecraftLandGenerator/master/scripts/eula.txt
[MLG] Saving as: eula.txt
[MLG] **
[MLG] 11 byte(s) copied
[MLG] Elapsed Time: 0 Seconds
[MLG] Done
[MLG] Downloading: https://raw.github.com/Morlok8k/MinecraftLandGenerator/master/scripts/server.properties
[MLG] Saving as: server.properties
[MLG] **
[MLG] 119 byte(s) copied
[MLG] Elapsed Time: 0 Seconds
[MLG] Done
[MLG-ERROR] Error in program arguments.
[MLG] Minecraft Land Generator version 1.7.6
[MLG] BuildID: (1421666774000)
[MLG] This version was last modified on Monday, January 19, 2015 at 5:26 AM, Central Standard Time
[MLG]
[MLG] Uses a Minecraft server to generate square land of a specified size.
[MLG]
[MLG]
[MLG] Notice: Not waiting for anything...
[MLG] Downloading: https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar
[MLG] Saving as: minecraft_server.jar
[MLG] *******************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
[MLG] 2360903 byte(s) copied
[MLG] Elapsed Time: 2 Seconds
[MLG] Done
[MLG-ERROR] Error in program arguments.
[MLG] Minecraft Land Generator version 1.7.6
[MLG] BuildID: (1421666774000)
[MLG] This version was last modified on Monday, January 19, 2015 at 5:26 AM, Central Standard Time
[MLG]
[MLG] Uses a Minecraft server to generate square land of a specified size.
[MLG]
[MLG]
[MLG] Notice: Not waiting for anything...
[MLG] MinecraftLandGenerator.conf file created.
[MLG-ERROR] Error in program arguments.
[MLG] Minecraft Land Generator version 1.7.6
[MLG] BuildID: (1421666774000)
[MLG] This version was last modified on Monday, January 19, 2015 at 5:26 AM, Central Standard Time
[MLG]
[MLG] Uses a Minecraft server to generate square land of a specified size.
[MLG]
[MLG]
[MLG] Notice: Not waiting for anything...
[MLG] Notice: Warnings from Server are Ignored
[MLG-ERROR] The currently configured world does not exist! Launching the server once to create it...
[Server] Starting minecraft server version 1.5.2
Terminate batch job (Y/N)? n
The system cannot find the file specified.

Aggressive force-stop issue with [WARNING] lines in log

Server version: 0.2.1 for Minecraft Alpha 1.1.2

When server is set to online-mode=false (auth servers no longer work!), MLG force-stops because it finds a warning in the log output.

Two issues at hand:

  1. A non-critical warning shuts down MLG (to prevent damage - but there should be a way to exempt this warning
  2. Since the server writes 4 lines with [WARNING], MLG tries to stop the server FOUR times in the same run.

Good first issue

  1. Make a whitelist of warnings
  2. Only send the stop/save-all command ONCE per run, not every time there's a new [WARNING] line.
[Server] Starting minecraft server version 0.2.1
[MLG]
[MLG] Warning found: Stopping Minecraft Land Generator
[Server] 2019-04-21 21:17:01 [WARNING] **** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!
[MLG]
[MLG] Forcing Save...
[MLG]
[MLG] Warning found: Stopping Minecraft Land Generator
[Server] 2019-04-21 21:17:01 [WARNING] The server will make no attempt to authenticate usernames. Be
ware.
[MLG]
[MLG] Forcing Save...
[MLG]
[MLG] Warning found: Stopping Minecraft Land Generator
[Server] 2019-04-21 21:17:01 [WARNING] While this makes the game possible to play without internet a
ccess, it also opens up the ability for hackers to connect with any username they choose.
[MLG]
[MLG] Forcing Save...
[MLG]
[MLG] Warning found: Stopping Minecraft Land Generator
[Server] 2019-04-21 21:17:01 [WARNING] To change this, set "online-mode" to "true" in the server.set
tings file.
[MLG]
[MLG] Forcing Save...
[MLG] 95%...
[Server] Done
[MLG] Saving server data...
[MLG] Stopping server...  (Please Wait...)

Server.log:

2019-04-21 21:17:01 [INFO] Starting minecraft server version 0.2.1
2019-04-21 21:17:01 [INFO] Loading properties
2019-04-21 21:17:01 [INFO] Starting Minecraft server on *:25565
2019-04-21 21:17:01 [WARNING] **** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!
2019-04-21 21:17:01 [WARNING] The server will make no attempt to authenticate usernames. Beware.
2019-04-21 21:17:01 [WARNING] While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.
2019-04-21 21:17:01 [WARNING] To change this, set "online-mode" to "true" in the server.settings file.
2019-04-21 21:17:01 [INFO] Preparing level "world"
2019-04-21 21:17:01 [INFO] Preparing start region
2019-04-21 21:17:01 [INFO] Done! For help, type "help" or "?"
2019-04-21 21:17:01 [INFO] CONSOLE: Forcing save..
2019-04-21 21:17:01 [INFO] CONSOLE: Save complete.
2019-04-21 21:17:01 [INFO] CONSOLE: Stopping the server..
2019-04-21 21:17:01 [INFO] CONSOLE: Stopping the server..
2019-04-21 21:17:01 [INFO] CONSOLE: Forcing save..
2019-04-21 21:17:01 [INFO] CONSOLE: Save complete.
2019-04-21 21:17:01 [INFO] CONSOLE: Stopping the server..
2019-04-21 21:17:01 [INFO] CONSOLE: Stopping the server..
2019-04-21 21:17:01 [INFO] CONSOLE: Forcing save..
2019-04-21 21:17:01 [INFO] CONSOLE: Save complete.
2019-04-21 21:17:01 [INFO] CONSOLE: Stopping the server..
2019-04-21 21:17:01 [INFO] CONSOLE: Stopping the server..
2019-04-21 21:17:01 [INFO] CONSOLE: Forcing save..
2019-04-21 21:17:01 [INFO] CONSOLE: Save complete.
2019-04-21 21:17:01 [INFO] CONSOLE: Stopping the server..
2019-04-21 21:17:01 [INFO] CONSOLE: Stopping the server..
2019-04-21 21:17:01 [INFO] CONSOLE: Forcing save..
2019-04-21 21:17:01 [INFO] CONSOLE: Save complete.
2019-04-21 21:17:01 [INFO] CONSOLE: Stopping the server..
2019-04-21 21:17:01 [INFO] Stopping server
2019-04-21 21:17:01 [INFO] Saving chunks

Custom server path does not work

Usage: java -jar MinecraftLandGenerator.jar x z [serverpath] [switches]
serverpath : the path to the directory in which the server runs (takes precedence over the config file setting)

Config:
ServerPath=.

The [serverpath] doesn't seem to work from command line. MLG checks for server.properties file with the path from config disregarding the startup argument.

Tried with:
java -jar MinecraftLandGenerator.jar 15000 15000 folderA -i1024 -x-15000 -z-15000
and ./folderA/, folderA/ and C:/folderA/ - no success.

MLG violates multiple java naming conventions

The packages are not named according to the Java Language Specification. Instead of morlok8k.minecraft.landgenerator and corrodias.minecraft.landgenerator it should rather be something like com.github.morlok8k.minecraft.landgenerator (according to the JLS Section 6.1 the package name should begin with just a reversed domain name of the software's author, in this case the github user subdomains would be an option).
Furthermore the division between morlok8k.minecraft.landgenerator and corrodias.minecraft.landgenerator seems pretty arbitrary and unnecessary to me.

Most of the class names start with MLG_ which is unnecessary since java got packages. Time, Update and SelfAware would be OK.

Major design changes

I'd like to implement a few changes to make this little project a more mature tool and easier to use. Things that could be improved IMO:

  • Use Maven for dependency management
  • Make it usable as library
  • Proper logging system
  • Proper CLI argument parsing using library
  • Make use of Java name conventions
  • Change license to a more accepted public domain license (like Unlicense or CC0)
  • Make use of the GitHub release system for distributing the software

What do you think?

MLG_Readme_and_Helpinfo.java has a broken name and is wrong

Apart from the uncommon naming scheme, MLG_Readme_and_Helpinfo.java does some very strange things. One would normally do what this method does with a small bash script invoking sed and a template file, the bash script being executed as needed and not compiled into the program.

String Index out of range

I'm not sure if this is still active or not. But figured I would post anyway

I get this error with every server I try this on. Let me know if you need more information.

Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -77
at java.lang.String.substring(String.java:1967)
at morlok8k.MinecraftLandGenerator.Server.runMinecraft(Server.java:200)
at morlok8k.MinecraftLandGenerator.Main.runCLI(Main.java:181)
at morlok8k.MinecraftLandGenerator.Main.main(Main.java:132)

Basically, MLG worked perfectly on a heavily modded 1.10.2 server. About two weeks after that, I tried it again using the exact same settings on a new version of that pack. I've tried it on a couple of other packs since, not sure what the issue is but this always happens.

Thoughts?

THIS_IS_THE_SOURCE_CODE.txt not really up to date

The file THIS_IS_THE_SOURCE_CODE.txt doesn't really fit the current upload system. At the moment, the downloads are hosted in /zip/ inside the GitHub project, while the file tells there available at the download page. I was already aware of that, but some people might go to the download page and be like "wtf there's nothing here" and end up completely confused, so it would probably be a good idea to update that.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.