From 64682027a54a3580c748e818fde9622484f168ed Mon Sep 17 00:00:00 2001 From: Alex Thomson Date: Sat, 13 Oct 2018 14:40:00 +1300 Subject: [PATCH] Prevent commands run from console crashing the entire instance --- .../velocitypowered/proxy/console/VelocityConsole.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/console/VelocityConsole.java b/proxy/src/main/java/com/velocitypowered/proxy/console/VelocityConsole.java index c654a2388..5fd60d35b 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/console/VelocityConsole.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/console/VelocityConsole.java @@ -68,8 +68,12 @@ public final class VelocityConsole extends SimpleTerminalConsole implements Comm @Override protected void runCommand(String command) { - if (!this.server.getCommandManager().execute(this, command)) { - sendMessage(TextComponent.of("Command not found.", TextColor.RED)); + try { + if (!this.server.getCommandManager().execute(this, command)) { + sendMessage(TextComponent.of("Command not found.", TextColor.RED)); + } + } catch (Exception e) { + logger.error("An error occurred while running this command.", e); } }