JSON.java
Now only has one method which can accept infinite component parameters:
Code (Java):
JSON.
send
(Player pl, JSONComponent...
components
)
;
Components Types
JClipboardComponent
Accepts three parameters of type String:
- "display" - the text to display. Cannot be null.
- "hover" - the text to display on hover. Can be null.
- "clipboard" - the text to copy to clipboard on click. Can be null.
JPromptComponent
Accepts three parameters of type String:
- "display" - the text to display. Cannot be null.
- "hover" - the text to display on hover. Can be null.
- "prompt" - the prompt to add to the textbox on click. Can be null.
JCommandComponent
Accepts three parameters of type String:
- "display" - the text to display. Cannot be null.
- "hover" - the text to display on hover. Can be null.
- "command" - the command to run on click. Can be null.
JWebComponent
Accepts three parameters of type String:
- "display" - the text to display. Cannot be null.
- "hover" - the text to display on hover. Can be null.
- "website" - the website URL to open on click. Can be null.
JTextComponent
Accepts two parameters of type String:
- "display" - the text to display. Cannot be null.
- "hover" - the text to display on hover. Can be null.
Example of usage
Code (Java):
JTextComponent text
=
new
JTextComponent
(
"This is raw text with a hover",
"this is the hover text"
)
;
JWebComponent webText
=
new JWebComponent
(
"This will open a website when clicked",
"this is the hover text",
"https://www.google.com"
)
;
JCommandComponent commandText
=
new JCommandComponent
(
"This will run a command when clicked",
"this is the hover text",
"this is the command"
)
;
JSON.
send
(player, text, webText, commandText
)
;
// Unlimited components can be supplied and will be automagically appended