FOLIA ✅ PAPER ✅ PURPUR ✅ 1.19.4 - 26.3 ✅
专为您的插件设计的基于数据包的全息投影,自 2.0.0 版本起也包含一个带有 /hologramlib 命令和已保存全息图的独立插件。
功能特性
- 类型: 文本、方块和物品全息图,排行榜(经典版、分页版、可切换版、单屏显示版),展示台,进度条,分页全息图,悬停菜单,粒子文字与图片,物品标签
- 文本: MiniMessage 格式,无需资源包即可在文本中显示玩家头颅(1.21.9+),ItemsAdder 表情符号,支持或不支持 PlaceholderAPI 的个性化玩家文本
- 动画: 打字效果、闪烁、移动渐变、闪光、乱码、彩虹色、揭示、循环。旋转、漂浮、弹跳、脉冲、拉伸、摇摆、抖动、果冻、弹出/消失或自定义关键帧,客户端插值渲染
- 特效: 路径动画、过渡效果(翻转、转向、挤压、弹出、滑动、拍打、掉落、旋转)、碎裂效果
- 交互: 可点击的全息图(带有可取消的
HologramInteractEvent 事件),悬停菜单
- 可见性: 按玩家设置查看者,查看权限,查看条件,查看距离,实体附着
- 独立插件: 支持
/hologramlib 命令及自动补全,全息图保存在 holograms.yml 中,点击动作,支持从 DecentHolograms、FancyHolograms 和 HolographicDisplays 导入
- 基于数据包: 不创建真实实体,仅解码全息数据包,当查看者的文本发生变化时,PlaceholderAPI 才发送数据包
在测试服务器上运行 /hologramlib demo 以查看您周围的所有全息图类型和动画效果。
免责声明
适用于 Paper、Purpur 和 Folia 1.19.4 - 26.3(Folia 需 1.20.1 及以上版本)。不支持 Spigot。
需要 PacketEvents 2.14.0 或更高版本。
全息图是显示实体,这是 Java 版的功能。通过 Geyser 连接的基岩版玩家无法在全息图中看到玩家头颅。
持久化全息图为新功能。更新时请备份 holograms.yml。
安装设置
- 下载插件 .jar 文件
- 下载 PacketEvents 2.14.0 或更高版本
- 将两个 .jar 文件放入服务器的 plugins 文件夹并重启
- 在游戏中使用
/hologramlib 创建全息图,或将 HologramLib 作为依赖项添加到您的插件中
命令列表
权限 hologramlib.admin,别名 /hl。
| 命令 |
功能说明 |
/hologramlib create <id> <text|item|block> [content] |
在您站立的位置创建一个已保存的全息图 |
/hologramlib content|scale|billboard|background|shadow|placeholders|permission <id> <value> |
编辑全息图 |
/hologramlib delete|info|tp|movehere <id> |
管理全息图 |
/hologramlib copy <id> <new id> |
复制全息图 |
/hologramlib list, /hologramlib near [radius] |
列出所有全息图或您附近的全息图 |
/hologramlib action <id> add <type:data>, /hologramlib action <id> clear |
点击动作:message(消息), command(命令), console(控制台), sound(音效), teleport(传送), connect(连接), permission(权限),例如 command:spawn |
/hologramlib import <decentholograms|fancyholograms|holographicdisplays> |
从其他插件导入全息图 |
/hologramlib demo [clear] |
生成所有功能的演示场景 |
/hologramlib help |
列出所有命令 |
所有消息均可在 plugins/HologramLib/messages.yml 中进行修改。
项目集成设置
Gradle (Kotlin)
repositories {
maven("https://jitpack.io")
}
dependencies {
compileOnly("com.github.maximjsx:HologramLib:2.0.2")
}
Gradle (Groovy)
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
compileOnly 'com.github.maximjsx:HologramLib:2.0.2'
}
Maven
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<dependency>
<groupId>com.github.maximjsx</groupId>
<artifactId>HologramLib</artifactId>
<version>2.0.2</version>
<scope>provided</scope>
</dependency>
将此添加到您的 plugin.yml 中:
depend:
- HologramLib
不建议对 HologramLib 进行阴影打包(Shading)。请直接在服务器上安装它。
代码示例
获取实例
private HologramManager hologramManager;
@Override
public void onEnable() {
HologramLib.getManager().ifPresentOrElse(
manager -> hologramManager = manager,
() -> getLogger().severe("HologramLib is not loaded"));
}
创建全息图
TextHologram hologram = new TextHologram("unique_id")
.setMiniMessageText("<aqua>Hello world!")
.setSeeThroughBlocks(false)
.setBillboard(Display.Billboard.VERTICAL)
.setShadow(true)
.setScale(1.5F, 1.5F, 1.5F)
.setTextOpacity((byte) 200)
.setBackgroundColor(Color.fromARGB(60, 255, 236, 222).asARGB())
.setAlignment(TextDisplay.TextAlignment.CENTER)
.setMaxLineWidth(200);
生成与移除
hologramManager.spawn(hologram, location);
hologramManager.remove(hologram);
让它动起来并做出反应
hologram.setTextProvider(player -> "<gold>Hey " + player.getName());
hologramManager.applyMotion(hologram, MotionAnimation.floating(0.2F, 40));
hologramManager.applyAnimation(hologram, TextAnimation.typing("<aqua>", "Welcome to the server"));
hologram.onInteract(player -> player.sendMessage("You clicked me"));
自定义文本动画
TextAnimation animation = new TextAnimation()
.setDelay(20) // 第一帧之前的刻数
.setSpeed(20) // 每帧的刻数
.addFrame("<red>First frame")
.addFrame("<green>Second frame")
.addFrame("Third frame<newline>Second line in third frame")
.addFrame("Last frame");
hologramManager.applyAnimation(hologram, animation);
保存全息图
保存在 holograms.yml 中,并在每次启动时重新生成。
HologramLib.getPersistentHolograms().ifPresent(saved -> saved.put(
HologramData.create("spawn_sign", HologramData.Type.TEXT, location, "<gold>Welcome!")
.withActions(List.of(new ClickAction(ClickAction.Type.COMMAND, "spawn")))));
排行榜
LeaderboardHologram leaderboard = new LeaderboardHologram(LeaderboardHologram.LeaderboardOptions.builder()
.title("Top Players - Kills")
.suffix("kills")
.maxDisplayEntries(10)
.showEmptyPlaces(true)
.leaderboardType(LeaderboardHologram.LeaderboardType.TOP_PLAYER_HEAD)
.build(), "top_kills");
leaderboard.setPlayerScore(uuid, "MaximDe", 1000);
leaderboard.setPlayerScore(otherUuid, "dream", 950);
hologramManager.spawn(leaderboard, location);
文本排行榜
在一个文本显示中呈现完整的排行榜,包括对齐的分数、下方的切换选项以及动画行。
TextLeaderboard board = new TextLeaderboard("kills")
.setTitle("<gold><bold>Top Kills")
.setEntries(List.of(new TextLeaderboard.Entry(uuid, "MaximDe", 120)))
.addToggle(TextLeaderboard.Toggle.of("period", "Daily", "Weekly", "Lifetime"))
.setTransition(Transition.FLIP)
.setCycle(200);
hologramManager.spawn(board, location);
Wiki
所有功能及代码示例
使用 AI 助手?请提供 llms.txt,这是整个 API 的紧凑参考文档。
示例/展示插件
更多信息
FOLIA ✅ PAPER ✅ PURPUR ✅ 1.19.4 - 26.3 ✅
Packet-based holograms for your own plugins, and since 2.0.0 also a plugin with /hologramlib commands and saved holograms.
FEATURES
- Types: text, block and item holograms, leaderboards (classic, paged, switchable, single display), podium, progress bars, paged holograms, hover menus, particle text and images, item labels
- Text: MiniMessage, player heads in text without a resource pack (1.21.9+), ItemsAdder emojis, per-player text with or without PlaceholderAPI
- Animations: typing, blink, moving gradient, shine, scramble, rainbow, reveal, cycle. Spin, floating, bounce, pulse, stretch, swing, shake, jelly, pop in/out or your own keyframes, interpolated on the client
- Effects: path animations, transitions (flip, turn, squash, pop, slide, flap, drop, spin), shatter effect
- Interactions: clickable holograms with a cancellable
HologramInteractEvent, hover menus
- Visibility: per-player viewers, view permission, view conditions, view distance, entity attachment
- Standalone plugin:
/hologramlib command with tab completion, holograms saved in holograms.yml, click actions, import from DecentHolograms, FancyHolograms and HolographicDisplays
- Packet-based: no real entities, only hologram packets are decoded, PlaceholderAPI only sends a packet when a viewer's text changed
Run /hologramlib demo on a test server to see every hologram type and animation around you.
DISCLAIMER
Works on Paper, Purpur and Folia 1.19.4 - 26.3 (Folia from 1.20.1). Spigot is not supported.
Requires PacketEvents 2.14.0 or newer.
Holograms are display entities, a Java Edition feature. Bedrock players through Geyser don't see player heads in holograms.
Persistent holograms are new. Keep a backup of holograms.yml when you update.
SETUP
- Download the plugin .jar
- Download PacketEvents 2.14.0 or newer
- Put both .jar files into your server's plugins folder and restart
- Create holograms in game with
/hologramlib, or add HologramLib as a dependency to your plugin
COMMANDS
Permission hologramlib.admin, alias /hl.
| Command |
What it does |
/hologramlib create <id> <text|item|block> [content] |
Creates a saved hologram where you stand |
/hologramlib content|scale|billboard|background|shadow|placeholders|permission <id> <value> |
Edits a hologram |
/hologramlib delete|info|tp|movehere <id> |
Manages a hologram |
/hologramlib copy <id> <new id> |
Copies a hologram |
/hologramlib list, /hologramlib near [radius] |
Lists all holograms or the ones close to you |
/hologramlib action <id> add <type:data>, /hologramlib action <id> clear |
Click actions: message, command, console, sound, teleport, connect, permission, e.g. command:spawn |
/hologramlib import <decentholograms|fancyholograms|holographicdisplays> |
Imports holograms from another plugin |
/hologramlib demo [clear] |
Spawns a showcase of every feature |
/hologramlib help |
Lists every command |
All messages can be changed in plugins/HologramLib/messages.yml.
PROJECT SETUP
Gradle (Kotlin)
repositories {
maven("https://jitpack.io")
}
dependencies {
compileOnly("com.github.maximjsx:HologramLib:2.0.2")
}
Gradle (Groovy)
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
compileOnly 'com.github.maximjsx:HologramLib:2.0.2'
}
Maven
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<dependency>
<groupId>com.github.maximjsx</groupId>
<artifactId>HologramLib</artifactId>
<version>2.0.2</version>
<scope>provided</scope>
</dependency>
Add this to your plugin.yml:
depend:
- HologramLib
Shading HologramLib is not recommended. Install it on the server instead.
Code examples
Getting the instance
private HologramManager hologramManager;
@Override
public void onEnable() {
HologramLib.getManager().ifPresentOrElse(
manager -> hologramManager = manager,
() -> getLogger().severe("HologramLib is not loaded"));
}
Creating a hologram
TextHologram hologram = new TextHologram("unique_id")
.setMiniMessageText("<aqua>Hello world!")
.setSeeThroughBlocks(false)
.setBillboard(Display.Billboard.VERTICAL)
.setShadow(true)
.setScale(1.5F, 1.5F, 1.5F)
.setTextOpacity((byte) 200)
.setBackgroundColor(Color.fromARGB(60, 255, 236, 222).asARGB())
.setAlignment(TextDisplay.TextAlignment.CENTER)
.setMaxLineWidth(200);
Spawning and removing
hologramManager.spawn(hologram, location);
hologramManager.remove(hologram);
Make it move and react
hologram.setTextProvider(player -> "<gold>Hey " + player.getName());
hologramManager.applyMotion(hologram, MotionAnimation.floating(0.2F, 40));
hologramManager.applyAnimation(hologram, TextAnimation.typing("<aqua>", "Welcome to the server"));
hologram.onInteract(player -> player.sendMessage("You clicked me"));
Your own text animation
TextAnimation animation = new TextAnimation()
.setDelay(20) // ticks before the first frame
.setSpeed(20) // ticks per frame
.addFrame("<red>First frame")
.addFrame("<green>Second frame")
.addFrame("Third frame<newline>Second line in third frame")
.addFrame("Last frame");
hologramManager.applyAnimation(hologram, animation);
Saved holograms
Kept in holograms.yml and spawned again on every start.
HologramLib.getPersistentHolograms().ifPresent(saved -> saved.put(
HologramData.create("spawn_sign", HologramData.Type.TEXT, location, "<gold>Welcome!")
.withActions(List.of(new ClickAction(ClickAction.Type.COMMAND, "spawn")))));
Leaderboard
LeaderboardHologram leaderboard = new LeaderboardHologram(LeaderboardHologram.LeaderboardOptions.builder()
.title("Top Players - Kills")
.suffix("kills")
.maxDisplayEntries(10)
.showEmptyPlaces(true)
.leaderboardType(LeaderboardHologram.LeaderboardType.TOP_PLAYER_HEAD)
.build(), "top_kills");
leaderboard.setPlayerScore(uuid, "MaximDe", 1000);
leaderboard.setPlayerScore(otherUuid, "dream", 950);
hologramManager.spawn(leaderboard, location);
Text leaderboard
A whole leaderboard in one text display, with aligned scores, toggles under it and animated rows.
TextLeaderboard board = new TextLeaderboard("kills")
.setTitle("<gold><bold>Top Kills")
.setEntries(List.of(new TextLeaderboard.Entry(uuid, "MaximDe", 120)))
.addToggle(TextLeaderboard.Toggle.of("period", "Daily", "Weekly", "Lifetime"))
.setTransition(Transition.FLIP)
.setCycle(200);
hologramManager.spawn(board, location);
Wiki
Every feature with code examples
Using an AI assistant? Give it llms.txt, a compact reference of the whole API.
Example/Showcase Plugin
More info
评论 0
登录后参与评分
还没有评论,来抢沙发吧