diff --git a/README b/README index b2fadd1..ffb5c18 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -Minecraft Land Generator version 1.6.0 Testing 12 +Minecraft Land Generator version 1.6.0 Testing 16 Updated November 4, 2011 @@ -24,11 +24,11 @@ Version History: Morlok8k: 1.6.0 -- TODO: add features - Added the ability to download files from the internet (specifically for the BuildID file, and conf file) - Added the ability to check what version the .jar is. (Using MD5 hashes, timestamps, and the BuildID file) -- Some Refactoring +- COde Refactoring - Code Formatting +- Code Optimization 1.5.1 - pr0f1x: Added the "save-all" command to be sent to the server before shutting it down. @@ -130,7 +130,8 @@ Other options: Outputs the current world's spawn point coordinates. java -jar MinecraftLandGenerator.jar -conf - Generates a MinecraftLandGenerator.conf file. + 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 diff --git a/bin/MLG-BuildID b/bin/MLG-BuildID index 1f39cb5..4269672 100644 --- a/bin/MLG-BuildID +++ b/bin/MLG-BuildID @@ -1,3 +1,4 @@ 919315DC465C9A821A857FCBE789C571=1320395554000#MLG v1.6.0 Testing 8 293A184EB26A62AE6D64CEB01BAD9537=1320399076000#MLG v1.6.0 Testing 11 4F00853101546B5C030F5D89036EC574=1320402115000#MLG v1.6.0 Testing 12 +E77F9F6977FA5BE75D81CA8E3584DCF8=1320404362000#MLG v1.6.0 Testing 16 diff --git a/bin/MinecraftLandGenerator.conf b/bin/MinecraftLandGenerator.conf index 1fd7ae4..234887f 100644 --- a/bin/MinecraftLandGenerator.conf +++ b/bin/MinecraftLandGenerator.conf @@ -1,6 +1,6 @@ -#Minecraft Land Generator Configuration File: Version: 1.6.0 Testing 8 +#Minecraft Land Generator Configuration File: Version: 1.6.0 Testing 16 #Authors: Corrodias, Morlok8k, pr0f1x -#Auto-Generated: Friday, November 4, 2011 at 1:53 AM Pacific Daylight Time +#Auto-Generated: Friday, November 4, 2011 at 3:59 AM Pacific Daylight Time #Line to run server: Java=java -Djava.awt.headless=true -Djline.terminal=jline.UnsupportedTerminal -Duser.language=en -Xms1024m -Xmx1024m -Xincgc -jar minecraft_server.jar nogui diff --git a/bin/MinecraftLandGenerator.jar b/bin/MinecraftLandGenerator.jar index 1797f2a..3d08a1e 100755 Binary files a/bin/MinecraftLandGenerator.jar and b/bin/MinecraftLandGenerator.jar differ diff --git a/src/corrodias/minecraft/landgenerator/Main.java b/src/corrodias/minecraft/landgenerator/Main.java index 995fc51..3043c9e 100644 --- a/src/corrodias/minecraft/landgenerator/Main.java +++ b/src/corrodias/minecraft/landgenerator/Main.java @@ -45,7 +45,7 @@ import org.jnbt.Tag; public class Main { // Version Number! - private static final String VERSION = "1.6.0 Testing 12"; + private static final String VERSION = "1.6.0 Testing 16"; private static final String AUTHORS = "Corrodias, Morlok8k, pr0f1x"; private static final String fileSeparator = System.getProperty("file.separator"); @@ -97,16 +97,20 @@ public class Main { private static String buildIDFile = "MLG-BuildID"; private static boolean isCompiledAsJar = false; private static String MLG_Current_Hash = null; + private static int inf_loop_protect_BuildID = 0; private static final String github_MLG_Conf_URL = "https://raw.github.com/Morlok8k/MinecraftLandGenerator/master/bin/MinecraftLandGenerator.conf"; private static final String github_MLG_BuildID_URL = "https://raw.github.com/Morlok8k/MinecraftLandGenerator/master/bin/MLG-BuildID"; - private static final String MinecraftLandGeneratorConf = "MinecraftLandGenerator.conf"; + ////// + private static final boolean testing = false; // a constant to display more output when debugging + ////// + // REMINDER: because I always forget/mix up languages: // "static" in java means "global" // "final" means "constant" @@ -124,6 +128,7 @@ public class Main { * * @author Corrodias, Morlok8k * @param args + * */ private void run(String[] args) { @@ -168,10 +173,12 @@ public class Main { // the arguments are apparently okay so far. parse the conf file. if (args[0].equalsIgnoreCase("-conf")) { - boolean fileSuccess = downloadFile(github_MLG_Conf_URL); - if (fileSuccess) { - System.out.println(MLG + MinecraftLandGeneratorConf + " file downloaded."); - return; + if (args[0].equalsIgnoreCase("download")) { + boolean fileSuccess = downloadFile(github_MLG_Conf_URL); + if (fileSuccess) { + System.out.println(MLG + MinecraftLandGeneratorConf + " file downloaded."); + return; + } } try { @@ -1195,11 +1202,11 @@ public class Main { + "Morlok8k:" + newLine + newLine + "1.6.0" + newLine - + "- TODO: add features" + newLine //TODO + "- Added the ability to download files from the internet (specifically for the BuildID file, and conf file)" + newLine + "- Added the ability to check what version the .jar is. (Using MD5 hashes, timestamps, and the BuildID file)" + newLine - + "- Some Refactoring" + newLine + + "- COde Refactoring" + newLine + "- Code Formatting" + newLine + + "- Code Optimization" + newLine + newLine + "1.5.1" + newLine + "- pr0f1x: Added the \"save-all\" command to be sent to the server before shutting it down." + newLine @@ -1382,20 +1389,15 @@ public class Main { */ public static void buildID() { - // TODO: Decide to download BuildID from Github. - + // download BuildID from Github. boolean fileSuccess = downloadFile(github_MLG_BuildID_URL); if (fileSuccess) { System.out.println(MLG + buildIDFile + " file downloaded."); - } + } // If not available, create. // After downloading, check to see if it matches hash. - // example: - // downloadFile(MinecraftLandGeneratorConfURL); - // downloadFile("https://raw.github.com/Morlok8k/MinecraftLandGenerator/master/bin/" + buildIDFile); - if (MLGFileName == null) { try { MLGFileName = getClassLoader(cls); @@ -1488,6 +1490,12 @@ public class Main { */ private void readBuildID() { + if (inf_loop_protect_BuildID > 10) { + MLG_Last_Modified_Date = new Date(new Long(0)); //set the day to Jan 1, 1970 for failure + return; + } + inf_loop_protect_BuildID++; // this is to prevent an infinite loop (however unlikely) + if (MLGFileName == null) { try { MLGFileName = getClassLoader(cls); @@ -1548,7 +1556,6 @@ public class Main { // System.out.println("[DEBUG] FoundLine False"); buildID(); readBuildID(); // yes I'm calling the function from itself. potential infinite loop? possibly. I haven't encountered it yet! - // TODO: Add safeguard to prevent Infinite Loops return; } } catch (Exception e) { @@ -1556,7 +1563,6 @@ public class Main { // e.printStackTrace(); buildID(); readBuildID(); - // TODO: Add safeguard to prevent Infinite Loops return; } @@ -1700,7 +1706,8 @@ public class Main { + " Outputs the current world's spawn point coordinates." + newLine + newLine + " java -jar MinecraftLandGenerator.jar -conf" + newLine - + " Generates a "+ MinecraftLandGeneratorConf + " file." + newLine + + " java -jar MinecraftLandGenerator.jar -conf download" + newLine + + " Generates or downloads a "+ MinecraftLandGeneratorConf + " file." + newLine + newLine + " java -jar MinecraftLandGenerator.jar -readme readme.txt" + newLine + " java -jar MinecraftLandGenerator.jar -readme" + newLine