-
Notifications
You must be signed in to change notification settings - Fork 1
Messages
A Message
consists of multiple string Chunk
s containing their own respective tooltip information.
All known tooltip types are as follows [Url(Click), Copy(Click), Suggestion(Click), Command(Click), Text(Hover), Action(Click), Item(Hover)]
A single message chunk can only contain one click tooltip as-well as one hover tooltip, if a chunk only contains 1 click tooltip multiple text hover tips can be applied or 1 item hover tip can be applied not both.
Building a message is really easy! A throw-back to some but new to others! Resembling the fanciful library, append different message styles and tooltips with ease!
If you're the type of person who's more comfortable working with functions rather than instantiation, each respective factory contains builder methods for local message building like so:
public class ExampleClass implements Message.Factory {
@Ordinal(1)
private void broadcast() {
Message message = message();
Message.Chunk chunk = text("Hello");
chunk.style(GALAXY);
ToolTip<String> hover1 = hover("This is a test");
hover1.color(ORANGE);
hover1.style(BOLD, UNDERLINE);
ToolTip<String> hover2 = hover("Can you read me?");
hover2.color(DARK_BLUE);
ToolTip<String> command = command("/help");
chunk.bind(command);
chunk.bind(hover1);
chunk.bind(hover2);
message.append(chunk);
}
}
// Fancy builder
Message message = new FancyMessage("Hello").style(GALAXY).then(" ").then("World!").style(GALAXY).hover("This is a test").hover("Can you read me?").command("/help");
// Normal builder
Message message = new MessageBuilder();
Message.Chunk chunk = new TextChunk("Hello");
chunk.style(GALAXY);
ToolTip<String> hover1 = new ToolTip.Text("This is a test");
hover1.color(ORANGE);
hover1.style(BOLD, UNDERLINE);
ToolTip<String> hover2 = new ToolTip.Text("Can you read me?");
hover2.color(DARK_BLUE);
ToolTip<String> command = new ToolTip.Command("/help");
chunk.bind(command);
chunk.bind(hover1);
chunk.bind(hover2);
message.append(chunk);
Both Messages and the chunks they contain can be completely formatted into/from strings
To convert a message/chunk to json formatting simply call the local toJson()
method.
To deserialize a json message:
Message message = new MessageBuilder().append(yourJsonStringHere);
To deserialize a json chunk:
Message message = new MessageBuilder();
Message.Chunk chunk = new JsonChunk(yourJsonStringHere);
message.append(chunk);
-
- AFK Player Utility
- Command Builder
- Command Utility
- Complete GUI Builder
- Complete Head Database/Locator
- Cooldown Abstraction
- Custom Gradient Color Interface
- Custom ID Generation
- Directional Enumeration
- Economy Interface Wrapper
- Entity Creation Tools
- File Management
- Item Recipe Builder
- Item Modification Builder
- Legacy Safe NamespacedKey
- Listing Collections
- Material Matcher
- Message Formatter
- String Utility
- Tab Completion Builder
- Task Scheduling
- Template Creation
- TextComponent Builder
- Vault Permission Interface Wrapper