Java Code Examples for org.bukkit.ChatColor#ITALIC

The following examples show how to use org.bukkit.ChatColor#ITALIC . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScoreboardManager.java    From UhcCore with GNU General Public License v3.0 6 votes vote down vote up
public String getScoreboardLine(int line){
    if (line == 0) return ChatColor.UNDERLINE + "" + ChatColor.RESET;
    if (line == 1) return ChatColor.ITALIC + "" + ChatColor.RESET;
    if (line == 2) return ChatColor.BOLD + "" + ChatColor.RESET;
    if (line == 3) return ChatColor.RESET + "" + ChatColor.RESET;
    if (line == 4) return ChatColor.GREEN + "" + ChatColor.RESET;
    if (line == 5) return ChatColor.DARK_GRAY + "" + ChatColor.RESET;
    if (line == 6) return ChatColor.GOLD + "" + ChatColor.RESET;
    if (line == 7) return ChatColor.RED + "" + ChatColor.RESET;
    if (line == 8) return ChatColor.YELLOW + "" + ChatColor.RESET;
    if (line == 9) return ChatColor.WHITE + "" + ChatColor.RESET;
    if (line == 10) return ChatColor.DARK_GREEN + "" + ChatColor.RESET;
    if (line == 11) return ChatColor.BLUE + "" + ChatColor.RESET;
    if (line == 12) return ChatColor.STRIKETHROUGH + "" + ChatColor.RESET;
    if (line == 13) return ChatColor.MAGIC + "" + ChatColor.RESET;
    if (line == 14) return ChatColor.DARK_RED + "" + ChatColor.RESET;
    return null;
}
 
Example 2
Source File: PrefixTest.java    From UHC with MIT License 6 votes vote down vote up
@Test
public void testContainsColoursOneFormatting() throws Exception {
    Prefix prefix = new Prefix(ChatColor.AQUA, ChatColor.ITALIC);

    assertThat(prefix.containsColours(false, ChatColor.AQUA)).isTrue();
    assertThat(prefix.containsColours(true, ChatColor.AQUA)).isFalse();

    assertThat(prefix.containsColours(false, ChatColor.BLUE)).isFalse();
    assertThat(prefix.containsColours(true, ChatColor.BLUE)).isFalse();

    assertThat(prefix.containsColours(false, ChatColor.ITALIC)).isTrue();
    assertThat(prefix.containsColours(true, ChatColor.ITALIC)).isFalse();

    assertThat(prefix.containsColours(false, ChatColor.AQUA, ChatColor.ITALIC)).isTrue();
    assertThat(prefix.containsColours(true, ChatColor.AQUA, ChatColor.ITALIC)).isTrue();

    assertThat(prefix.containsColours(true, ChatColor.BLUE, ChatColor.ITALIC)).isFalse();
    assertThat(prefix.containsColours(true, ChatColor.BLUE, ChatColor.ITALIC)).isFalse();
}
 
Example 3
Source File: PrefixTest.java    From UHC with MIT License 6 votes vote down vote up
@Test
public void testContainsColoursTwoFormatting() throws Exception {
    Prefix prefix = new Prefix(ChatColor.AQUA, ChatColor.ITALIC, ChatColor.BOLD);

    assertThat(prefix.containsColours(false, ChatColor.AQUA)).isTrue();
    assertThat(prefix.containsColours(true, ChatColor.AQUA)).isFalse();

    assertThat(prefix.containsColours(false, ChatColor.BLUE)).isFalse();
    assertThat(prefix.containsColours(true, ChatColor.BLUE)).isFalse();

    assertThat(prefix.containsColours(false, ChatColor.ITALIC)).isTrue();
    assertThat(prefix.containsColours(true, ChatColor.ITALIC)).isFalse();

    assertThat(prefix.containsColours(false, ChatColor.AQUA, ChatColor.ITALIC)).isTrue();
    assertThat(prefix.containsColours(true, ChatColor.AQUA, ChatColor.ITALIC)).isFalse();

    assertThat(prefix.containsColours(true, ChatColor.BLUE, ChatColor.ITALIC)).isFalse();
    assertThat(prefix.containsColours(true, ChatColor.BLUE, ChatColor.ITALIC)).isFalse();
}
 
