ChatLib

This project is abandoned and its default file will likely not work with the most recent version of Minecraft. Whether this project is out of date or its author has marked it as abandoned, this project is no longer maintained.

ChatLib, an easy to use chat library for sending JSON messages

Description

OK. Let's be straight with this. The new chat features in 1.7 are just plain awesomeness. The new hover and click events can do craziness! There is one issue, however. Bukkit hasn't implemented an API for it. That is were ChatLib comes in. With just one line of code, you send a completely custom message with all sorts of different features.

This plugin is rather simple, really. It is based off of bobacadodl JSONChatLib on the forums, but I oversimplified it so you guys don't need to bother with some uninteresting stuff.

ChatLib also includes /tellraw, which is a placeholder command since the 1.7.2 betas don't include it. /tellraw will function just like vanilla /tellraw, I made sure every messages matches too!

Installing

Install this like any other plugin. Just drag and drop into your plugins folder. You need ProtocolLib for this to function, because that is what sends the data to the client (and so there is no need for reflection).

Permissions

ChatLib has only one permission node, and that is bukkit.command.tellraw. I know I should have used my own permission node, it's just the tellraw command was meant to simulate what it would be like if the server had it. In case you can't tell what that permission node means, it gives you permission for the command /tellraw.

REQUIRES PROTOCOLLIB

API

If you are a normal server owner just wanting /tellraw, you can ignore this part. If you intend to use this API in your plugins, read this.

ChatLib messages are made up of ChatParts. ChatParts are simple to initialize.

//Creates a simple white ChatPart with the text "Hello!"
ChatPart foo = new ChatPart("Hello!");
//Creates a ChatPart that says "Biscuits!" and is colored Blue.
ChatPart derp = new ChatPart("Biscuits!", JSONChatColor.BLUE);
//Creates a ChatPart that says "Biscuits!" and is Bold.
ChatPart herp = new ChatPart("Biscuits!",  new JSONChatFormat[] {JSONChatFormat.BOLD});
//Creates a ChatPart that says "Biscuits!", is colored Blue, and is Bold.
ChatPart potato = new ChatPart("Biscuits!", JSONChatColor.BLUE, new JSONChatFormat[] {JSONChatFormat.BOLD});

Now, multiple ChatParts can be "glued" together to create a message.

// This will send a message saying "Hello! This is awesome stuff, huh?
MessageSender.sendMessage(player, new ChatPart("Hello!"), new ChatPart(" This is awesome stuff, huh?"));

So far this stuff is completely available in the Bukkit API. What makes this special is the hovering and click events.

// This will send a message saying "[Do you like pie?]" and when you hover over it it you will get "Yes, I sure do!"
MessageSender.sendMessage(player, new ChatPart("[Do you like pie?]").setHoverEvent(JSONChatHoverEventType.SHOW_TEXT, "Yes, Is sure do!"));

Comments

Posts Quoted:
Reply
Clear All Quotes

About This Project

  • Project ID
    71128
  • Created
    Dec 22, 2013
  • Last Released File
    Jan 19, 2014
  • Total Downloads
    1,894
  • License

Categories

Members

Recent Files

Bukkit