mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-09 08:32:07 -07:00
Fix crash from console-commands throwing exception. Fixes BUKKIT-2479
When 1.3.1 was released, a try-catch block was removed from the tick loop that called the method in NMS to handle commands. This restores a try-catch to prevent the console from crashing the server.
This commit is contained in:
@@ -106,7 +106,14 @@ public class NetServerHandler extends NetHandler {
|
|||||||
this.h = false;
|
this.h = false;
|
||||||
++this.f;
|
++this.f;
|
||||||
// this.minecraftServer.methodProfiler.a("packetflow"); // CraftBukkit - not in production code
|
// this.minecraftServer.methodProfiler.a("packetflow"); // CraftBukkit - not in production code
|
||||||
|
// CraftBukkit start
|
||||||
|
try {
|
||||||
this.networkManager.b();
|
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
|
// this.minecraftServer.methodProfiler.c("keepAlive"); // CraftBukkit - not in production code
|
||||||
if ((long) this.f - this.l > 20L) {
|
if ((long) this.f - this.l > 20L) {
|
||||||
this.l = (long) this.f;
|
this.l = (long) this.f;
|
||||||
|
@@ -485,7 +485,12 @@ public final class CraftServer implements Server {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
return dispatchCommand(sender, serverCommand.command);
|
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) {
|
public boolean dispatchCommand(CommandSender sender, String commandLine) {
|
||||||
|
Reference in New Issue
Block a user