Tutorial - LaPiMoNsTeR/JsonChatAPI GitHub Wiki
The principal constructor is :
JsonMessage msg = new JsonMessage(JsonPosition position);
You have 3 positions :
- CHAT (clickable message)
- SYSTEM_MESSAGE (clickable message)
- ACTION_BAR (action bar message)
To add text, you need use this function :
` msg.text(String message); `
To add text and color, you need use this function :
` msg.text(String message, JsonColor color); `
You have lot of color :
> BLACK , DARK_BLUE , DARK_GREEN , DARK_AQUA , DARK_RED , DARK_PURPLE , GOLD , GRAY , DARK_GRAY , BLUE , GREEN , AQUA , RED , LIGHT_PURPLE , YELLOW , WHITE
To add text, color and format; you need use this function :
`msg.text(String message, JsonColor color, JsonFormat format);`
or
`msg.text(String message, JsonColor color, JsonFormat[] formats);`
To make table.
exemple :
msg.text("welcome", JsonColor.YELLOW, new JsonFomat[] {JsonFormat.BOLD, JsonFormat.ITALIC});
You have lot of format :
OBFUSCATED , BOLD , STRIKETHROUGH , UNDERLINE , ITALIC
After, to use extra text ( just work with CHAT and SYSTEM_MESSAGE position ) , you need use :
JsonExtra extra = new JsonExtra(same parameters as text);
To add hover event (mouse hover), use :
extra.hover(JsonHoverEventType type, String value);
You have 1 JsonHoverEventType :
- SHOW_TEXT // Will show ' value ' when mouse hover text in extra.
To add click event (mouse click), use :
extra.click(JsonClickEventType type, String value);
You have 3 JsonClickEventType :
- SUGGEST_COMMAND // Will print ' value ' in text entry bar
- RUN_COMMAND // Will execute ' value '
- OPEN_URL // Will open url ( value )
After, to add JsonExtra in your JsonMessage, use :
msg.extra(extra.work());
To send JsonMessage to player , use :
msg.send(Player p);
To send JsonMessage to all players, use :
msg.sendToAll();
Principal constructors are :
JsonTitle title = new JsonTitle(String title);
and
JsonTitle title = new JsonTitle(String title, String subtitle);
To send JsonTitle to player , use :
title.send(Player p);
To send JsonTitle to all players, use :
title.sendToAll();