Bold?

Discussion in 'Plugin Development' started by Newby, Dec 18, 2013.

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

    Newby

    How to I sent a message to a player in bold blue? I tried
    Code:
    player.sendMessage(ChatColor.BOLD.toString() + ChatColor.BLUE + "Survival" + ChatColor.DARK_AQUA + " to " + ChatColor.BOLD + ChatColor.BLUE + "Creative.");
    but it comes out like this:
    http://prntscr.com/2c9ooi
     
  2. Offline

    Pezah

    Try ChatColor.BLUE + ChatColor.BOLD.
     
    Newby likes this.
  3. Offline

    ccrama

    No, it needs a string after the color. Do ChatColor.BLUE +""+ChatColor.BOLD+your string. The color needs to be first!
     
    Newby likes this.
  4. Offline

    ThunderWaffeMC

    After each ChatColor you must add a string ("") even if it's empty. For example this is what you would use:

    Code:java
    1.  
    2. player.sendMessage(ChatColor.BLUE + "" + ChatColor.BOLD.toString() + "Survival " + ChatColor.DARK_AQUA + "to " + ChatColor.BLUE + "" + ChatColor.BOLD + "Creative.");
    3.  
     
    Newby likes this.
  5. Offline

    xTrollxDudex

    Newby
    The best coding style is
    PHP:
    ChatColor.BOLD.toString() + ChatColor.BLUE /* your text */
     
  6. Offline

    JRL1004

    xTrollxDudex "Format" ChatColors are a bit broken, in that they only work in one way. You have to define the color BEFORE the format, any other way disables the format, so the correct code is:
    PHP:
    ChatColor.BLUE.toString() + ChatColor.BOLD /* your text */
     
    Newby likes this.
  7. Offline

    xTrollxDudex

    Well, I don't play minecraft much or test my code at all so :p
     
  8. Offline

    Newby

    Thanks for the replies guys, it is working now :D
    I have another problem though, I have this check:
    Code:
    if (!(player.hasPermission("perms.donator")) || (player.hasPermission("perms.warrior")) || (player.hasPermission("perms.knight")) || (player.hasPermission("perms.elite")) || (player.hasPermission("hauntedessentials.legend")) || (player.hasPermission("perms.lord")) || (player.hasPermission("perms.overlord")) || (player.hasPermission("perms.god")) || (player.hasPermission("perms.haunted")) || (player.hasPermission("perms.trial-mod")) || (player.hasPermission("perms.mod")) || (player.hasPermission("perms.admin")))
                    {
                        MessageManagerUtility.invalidPermission(player, command);
                        return true;
                    }
                    player.openInventory(player.getEnderChest());
    even if I am OP it still doesn't open my enderchest, it tells me I don't have permission
     
  9. Offline

    ResultStatic

    try putting else before player.openInve....
     
  10. Offline

    Newby

    ResultStatic
    Sorry for the late reply but it is still telling I don't have permission even after adding the else
     
Thread Status:
Not open for further replies.

Share This Page