Solved Line Error with ChatColor

Discussion in 'Spigot Plugin Development' started by RealRivex, Mar 31, 2020.

  1. Hey, i got an error on this Line:
    team.addEntry(ChatColor.AQUA + ChatColor.WHITE);

    the error is this:
    The operator + is undefined for the argument type(s) org.bukkit.ChatColor, org.bukkit.ChatColor

    would be glad to get helped!
  2. team.addEntry(ChatColor.AQUA + "" +ChatColor.WHITE);
  3. ChatColor is not a string

    ChatColor.AQUA.toString() + ChatColor.WHITE.toString()
  4. Really ...
    You can only assign ONE ChatColor to a section of text at a time.
    In your case
    team.addEntry(ChatColor.AQUA + ChatColor.WHITE);

    If that was possible, the ChatColor to be assigned would be 'WHITE' as the last ONE in your statement.

    Your IDE should be giving you some construction hints.

    But, as there is NO text object for the ChatColor to be assigned to, the statement would fail anyway.

    Your team.addEntry(ChatColor)
    Should be ...
    team.addEntry(String) (or, textObject)

    Then a valid statement would be
    team.addEntry(ChatColor + TextObject)
    #4 Goldentoenail, Mar 31, 2020
    Last edited: Mar 31, 2020