Example 4
Source File: Command.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
public static void broadcastCommandMessage(CommandSender source, String message, boolean sendToSource) {
    String result = source.getName() + ": " + message;

    if (source instanceof BlockCommandSender) {
        BlockCommandSender blockCommandSender = (BlockCommandSender) source;

        if (blockCommandSender.getBlock().getWorld().getGameRuleValue("commandBlockOutput").equalsIgnoreCase("false")) {
            Bukkit.getConsoleSender().sendMessage(result);
            return;
        }
    } else if (source instanceof CommandMinecart) {
        CommandMinecart commandMinecart = (CommandMinecart) source;

        if (commandMinecart.getWorld().getGameRuleValue("commandBlockOutput").equalsIgnoreCase("false")) {
            Bukkit.getConsoleSender().sendMessage(result);
            return;
        }
    }

    Set<Permissible> users = Bukkit.getPluginManager().getPermissionSubscriptions(Server.BROADCAST_CHANNEL_ADMINISTRATIVE);
    String colored = ChatColor.GRAY + "" + ChatColor.ITALIC + "[" + result + ChatColor.GRAY + ChatColor.ITALIC + "]";

    if (sendToSource && !(source instanceof ConsoleCommandSender)) {
        source.sendMessage(message);
    }

    for (Permissible user : users) {
        if (user instanceof CommandSender && user.hasPermission(Server.BROADCAST_CHANNEL_ADMINISTRATIVE)) {
            CommandSender target = (CommandSender) user;

            if (target instanceof ConsoleCommandSender) {
                target.sendMessage(result);
            } else if (target != source) {
                target.sendMessage(colored);
            }
        }
    }
}
 
Example 5
Source File: BonusGoodie.java    From civcraft with GNU General Public License v2.0 5 votes vote down vote up
public String getBonusDisplayString() {
	String out = "";
	
	for (ConfigBuff cBuff : this.config.buffs.values()) {
		out += ChatColor.UNDERLINE+cBuff.name;
		out += ";";
		out += CivColor.White+ChatColor.ITALIC+cBuff.description;
		out += ";";
	}

	return out;		
}
 
Example 6
Source File: ItemQualityColorizer.java    From EliteMobs with GNU General Public License v3.0 4 votes vote down vote up
private static ItemMeta colorizeNameAndLore(ChatColor chatColor, ItemMeta itemMeta) {

        itemMeta.setDisplayName(chatColor + itemMeta.getDisplayName());

        List list = new ArrayList();

        if (itemMeta.getLore() != null) {

            for (String string : itemMeta.getLore()) {

                if (!string.isEmpty()) {

                    String colorizedString = chatColor + "" + ChatColor.ITALIC + string;
                    list.add(colorizedString);

                }

            }

            itemMeta.setLore(list);

        }

        return itemMeta;

    }
 
Example 7
Source File: Contributor.java    From CardinalPGM with MIT License 4 votes vote down vote up
public String toChatMessage() {
    return getDisplayName() +
            (contribution != null ? ChatColor.GRAY + " - " + ChatColor.ITALIC + getContribution() : "");
}
 
Example 8
Source File: ItemQualityColorizer.java    From EliteMobs with GNU General Public License v3.0 3 votes vote down vote up
private static ItemMeta colorizeBoldNameAndLore(ChatColor chatColor, ItemMeta itemMeta) {

        /*
        Cancel colorization in case item already has a color (for custom and unique items)
         */
        if (itemMeta.getDisplayName().equals(ChatColor.stripColor(itemMeta.getDisplayName())))
            itemMeta.setDisplayName(chatColor + "" + ChatColor.BOLD + "" + itemMeta.getDisplayName());

        List list = new ArrayList();

        if (!itemMeta.getLore().isEmpty()) {

            for (String string : itemMeta.getLore()) {

                if (!string.isEmpty()) {

                    String colorizedString = chatColor + "" + ChatColor.BOLD + "" + ChatColor.ITALIC + string;
                    list.add(colorizedString);

                }

            }

            itemMeta.setLore(list);

        }

        return itemMeta;

    }