This API allows you to to create dynamic messages, load messages from configuration files and format the messages you created.
Examples
Add messages
Load additional messages from the plugin's configuration fileCode (Java):
new MessageBuilder()
.withMessage("test.message1", "This is the first test message")
.withMessage("test.another.message", "This is another test message")
.build();
Access built messagesCode (Java):
new MessageBuilder()
.withMessage("test.message1", "This is the first test message")
.withMessage("test.another.message", "This is another test message")
.fromConfig(myPlugin.getConfig())
.build();
Access built messages with additional replacementsCode (Java):
MessageContainer container = new MessageBuilder()
.withMessage("test.message1", "This is the first test message")
.withMessage("test.another.message", "This is another test message")
.build();
container.getMessage("test.message1"); // Returns 'This is the first test message'
Code (Java):
MessageContainer container = new MessageBuilder()
.withMessage("test.message1", "This is the first test message")
.withMessage("test.another.message", "This is another test message")
.withMessage("test.formatted.message", "This is a formatted message for %player%")
.build();
container.getMessage("test.formatted.message", new ReplacementContainer().replace("%player%", player.getName())); //Returns (for example) 'This is a formatted message for inventivetalent'
Maven
Code (XML):
<repositories>
<repository>
<id>inventive-repo</id>
<url>https://repo.inventivetalent.org/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.inventivetalent</groupId>
<artifactId>messagebuilder</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
Links

[API] MessageBuilder 1.1.0-SNAPSHOT
Easily create dynamic, formatted messages & load messages from configurations
Recent Updates
- 1.11 support Feb 24, 2017