Basic Operations

Get API instance

CustomNameplatesAPI api = CustomNameplatesAPI.getInstance();

Create text with images

Optional<Background> background = api.getBackground("bedrock_1");
if (background.isPresent()) {
    String textWithBackground = api.createTextWithImage("<red>Test Message</red>", background.get(), 1, 1);
}

Subscribe events

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>");

Last updated