Solved Get Color From String

Discussion in 'Plugin Development' started by MrFrozen, Jul 14, 2015.

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

    MrFrozen

    When the players holds a item in the hand I wanna check if the item name cotains a color like ChatColor.GREEN and if it does execute code. This check is color depending and not name
     
  2. Offline

    mythbusterma

    @MrFrozen

    String#contains(ChatColor.GREEN)
     
  3. Offline

    MrFrozen

    The method contains(CharSequence) in the type String is not applicable for the arguments (ChatColor)
    Code:
    item.hasDisplayName() && item.getDisplayName().contains(ChatColor.DARK_GRAY)
     
  4. Online

    timtower Administrator Administrator Moderator

  5. Offline

    MrFrozen

    I just used
    Code:
    if(item.hasDisplayName() && item.getDisplayName().contains("" + ChatColor.AQUA)) {
    and it works fine thanks for help and I will declare this threas as sovled!
     
Thread Status:
Not open for further replies.

Share This Page