CustomNameplatesAPI api = CustomNameplatesAPI.getInstance();
Optional<Background> background = api.getBackground("bedrock_1");
if (background.isPresent()) {
String textWithBackground = api.createTextWithImage("<red>Test Message</red>", background.get(), 1, 1);
}
CustomNameplates.getInstance().getEventManager().subscribe(CommandFeedbackEvent.class, event -> {
if (event.key().equals("xxx.xxx")) {
if (event.sender() instanceof Player player) {
event.cancelled(true);
player.sendActionBar("xxxxxxx");
}
}
});
Get the advance of the text
float advance = api.getTextAdvance("<font:xxx:xxx>111</font> <bold>1234</bold>");