Add fallback for when jline fails to initialize. Fixes BUKKIT-1675.

This commit is contained in:
Travis Watkins 2012-05-22 23:44:03 -05:00
parent 21327265f0
commit 94e9543a14
2 changed files with 12 additions and 2 deletions

View file

@ -93,8 +93,17 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
try { try {
this.reader = new ConsoleReader(System.in, System.out); this.reader = new ConsoleReader(System.in, System.out);
this.reader.setExpandEvents(false); // Avoid parsing exceptions for uncommonly used event designators this.reader.setExpandEvents(false); // Avoid parsing exceptions for uncommonly used event designators
} catch (IOException ex) { } catch (Exception e) {
Logger.getLogger(MinecraftServer.class.getName()).log(Level.SEVERE, null, ex); try {
// Try again with jline disabled for Windows users without C++ 2008 Redistributable
System.setProperty("jline.terminal", "jline.UnsupportedTerminal");
System.setProperty("user.language", "en");
org.bukkit.craftbukkit.Main.useJline = false;
this.reader = new ConsoleReader(System.in, System.out);
this.reader.setExpandEvents(false);
} catch (IOException ex) {
Logger.getLogger(MinecraftServer.class.getName()).log(Level.SEVERE, null, ex);
}
} }
Runtime.getRuntime().addShutdownHook(new ServerShutdownThread(this)); Runtime.getRuntime().addShutdownHook(new ServerShutdownThread(this));
// CraftBukkit end // CraftBukkit end

View file

@ -932,6 +932,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
} else if (packet19entityaction.animation == 5) { } else if (packet19entityaction.animation == 5) {
this.player.setSprinting(false); this.player.setSprinting(false);
} else if (packet19entityaction.animation == 3) { } else if (packet19entityaction.animation == 3) {
if (this.player.fauxSleeping && !this.player.sleeping) return; // CraftBukkit - Can't leave bed if not in one!
this.player.a(false, true, true); this.player.a(false, true, true);
this.checkMovement = false; this.checkMovement = false;
} }