基础操作
获取API实例
CustomNameplatesAPI api = CustomNameplatesAPI.getInstance();
创建带图片的文本
Optional<Background> background = api.getBackground("bedrock_1");
if (background.isPresent()) {
String textWithBackground = api.createTextWithImage("<red>测试消息</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");
}
}
});
获取文本的前进量
float advance = api.getTextAdvance("<font:xxx:xxx>111</font> <bold>1234</bold>");
最后更新于