diff --git a/README b/README index e645c1d..1c3c2a3 100644 --- a/README +++ b/README @@ -1,6 +1,6 @@ -Minecraft Land Generator version 1.6.03 +Minecraft Land Generator version 1.6.05 -Updated February 3, 2012 +Updated March 5, 2012 Original Code by Corrodias November 2010 Enhanced Code by Morlok8k Feb. 2011 to Now (or at least to the date listed above!) diff --git a/bin/MLG-BuildID b/bin/MLG-BuildID index 59ce3ca..b97db99 100644 --- a/bin/MLG-BuildID +++ b/bin/MLG-BuildID @@ -26,3 +26,4 @@ E8F78713C050CAF5AFE80EDDB1091BE8=1324945000000# MLG v1.6.02 66803F01F521ADE310AEEC360934962F=1324946221000# MLG v1.6.02 55F041F8EED20E7CEAD2489A1686D877=1328270387000# MLG v1.6.03 41AEE7ED67C84151DAEA0BCD131216DD=1328271164000# MLG v1.6.03 +ADD84FD64285CAE603BF1E184C66ACE4=1330940254000# MLG v1.6.05 diff --git a/bin/MinecraftLandGenerator.conf b/bin/MinecraftLandGenerator.conf index e6e60a4..87c2859 100644 --- a/bin/MinecraftLandGenerator.conf +++ b/bin/MinecraftLandGenerator.conf @@ -1,6 +1,6 @@ -#Minecraft Land Generator Configuration File: Version: 1.6.03 +#Minecraft Land Generator Configuration File: Version: 1.6.05 #Authors: Corrodias, Morlok8k, pr0f1x -#Auto-Generated: Friday, February 3, 2012 at 4:12 AM Pacific Standard Time +#Auto-Generated: Monday, March 5, 2012 at 1:37 AM Pacific Standard 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 91edf97..236c756 100755 Binary files a/bin/MinecraftLandGenerator.jar and b/bin/MinecraftLandGenerator.jar differ diff --git a/scripts/Run_MLG_(Mac).command b/scripts/Run_MLG_(Mac).command new file mode 100644 index 0000000..a7c25c2 --- /dev/null +++ b/scripts/Run_MLG_(Mac).command @@ -0,0 +1,8 @@ +#!/bin/bash +cd "$(dirname "$0")" +exec java -Djava.awt.headless=true -Xms1024m -Xmx1024m -Xincgc -jar MinecraftLandGenerator.jar 2000 2000 + + + + + diff --git a/scripts/Run_MLG_(Windows).cmd b/scripts/Run_MLG_(Windows).cmd new file mode 100644 index 0000000..68ba26d --- /dev/null +++ b/scripts/Run_MLG_(Windows).cmd @@ -0,0 +1,3 @@ +@echo off + +java -client -Djava.awt.headless=true -jar MinecraftLandGenerator.jar 2000 2000 diff --git a/scripts/Run_Server_(Mac).command b/scripts/Run_Server_(Mac).command new file mode 100644 index 0000000..6b8363d --- /dev/null +++ b/scripts/Run_Server_(Mac).command @@ -0,0 +1,4 @@ +#!/bin/bash +cd "$(dirname "$0")" +exec java -Djava.net.preferIPv4Stack=true -Djava.awt.headless=true -Xms1024m -Xmx1024m -Xincgc -jar minecraft_server.jar + diff --git a/scripts/Run_Server_(Windows).cmd b/scripts/Run_Server_(Windows).cmd new file mode 100644 index 0000000..2ca4a77 --- /dev/null +++ b/scripts/Run_Server_(Windows).cmd @@ -0,0 +1,3 @@ +@echo off + +java -client -showversion -Djava.net.preferIPv4Stack=true -Djava.awt.headless=true -Xms1024m -Xmx1024m -Xincgc -jar minecraft_server.jar diff --git a/scripts/Update_MLG_(Mac).command b/scripts/Update_MLG_(Mac).command new file mode 100644 index 0000000..06f20ff --- /dev/null +++ b/scripts/Update_MLG_(Mac).command @@ -0,0 +1,8 @@ +#!/bin/bash +cd "$(dirname "$0")" +exec java -Djava.awt.headless=true -Xms1024m -Xmx1024m -Xincgc -jar MinecraftLandGenerator.jar -update + + + + + diff --git a/scripts/Update_MLG_(Windows).cmd b/scripts/Update_MLG_(Windows).cmd new file mode 100644 index 0000000..63be1e6 --- /dev/null +++ b/scripts/Update_MLG_(Windows).cmd @@ -0,0 +1,3 @@ +@echo off + +java -client -Djava.awt.headless=true -jar MinecraftLandGenerator.jar -update diff --git a/scripts/Update_Server_(Mac).command b/scripts/Update_Server_(Mac).command new file mode 100644 index 0000000..044a5cc --- /dev/null +++ b/scripts/Update_Server_(Mac).command @@ -0,0 +1,8 @@ +#!/bin/bash +cd "$(dirname "$0")" +exec java -Djava.awt.headless=true -Xms1024m -Xmx1024m -Xincgc -jar MinecraftLandGenerator.jar -downloadfile https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar + + + + + diff --git a/scripts/Update_Server_(Windows).cmd b/scripts/Update_Server_(Windows).cmd new file mode 100644 index 0000000..252a2ca --- /dev/null +++ b/scripts/Update_Server_(Windows).cmd @@ -0,0 +1,3 @@ +@echo off + +java -client -Djava.awt.headless=true -jar MinecraftLandGenerator.jar -downloadfile https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar diff --git a/src/corrodias/minecraft/landgenerator/Main.java b/src/corrodias/minecraft/landgenerator/Main.java index 134fd6b..d105d2d 100644 --- a/src/corrodias/minecraft/landgenerator/Main.java +++ b/src/corrodias/minecraft/landgenerator/Main.java @@ -52,7 +52,8 @@ import org.jnbt.Tag; public class Main { // Version Number! - private static final String VERSION = "1.6.03"; + private static final String PROG_NAME = "Minecraft Land Generator"; + private static final String VERSION = "1.6.05"; private static final String AUTHORS = "Corrodias, Morlok8k, pr0f1x"; private static final String fileSeparator = System.getProperty("file.separator"); @@ -163,7 +164,7 @@ public class Main { // The following displays no matter what happens, so we needed this date stuff to happen first. - out("Minecraft Land Generator version " + VERSION); + out(PROG_NAME + " version " + VERSION); out("BuildID: (" + MLG_Last_Modified_Date.getTime() + ")"); // instead of dateformatting the buildid, we return the raw Long number. // thus different timezones wont display a different buildID out("This version was last modified on " + dateFormat.format(MLG_Last_Modified_Date)); @@ -217,12 +218,14 @@ public class Main { } else if (args[0].equalsIgnoreCase("-ps") || args[0].equalsIgnoreCase("-printspawn")) { // okay, sorry, this is an ugly hack, but it's just a last-minute feature. printSpawn(); + waitTenSec(false); return; } else if (args[0].equalsIgnoreCase("-build")) { buildID(false); return; } else if (args[0].equalsIgnoreCase("-update")) { updateMLG(); + waitTenSec(false); return; } else if (args[0].equalsIgnoreCase("-readme")) { @@ -237,6 +240,7 @@ public class Main { downloadFile(args[1], true); } else { out("No File to Download!"); + waitTenSec(false); } return; @@ -254,18 +258,22 @@ public class Main { } catch (FileNotFoundException ex) { System.err.println(args[1] + " - File not found"); + waitTenSec(false); return; } catch (IOException ex) { System.err.println(args[1] + " - Could not read file."); + waitTenSec(false); return; } } else { out("No File with links!"); + waitTenSec(false); } return; } else if (args.length == 1) { out("For help, use java -jar " + MLGFileNameShort + " -help"); + waitTenSec(false); return; } @@ -303,19 +311,7 @@ public class Main { saveConf(false); //old conf - outP(MLG); //here we wait 10 sec before closing. - int count = 0; - while (count <= 100) { - outP(count + "% "); - - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - count += 10; - } - outP(newLine); + waitTenSec(false); return; } @@ -699,18 +695,34 @@ public class Main { OutputStream outputStream = process.getOutputStream(); // moved here to remove some redundancy + //TODO: add converting section: + /* + 2012-02-29 03:50:28 [INFO] Converting map! + Scanning folders... + Total conversion count is 9 + 2012-02-29 03:50:29 [INFO] Converting... 8% + 2012-02-29 03:50:30 [INFO] Converting... 9% + 2012-02-29 03:50:31 [INFO] Converting... 10% + 2012-02-29 03:50:32 [INFO] Converting... 12% + 2012-02-29 03:50:33 [INFO] Converting... 13% + */ + + boolean convertedMapFormattingFlag = false; // This allows MLG to track if we converted a map to a new format (such as Chunk-file -> McRegion, or McRegion -> Anvil) + // just so it gets a line ending after the % output finishes while ((line = pOut.readLine()) != null) { line = line.trim(); if (verbose) { - if (line.contains("[INFO]")) { + if (line.contains("[INFO]")) { //TODO: add to .conf out(line.substring(line.lastIndexOf("]") + 2)); } else { out(line); } - } else if (line.contains(preparingText)) { - + } else if (line.contains(preparingText) || line.contains("Converting...")) { + if (line.contains("Converting...")) { + convertedMapFormattingFlag = true; + } outTmp2 = line.substring(line.length() - 3, line.length()); outTmp2 = outTmp2.trim(); //we are removing extra spaces here if (outTmp.equals(outTmp2)) { @@ -730,6 +742,12 @@ public class Main { } else if (line.contains(preparingLevel)) { prepTextFirst = true; + + if (convertedMapFormattingFlag == true) { + outP(newLine); + convertedMapFormattingFlag = false; + } + if (line.contains("level 0")) { // "Preparing start region for level 0" outP(MLG + worldName + ": " + level_0 + ":" + newLine); } else if (line.contains("level 1")) { // "Preparing start region for level 1" @@ -753,7 +771,7 @@ public class Main { } else { outP(newLine + MLG + line.substring(line.lastIndexOf("]") + 2)); } - } else if (line.contains("server version")) { + } else if (line.contains("server version") || line.contains("Converting map!")) { //TODO: add to .conf out(line.substring(line.lastIndexOf("]") + 2)); } @@ -803,7 +821,7 @@ public class Main { } //Here we want to ignore the most common warning: "Can't keep up!" - if (line.contains("Can't keep up!")) { + if (line.contains("Can't keep up!")) { //TODO: add to .conf cantKeepUp = true; //[WARNING] Can't keep up! Did the system time change, or is the server overloaded? ignoreWarnings = true; } @@ -811,7 +829,7 @@ public class Main { if (ignoreWarnings == false) { if (line.contains("[WARNING]")) { // If we have a warning, stop... out(""); - out("Warning found: Stopping Minecraft Land Generator"); + out("Warning found: Stopping " + PROG_NAME); if (verbose == false) { // If verbose is true, we already displayed it. out(line); } @@ -935,7 +953,7 @@ public class Main { //@formatter:off String ReadMeText = ""; - ReadMeText = "Minecraft Land Generator version " + VERSION + newLine + ReadMeText = PROG_NAME + " version " + VERSION + newLine + newLine + "Updated " + dateFormat_MDY.format(MLG_Last_Modified_Date) + newLine + newLine @@ -957,7 +975,7 @@ public class Main { + newLine + "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" + newLine - + "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." + + "Other Public Domain code has been used in this program, and references to sources are included in the comments of " + PROG_NAME + "'s source code." + newLine + "-----------------------------------------------" + newLine + newLine @@ -1082,6 +1100,7 @@ public class Main { * URL in a String * @param Output * Displays output if true + * @return Boolean: true if download was successful, false if download wasn't */ private static boolean downloadFile(String URL, boolean Output) { @@ -1441,7 +1460,7 @@ public class Main { //out(diff); if (diff < 0) { // if this is less than 0, there is a new version of MLG on the Internet! - out("There is a NEW VERSION Of Minecraft Land Generator available online!"); + out("There is a NEW VERSION Of " + PROG_NAME + " available online!"); try { File fileRename = new File(MLG_JarFile); @@ -1843,7 +1862,7 @@ public class Main { String txt = null; //@formatter:off - txt = "#Minecraft Land Generator Configuration File: Version: " + VERSION + newLine + txt = "#" + PROG_NAME + " Configuration File: Version: " + VERSION + newLine + "#Authors: " + AUTHORS + newLine + "#Auto-Generated: " + dateFormat.format(date) + newLine + newLine @@ -1998,6 +2017,35 @@ public class Main { } + /** + * waits ten seconds. outputs 10%, 20%, etc after each second. + * + * @author Morlok8k + */ + private static void waitTenSec(boolean output) { + if (output) { + outP(MLG); //here we wait 10 sec. + } + int count = 0; + while (count <= 100) { + if (output) { + outP(count + "% "); + } + + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + count += 10; + } + if (output) { + outP(newLine); + } + return; + + } + /* Morlok8k: * Just a note about this unescape method: * I am quite amazed at this code. It is vastly superior to my own coding ability.