use of net.wurstclient.features.Cmd in project Wurst-MC-1.12 by Wurst-Imperium.
the class HelpCmd method call.
@Override
public void call(String[] args) throws CmdException {
if (args.length == 0) {
call(new String[] { "1" });
return;
}
int pages = (int) Math.ceil(wurst.commands.countCommands() / 8D);
if (MiscUtils.isInteger(args[0])) {
int page = Integer.valueOf(args[0]);
if (page > pages || page < 1)
throw new CmdSyntaxError("Invalid page: " + page);
ChatUtils.message("Available commands: " + wurst.commands.countCommands());
ChatUtils.message("Command list (page " + page + "/" + pages + "):");
Iterator<Cmd> itr = wurst.commands.getAllCommands().iterator();
for (int i = 0; itr.hasNext(); i++) {
Cmd cmd = itr.next();
if (i >= (page - 1) * 8 && i < (page - 1) * 8 + 8)
ChatUtils.message(cmd.getCmdName());
}
} else {
Cmd cmd = wurst.commands.getCommandByName(args[0]);
if (cmd != null) {
ChatUtils.message("Available help for ." + args[0] + ":");
cmd.printHelp();
cmd.printSyntax();
} else
throw new CmdError("Command \"" + args[0] + "\" could not be found.");
}
}
use of net.wurstclient.features.Cmd 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);
}
}
use of net.wurstclient.features.Cmd in project Wurst-MC-1.12 by Wurst-Imperium.
the class FeaturesCmd method call.
@Override
public void call(String[] args) throws CmdException {
if (args.length != 0)
throw new CmdSyntaxError();
ChatUtils.message("> All features: " + wurst.navigator.countAllFeatures());
ChatUtils.message("> Mods: " + wurst.mods.countMods());
ChatUtils.message("> Commands: " + wurst.commands.countCommands());
ChatUtils.message("> Special features: " + wurst.special.countFeatures());
int settings = 0, bypasses = 0;
for (Mod mod : wurst.mods.getAllMods()) {
settings += mod.getSettings().size();
if (mod.getClass().getAnnotation(Mod.Bypasses.class).mineplex())
bypasses++;
}
ChatUtils.message("> NoCheat bypasses (mods only): " + bypasses);
for (Cmd cmd : wurst.commands.getAllCommands()) settings += cmd.getSettings().size();
for (Spf spf : wurst.special.getAllFeatures()) settings += spf.getSettings().size();
ChatUtils.message("> Settings: " + settings);
}
Aggregations