Created
March 19, 2024 08:37
-
-
Save Minikloon/e0ec3a6ada42c127a2d4caf7cd8f0686 to your computer and use it in GitHub Desktop.
https://docs.advntr.dev/minimessage/index.html + Java 21 String Templates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import net.kyori.adventure.text.Component; | |
import net.kyori.adventure.text.minimessage.MiniMessage; | |
public final class MiniMessageTemplate { | |
private MiniMessageTemplate() {} | |
public static final StringTemplate.Processor<Component, RuntimeException> MM = stringTemplate -> { | |
String interpolated = STR.process(stringTemplate); | |
MiniMessage mm = MiniMessage.miniMessage(); | |
return mm.deserialize(interpolated); | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eventsHandler.addListener(PlayerBlockBreakEvent.class, event -> { | |
Player player = event.getPlayer(); | |
LOG.info(STR."\{player.getUsername()} broke a block!"); | |
player.getInstance().sendMessage(MM."<rainbow>\{player.getUsername()} broke a block!</rainbow>"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment