A message library, which focuses on simplicity and flexibility.
honey was created to allow for developers to create easily customizable messages for end users, by giving them flexibility with placeholders.
maven("https://repo.shiza.dev/releases")
maven { url 'https://repo.shiza.dev/releases' }
implementation("dev.shiza:honey:2.2.2")
implementation 'dev.shiza:honey:2.2.2'
<repository>
<id>shiza-releases</id>
<url>https://repo.shiza.dev/releases</url>
</repository>
<dependency>
<groupId>dev.shiza</groupId>
<artifactId>honey</artifactId>
<version>2.2.2</version>
</dependency>
A showcase of how to use honey, can be found in honey-test-plugin module.
MessageFormatter provides all functionality that honey offers, it comes with reflective placeholder evaluation and sanitization to make them harmless, while used with minimessage without any additional hasle on developer side.
AdventureMessageDispatcher.createTitle()
.viewer(event.getPlayer())
.title(it -> it.template(formatter, "Hello!"))
.subtitle(it -> it.template(formatter, "It is a pleasure to see you there {{player.getName}}"))
.variable("player", event.getPlayer())
.times(2, 4, 2)
.dispatch();
AdventureMessageDispatcher.createChat()
.viewer(Bukkit.getServer())
.template(formatter, "{{player.getName}} has joined the server!")
.variable("player", event.getPlayer())
.dispatch();
AdventureMessageDispatcher.createActionBar()
.viewer(event.getPlayer())
.template(formatter, "Honey is great, isn't it?")
.dispatch();
MessageDispatcher provides a way to send messages without the need of using placeholders.
AdventureMessageDispatcher.createChat()
.viewer(Bukkit.getServer())
.template(Component.text("Somebody joined to the server!").color(NamedTextColor.RED))
.dispatch();
AdventureMessageDispatcher.createActionBar()
.viewer(event.getPlayer())
.template(Component.text("Honey is great, isn't it?"))
.dispatch();
AdventureMessageDispatcher.createChat()
.viewer(event.player)
.template(Component.text("Hello!"))
.dispatch()
AdventureMessageDispatcher.createActionBar()
.viewer(event.player)
.template(Component.text("This is an action bar message!"))
.dispatch()
player.createChat()
.template(Component.text("A custom chat message"))
.dispatch()
player.createActionBar()
.template(Component.text("This is a custom action bar"))
.dispatch()
AdventureMessageDispatcher.createTitle()
.viewer(event.player)
.title { it.template(Component.text("Hello!")) }
.subtitle { it.template(Component.text("It's great to see you!")) }
.times(2, 4, 2)
.dispatch()
-
dispatch This method immediately delivers the message synchronously. It calls the deliver function with the rendered message and the viewer, and the action is completed immediately.
-
dispatchAsync This method delivers the message asynchronously. It returns a CompletableFuture that performs the message rendering in the background and then delivers the result once it's ready. It allows non-blocking behavior and handles exceptions asynchronously.