1
1
mirror of https://github.com/geekfrog/PermissionsTime.git synced 2024-12-23 05:18:47 +00:00
This commit is contained in:
GeekFrog 2017-07-16 17:46:57 +08:00
parent 85a9dbc407
commit fd3b47d5c5
2 changed files with 11 additions and 4 deletions

View File

@ -9,6 +9,7 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
@ -50,7 +51,12 @@ public class PackagesCfg extends PluginConfig {
}
PACKAGE_ITEMS.clear();
for (Entry<String, PermissionPackageBean> e : PACKAGES.entrySet()) {
PACKAGE_ITEMS.put(e.getKey(), getPackageItem(e.getKey(), e.getValue()));
ItemStack item = getPackageItem(e.getKey(), e.getValue());
if (item != null) {
PACKAGE_ITEMS.put(e.getKey(), item);
} else {
PluginMain.LOG.log(Level.SEVERE, "Packages of " + e.getKey() + " has problem.");
}
allPermissions.addAll(e.getValue().getPermissions());
allGroups.addAll(e.getValue().getGroups());
}

View File

@ -20,12 +20,13 @@ public class PlayerPermissionShow {
for (PlayerDataBean pdb : pdbList) {
ItemStack item = PackagesCfg.PACKAGE_ITEMS.get(pdb.getPackageName());
if (item != null) {
ItemMeta meta = item.getItemMeta();
ItemStack tItem = item.clone();
ItemMeta meta = tItem.getItemMeta();
List<String> lores = meta.getLore();
lores.add(StrUtil.messageFormat(LangCfg.EXPIRATION_DATE, StrUtil.timestampToString(pdb.getExpire())));
meta.setLore(lores);
item.setItemMeta(meta);
inventory.addItem(item);
tItem.setItemMeta(meta);
inventory.addItem(tItem);
}
}
p.openInventory(inventory);