@Deprecated public class JsonBuilder extends Object
Uses an input string to apply a click event and a string list to apply a hover event.
If click and hover values are null/empty, it will use the
TextUtils.FORMAT_CHAT_PATTERN to parse the respective actions and
add then in the chat component.
After all the actions are set in the chat component, the message is sent to the target player.
| Constructor and Description |
|---|
JsonBuilder(org.bukkit.entity.Player target,
org.bukkit.entity.Player parser,
String string)
Deprecated.
Converts a
String line to a JsonBuilder object. |
| Modifier and Type | Method and Description |
|---|---|
static net.md_5.bungee.api.chat.BaseComponent[] |
of(org.bukkit.entity.Player parser,
String text)
Deprecated.
Converts a line to a
BaseComponent array using the
TextUtils.FORMAT_CHAT_PATTERN. |
static net.md_5.bungee.api.chat.BaseComponent[] |
of(String text)
Deprecated.
Converts a line to a
BaseComponent array using the
TextUtils.FORMAT_CHAT_PATTERN. |
boolean |
send()
Deprecated.
Sends the
JsonBuilder object to the target player,
if not defined will be to the parser player. |
public JsonBuilder(org.bukkit.entity.Player target,
org.bukkit.entity.Player parser,
String string)
String line to a JsonBuilder object.
Parses all the required keys from BeansLib and formats colors.
target - a target to send a message, can be nullparser - a parser to parse placeholdersstring - an input stringpublic boolean send()
JsonBuilder object to the target player,
if not defined will be to the parser player.public static net.md_5.bungee.api.chat.BaseComponent[] of(org.bukkit.entity.Player parser,
String text)
BaseComponent array using the
TextUtils.FORMAT_CHAT_PATTERN.
// Example of how to use it:
String text = "<hover:\"a hover line\">text to apply</text>";
BaseComponent[] array = JsonBuilder.fromText(player, text);
player.spigot().sendMessage(array);
parser - a player to parse placeholderstext - an input stringpublic static net.md_5.bungee.api.chat.BaseComponent[] of(String text)
BaseComponent array using the
TextUtils.FORMAT_CHAT_PATTERN.
// Example of how to use it:
String text = "<hover:\"a hover line\">text to apply</text>";
BaseComponent[] array = JsonBuilder.fromText(text);
player.spigot().sendMessage(array);
text - an input stringCopyright © 2023. All rights reserved.