feat: 添加潜影盒快捷打开和末影箱自定义标题功能
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user