summaryrefslogtreecommitdiffstats
path: root/src/main/java/org
diff options
context:
space:
mode:
authorDinnerbone <dinnerbone@dinnerbone.com>2011-05-19 21:46:47 +0100
committerDinnerbone <dinnerbone@dinnerbone.com>2011-05-19 21:46:47 +0100
commit6319a19073b10bc5f2d16ac7ce104b5ced267cdc (patch)
tree3ac377816444512a5ef203e0e3a28a76cc49442d /src/main/java/org
parent480c1b987704687f0dfe9ae6d4a136b8d2071725 (diff)
downloadcraftbukkit-6319a19073b10bc5f2d16ac7ce104b5ced267cdc.tar
craftbukkit-6319a19073b10bc5f2d16ac7ce104b5ced267cdc.tar.gz
craftbukkit-6319a19073b10bc5f2d16ac7ce104b5ced267cdc.tar.lz
craftbukkit-6319a19073b10bc5f2d16ac7ce104b5ced267cdc.tar.xz
craftbukkit-6319a19073b10bc5f2d16ac7ce104b5ced267cdc.zip
Possible fix for -nojline printing blank lines
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/Main.java7
-rw-r--r--src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleHandler.java21
2 files changed, 18 insertions, 10 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 9f8708df..3ec19b46 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -12,7 +12,7 @@ import joptsimple.OptionSet;
import net.minecraft.server.MinecraftServer;
public class Main {
- public static String jlineTerminalSetting;
+ public static boolean useJline = true;
public static void main(String[] args) {
// Todo: Installation script
@@ -88,11 +88,14 @@ public class Main {
}
} else {
try {
+ useJline = !"jline.UnsupportedTerminal".equals(System.getProperty("jline.terminal"));
+
if (options.has("nojline")) {
System.setProperty("jline.terminal", "jline.UnsupportedTerminal");
System.setProperty("user.language", "en");
+ useJline = false;
}
- jlineTerminalSetting = System.getProperty("jline.terminal");
+
MinecraftServer.main(options);
} catch (Throwable t) {
t.printStackTrace();
diff --git a/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleHandler.java b/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleHandler.java
index 43bc392f..111123f5 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleHandler.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/TerminalConsoleHandler.java
@@ -5,6 +5,7 @@ import java.util.logging.ConsoleHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import jline.ConsoleReader;
+import org.bukkit.craftbukkit.Main;
public class TerminalConsoleHandler extends ConsoleHandler {
private final ConsoleReader reader;
@@ -17,15 +18,19 @@ public class TerminalConsoleHandler extends ConsoleHandler {
@Override
public synchronized void flush() {
try {
- reader.printString(ConsoleReader.RESET_LINE + "");
- reader.flushConsole();
- super.flush();
- try {
- reader.drawLine();
- } catch (Throwable ex) {
- reader.getCursorBuffer().clearBuffer();
+ if (Main.useJline) {
+ reader.printString(ConsoleReader.RESET_LINE + "");
+ reader.flushConsole();
+ super.flush();
+ try {
+ reader.drawLine();
+ } catch (Throwable ex) {
+ reader.getCursorBuffer().clearBuffer();
+ }
+ reader.flushConsole();
+ } else {
+ super.flush();
}
- reader.flushConsole();
} catch (IOException ex) {
Logger.getLogger(TerminalConsoleHandler.class.getName()).log(Level.SEVERE, null, ex);
}