diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index 6087692cef..f11d2b2755 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -106,7 +106,14 @@ public class NetServerHandler extends NetHandler { this.h = false; ++this.f; // this.minecraftServer.methodProfiler.a("packetflow"); // CraftBukkit - not in production code - this.networkManager.b(); + // CraftBukkit start + try { + this.networkManager.b(); + } catch (Exception ex) { + logger.log(Level.WARNING, "Exception from " + this.player.name, ex); + this.disconnect(ex.getClass().getName()); + } + // CraftBukkit end // this.minecraftServer.methodProfiler.c("keepAlive"); // CraftBukkit - not in production code if ((long) this.f - this.l > 20L) { this.l = (long) this.f; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 500c490934..f11f7329e3 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -485,7 +485,12 @@ public final class CraftServer implements Server { return true; } } - return dispatchCommand(sender, serverCommand.command); + try { + return dispatchCommand(sender, serverCommand.command); + } catch (Exception ex) { + getLogger().log(Level.WARNING, "Unexpected exception while parsing console command \"" + serverCommand.command + '"', ex); + return false; + } } public boolean dispatchCommand(CommandSender sender, String commandLine) {