Skip to content

Instantly share code, notes, and snippets.

@Minikloon
Created March 19, 2024 08:37
Show Gist options
  • Save Minikloon/e0ec3a6ada42c127a2d4caf7cd8f0686 to your computer and use it in GitHub Desktop.
Save Minikloon/e0ec3a6ada42c127a2d4caf7cd8f0686 to your computer and use it in GitHub Desktop.
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);
};
}
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