another minor change - makes xx% output nicer by rewriting existing line.
This commit is contained in:
parent
d50178faeb
commit
cdf14f9f4f
@ -39,7 +39,7 @@ public class MLG_Server {
|
||||
BufferedReader pOut =
|
||||
new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||
String line;
|
||||
while ((line = pOut.readLine()) != null) {
|
||||
while ((line = pOut.readLine()) != null) { // readLine() returns null when the process exits
|
||||
|
||||
line = line.trim(); //Trim spaces off the beginning and end, if any.
|
||||
|
||||
@ -53,7 +53,7 @@ public class MLG_Server {
|
||||
|
||||
}
|
||||
}
|
||||
// readLine() returns null when the process exits
|
||||
// End while loop
|
||||
|
||||
} else { // start minecraft server normally!
|
||||
Process process = Main.minecraft.start();
|
||||
@ -80,20 +80,9 @@ public class MLG_Server {
|
||||
|
||||
OutputStream outputStream = process.getOutputStream(); // moved here to remove some redundancy
|
||||
|
||||
/*
|
||||
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) {
|
||||
while ((line = pOut.readLine()) != null) { // readLine() returns null when the process exits
|
||||
|
||||
int posBracket = line.lastIndexOf("]");
|
||||
if (posBracket != -1) {
|
||||
@ -107,29 +96,31 @@ public class MLG_Server {
|
||||
|
||||
if (Main.verbose) {
|
||||
Main.outS(shortLine);
|
||||
} else if (line.toLowerCase().contains("saving")) {
|
||||
Main.outS(shortLine);
|
||||
//} else if (line.toLowerCase().contains("saving")) { //this was just clutter
|
||||
// Main.outS(shortLine);
|
||||
} else if (line.contains(Main.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)) {
|
||||
//instead of printing the same number, we add another dot
|
||||
Main.outP(".");
|
||||
|
||||
//if (outTmp.equals(outTmp2)) {
|
||||
//instead of printing the same number, we add another dot
|
||||
//Main.outP(".");
|
||||
//} else {
|
||||
outTmp = outTmp2;
|
||||
|
||||
if (prepTextFirst) {
|
||||
Main.outP(Main.MLG + outTmp + "...");
|
||||
prepTextFirst = false;
|
||||
} else {
|
||||
outTmp = outTmp2;
|
||||
|
||||
if (prepTextFirst) {
|
||||
Main.outP(Main.MLG + outTmp + "...");
|
||||
prepTextFirst = false;
|
||||
} else {
|
||||
Main.outP(" " + outTmp + "...");
|
||||
}
|
||||
|
||||
//Main.outP(" " + outTmp + "...");
|
||||
Main.outP("\r" + Main.MLG + outTmp + "..."); //here we use \r to go back to the previous line, and rewrite it
|
||||
}
|
||||
|
||||
//}
|
||||
|
||||
} else if (line.contains(Main.preparingLevel)) {
|
||||
prepTextFirst = true;
|
||||
|
||||
@ -139,25 +130,35 @@ public class MLG_Server {
|
||||
}
|
||||
|
||||
if (line.contains("level 0")) { // "Preparing start region for level 0"
|
||||
Main.outP(Main.MLG + Main.worldName + ": " + Main.level_0 + ":" + Main.newLine);
|
||||
Main.outP(Main.MLG + Main.worldName + ": " + Main.level_0 + ":"
|
||||
+ Main.newLine);
|
||||
} else if (line.contains("level 1")) { // "Preparing start region for level 1"
|
||||
Main.outP(Main.newLine + Main.MLG + Main.worldName + ": " + Main.level_1 + ":" + Main.newLine);
|
||||
Main.outP(Main.newLine + Main.MLG + Main.worldName + ": " + Main.level_1
|
||||
+ ":" + Main.newLine);
|
||||
} else if (line.contains("level 2")) { // "Preparing start region for level 2"
|
||||
Main.outP(Main.newLine + Main.MLG + Main.worldName + ": " + Main.level_2 + ":" + Main.newLine);
|
||||
Main.outP(Main.newLine + Main.MLG + Main.worldName + ": " + Main.level_2
|
||||
+ ":" + Main.newLine);
|
||||
} else if (line.contains("level 3")) { // "Preparing start region for level 3"
|
||||
Main.outP(Main.newLine + Main.MLG + Main.worldName + ": " + Main.level_3 + ":" + Main.newLine);
|
||||
Main.outP(Main.newLine + Main.MLG + Main.worldName + ": " + Main.level_3
|
||||
+ ":" + Main.newLine);
|
||||
} else if (line.contains("level 4")) { // "Preparing start region for level 4"
|
||||
Main.outP(Main.newLine + Main.MLG + Main.worldName + ": " + Main.level_4 + ":" + Main.newLine);
|
||||
Main.outP(Main.newLine + Main.MLG + Main.worldName + ": " + Main.level_4
|
||||
+ ":" + Main.newLine);
|
||||
} else if (line.contains("level 5")) { // "Preparing start region for level 5"
|
||||
Main.outP(Main.newLine + Main.MLG + Main.worldName + ": " + Main.level_5 + ":" + Main.newLine);
|
||||
Main.outP(Main.newLine + Main.MLG + Main.worldName + ": " + Main.level_5
|
||||
+ ":" + Main.newLine);
|
||||
} else if (line.contains("level 6")) { // "Preparing start region for level 6"
|
||||
Main.outP(Main.newLine + Main.MLG + Main.worldName + ": " + Main.level_6 + ":" + Main.newLine);
|
||||
Main.outP(Main.newLine + Main.MLG + Main.worldName + ": " + Main.level_6
|
||||
+ ":" + Main.newLine);
|
||||
} else if (line.contains("level 7")) { // "Preparing start region for level 7"
|
||||
Main.outP(Main.newLine + Main.MLG + Main.worldName + ": " + Main.level_7 + ":" + Main.newLine);
|
||||
Main.outP(Main.newLine + Main.MLG + Main.worldName + ": " + Main.level_7
|
||||
+ ":" + Main.newLine);
|
||||
} else if (line.contains("level 8")) { // "Preparing start region for level 8"
|
||||
Main.outP(Main.newLine + Main.MLG + Main.worldName + ": " + Main.level_8 + ":" + Main.newLine);
|
||||
Main.outP(Main.newLine + Main.MLG + Main.worldName + ": " + Main.level_8
|
||||
+ ":" + Main.newLine);
|
||||
} else if (line.contains("level 9")) { // "Preparing start region for level 9"
|
||||
Main.outP(Main.newLine + Main.MLG + Main.worldName + ": " + Main.level_9 + ":" + Main.newLine);
|
||||
Main.outP(Main.newLine + Main.MLG + Main.worldName + ": " + Main.level_9
|
||||
+ ":" + Main.newLine);
|
||||
} else {
|
||||
Main.outP(Main.newLine + Main.MLG + shortLine);
|
||||
}
|
||||
@ -293,7 +294,7 @@ public class MLG_Server {
|
||||
outputStream.close();
|
||||
}
|
||||
|
||||
// readLine() returns null when the process exits
|
||||
// while loop has finished now.
|
||||
return serverSuccess;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user