diff --git a/README b/README index 3e06494..2d7afa1 100644 --- a/README +++ b/README @@ -1,6 +1,6 @@ -Minecraft Land Generator version 1.4.2 +Minecraft Land Generator version 1.4.3 -Updated May 12, 2011 +Updated May 14, 2011 Original Code by Corrodias November 2010 Enhanced Code by Morlok8k Feb. 2011 to Now (or at least to the date listed above!) @@ -24,6 +24,10 @@ The JNLP library is included (inside the .jar) as jnbt-1.1.jar. It is not public ----------------------------------------------- Version History: +Morlok8k: + +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 diff --git a/bin/MinecraftLandGenerator.jar b/bin/MinecraftLandGenerator.jar index 677aed3..83188a6 100644 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 ddeae9c..0422601 100644 --- a/src/corrodias/minecraft/landgenerator/Main.java +++ b/src/corrodias/minecraft/landgenerator/Main.java @@ -42,7 +42,7 @@ import org.jnbt.Tag; public class Main { //Version Number! - private static final String VERSION = "1.4.2"; + private static final String VERSION = "1.4.3"; private static final String separator = System.getProperty("file.separator"); //private static final String classpath = System.getProperty("java.class.path"); @@ -513,6 +513,9 @@ public class Main { */ protected static void runMinecraft(ProcessBuilder minecraft, boolean verbose, boolean alternate, String javaLine) throws IOException { System.out.println("Starting server."); + + boolean warning = false; + // monitor output and print to console where required. // STOP the server when it's done. @@ -595,6 +598,16 @@ public class Main { outputStream.flush(); outputStream.close(); } + if (line.contains("[WARNING]")) { //If we have a severe error, stop... + System.out.println(""); + System.out.println("Warning found: Stopping Minecraft Land Generator"); + System.out.println(""); + OutputStream outputStream = process.getOutputStream(); + outputStream.write(stop); //if the warning was a fail to bind to port, we may need to write stop twice! (but since we write stop every time we see a warning, we should be fine.) + outputStream.flush(); + outputStream.close(); + warning = true; + } if (line.contains("[SEVERE]")) { //If we have a severe error, stop... System.out.println(""); System.out.println("Severe error found: Stopping server."); @@ -606,6 +619,11 @@ public class Main { //Quit! } } + + if (warning == true){ + System.exit(1); + } + } @@ -643,26 +661,27 @@ public class Main { BufferedReader in = new BufferedReader(new FileReader(config)); String line; while ((line = in.readLine()) != null) { - int ignoreLine = line.indexOf('#'); - if (ignoreLine == -1){ - ignoreLine = 1; - } else if (ignoreLine == 0){ - ignoreLine = 1; - } else if (ignoreLine == 1){ - ignoreLine = 1; - } else { - ignoreLine = line.length(); - } - if (ignoreLine != 1){ - ignoreLine = line.length(); - } - int pos = line.indexOf('='); + int end = line.lastIndexOf('#'); //comments, ignored lines + + + if (end == -1){ // If we have no hash sign, then we read till the end of the line + end = line.length(); + } + + if (end <= pos){ // If hash is before the '=', we may have a issue... it should be fine, cause we check for issues next, but lets make sure. + end = line.length(); + } + if (pos != -1) { if (line.substring(0, pos).toLowerCase().equals("serverpath")) { - serverPath = line.substring(pos + 1, ignoreLine); + serverPath = line.substring(pos + 1, end); } else if (line.substring(0, pos).toLowerCase().equals("java")) { - javaLine = line.substring(pos + 1, ignoreLine); + javaLine = line.substring(pos + 1, end); + } else if (line.substring(0, pos).toLowerCase().equals("done_text")) { + doneText = line.substring(pos + 1, end); + } else if (line.substring(0, pos).toLowerCase().equals("preparing_text")) { + preparingText = line.substring(pos + 1, end); } } }