use of net.minecraft.util.ChatStyle in project ForestryMC by ForestryMC.
the class CommandVersion method processSubCommand.
@Override
public void processSubCommand(ICommandSender sender, String[] args) {
ChatStyle style = new ChatStyle();
if (Version.isOutdated()) {
style.setColor(EnumChatFormatting.RED);
} else {
style.setColor(EnumChatFormatting.GREEN);
}
CommandHelpers.sendLocalizedChatMessage(sender, style, "for.chat.version", Version.getVersion(), Proxies.common.getMinecraftVersion(), Version.getRecommendedVersion());
if (Version.isOutdated()) {
for (String updateLine : Version.getChangelog()) {
CommandHelpers.sendChatMessage(sender, EnumChatFormatting.BLUE + updateLine);
}
}
}
use of net.minecraft.util.ChatStyle in project BloodMagic by WayofTime.
the class CommandBloodMagic method processCommand.
@Override
public void processCommand(ICommandSender commandSender, String[] args) {
if (args.length > 0 && subCommands.containsKey(args[0])) {
ISubCommand subCommand = subCommands.get(args[0]);
String[] subArgs = Arrays.copyOfRange(args, 1, args.length);
if (subCommand.canSenderUseSubCommand(commandSender))
subCommand.processSubCommand(commandSender, subArgs);
else
commandSender.addChatMessage(new ChatComponentTranslation("commands.error.perm").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED)));
} else {
commandSender.addChatMessage(new ChatComponentTranslation("commands.error.unknown").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED)));
}
}
use of net.minecraft.util.ChatStyle in project ct.js by ChatTriggers.
the class Message method parseMessages.
// helper method to parse chat component parts
private void parseMessages() {
this.chatMessage = new ChatComponentText("");
for (Object message : this.messageParts) {
if (message instanceof String) {
String toAdd = ((String) message);
ChatComponentText cct = new ChatComponentText(this.formatted ? ChatLib.addColor(toAdd) : toAdd);
cct.setChatStyle(new ChatStyle().setParentStyle(null));
this.chatMessage.appendSibling(cct);
} else if (message instanceof TextComponent) {
this.chatMessage.appendSibling(((TextComponent) message).getChatComponentText());
}
}
}
use of net.minecraft.util.ChatStyle in project watson by totemo.
the class WatsonCommandBase method sendColouredText.
// --------------------------------------------------------------------------
/**
* Send a message to the specified command sender in the specified colour.
*
* @param sender the command sender who is the message recipient.
* @param colour the colour.
* @param message the text.
*/
public void sendColouredText(ICommandSender sender, EnumChatFormatting colour, String message) {
ChatComponentText chat = new ChatComponentText(message);
ChatStyle style = new ChatStyle();
style.setColor(colour);
chat.setChatStyle(style);
sender.addChatMessage(chat);
}
use of net.minecraft.util.ChatStyle in project watson by totemo.
the class Chat method localChat.
// --------------------------------------------------------------------------
/**
* Display a chat message locally.
*
* @param colour the colour to format the text as.
* @param message the text to display.
*/
public static void localChat(EnumChatFormatting colour, String message) {
ChatComponentText chat = new ChatComponentText(message);
ChatStyle style = new ChatStyle();
style.setColor(colour);
chat.setChatStyle(style);
localChat(chat);
}
Aggregations