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

SPIGOT-5538: Using javaw to run GUI prints input error

Dieser Commit ist enthalten in:
md_5 2020-01-28 10:36:47 +11:00
Ursprung e653ae7669
Commit 44016b1dfc

Datei anzeigen

@ -31,7 +31,7 @@
this.propertyManager = dedicatedserversettings; this.propertyManager = dedicatedserversettings;
this.remoteControlCommandListener = new RemoteControlCommandListener(this); this.remoteControlCommandListener = new RemoteControlCommandListener(this);
Thread thread = new Thread("Server Infinisleeper") { Thread thread = new Thread("Server Infinisleeper") {
@@ -66,13 +79,37 @@ @@ -66,13 +79,44 @@
public boolean init() throws IOException { public boolean init() throws IOException {
Thread thread = new Thread("Server console handler") { Thread thread = new Thread("Server console handler") {
public void run() { public void run() {
@ -41,6 +41,13 @@
+ return; + return;
+ } + }
+ jline.console.ConsoleReader bufferedreader = reader; + jline.console.ConsoleReader bufferedreader = reader;
+
+ // MC-33041, SPIGOT-5538: if System.in is not valid due to javaw, then return
+ try {
+ System.in.available();
+ } catch (IOException ex) {
+ return;
+ }
+ // CraftBukkit end + // CraftBukkit end
String s; String s;
@ -72,7 +79,7 @@
} }
} catch (IOException ioexception) { } catch (IOException ioexception) {
DedicatedServer.LOGGER.error("Exception handling console input", ioexception); DedicatedServer.LOGGER.error("Exception handling console input", ioexception);
@@ -81,6 +118,27 @@ @@ -81,6 +125,27 @@
} }
}; };
@ -100,7 +107,7 @@
thread.setDaemon(true); thread.setDaemon(true);
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(DedicatedServer.LOGGER)); thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(DedicatedServer.LOGGER));
thread.start(); thread.start();
@@ -134,6 +192,12 @@ @@ -134,6 +199,12 @@
return false; return false;
} }
@ -113,7 +120,7 @@
if (!this.getOnlineMode()) { if (!this.getOnlineMode()) {
DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!"); DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware."); DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware.");
@@ -148,7 +212,7 @@ @@ -148,7 +219,7 @@
if (!NameReferencingFileConverter.e(this)) { if (!NameReferencingFileConverter.e(this)) {
return false; return false;
} else { } else {
@ -122,7 +129,7 @@
long i = SystemUtils.getMonotonicNanos(); long i = SystemUtils.getMonotonicNanos();
String s = dedicatedserverproperties.levelSeed; String s = dedicatedserverproperties.levelSeed;
String s1 = dedicatedserverproperties.generatorSettings; String s1 = dedicatedserverproperties.generatorSettings;
@@ -178,7 +242,13 @@ @@ -178,7 +249,13 @@
if (worldtype == WorldType.FLAT) { if (worldtype == WorldType.FLAT) {
jsonobject.addProperty("flat_world_options", s1); jsonobject.addProperty("flat_world_options", s1);
} else if (!s1.isEmpty()) { } else if (!s1.isEmpty()) {
@ -137,7 +144,7 @@
} }
this.a(this.getWorld(), this.getWorld(), j, worldtype, jsonobject); this.a(this.getWorld(), this.getWorld(), j, worldtype, jsonobject);
@@ -200,6 +270,7 @@ @@ -200,6 +277,7 @@
DedicatedServer.LOGGER.info("Starting remote control listener"); DedicatedServer.LOGGER.info("Starting remote control listener");
this.remoteControlListener = new RemoteControlListener(this); this.remoteControlListener = new RemoteControlListener(this);
this.remoteControlListener.a(); this.remoteControlListener.a();
@ -145,7 +152,7 @@
} }
if (this.getMaxTickTime() > 0L) { if (this.getMaxTickTime() > 0L) {
@@ -307,6 +378,7 @@ @@ -307,6 +385,7 @@
this.remoteStatusListener.b(); this.remoteStatusListener.b();
} }
@ -153,7 +160,7 @@
} }
@Override @Override
@@ -340,7 +412,15 @@ @@ -340,7 +419,15 @@
while (!this.serverCommandQueue.isEmpty()) { while (!this.serverCommandQueue.isEmpty()) {
ServerCommand servercommand = (ServerCommand) this.serverCommandQueue.remove(0); ServerCommand servercommand = (ServerCommand) this.serverCommandQueue.remove(0);
@ -170,7 +177,7 @@
} }
} }
@@ -540,14 +620,45 @@ @@ -540,14 +627,45 @@
@Override @Override
public String getPlugins() { public String getPlugins() {
@ -218,7 +225,7 @@
}); });
return this.remoteControlCommandListener.getMessages(); return this.remoteControlCommandListener.getMessages();
} }
@@ -568,4 +679,16 @@ @@ -568,4 +686,16 @@
public boolean a(GameProfile gameprofile) { public boolean a(GameProfile gameprofile) {
return false; return false;
} }