use of org.bleachhack.command.Command in project BleachHack by BleachDrinker420.
the class CmdHelp method onCommand.
@Override
public void onCommand(String alias, String[] args) throws Exception {
String cmd = args.length == 0 ? "" : args[0];
if (cmd.isEmpty()) {
BleachLogger.info("Commands:");
} else {
BleachLogger.info("Syntax for " + getPrefix() + cmd.toLowerCase(Locale.ENGLISH) + ":");
}
for (Command c : CommandManager.getCommands()) {
if (!cmd.isEmpty() && Stream.of(c.getAliases()).noneMatch(cmd::equalsIgnoreCase))
continue;
MutableText text = new LiteralText(getPrefix() + c.getAliases()[0] + ": \u00a7f" + c.getDescription()).styled(s -> s.withColor(BleachLogger.INFO_COLOR));
BleachLogger.noPrefix(text.styled(style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, c.getHelpTooltip()))));
}
}
Aggregations