Operator '+' is invalid for ChatColor and int primitive type

Discussion in 'Plugin Development' started by Jaker232, Apr 7, 2012.

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

    Jaker232

    Code:java
    1.  
    2. p1.sendMessage(ChatColor.GOLD + points + " has been added to your stats and " + betting+ " added to your wallet.");
    3.  

    The following line above gives a line that returns this error message "The operator + is undefined for the argument type(s) ChatColor, int". I assume that I've tried parsing it using the String wrapper class, but no method could be found. What else methods are available for use?
     
  2. Offline

    Musaddict

    Change it to:
    Code:java
    1.  
    2. p1.sendMessage(ChatColor.GOLD + "" + points + " has been added to your stats and " + betting+ " added to your wallet.");
    3.  


    I think it doesn't like your int "points" being directly after your colorcode, so just add some quotations in between.
     
    jjacobson likes this.
  3. Offline

    Jaker232

    Thank you for your rather brief solution to this dilemma I have seem to have no clue how to fix. I will keep this in mind.
    I'll also keep in mind to credit you for helping me with an issue.
     
  4. Offline

    Musaddict

    Glad I could help :)
     
    jjacobson likes this.
Thread Status:
Not open for further replies.

Share This Page