Solved Using Unicode Characters

Discussion in 'Plugin Development' started by omon23, Jul 23, 2014.

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

    omon23

    Hello, I've recently seen on some servers that they've managed to put unicode characters in chat and on the Enderdragon bar. I would like to be able to implement this into my plugin(not the Enderdragon Bar), but be able to send these special unicode characters in chat.

    I have looked over the internet, and couldn't find out anything. I was just wondering, does anyone know how to do this? If anyone does I would be extremely grateful if you could let me know how to and I will be very happy :)

    Thanks,
    - omon23
     
  2. omon23 Can you please explain this a bit more? it's hard for me to understand :/
     
  3. Offline

    Dragonphase

    omon23

    You should be able to paste the unicode characters into your IDE. I'm not sure if there's any steps you have to take to enable Unicode but I know this has worked for me previously.
     
  4. Offline

    omon23


    I tried that, and it doesn't work. For what symbol I want to use, when I paste it, it comes up a with a question mark in a box in the IDE and it won't let me export my plugin from the IDE because of an unknown character.
     
  5. Offline

    ZodiacTheories

  6. Offline

    Dragonphase

    omon23

    For Eclipse, there's this article on StackOverflow which explains how to enable the usage of Unicode characters by enabling encoding of UTF-8. You might have to search google for the IDE you're using if you're not using Eclipse.
     
  7. Offline

    bombom3000

    Hello omon23!

    I believe you could process what a player has said before it is broadcasted to the server, this will allow you to, for example say <3 and a unicode heart is printed in chat instead of the '<3'. I believe this is what you are looking for.

    I do not know any code for the chat processing as of now, but to use unicode characters in chat you could use this:

    Code:java
    1. char heart = '\u2764';
    2.  
    3. Bukkit.broadcastMessage("" + heart);


    If you put the 'Bukkit.broadcastMessage("" + heart);' into an event, when it is fired it will print a unicode heavy heart into the chat. Have a play around with this.

    I had a little look around and from what I can see, you can use an
    Code:
    onChat
    event in your listener class, cancel the event, use some Java text parser, then make the player say it again.
    As I said, I cannot provide code for that.
    I hope this helped at least a little!

    Also, a quick note: Not all unicode characters are able to be used in Minecraft, due to the custom font not including all of them.

    -Charlie
     
    Johnylog likes this.
  8. Offline

    omon23

    Dragonphase When I exported my plugin, it came up with an error, because the encoding wasn't in UTF-8. I thought changing it to that might break the plugin, but in fact it doesn't and it's now working :D. Thanks for sending me the article.

    bombom3000 Yeah, I didn't think all unicode characters could be used because of the font, but the ones I wanted to use are working.

    Marked as solved.

    - omon23
     
Thread Status:
Not open for further replies.

Share This Page