Solved JSON ChatMessage

Discussion in 'Plugin Development' started by badboysteee98, Apr 19, 2014.

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

    badboysteee98

    Hello Bukkit,

    I need some help with JSON ChatMessage and how to make a new line

    Code:java
    1. if(cmd.getName().equalsIgnoreCase("vote")) {
    2. new FancyMessage
    3. (ChatColor.GOLD + "--------------------------------------------")
    4. .then(ChatColor.LIGHT_PURPLE + "Voting Daily Gets You Money And More Cool Items")//Need this to be a new line
    5. .link("[url]http://www.endersoul.net/vote[/url]")
    6. .tooltip(ChatColor.GREEN + "Go to the voting website")
    7. .then(ChatColor.GOLD + "--------------------------------------------")//Need this to be a new line
    8. .send(player);
    9. return true;
    10. }


    Any help is thankful and any docs will help aswell :D
     
  2. Offline

    Heirteir

    badboysteee98
    This should fix your problem this isn't tested but you should get what I am trying to throw
    Code:java
    1. if(cmd.getName().equalsIgnoreCase("vote")) {
    2. new FancyMessage
    3. (ChatColor.GOLD + "--------------------------------------------")
    4. .then(ChatColor.LIGHT_PURPLE + "Voting Daily Gets You Money And More Cool Items")//Need this to be a new line
    5. .link("[url]http://www.endersoul.net/vote[/url]")
    6. .tooltip(Arrays.asList(ChatColor.GREEN + "Go to the voting website", "line 2", "line 3", "line4", "etc"))
    7. .then(ChatColor.GOLD + "--------------------------------------------")//Need this to be a new line
    8. .send(player);
    9. return true;
    10. }


    Using Arrays.asList(); I can list all the strings on the tooltip!
    (This isn't tested please let me know if it doesn't work.)

    P.S: Let me know if it works!

    --Heirteir
     
  3. Offline

    badboysteee98

    Heirteir Okay testing

    Heirteir Not sure your trying to do what I am I'm trying to make it so when a player does /vote this shows up

    -----------------
    Voting daily.........
    -----------------

    Atm it shows up like this
    --------------------------Voting daily....
    ----------------------

    A new line for each message

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 7, 2016
  4. Offline

    Heirteir

    badboysteee98
    Ah I misread what you were asking xD
    Simply use \n using the .then();
    Code:java
    1. .then("\nline 1\nLine2\nLine3\nLine 4\nETC.");

    I think that's what your looking for

    EDIT:
    Of course you could use many .then(); methods and make different colors for each line if you would like.
     
  5. Offline

    badboysteee98

    Heirteir This doesn't work either sorry :/

    I get wired characters

    EDIT: Already tried your last part doesn't work
     
  6. Offline

    Heirteir

    badboysteee98
    Instead of making the whole thing a json chat message make the part that you need the tooltip on the chat message
    Example:
    Code:java
    1. if(cmd.getName().equalsIgnoreCase("vote")) {
    2. player.sendMessage(ChatColor.GOLD + "--------------------------------------------");
    3. new FancyMessage
    4. (ChatColor.LIGHT_PURPLE + "Voting Daily Gets You Money And More Cool Items")//Need this to be a new line
    5. .link("[url]http://www.endersoul.net/vote[/url]")
    6. .tooltip(ChatColor.GREEN + "Go to the voting website")
    7. .send(player);
    8. player.sendMessage(ChatColor.GREEN + "Line 1\nLine 2\nLine3\nLine4\nLine 5");
    9. player.sendMessage(ChatColor.GOLD + "--------------------------------------------");//Need this to be a new line
    10. return true;
    11. }


    You gotta think outside the box my friend

    --Heirteir
     
  7. Offline

    badboysteee98

    Heirteir Arrr like it :p +1 like from me :D
     
  8. Offline

    Heirteir

Thread Status:
Not open for further replies.

Share This Page