From 8b31e6908ab119b9d833387fed927fea074946db Mon Sep 17 00:00:00 2001 From: Morlok8k Date: Fri, 30 Sep 2011 18:07:58 -0700 Subject: [PATCH] 1.5.1 initial commit --- .../minecraft/landgenerator/Main.java | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/corrodias/minecraft/landgenerator/Main.java b/src/corrodias/minecraft/landgenerator/Main.java index 73c10d0..a7d6528 100644 --- a/src/corrodias/minecraft/landgenerator/Main.java +++ b/src/corrodias/minecraft/landgenerator/Main.java @@ -43,7 +43,7 @@ import org.jnbt.Tag; public class Main { //Version Number! - private static final String VERSION = "1.5.0"; + private static final String VERSION = "1.5.1"; private static final String separator = System.getProperty("file.separator"); //private static final String classpath = System.getProperty("java.class.path"); @@ -653,7 +653,9 @@ public class Main { if (line.contains("[INFO] Done")) { //EDITED By Morlok8k for Minecraft 1.3+ Beta System.out.println("Stopping server."); byte[] stop = {'s', 't', 'o', 'p', '\r', '\n'}; + byte[] saveAll = {'s', 'a', 'v', 'e', '-', 'a', 'l', 'l', '\r', '\n'}; OutputStream outputStream = process.getOutputStream(); + outputStream.write(saveAll); outputStream.write(stop); outputStream.flush(); } @@ -675,6 +677,8 @@ public class Main { byte[] stop = {'s', 't', 'o', 'p', '\r', '\n'}; //Moved here, so this code wont run every loop, thus Faster! //and no, i can't use a string here! + byte[] saveAll = {'s', 'a', 'v', 'e', '-', 'a', 'l', 'l', '\r', '\n'}; + OutputStream outputStream = process.getOutputStream(); //moved here to remove some redundancy @@ -715,6 +719,9 @@ public class Main { if (line.contains(doneText)) { // now this is configurable! System.out.println(""); + System.out.println("Forcing Save..."); + outputStream.write(saveAll); + outputStream.flush(); System.out.println("Stopping server."); //OutputStream outputStream = process.getOutputStream(); outputStream.write(stop); @@ -722,10 +729,16 @@ public class Main { //outputStream.close(); } if (ignoreWarnings == false) { - if (line.contains("[WARNING]")) { //If we have a severe error, stop... + if (line.contains("[WARNING]")) { //If we have a warning, stop... System.out.println(""); System.out.println("Warning found: Stopping Minecraft Land Generator"); + if (verbose == false) { //If verbose is true, we already displayed it. + System.out.println(line); + } System.out.println(""); + System.out.println("Forcing Save..."); + outputStream.write(saveAll); + outputStream.flush(); //OutputStream outputStream = process.getOutputStream(); outputStream.write(stop); //if the warning was a fail to bind to port, we may need to write stop twice! outputStream.flush(); @@ -738,7 +751,13 @@ public class Main { if (line.contains("[SEVERE]")) { //If we have a severe error, stop... System.out.println(""); System.out.println("Severe error found: Stopping server."); + if (verbose == false) { //If verbose is true, we already displayed it. + System.out.println(line); + } System.out.println(""); + System.out.println("Forcing Save..."); + outputStream.write(saveAll); + outputStream.flush(); //OutputStream outputStream = process.getOutputStream(); outputStream.write(stop); outputStream.flush();