docs: 更新 README 添加潜影盒和末影箱功能说明

This commit is contained in:
Coldsmile_7
2026-04-15 01:20:05 +08:00
parent cc07647551
commit 2364ddee97
3 changed files with 22 additions and 93 deletions

View File

@@ -1,8 +1,11 @@
package cn.infstar.essentialsC.commands;
import cn.infstar.essentialsC.EssentialsC;
import org.bukkit.entity.Player;
/**
* 末影箱命令 - 参考 EssentialsX 实现
* 直接打开玩家的末影箱,确保数据安全
*/
public class EnderChestCommand extends BaseCommand {
public EnderChestCommand() {
@@ -11,18 +14,9 @@ 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 实现)
// 直接打开玩家的末影箱EssentialsX 方式)
// 优点100% 安全,不会吞物品或刷物品
// 缺点:标题显示为 "Ender Chest"(由客户端语言决定)
player.openInventory(player.getEnderChest());
return true;
}