summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/net/minecraft/server/ThreadCommandReader.java18
-rw-r--r--src/main/java/org/bukkit/craftbukkit/Main.java8
-rw-r--r--src/main/java/org/bukkit/craftbukkit/util/ShortConsoleLogFormatter.java2
3 files changed, 24 insertions, 4 deletions
diff --git a/src/main/java/net/minecraft/server/ThreadCommandReader.java b/src/main/java/net/minecraft/server/ThreadCommandReader.java
index f3d36e65..0158e96a 100644
--- a/src/main/java/net/minecraft/server/ThreadCommandReader.java
+++ b/src/main/java/net/minecraft/server/ThreadCommandReader.java
@@ -19,14 +19,24 @@ public class ThreadCommandReader extends Thread {
}
public void run() {
- // CraftBukkit
+ // CraftBukkit start
ConsoleReader bufferedreader = this.server.reader;
String s = null;
+ String jlineTerminalSetting = org.bukkit.craftbukkit.Main.jlineTerminalSetting;
+ // CraftBukkit end
try {
- // CraftBukkit
- while (!this.server.isStopped && MinecraftServer.isRunning(this.server) && ((s = bufferedreader.readLine(">", null)) != null)) {
- this.server.issueCommand(s, this.server);
+ while (!this.server.isStopped && MinecraftServer.isRunning(this.server)) {
+ // CraftBukkit start - JLine disabling compatibility
+ if (jlineTerminalSetting != null && jlineTerminalSetting.equals("jline.UnsupportedTerminal")) {
+ s = bufferedreader.readLine();
+ } else {
+ s = bufferedreader.readLine(">", null);
+ }
+ if (s != null) {
+ // CraftBukkit end
+ this.server.issueCommand(s, this.server);
+ }
}
} catch (IOException ioexception) {
// CraftBukkit
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index f0863edd..0dacd2ee 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -12,6 +12,8 @@ import joptsimple.OptionSet;
import net.minecraft.server.MinecraftServer;
public class Main {
+ public static String jlineTerminalSetting = System.getProperty("jline.terminal");
+
public static void main(String[] args) {
// Todo: Installation script
OptionParser parser = new OptionParser() {
@@ -65,6 +67,8 @@ public class Main {
.ofType(File.class)
.defaultsTo(new File("bukkit.yml"))
.describedAs("Yml file");
+
+ acceptsAll(asList("nojline"), "Disables jline and emulates the vanilla console");
}
};
@@ -84,6 +88,10 @@ public class Main {
}
} else {
try {
+ if (options.has("nojline")) {
+ System.setProperty("jline.terminal", "jline.UnsupportedTerminal");
+ System.setProperty("user.language", "en");
+ }
MinecraftServer.main(options);
} catch (Throwable t) {
t.printStackTrace();
diff --git a/src/main/java/org/bukkit/craftbukkit/util/ShortConsoleLogFormatter.java b/src/main/java/org/bukkit/craftbukkit/util/ShortConsoleLogFormatter.java
index 8d8b4e73..282f058d 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/ShortConsoleLogFormatter.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/ShortConsoleLogFormatter.java
@@ -26,6 +26,8 @@ public class ShortConsoleLogFormatter extends Formatter {
} catch (OptionException ex) {
System.err.println("Given date format is not valid. Falling back to default.");
}
+ } else if (options.has("nojline")) {
+ date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
}
if (date == null) {