feat: 添加潜影盒快捷打开和末影箱自定义标题功能

This commit is contained in:
Coldsmile_7
2026-04-15 00:55:31 +08:00
parent f6364ac36b
commit cc07647551
62 changed files with 15171 additions and 304 deletions

View File

@@ -1,5 +1,6 @@
package cn.infstar.essentialsC.commands;
import cn.infstar.essentialsC.EssentialsC;
import org.bukkit.entity.Player;
public class EnderChestCommand extends BaseCommand {
@@ -10,7 +11,18 @@ public class EnderChestCommand extends BaseCommand {
@Override
protected boolean execute(Player player, String[] args) {
// 打开玩家的末影箱(标题由客户端决定)
EssentialsC plugin = EssentialsC.getInstance();
// 如果启用了 ProtocolLib使用自定义标题
if (plugin.isProtocolLibEnabled()) {
// 从配置读取标题
String title = plugin.getConfig().getString("enderchest.title", "&5随身末影箱");
// 标记下一个打开的 inventory 需要修改标题
plugin.getInventoryTitleListener().markForTitleChange(player, title);
}
// 直接打开玩家的末影箱(参考 EssentialsX 实现)
player.openInventory(player.getEnderChest());
return true;
}