How do I display two colors in one line?

Discussion in 'Plugin Development' started by NSPredator, Dec 1, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    NSPredator

    Hello,
    I am very new to programing and I am developing my first Craftbukkit plugin. I want the plugin to display a one part of a sentence in one color and another part of the sentence in another color. I want the sentence on one line but with two different colors. Is this possible?

    Here is what I have:
    Code:java
    1. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args ) {
    2. if(sender instanceof Player) {
    3. Player player = (Player) sender;
    4. if(cmd.getName().equalsIgnoreCase("ch")) {
    5. player.sendMessage(ChatColor.AQUA +"AQUA:");


    Many thanks,
    NSPredator
     
  2. Offline

    Windy Day

    Yes, very possible just use:
    Code:
    player.sendMessage(ChatColor.COLOR1 + "A message in color one! " + ChatColor.COLOR2 + "The rest of the message is in color two!");
     
  3. Offline

    KaiPol

    What Windy said, also if you want to add bold or italiac do:
    Code:
    (ChatColor.GOLD + "" + ChatColor.BOLD + "Gold, bold message!");
     
  4. Offline

    NSPredator

    Thank you very much for your help everyone.
    NSPredator
     
  5. Offline

    willy00

    Remember to tag this as solved.
     
Thread Status:
Not open for further replies.

Share This Page