Fixed commands not working.

This commit is contained in:
ImHacking 2022-06-23 17:10:08 -04:00
parent 9126c9d295
commit 6e6e4d3fe0
1 changed files with 18 additions and 13 deletions

View File

@ -137,6 +137,9 @@ public class SimpleCommandMap implements CommandMap {
return false;
}
if (target.timings == null) {
target.execute(sender, sentCommandLabel, Arrays_copyOfRange(args, 1, args.length));
} 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)
@ -147,9 +150,10 @@ public class SimpleCommandMap implements CommandMap {
throw ex;
} catch (Throwable ex) {
target.timings.stopTiming(); // Spigot
throw new CommandException("Unhandled exception executing '" + commandLine + "' in " + target, ex);
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