FOLIA ✅ PAPER ✅ PURPUR ✅ 1.19.4 - 26.3 ✅
专为你的插件设计的基于数据包的全息投影,自 2.0.0 版本起也提供带有 /holo 命令和保存全息功能的独立插件。
功能特性
- 类型: 文本、方块和物品全息投影,排行榜(经典版、分页式、可切换、单屏显示),展示台,进度条,分页全息投影,悬停菜单,粒子文字和图片,物品标签
- 文本: MiniMessage 支持,无需资源包即可在文本中显示玩家头像(1.21.9+),ItemsAdder 表情符号,支持或不支持 PlaceholderAPI 的个性化玩家文本
- 动画: 打字效果、闪烁、移动渐变、闪光、乱序、彩虹色、揭示、循环。旋转、浮动、弹跳、脉冲、拉伸、摇摆、抖动、果冻效果、弹出/消失或自定义关键帧,客户端插值处理
- 特效: 路径动画、过渡效果(翻转、转向、挤压、弹出、滑动、翻动、掉落、旋转)、破碎效果
- 交互: 可点击的全息投影,包含可取消的
HologramInteractEvent 事件,悬停菜单
- 可见性: 针对每个玩家的视图控制,查看权限,查看条件,查看距离,实体附着
- 独立插件:
/holo 命令带 Tab 补全,全息投影保存在 holograms.yml 中,点击动作,支持从 DecentHolograms、FancyHolograms 和 HolographicDisplays 导入
- 基于数据包: 无真实实体存在,PlaceholderAPI 仅在查看者的文本发生变化时发送数据包
在测试服务器上运行 /holo demo 以查看周围所有类型的全息投影和动画效果。
免责声明
适用于 Paper、Purpur 和 Folia 1.19.4 - 26.3(Folia 从 1.20.1 开始支持)。不支持 Spigot。
需要 PacketEvents 2.14.0 或更高版本。
全息投影是显示实体,这是 Java 版的功能。通过 Geyser 连接的 Bedrock 玩家无法在全息投影中看到玩家头像。
持久化全息投影是新功能。更新时请保留 holograms.yml 的备份。
安装设置
- 下载插件 .jar 文件
- 下载 PacketEvents 2.14.0 或更高版本
- 将两个 .jar 文件放入服务器的 plugins 文件夹并重启服务器
- 在游戏中使用
/holo 创建全息投影,或将 HologramLib 作为依赖项添加到你的插件中
命令
权限 hologramlib.admin,别名 /holo 和 /hl。
| 命令 |
功能说明 |
/holo create <id> <text|item|block> [content] |
在你站立的位置创建一个已保存的全息投影 |
/holo content|scale|billboard|background|shadow|placeholders|permission <id> <value> |
编辑全息投影 |
/holo delete|info|tp|movehere <id> |
管理全息投影 |
/holo copy <id> <new id> |
复制全息投影 |
/holo list, /holo near [radius] |
列出所有全息投影或你附近的全息投影 |
/holo action <id> add <type:data>, /holo action <id> clear |
点击动作:message(消息)、command(命令)、console(控制台)、sound(声音)、teleport(传送)、connect(连接)、permission(权限),例如 command:spawn |
/holo import <decentholograms|fancyholograms|holographicdisplays> |
从其他插件导入全息投影 |
/holo demo [clear] |
生成展示所有功能的效果 |
/holo help |
列出所有命令 |
所有消息均可在 plugins/HologramLib/messages.yml 中修改。
项目集成设置
Gradle (Kotlin)
repositories {
maven("https://jitpack.io")
}
dependencies {
compileOnly("com.github.maximjsx:HologramLib:2.0.0")
}
Gradle (Groovy)
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
compileOnly 'com.github.maximjsx:HologramLib:2.0.0'
}
Maven
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<dependency>
<groupId>com.github.maximjsx</groupId>
<artifactId>HologramLib</artifactId>
<version>2.0.0</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>第一帧")
.addFrame("<green>第二帧")
.addFrame("第三帧<newline>第三帧的第二行")
.addFrame("最后一帧");
hologramManager.applyAnimation(hologram, animation);
排行榜
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 的精简参考文档。
Example/Showcase Plugin
更多信息
FOLIA ✅ PAPER ✅ PURPUR ✅ 1.19.4 - 26.3 ✅
Packet-based holograms for your own plugins, and since 2.0.0 also a plugin with /holo 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:
/holo command with tab completion, holograms saved in holograms.yml, click actions, import from DecentHolograms, FancyHolograms and HolographicDisplays
- Packet-based: no real entities, PlaceholderAPI only sends a packet when a viewer's text changed
Run /holo 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
/holo, or add HologramLib as a dependency to your plugin
COMMANDS
Permission hologramlib.admin, aliases /holo and /hl.
| Command |
What it does |
/holo create <id> <text|item|block> [content] |
Creates a saved hologram where you stand |
/holo content|scale|billboard|background|shadow|placeholders|permission <id> <value> |
Edits a hologram |
/holo delete|info|tp|movehere <id> |
Manages a hologram |
/holo copy <id> <new id> |
Copies a hologram |
/holo list, /holo near [radius] |
Lists all holograms or the ones close to you |
/holo action <id> add <type:data>, /holo action <id> clear |
Click actions: message, command, console, sound, teleport, connect, permission, e.g. command:spawn |
/holo import <decentholograms|fancyholograms|holographicdisplays> |
Imports holograms from another plugin |
/holo demo [clear] |
Spawns a showcase of every feature |
/holo 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.0")
}
Gradle (Groovy)
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
compileOnly 'com.github.maximjsx:HologramLib:2.0.0'
}
Maven
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<dependency>
<groupId>com.github.maximjsx</groupId>
<artifactId>HologramLib</artifactId>
<version>2.0.0</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);
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
登录后参与评分
还没有评论,来抢沙发吧