Search in sources :

Example 1 with MorePageDisplay

use of logisticspipes.commands.chathelper.MorePageDisplay in project LogisticsPipes by RS485.

the class ListCommand method executeCommand.

@Override
public void executeCommand(ICommandSender sender, String[] args) {
    MorePageDisplay display = new MorePageDisplay(new String[] { "|< Wrapper status - Page: %/$ >|" }, sender);
    for (AbstractWrapper controller : LogisticsWrapperHandler.wrapperController) {
        StringBuilder builder = new StringBuilder();
        builder.append(ChatColor.AQUA);
        builder.append(controller.getName());
        builder.append(controller.getTypeName());
        builder.append(": ");
        if (controller.getState() == WrapperState.Enabled) {
            builder.append(ChatColor.GREEN);
            builder.append("enabled");
        } else if (controller.getState() == WrapperState.ModMissing) {
            builder.append(ChatColor.GRAY);
            builder.append("disabled (mod not found)");
        } else if (controller.getState() == WrapperState.Exception) {
            builder.append(ChatColor.RED);
            builder.append("disabled (exception)");
        } else {
            builder.append(ChatColor.BLUE);
            builder.append("disabled (" + controller.getReason() + ")");
        }
        display.append(builder.toString());
    }
    display.display(sender);
}
Also used : AbstractWrapper(logisticspipes.asm.wrapper.AbstractWrapper) MorePageDisplay(logisticspipes.commands.chathelper.MorePageDisplay)

Example 2 with MorePageDisplay

use of logisticspipes.commands.chathelper.MorePageDisplay in project LogisticsPipes by RS485.

the class SubCommandHandler method displayHelp.

public final void displayHelp(ICommandSender sender) {
    MorePageDisplay display = new MorePageDisplay(new String[] { "|< Help - " + getNames()[0] + " - Page: %/$ >|" }, sender);
    for (ICommandHandler command : subCommands) {
        if (!command.getDescription()[0].startsWith("#")) {
            boolean first = true;
            String prefix = (command instanceof SubCommandHandler ? ChatColor.BLUE : ChatColor.YELLOW) + command.getNames()[0] + ChatColor.RESET + ": ";
            for (int d = 0; d < command.getDescription().length; d++) {
                display.append(prefix + command.getDescription()[d], !first);
                prefix = "    ";
                first = false;
            }
            if (command instanceof SubCommandHandler) {
                display.append("      " + ChatColor.GRAY + "- add " + ChatColor.YELLOW + "help" + ChatColor.GRAY + " to see the subcommands", true);
            }
            first = true;
            if (command.getNames().length > 1) {
                for (int i = 1; i < command.getNames().length; i++) {
                    display.append((first ? "  alias: - " : "         - ") + ChatColor.GOLD + command.getNames()[i] + "", true);
                    first = false;
                }
            }
            display.append("", true);
        }
    }
    display.display(sender);
}
Also used : MorePageDisplay(logisticspipes.commands.chathelper.MorePageDisplay)

Example 3 with MorePageDisplay

use of logisticspipes.commands.chathelper.MorePageDisplay in project LogisticsPipes by RS485.

the class ChangelogCommand method executeCommand.

@Override
public void executeCommand(ICommandSender sender, String[] args) {
    VersionChecker versionChecker = LogisticsPipes.versionChecker;
    String statusMessage = versionChecker.getVersionCheckerStatus();
    if (versionChecker.isVersionCheckDone() && versionChecker.getVersionInfo().isNewVersionAvailable()) {
        VersionChecker.VersionInfo versionInfo = versionChecker.getVersionInfo();
        MorePageDisplay display = new MorePageDisplay(new String[] { "(The newest version is #" + versionInfo.getNewestBuild() + ")", "< Changelog Page %/$ >" }, sender);
        if (versionInfo.getChangelog().isEmpty()) {
            display.append("No commits since your version.");
        } else {
            versionInfo.getChangelog().forEach(display::append);
        }
        display.display(sender);
    } else {
        sender.addChatMessage(new ChatComponentText(statusMessage));
    }
}
Also used : VersionChecker(logisticspipes.ticks.VersionChecker) ChatComponentText(net.minecraft.util.ChatComponentText) MorePageDisplay(logisticspipes.commands.chathelper.MorePageDisplay)

Aggregations

MorePageDisplay (logisticspipes.commands.chathelper.MorePageDisplay)3 AbstractWrapper (logisticspipes.asm.wrapper.AbstractWrapper)1 VersionChecker (logisticspipes.ticks.VersionChecker)1 ChatComponentText (net.minecraft.util.ChatComponentText)1