JsonMessage API 2.2.1

A single class API enabling full control over json messages to be sent in chat

  1. JustisR
    Tested Minecraft Versions:
    • 1.7
    • 1.8
    • 1.9
    • 1.10
    • 1.11
    • 1.12
    • 1.13
    • 1.14
    • 1.15
    • 1.16
    Source Code:
    https://gist.github.com/justisr/7a7449adac931a066c51
    The downloadable zip file for this resource contains a compiled plugin which uses the API in several example messages.
    It also contains the .java file containing the API with documentation.
    I wanted to ensure it was as easy to add to your project as it is to use, so it's all contained within a single class.

    To use the API, all you have to do is:
    Code (Java):
    new JsonMessage().append(ChatColor.GREEN + "Click me to fly!").setHoverAsTooltip("Seriously, just click!", "Zoom zoom!").setClickAsExecuteCmd("/fly").save().send(player[]);
    It's really that simple.

    With this API you can...
    • Create tooltips for when a player hovers over your chat message
    • Redirect players to a URL, when a player clicks your chat message
    • Suggest a command/message to a player's chat box when they click your chat message
    • Force the player to run a command when they click your chat message
    Or a combination of clicks and hover events at the same time!
    https://gyazo.com/141dd341317c1ca5bbd142e24646dc77

    This API utilizes reflection in order to work on all server/plugin versions without the need for new imports, provided the class path files don't change.
    (I have accounted for the IChatBaseComponent path change)
    If class paths do change in future updates, be sure to notify me and I'll make an update.

    The plugin version of this resource demonstrates the API with the commands:
    /jsonchat
    /jsonchat example

    Spigot does already come with a huge library for parsing json messages.
    There are other massive libraries out there, as well.
    Each of them using a lot of different classes, and a lot of unnecessary formatting methods (.color(Color).bold(true)).
    BaseComponent TextComponent TranslateComponent ComponentBuilder....... All for a single message!
    It becomes confusing, redundant, and tedious...

    I aim to be able to replicate all of the neccesary functionality from these large libraries and keeping it contained in a single class file.
    So only one class name ever needs to remembered.
    JsonMessage.
    No components, and NO ridiculous "color" or "bold" or "stylize" methods!

    The builder is hidden in a static inner class.
    The users of this API never have to deal with it.
    Simply string what you want from the message, save and send.
    On top of that, it supports all ChatColor formats straight from within the text, so you don't have to append a whole bunch of different strings and reset all the settings just get a new color on your character.

    One class.
    Simplified API.
    ChatColors directly supported without breaking on new lines.
    Since I deal with the raw Json strings directly, speed is drastically increased.
    For most users, including myself... This is perfect.
    (That's the aim, at least)

    This API is free for use provided the license is not removed, and I intend to keep it updated constantly.
    Though, donations are always welcome. I don't make much.
    http://paypal.me/justisr

    All suggestions/feedback appreciated.

Recent Reviews

  1. DespairGods
    DespairGods
    5/5,
    Version: 2.2.0
    Could you update it for 1.14.x sir?
    The Api seems really interesesting and i love the fact that someone took the time to do this.
    The 1.14 update would really be apreciated, thank you very much!
  2. xjaxzee
    xjaxzee
    5/5,
    Version: 1.1.3
    The only thing I can say is.. I love you (No but this is amazing it saves so much time <3)
  3. MCPro_247
    MCPro_247
    4/5,
    Version: 1.1.3
    Very good plugin, clean code, and very easy to use especially for people who don't know a lot about Json like me for instance.