TitleManager 是一个简洁的库,用于在 Minecraft 1.8 及以上版本中向玩家发送标题。它提供了发送主标题、副标题和自定义时长的功能,并通过检查客户端版本有效防止了潜在的客户端崩溃问题。
以下代码示例展示了如何在玩家加入游戏时发送一个自定义标题。
@EventHandler
public void onJoin(PlayerJoinEvent e) {
// 设置标题的时长(淡入、停留、淡出,单位:刻)
TitleAPI.sendTimings(e.getPlayer(), 20, 40, 20);
// 创建并发送副标题
TextComponent subTitle = new TextComponent("And I am a Subtitle");
subTitle.setColor(ChatColor.BLUE);
TitleAPI.sendSubTitle(e.getPlayer(), subTitle);
// 创建并发送主标题
TextComponent title = new TextComponent("I am a Title!");
title.setColor(ChatColor.BLUE);
TitleAPI.sendTitle(e.getPlayer(), title);
}您可以通过 Maven 轻松地将此 API 添加到您的项目中。
在您的 pom.xml 文件中添加以下仓库配置:
<repository>
<id>inventive-repo</id>
<url>https://repo.inventivetalent.org/content/groups/public/</url>
</repository><dependency>
<groupId>org.inventivetalent</groupId>
<artifactId>titleapi</artifactId>
<version>2.1.1</version>
</dependency>此 API 与 APIManager 兼容。有关如何实现的具体信息,请点击此处查看。
我非常乐意免费制作并维护插件,但您的支持能帮助我持续提供免费资源。
友情链接: 网易我的世界 | 泰拉瑞亚 | ocent云计算 | 米饭Minecraft插件文档 | 友链合作
历史访问人数:2,602,290 | 历史访问人次:3,155,448
今日访问人数:23,040 | 今日访问人次:25,069
昨日访问人数:24,332 | 昨日访问人次:29,698
Copyright © 2019-2026 我的世界服务器列表站. All rights reserved.
❤ Powered by GermMC 京ICP备17023959号-6