geforkt von Mirrors/Paper
Added new --noconsole command argument, thanks to mkurzeja for the idea
Dieser Commit ist enthalten in:
Ursprung
13561bca9c
Commit
589f66bd1b
@ -4,6 +4,8 @@ import java.io.BufferedReader;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
|
import static org.bukkit.craftbukkit.Main.*;
|
||||||
|
|
||||||
public class ThreadCommandReader extends Thread {
|
public class ThreadCommandReader extends Thread {
|
||||||
|
|
||||||
final MinecraftServer server;
|
final MinecraftServer server;
|
||||||
@ -13,13 +15,19 @@ public class ThreadCommandReader extends Thread {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
|
// CraftBukkit start
|
||||||
|
if (!useConsole) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
jline.ConsoleReader bufferedreader = this.server.reader; // CraftBukkit
|
jline.ConsoleReader bufferedreader = this.server.reader; // CraftBukkit
|
||||||
String s = null;
|
String s = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// CraftBukkit start - JLine disabling compatibility
|
// CraftBukkit start - JLine disabling compatibility
|
||||||
while (!this.server.isStopped && MinecraftServer.isRunning(this.server)) {
|
while (!this.server.isStopped && MinecraftServer.isRunning(this.server)) {
|
||||||
if (org.bukkit.craftbukkit.Main.useJline) {
|
if (useJline) {
|
||||||
s = bufferedreader.readLine(">", null);
|
s = bufferedreader.readLine(">", null);
|
||||||
} else {
|
} else {
|
||||||
s = bufferedreader.readLine();
|
s = bufferedreader.readLine();
|
||||||
|
@ -106,6 +106,10 @@ public final class CraftServer implements Server {
|
|||||||
|
|
||||||
Bukkit.setServer(this);
|
Bukkit.setServer(this);
|
||||||
|
|
||||||
|
if (!Main.useConsole) {
|
||||||
|
getLogger().info("Console input is disabled due to --noconsole command argument");
|
||||||
|
}
|
||||||
|
|
||||||
configuration = YamlConfiguration.loadConfiguration(getConfigFile());
|
configuration = YamlConfiguration.loadConfiguration(getConfigFile());
|
||||||
configuration.options().copyDefaults(true);
|
configuration.options().copyDefaults(true);
|
||||||
configuration.setDefaults(YamlConfiguration.loadConfiguration(getClass().getClassLoader().getResourceAsStream("configurations/bukkit.yml")));
|
configuration.setDefaults(YamlConfiguration.loadConfiguration(getClass().getClassLoader().getResourceAsStream("configurations/bukkit.yml")));
|
||||||
|
@ -13,6 +13,7 @@ import net.minecraft.server.MinecraftServer;
|
|||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
public static boolean useJline = true;
|
public static boolean useJline = true;
|
||||||
|
public static boolean useConsole = true;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
// Todo: Installation script
|
// Todo: Installation script
|
||||||
@ -94,6 +95,8 @@ public class Main {
|
|||||||
|
|
||||||
acceptsAll(asList("nojline"), "Disables jline and emulates the vanilla console");
|
acceptsAll(asList("nojline"), "Disables jline and emulates the vanilla console");
|
||||||
|
|
||||||
|
acceptsAll(asList("noconsole"), "Disables the console");
|
||||||
|
|
||||||
acceptsAll(asList("v", "version"), "Show the CraftBukkit Version");
|
acceptsAll(asList("v", "version"), "Show the CraftBukkit Version");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -124,6 +127,10 @@ public class Main {
|
|||||||
useJline = false;
|
useJline = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options.has("noconsole")) {
|
||||||
|
useConsole = false;
|
||||||
|
}
|
||||||
|
|
||||||
MinecraftServer.main(options);
|
MinecraftServer.main(options);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
t.printStackTrace();
|
t.printStackTrace();
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren