summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Adams <dinnerbone@dinnerbone.com>2011-11-05 20:14:26 +0000
committerNathan Adams <dinnerbone@dinnerbone.com>2011-11-05 20:15:19 +0000
commit589f66bd1b766dc1fdd737ee885304196a2ed86a (patch)
tree5457f9727418f5847c63712bcf71a427e1733106
parent13561bca9c7c6d99ff2c0272c83f2949842e879e (diff)
downloadcraftbukkit-589f66bd1b766dc1fdd737ee885304196a2ed86a.tar
craftbukkit-589f66bd1b766dc1fdd737ee885304196a2ed86a.tar.gz
craftbukkit-589f66bd1b766dc1fdd737ee885304196a2ed86a.tar.lz
craftbukkit-589f66bd1b766dc1fdd737ee885304196a2ed86a.tar.xz
craftbukkit-589f66bd1b766dc1fdd737ee885304196a2ed86a.zip
Added new --noconsole command argument, thanks to mkurzeja for the idea
-rw-r--r--src/main/java/net/minecraft/server/ThreadCommandReader.java10
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftServer.java4
-rw-r--r--src/main/java/org/bukkit/craftbukkit/Main.java7
3 files changed, 20 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/ThreadCommandReader.java b/src/main/java/net/minecraft/server/ThreadCommandReader.java
index 821cf660..09505ff6 100644
--- a/src/main/java/net/minecraft/server/ThreadCommandReader.java
+++ b/src/main/java/net/minecraft/server/ThreadCommandReader.java
@@ -4,6 +4,8 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
+import static org.bukkit.craftbukkit.Main.*;
+
public class ThreadCommandReader extends Thread {
final MinecraftServer server;
@@ -13,13 +15,19 @@ public class ThreadCommandReader extends Thread {
}
public void run() {
+ // CraftBukkit start
+ if (!useConsole) {
+ return;
+ }
+ // CraftBukkit end
+
jline.ConsoleReader bufferedreader = this.server.reader; // CraftBukkit
String s = null;
try {
// CraftBukkit start - JLine disabling compatibility
while (!this.server.isStopped && MinecraftServer.isRunning(this.server)) {
- if (org.bukkit.craftbukkit.Main.useJline) {
+ if (useJline) {
s = bufferedreader.readLine(">", null);
} else {
s = bufferedreader.readLine();
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 6f69bd7b..8b2c93e2 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -105,6 +105,10 @@ public final class CraftServer implements Server {
this.serverVersion = CraftServer.class.getPackage().getImplementationVersion();
Bukkit.setServer(this);
+
+ if (!Main.useConsole) {
+ getLogger().info("Console input is disabled due to --noconsole command argument");
+ }
configuration = YamlConfiguration.loadConfiguration(getConfigFile());
configuration.options().copyDefaults(true);
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 68b9abd2..4c3bb0c3 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -13,6 +13,7 @@ import net.minecraft.server.MinecraftServer;
public class Main {
public static boolean useJline = true;
+ public static boolean useConsole = true;
public static void main(String[] args) {
// Todo: Installation script
@@ -93,6 +94,8 @@ public class Main {
.describedAs("Yml file");
acceptsAll(asList("nojline"), "Disables jline and emulates the vanilla console");
+
+ acceptsAll(asList("noconsole"), "Disables the console");
acceptsAll(asList("v", "version"), "Show the CraftBukkit Version");
}
@@ -123,6 +126,10 @@ public class Main {
System.setProperty("user.language", "en");
useJline = false;
}
+
+ if (options.has("noconsole")) {
+ useConsole = false;
+ }
MinecraftServer.main(options);
} catch (Throwable t) {