diff --git a/TacoSpigot-API/src/main/java/org/bukkit/command/SimpleCommandMap.java b/TacoSpigot-API/src/main/java/org/bukkit/command/SimpleCommandMap.java index 12d9232..bcb03b1 100644 --- a/TacoSpigot-API/src/main/java/org/bukkit/command/SimpleCommandMap.java +++ b/TacoSpigot-API/src/main/java/org/bukkit/command/SimpleCommandMap.java @@ -137,19 +137,23 @@ public class SimpleCommandMap implements CommandMap { return false; } - try { - target.timings.startTiming(); // Spigot - // Note: we don't return the result of target.execute as thats success / failure, we return handled (true) or not handled (false) + if (target.timings == null) { target.execute(sender, sentCommandLabel, Arrays_copyOfRange(args, 1, args.length)); - target.timings.stopTiming(); // Spigot - } catch (CommandException ex) { - target.timings.stopTiming(); // Spigot - throw ex; - } catch (Throwable ex) { - target.timings.stopTiming(); // Spigot - throw new CommandException("Unhandled exception executing '" + commandLine + "' in " + target, ex); + } else { + try { + target.timings.startTiming(); // Spigot + // Note: we don't return the result of target.execute as thats success / failure, we return handled (true) or not handled (false) + target.execute(sender, sentCommandLabel, Arrays_copyOfRange(args, 1, args.length)); + target.timings.stopTiming(); // Spigot + } catch (CommandException ex) { + target.timings.stopTiming(); // Spigot + throw ex; + } catch (Throwable ex) { + target.timings.stopTiming(); // Spigot + String msg = "Unhandled exception executing '" + commandLine + "' in " + target; + throw new CommandException(msg, ex); + } } - // return true as command was handled return true; } @@ -224,7 +228,8 @@ public class SimpleCommandMap implements CommandMap { } catch (CommandException ex) { throw ex; } catch (Throwable ex) { - throw new CommandException("Unhandled exception executing tab-completer for '" + cmdLine + "' in " + target, ex); + String msg = "Unhandled exception executing tab-completer for '" + cmdLine + "' in " + target; + throw new CommandException(msg, ex); } } // PaperSpigot end @@ -273,4 +278,4 @@ public class SimpleCommandMap implements CommandMap { } } } -} +} \ No newline at end of file