[1.8.8] Sending a message with "

Discussion in 'Spigot Plugin Development' started by TheDaChicken, Jun 4, 2017.

  1. Hello, How do you send a player a message with "
    Code (Text):
    player.sendMessage("");
    ? because the message needs to have " around the string
     
  2. You can escape the character with a backslash (i.e. sendMessage(" \" "))
     
  3. I am getting a ERROR in ECLIPSE on:
    Code (Text):
    Bukkit.dispatchCommand(Main.Console, "replaceitem entity DatChicken040 slot.armor.head skull 1 3 {display:{Name:\Chicken\},SkullOwner:{Id:\7d3a8ace-e045-4eba-ab71-71dbf525daf1\,Properties:{textures:[{Value:\eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTYzODQ2OWE1OTljZWVmNzIwNzUzNzYwMzI0OGE5YWIxMWZmNTkxZmQzNzhiZWE0NzM1YjM0NmE3ZmFlODkzIn19fQ==\}]}}}");
    I was sending a command with " so I put \ then I get this ERORR:
    ERRORIMAGE0.PNG
     
  4. This is one of the first things you learn with java, they said it above you use \" plus eclipse told you right there. Example:

    Player.sendMessage("My name is \"xPlumpOrange\"");

    Output

    My Name Is "xPlumpOrange"

    A Beginner Java Textbook Talking About This:

    [​IMG]
     
    #5 xPlumpOrange, Jun 4, 2017
    Last edited: Jun 4, 2017
  5. Instead of Name:\Chicken\ write Name:\"Chicken\"
    Also so this with the other backslahes
     
  6. @xPlumpOrange Sorry About That Lol


    I am getting another error! Sorry
    ERRORIMAGE1.PNG
    There is a String idk why it is giving me that error!
     
  7. You didn't escape the quote properly. Show the entire line.
     
  8. Code (Text):
    Bukkit.dispatchCommand(Main.Console, "replaceitem entity DatChicken040 slot.armor.head skull 1 3 {display:{Name:\"Chicken\"},SkullOwner:{Id:\"7d3a8ace-e045-4eba-ab71-71dbf525daf1\",Properties:{textures:[{Value:"\"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTYzODQ2OWE1OTljZWVmNzIwNzUzNzYwMzI0OGE5YWIxMWZmNTkxZmQzNzhiZWE0NzM1YjM0NmE3ZmFlODkzIn19fQ=="\"}]}}}"");
     
  9. I made this. Use it and then you get some output. Make sure you enter what you would enter in chat in mc or something
     

    Attached Files:

  10. @ramidzk Sorry but... That did not work
     
  11. Choco

    Moderator

    Can we just discuss the fact that, if this is what you're doing to replace an item on a player's head, you might as well be using Command Blocks. There are API methods for this, you should use them
     
  12. Umm you do
    java -jar "Minecraft Shit Helper.jar"
    <enter text here now>
    <get your output>

    Totally correct. (Skull)Block#getData();
     
  13. @ramidzk Yep I did java -jar "Minecraft **** Helper.jar" The Output code did not work Sorry

    @2008Choco Do you know how do give a Head with UUID and name like how this command?
    Code (Text):
    Bukkit.dispatchCommand(Main.Console, "replaceitem entity DatChicken040 slot.armor.head skull 1 3 {display:{Name:\"Chicken\"},SkullOwner:{Id:\"7d3a8ace-e045-4eba-ab71-71dbf525daf1\\",Properties:{textures:[{Value:\"\\"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTYzODQ2OWE1OTljZWVmNzIwNzUzNzYwMzI0OGE5YWIxMWZmNTkxZmQzNzhiZWE0NzM1YjM0NmE3ZmFlODkzIn19fQ==\"\\"}]}}}\"\");
     
    #14 TheDaChicken, Jun 4, 2017
    Last edited: Jun 4, 2017