use of net.wurstclient.features.Cmd.CmdException in project Wurst-MC-1.12 by Wurst-Imperium.
the class CmdManager method runCommand.
public void runCommand(String input) {
String[] parts = input.split(" ");
Cmd cmd = getCommandByName(parts[0]);
if (cmd == null) {
ChatUtils.error("Unknown command: ." + parts[0]);
if (input.startsWith("/"))
ChatUtils.message("Use \".say " + input + "\" to send it as a chat command.");
else
ChatUtils.message("Type \".help\" for a list of commands or \".say ." + input + "\" to send it as a chat message.");
return;
}
try {
cmd.call(Arrays.copyOfRange(parts, 1, parts.length));
} catch (CmdException e) {
e.printToChat();
} catch (Throwable e) {
CrashReport crashReport = CrashReport.makeCrashReport(e, "Running Wurst command");
CrashReportCategory crashReportCategory = crashReport.makeCategory("Affected command");
crashReportCategory.setDetail("Command input", () -> input);
throw new ReportedException(crashReport);
}
}
Aggregations