Search in sources :

Example 11 with ChatStyle

use of net.minecraft.util.ChatStyle in project watson by totemo.

the class WatsonCommand method help.

// handleConfigCommand
// --------------------------------------------------------------------------
/**
 * Show a help message.
 */
public void help(ICommandSender sender) {
    String w = Configuration.instance.getWatsonPrefix();
    localOutput(sender, "Usage:");
    localOutput(sender, "  /" + w + " help");
    localOutput(sender, "  /" + w + " display [on|off]");
    localOutput(sender, "  /" + w + " outline [on|off]");
    localOutput(sender, "  /" + w + " anno [on|off]");
    localOutput(sender, "  /" + w + " vector [on|off]");
    localOutput(sender, "  /" + w + " vector (creations|destructions) [on|off]");
    localOutput(sender, "  /" + w + " vector length <decimal>");
    localOutput(sender, "  /" + w + " label [on|off]");
    localOutput(sender, "  /" + w + " clear");
    localOutput(sender, "  /" + w + " pre [<count>]");
    localOutput(sender, "  /" + w + " post [<count>]");
    localOutput(sender, "  /" + w + " ore [<page>]");
    localOutput(sender, "  /" + w + " ratio");
    localOutput(sender, "  /" + w + " tp [next|prev|<number>]");
    localOutput(sender, "  /" + w + " edits [list]");
    localOutput(sender, "  /" + w + " edits (hide|show|remove) <player> ...");
    localOutput(sender, "  /" + w + " filter [list|clear]");
    localOutput(sender, "  /" + w + " filter (add|remove) <player> ...");
    localOutput(sender, "  /" + w + " servertime");
    localOutput(sender, "  /" + w + " file list [*|<playername>] [<page>]");
    localOutput(sender, "  /" + w + " file delete *|<filename>|<playername>");
    localOutput(sender, "  /" + w + " file expire <YYYY-MM-DD>");
    localOutput(sender, "  /" + w + " file load <filename>|<playername>");
    localOutput(sender, "  /" + w + " file save [<filename>]");
    localOutput(sender, "  /" + w + " config <name> [<value>]");
    localOutput(sender, "  /hl help");
    localOutput(sender, "  /anno help");
    // Make the documentation link clickable.
    IChatComponent docs = new ChatComponentText("Documentation: ");
    ChatStyle style = new ChatStyle().setColor(EnumChatFormatting.AQUA);
    docs.setChatStyle(style);
    String url = "http://github.com/totemo/watson";
    IChatComponent link = new ChatComponentText(url);
    ChatStyle linkStyle = new ChatStyle();
    linkStyle.setUnderlined(true);
    link.setChatStyle(linkStyle);
    linkStyle.setChatClickEvent(new ClickEvent(Action.OPEN_URL, url));
    docs.appendSibling(link);
    sender.addChatMessage(docs);
    if (!Configuration.instance.isEnabled()) {
        localOutput(sender, "Watson is currently disabled.");
        localOutput(sender, "To re-enable, use: /" + w + " config watson on");
    }
}
Also used : ChatStyle(net.minecraft.util.ChatStyle) ClickEvent(net.minecraft.event.ClickEvent) IChatComponent(net.minecraft.util.IChatComponent) ChatComponentText(net.minecraft.util.ChatComponentText)

Example 12 with ChatStyle

use of net.minecraft.util.ChatStyle in project ForestryMC by ForestryMC.

the class CommandHelpers method printHelp.

public static void printHelp(ICommandSender sender, IForestryCommand command) {
    String commandString = command.getFullCommandString().replace(" ", ".");
    ChatStyle header = new ChatStyle();
    header.setColor(EnumChatFormatting.BLUE);
    sendLocalizedChatMessage(sender, header, "for.chat.command." + commandString + ".format", command.getFullCommandString());
    ChatStyle body = new ChatStyle();
    body.setColor(EnumChatFormatting.GRAY);
    List<String> commandAliases = command.getCommandAliases();
    if (commandAliases.size() > 0) {
        sendLocalizedChatMessage(sender, body, "for.chat.command.aliases", commandAliases.toString().replace("[", "").replace("]", ""));
    }
    int permLevel = command.getPermissionLevel();
    if (permLevel > 0) {
        sendLocalizedChatMessage(sender, body, "for.chat.command.permlevel", permLevel);
    }
    sendLocalizedChatMessage(sender, body, "for.chat.command." + commandString + ".help");
    if (!command.getChildren().isEmpty()) {
        sendLocalizedChatMessage(sender, "for.chat.command.list");
        for (SubCommand child : command.getChildren()) {
            sendLocalizedChatMessage(sender, "for.chat.command." + child.getFullCommandString().replace(" ", ".") + ".desc", child.getCommandName());
        }
    }
}
Also used : ChatStyle(net.minecraft.util.ChatStyle)

Example 13 with ChatStyle

use of net.minecraft.util.ChatStyle in project ForestryMC by ForestryMC.

the class CommandModeInfo method processSubCommand.

@Override
public void processSubCommand(ICommandSender sender, String[] args) {
    if (args.length <= 0) {
        printHelp(sender);
        return;
    }
    String modeName = modeHelper.getModeNameMatching(args[0]);
    if (modeName == null) {
        CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.mode.info.error", args[0]);
        printHelp(sender);
        return;
    }
    ChatStyle green = new ChatStyle();
    green.setColor(EnumChatFormatting.GREEN);
    CommandHelpers.sendLocalizedChatMessage(sender, green, modeName);
    for (String desc : modeHelper.getDescription(modeName)) {
        CommandHelpers.sendLocalizedChatMessage(sender, "for." + desc);
    }
}
Also used : ChatStyle(net.minecraft.util.ChatStyle)

Aggregations

ChatStyle (net.minecraft.util.ChatStyle)13 ChatComponentText (net.minecraft.util.ChatComponentText)8 IChatComponent (net.minecraft.util.IChatComponent)5 ClickEvent (net.minecraft.event.ClickEvent)4 InvokeEvent (cc.hyperium.event.InvokeEvent)2 HoverEvent (net.minecraft.event.HoverEvent)2 ISubCommand (WayofTime.alchemicalWizardry.api.command.ISubCommand)1 LevelheadDisplay (cc.hyperium.mods.levelhead.display.LevelheadDisplay)1 ToggleBase (cc.hyperium.mods.togglechat.toggles.ToggleBase)1 TypeMessageSeparator (cc.hyperium.mods.togglechat.toggles.defaults.TypeMessageSeparator)1 ArrayList (java.util.ArrayList)1 UUID (java.util.UUID)1 ChatComponentTranslation (net.minecraft.util.ChatComponentTranslation)1 EnumChatFormatting (net.minecraft.util.EnumChatFormatting)1