From 94e9543a14c5cc70bf42a8d28992f867d52a4b98 Mon Sep 17 00:00:00 2001 From: Travis Watkins Date: Tue, 22 May 2012 23:44:03 -0500 Subject: [PATCH] Add fallback for when jline fails to initialize. Fixes BUKKIT-1675. --- .../java/net/minecraft/server/MinecraftServer.java | 13 +++++++++++-- .../java/net/minecraft/server/NetServerHandler.java | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index d6f69c998e..4ddccac4fa 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -93,8 +93,17 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe try { this.reader = new ConsoleReader(System.in, System.out); this.reader.setExpandEvents(false); // Avoid parsing exceptions for uncommonly used event designators - } catch (IOException ex) { - Logger.getLogger(MinecraftServer.class.getName()).log(Level.SEVERE, null, ex); + } catch (Exception e) { + 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)); // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index d07b114617..9d002fb841 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -932,6 +932,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { } else if (packet19entityaction.animation == 5) { this.player.setSprinting(false); } 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.checkMovement = false; }