From b92bf7893c6ce5be757b92d5b855013e27bd7901 Mon Sep 17 00:00:00 2001 From: GeekFrog Date: Sun, 16 Jul 2017 06:36:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=88=B0=E6=9C=9F=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mc/permissionstime/gui/PlayerPermissionShow.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/gg/frog/mc/permissionstime/gui/PlayerPermissionShow.java b/src/main/gg/frog/mc/permissionstime/gui/PlayerPermissionShow.java index 51a088e..643d024 100644 --- a/src/main/gg/frog/mc/permissionstime/gui/PlayerPermissionShow.java +++ b/src/main/gg/frog/mc/permissionstime/gui/PlayerPermissionShow.java @@ -5,7 +5,9 @@ import java.util.List; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.InventoryView; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; import gg.frog.mc.permissionstime.config.PackagesCfg; import gg.frog.mc.permissionstime.model.db.PlayerDataBean; @@ -18,12 +20,15 @@ public class PlayerPermissionShow { for (PlayerDataBean pdb : pdbList) { ItemStack item = PackagesCfg.PACKAGE_ITEMS.get(pdb.getPackageName()); if (item != null) { - inventory.addItem(item); - List lores = item.getItemMeta().getLore(); + ItemMeta meta = item.getItemMeta(); + List lores = meta.getLore(); lores.add(""); lores.add(StrUtil.messageFormat("&4到期时间: {0}", StrUtil.timestampToString(pdb.getExpire()))); + meta.setLore(lores); + item.setItemMeta(meta); + inventory.addItem(item); } } - p.openInventory(inventory); + InventoryView view = p.openInventory(inventory); } }