From 29d036a13fff895db0881d69406856b4321fdebf Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Mon, 10 May 2021 22:57:07 +0200 Subject: [PATCH] Better error handling for BrigadierCommand in bungee lib --- .../lib/bungee/commands/BrigadierCommand.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Bungee/src/main/java/fr/pandacube/lib/bungee/commands/BrigadierCommand.java b/Bungee/src/main/java/fr/pandacube/lib/bungee/commands/BrigadierCommand.java index 5667822..cdc0fe3 100644 --- a/Bungee/src/main/java/fr/pandacube/lib/bungee/commands/BrigadierCommand.java +++ b/Bungee/src/main/java/fr/pandacube/lib/bungee/commands/BrigadierCommand.java @@ -42,8 +42,16 @@ public abstract class BrigadierCommand extends ChatStatic { } dispatcher = BrigadierDispatcher.getInstance(); - LiteralArgumentBuilder builder = buildCommand(); - String[] aliases = getAliases(); + LiteralArgumentBuilder builder; + String[] aliases; + + try { + builder = buildCommand(); + aliases = getAliases(); + } catch (Exception e) { + Log.severe("Exception encountered when building Brigadier command " + getClass().getName(), e); + return; + } if (aliases == null) aliases = new String[0];