3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-19 04:50:06 +01:00

Added -nojline CLI option to emulate vanilla console behaviours. Added JLine disabling compatibility (removes the '>').

-nojline disables JLine, removes the '>', sets the timestamp to vanilla's and sets the language to English.

-Djline.terminal=jline.UnsupportedTerminal disables JLine and removes the '>'.
Dieser Commit ist enthalten in:
EvilSeph 2011-05-18 15:23:27 -04:00
Ursprung cd87e51638
Commit eac5b9623d
3 geänderte Dateien mit 24 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -19,14 +19,24 @@ public class ThreadCommandReader extends Thread {
} }
public void run() { public void run() {
// CraftBukkit // CraftBukkit start
ConsoleReader bufferedreader = this.server.reader; ConsoleReader bufferedreader = this.server.reader;
String s = null; String s = null;
String jlineTerminalSetting = org.bukkit.craftbukkit.Main.jlineTerminalSetting;
// CraftBukkit end
try { try {
// CraftBukkit while (!this.server.isStopped && MinecraftServer.isRunning(this.server)) {
while (!this.server.isStopped && MinecraftServer.isRunning(this.server) && ((s = bufferedreader.readLine(">", null)) != null)) { // CraftBukkit start - JLine disabling compatibility
this.server.issueCommand(s, this.server); 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) { } catch (IOException ioexception) {
// CraftBukkit // CraftBukkit

Datei anzeigen

@ -12,6 +12,8 @@ import joptsimple.OptionSet;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
public class Main { public class Main {
public static String jlineTerminalSetting = System.getProperty("jline.terminal");
public static void main(String[] args) { public static void main(String[] args) {
// Todo: Installation script // Todo: Installation script
OptionParser parser = new OptionParser() { OptionParser parser = new OptionParser() {
@ -65,6 +67,8 @@ public class Main {
.ofType(File.class) .ofType(File.class)
.defaultsTo(new File("bukkit.yml")) .defaultsTo(new File("bukkit.yml"))
.describedAs("Yml file"); .describedAs("Yml file");
acceptsAll(asList("nojline"), "Disables jline and emulates the vanilla console");
} }
}; };
@ -84,6 +88,10 @@ public class Main {
} }
} else { } else {
try { try {
if (options.has("nojline")) {
System.setProperty("jline.terminal", "jline.UnsupportedTerminal");
System.setProperty("user.language", "en");
}
MinecraftServer.main(options); MinecraftServer.main(options);
} catch (Throwable t) { } catch (Throwable t) {
t.printStackTrace(); t.printStackTrace();

Datei anzeigen

@ -26,6 +26,8 @@ public class ShortConsoleLogFormatter extends Formatter {
} catch (OptionException ex) { } catch (OptionException ex) {
System.err.println("Given date format is not valid. Falling back to default."); 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) { if (date == null) {