Java 类org.bukkit.inventory.meta.ItemMeta 实例源码

项目:ZorahPractice    文件:ItemBuilder.java   
public ItemStack getItem() {
    List<String> lore = new ArrayList<String>();

    for (int i=0; i<this.lore.length; i++) {
        lore.add(ChatColor.translateAlternateColorCodes('&', this.lore[i]));
    }

    ItemStack item = new ItemStack(this.type, this.amount, this.data);
    ItemMeta meta = item.getItemMeta();

    meta.setDisplayName(name);
    meta.setLore(lore);
    meta.spigot().setUnbreakable(this.unbreakable);
    item.setItemMeta(meta);

    return item;
}
项目:KingdomFactions    文件:EmpireWandModule.java   
public ItemStack getEmpireWand() {


        ItemStack empirewand = new ItemStack(Material.BLAZE_ROD, 1);
        ItemMeta meta = empirewand.getItemMeta();
        meta.setDisplayName(ChatColor.RED + "Empire Wand");
        ArrayList<String> lore = new ArrayList<String>();
        try {
            lore.add(ChatColor.translateAlternateColorCodes('&', new Randomizer<String>(KingdomFactionsPlugin.getInstance()
                            .getDataManager().getArrayData("Empirewand.lores").getValue()).result()));
        } catch (DataException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        meta.setLore(lore);
        meta.addEnchant(Enchantment.LURE, 1, true);
        meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
        empirewand.setItemMeta(meta);

        return empirewand;
    }
项目:AlphaLibary    文件:SkullItemBuilder.java   
public static ItemStack getCustomSkull(String url) {
    GameProfile profile = SkinChangeUtil.changeSkin(url);

    ItemStack head = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
    ItemMeta headMeta = head.getItemMeta();
    Class<?> headMetaClass = headMeta.getClass();

    try {
        Field f = headMetaClass.getDeclaredField("profile");
        f.setAccessible(true);

        f.set(headMeta, profile);
    } catch (NoSuchFieldException | IllegalAccessException e) {
        e.printStackTrace();
    }

    head.setItemMeta(headMeta);
    return head;
}
项目:EpicBanRequests    文件:BanRequest.java   
public ItemStack getItem() {
    ItemStack is = new ItemStack(Material.PAPER);
    ItemMeta im = is.getItemMeta();

    /**
     * Item:
     * 
     * Name = Request #x
     * Lore 1: Requested by: _name_
     * Lore :  Ban: 
     * Lore 2: Reason: reason
     * Lore 3: Time: time 
     */

    im.setDisplayName(Messager.color("&eRequest #" + id));
    im.setLore(Arrays.asList(Messager.color("&eRequested by: &7" + Bukkit.getOfflinePlayer(UUID.fromString(openerUUID)).getName()), 
            Messager.color("&eBan: &7" + Bukkit.getOfflinePlayer(UUID.fromString(playerToBanUUID)).getName()),
            Messager.color("&eReason: &7" + banReason), 
            Messager.color("&eRequested at: &7" + timeOpenedFormatted)));

    is.setItemMeta(im);

    return is;
}
项目:FactionsXL    文件:TradeOfferCommand.java   
private Inventory choosePartner(Faction creator) {
    int size = (int) (9 * Math.ceil(((double) factions.getActive().size() / 9)));
    Inventory gui = Bukkit.createInventory(null, size, FMessage.TRADE_OFFER_CHOOSE_PARTNER.getMessage());
    int i = 0;
    for (Faction faction : factions.getActive()) {
        ItemStack icon = faction.getBannerStack();
        ItemMeta meta = icon.getItemMeta();
        meta.setDisplayName(creator.getRelation(faction).getColor() + faction.getName());
        meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
        icon.setItemMeta(meta);
        gui.setItem(i, icon);
        factionBySlot.put(i, faction);
        i++;
    }
    return gui;
}
项目:BlockBall    文件:ItemStackBuilder.java   
/**
 * Adds lore after the index of a lore line
 *
 * @param index index
 * @param lore  lore
 * @return builder
 */
public ItemStackBuilder addLore(int index, String... lore) {
    final ItemMeta itemMeta = this.getItemMeta();
    final List<String> data = new ArrayList<>();
    for (int i = 0; i < itemMeta.getLore().size(); i++) {
        data.add(itemMeta.getLore().get(0));
        if (i == index) {
            for (final String s : lore) {
                data.add(ChatColor.translateAlternateColorCodes('&', s));
            }
        }
    }
    itemMeta.setLore(data);
    this.setItemMeta(itemMeta);
    return this;
}
项目:ProjectAres    文件:DefuseListener.java   
@EventHandler
public void giveKit(final ObserverKitApplyEvent event) {
    final MatchPlayer player = mm.getPlayer(event.getPlayer());
    if(player == null) return;
    if(!player.isObservingType()) return;
    if(!player.getBukkit().hasPermission("pgm.defuse")) return;

    ItemStack shears = new ItemStack(DEFUSE_ITEM);

    // TODO: Update information if locale changes
    ItemMeta meta = shears.getItemMeta();
    meta.addItemFlags(ItemFlag.values());
    meta.setDisplayName(PGMTranslations.t("defuse.displayName", player));
    meta.setLore(Lists.newArrayList(ChatColor.GRAY + PGMTranslations.t("defuse.tooltip", player)));
    shears.setItemMeta(meta);

    event.getPlayer().getInventory().setItem(DEFUSE_SLOT, shears);
}
项目:SuperiorCraft    文件:LongRangeWeapon.java   
public LongRangeWeapon(Material wep, String name, Material ammo, String desc, String type, double damage, int cooltime, boolean isCrit, int knockback, boolean silent, int shots, String proj) {
    this.wep = wep;
    this.name = name;
    this.ammo = ammo;
    this.desc = desc;
    this.type = type;
    this.damage = damage;
    this.cooltime = cooltime;
    this.isCrit = isCrit;
    this.knockback = knockback;
    this.silent = silent;
    this.shots = shots;
    this.proj = proj;

    ItemStack item = new ItemStack(wep);

    ItemMeta meta = item.getItemMeta();
    meta.setDisplayName(ChatColor.BOLD + name);
    ArrayList<String> lore = new ArrayList<String>();
    lore.add(ChatColor.BOLD + desc);
    lore.add(ChatColor.WHITE + type);
    meta.setLore(lore);
    item.setItemMeta(meta);

    addWep(item);
}
项目:Bags2    文件:BagBase.java   
@Override
public void onInteract(PlayerInteractEvent e, EquipmentSlot es)
{
    ItemStack stack = es.equals(EquipmentSlot.HAND) ? e.getPlayer().getInventory().getItemInMainHand() : e.getPlayer().getInventory().getItemInOffHand();
    if(stack.hasItemMeta() ? !stack.getItemMeta().getDisplayName().equals(Translation.get(name)) : false)
    {
        if(stack.getItemMeta().getDisplayName().startsWith(ChatColor.RESET.toString()))
        {

            ItemMeta im = stack.getItemMeta();
            if(!im.getDisplayName().startsWith(ChatColor.ITALIC.toString()))
            im.setDisplayName(ChatColor.RESET + Translation.get(name));
            stack.setItemMeta(im);
            if(es.equals(EquipmentSlot.HAND))
            e.getPlayer().getInventory().setItemInMainHand(stack);
            else
            e.getPlayer().getInventory().setItemInOffHand(stack);
        }
    }
    super.onInteract(e, es);
}
项目:prisonPicks    文件:PickTest.java   
@Test
public void testIsPick() {

    //make a mock Xpick
    ItemMeta i = mock(ItemMeta.class); 
    doReturn(true).when(i).hasLore(); 

    doReturn(Material.DIAMOND_PICKAXE).when(tool).getType(); 
    doReturn(true).when(tool).hasItemMeta(); 
    doReturn(i).when(tool).getItemMeta(); 

    //this should work
    assertTrue(Pick.isPick(tool)); 

    //no lore
    doReturn(false).when(i).hasLore(); 
    assertFalse(Pick.isPick(tool)); 

    //no metadata
    doReturn(false).when(tool).hasItemMeta(); 
    assertFalse(Pick.isPick(tool)); 
}
项目:HCFCore    文件:CrowbarListener.java   
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onBlockPlace(BlockPlaceEvent event) {
    Block block = event.getBlockPlaced();
    ItemStack stack = event.getItemInHand();
    Player player = event.getPlayer();
    if (block.getState() instanceof CreatureSpawner && stack.hasItemMeta()) {
        ItemMeta meta = stack.getItemMeta();

        if (meta.hasLore() && meta.hasDisplayName()) {
            CreatureSpawner spawner = (CreatureSpawner) block.getState();
            List<String> lore = meta.getLore();
            if (!lore.isEmpty()) {
                String spawnerName = ChatColor.stripColor(lore.get(0).toUpperCase());
                Optional<EntityType> entityTypeOptional = GuavaCompat.getIfPresent(EntityType.class, spawnerName);
                if (entityTypeOptional.isPresent()) {
                    spawner.setSpawnedType(entityTypeOptional.get());
                    spawner.update(true, true);
                    player.sendMessage(ChatColor.AQUA + "Placed a " + ChatColor.BLUE + spawnerName + ChatColor.AQUA + " spawner.");
                }
            }
        }
    }
}
项目:ZentrelaRPG    文件:PlayerDataRPG.java   
private void addSet(ItemStack item) {
    if (item == null)
        return;
    ItemMeta im = item.getItemMeta();
    if (im == null)
        return;
    if (!im.hasDisplayName())
        return;
    if (im.getDisplayName().startsWith("*"))
        return;
    String name = im.getDisplayName();
    for (String s : ItemBalance.SET_PREFIXES) {
        if (name.contains(s)) {
            if (armorSetCounter.containsKey(s))
                armorSetCounter.put(s, armorSetCounter.get(s) + 1);
            else
                armorSetCounter.put(s, 1);
            break;
        }
    }
}
项目:Arcadia-Spigot    文件:Utils.java   
public static void resetPlayer(Player player) {
    player.setLevel(0);
    player.setExp(0);
    player.setFoodLevel(20);
    player.setHealth(20);
    player.setHealthScale(20);
    player.setExhaustion(0);
    player.getInventory().clear();
    ItemStack blankItem = new ItemStack(Material.STAINED_GLASS_PANE, 1, (byte) 15);
    ItemMeta blankMeta = blankItem.getItemMeta();
    blankMeta.setDisplayName("" + ChatColor.RED);
    blankItem.setItemMeta(blankMeta);
    for(int i=9; i<=35; i++) {
        player.getInventory().setItem(i, blankItem);
    }
    player.getInventory().setHelmet(new ItemStack(Material.AIR, 1));
    player.getInventory().setChestplate(new ItemStack(Material.AIR, 1));
    player.getInventory().setLeggings(new ItemStack(Material.AIR, 1));
    player.getInventory().setBoots(new ItemStack(Material.AIR, 1));
    for(PotionEffect potionEffect : player.getActivePotionEffects()) {
        player.removePotionEffect(potionEffect.getType());
    }
    player.setFireTicks(0);
}
项目:ZentrelaCore    文件:MenuManager.java   
private static String serializeForMenu(ItemStack item) {
    StringBuilder sb = new StringBuilder();
    sb.append(item.getType());
    sb.append('$');
    sb.append(item.getAmount());
    if (item.hasItemMeta()) {
        ItemMeta im = item.getItemMeta();
        if (im.hasDisplayName()) {
            sb.append('#');
            sb.append(im.getDisplayName());
        }
        if (im.hasLore()) {
            sb.append('#');
            sb.append(im.getLore().toString());
        }
        if (im.hasEnchants()) {
            sb.append('#');
            sb.append(im.getEnchants().toString());
        }
    }
    return sb.toString();
}
项目:HCFCore    文件:KitsCommand.java   
private ItemStack titaniumKitGlass(Player player) {
    ItemStack stack = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 0, (byte) 14);
    ItemMeta meta = stack.getItemMeta();
    addGlow(stack);
    meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&4Titanium &7Kit"));
    List<String> lore = new ArrayList<String>();
    lore.add(ChatColor.translateAlternateColorCodes('&', "&7This is a kit contains:"));
    lore.add(ChatColor.translateAlternateColorCodes('&', "&fGod Diamond kit!"));
    lore.add("");
    lore.add(ChatColor.translateAlternateColorCodes('&', "&8&l* &cPurchase the Titanium Rank from store.hcriots.net"));
    lore.add("");
    lore.add(ChatColor.translateAlternateColorCodes('&', "&8&l* &7CoolDown: &c3 Days"));
    if(cooldowns.containsKey(player.getUniqueId())) {
        if(cooldowns.get(player.getUniqueId()).containsKey("TitaniumKit")) {
            lore.add(ChatColor.translateAlternateColorCodes('&', "&8&l* &7Available in: &c" + DurationFormatUtils.formatDurationWords(cooldowns.get(player.getUniqueId()).get("TitaniumKit"), true, true)));
        } else {
            lore.add(ChatColor.translateAlternateColorCodes('&', "&8&l* &7Available in: &aNow"));
        }
    } else {
        lore.add(ChatColor.translateAlternateColorCodes('&', "&8&l* &7Available in: &aNow"));
    }
    meta.setLore(lore);
    stack.setItemMeta(meta);
    return stack;
}
项目:Scorch    文件:CustomEnchantment.java   
public ItemStack removeFromItem(ItemStack item)
{
    ItemMeta meta = item.getItemMeta();
    if (meta == null) return item;
    if (!meta.hasLore()) return item;
    List<String> metaLore = meta.getLore();

    // Make sure the enchantment doesn't already exist on the item
    for (Map.Entry<CustomEnchantment, Integer> entry : getEnchantments(item).entrySet())
    {
        if (entry.getKey().getName().equals(getName()))
        {
            metaLore.remove(ChatColor.GRAY + getName() + " " + RomanNumerals.numeralOf(entry.getValue()));
        }
    }
    return item;
}
项目:EpicBanRequests    文件:GUIManager.java   
public static Inventory archived(Player player) {
    Inventory i = Bukkit.createInventory(null, 54, Messager.color("&7Archived Requests"));


    ItemStack back = new ItemStack(Material.ARROW);
    ItemMeta im = back.getItemMeta();
    im.setDisplayName(Messager.color("&cBack"));
    back.setItemMeta(im);       
    i.setItem(45, back);

    int tillFull = 0;
    for (int x = Main.getInstance().getConfig().getInt("current_id"); x <= 0; x--) {    

        if (tillFull >= 53) {
            Messager.msgPlayer("&cAll of the archived requests could not fit in the GUI. Showing the newest first.", player);
            break;
        }
        BanRequest br = new BanRequest(x);
        if (br.closed) {
            i.addItem(br.getArchivedItem());
            tillFull++;
        }
    }

    return i;
}
项目:RPGInventory    文件:CraftExtension.java   
CraftExtension(String name, ConfigurationSection config) {
    this.name = name;
    this.capItem = CraftManager.getCapItem().clone();
    ItemMeta meta = capItem.getItemMeta();
    meta.setDisplayName(StringUtils.coloredLine(config.getString("name")));
    if (config.contains("lore")) {
        meta.setLore(StringUtils.coloredLines(config.getStringList("lore")));
    }
    this.capItem.setItemMeta(meta);
    this.slots = config.getIntegerList("slots");

    if (config.contains("includes")) {
        this.includes = new ArrayList<>();

        for (String childName : config.getStringList("includes")) {
            CraftExtension child = CraftManager.getByName(childName);
            if (child != null) {
                includes.add(child);
            }
        }
    } else {
        this.includes = null;
    }
}
项目:SaveableSerializing    文件:FireworkEffectsMeta.java   
@Override
public SubMeta setFrom(ItemMeta meta) {
    if(meta instanceof FireworkEffectMeta){
        FireworkEffectMeta fire = (FireworkEffectMeta) meta;
        me = new FireworkEffects(fire.getEffect());
    }
    return this;
}
项目:AsgardAscension    文件:AbilityManager.java   
public void applyAbility(Player player, ItemStack item, Ability ability, boolean temporary) {
    // Adding lore
    ItemMeta meta = item.getItemMeta();
    List<String> lore = meta.hasLore() ?
            meta.getLore() : new ArrayList<>();

    lore.add(ChatColor.GRAY + "Ability: " + ChatColor.RED + ability.getName());
    if(temporary)
        lore.add(ChatColor.GRAY + "Temporary");
    meta.setLore(lore);
    item.setItemMeta(meta);
    player.getInventory().setItemInMainHand(item);

    if(!temporary)
        return;

    // Adding timer for temporary abilities
    new BukkitRunnable() {

        @Override
        public void run() {
            if(!isActive(player, item)) {
                this.cancel();
            }

            updateTemporaryItem(player, item, ability);

            player.sendMessage(Lang.HEADERS_TOKENS.toString() 
                    + Lang.TOKENS_SHOP_EXPIRED.toString()
                        .replaceAll("%s", ability.getName()));
        }

    }.runTaskLater(plugin, 100 * 60 * 20);
}
项目:BedwarsXP    文件:XPItemShop.java   
private void addCategoriesToInventory(Inventory inventory, Player player) {
    for (MerchantCategory category : this.categories) {
        if (category.getMaterial() == null) {
            Main.getInstance()
                    .getServer()
                    .getConsoleSender()
                    .sendMessage(
                            ChatWriter
                                    .pluginMessage(ChatColor.RED
                                            + "Careful: Not supported material in shop category '"
                                            + category.getName() + "'"));
        } else if ((player == null)
                || (player.hasPermission(category.getPermission()))) {
            ItemStack is = new ItemStack(category.getMaterial(), 1);
            ItemMeta im = is.getItemMeta();

            if ((this.currentCategory != null)
                    && (this.currentCategory.equals(category))) {
                im.addEnchant(Enchantment.DAMAGE_ALL, 1, true);
            }

            im.setDisplayName(category.getName());
            im.setLore(category.getLores());
            is.setItemMeta(im);

            inventory.addItem(new ItemStack[] { is });
        }
    }
}
项目:MinecraftMarket-Plugin    文件:ItemStackBuilder.java   
public List<String> getLore() {
    if (itemStack.getType() == Material.AIR) return new ArrayList<>();
    final ItemMeta meta = itemStack.getItemMeta();
    List<String> lore = meta.getLore();
    if (lore == null) {
        lore = new ArrayList<>();
    }
    return lore;
}
项目:HCFCore    文件:BottledExpListener.java   
/**
 * Checks if an {@link ItemStack} is bottled exp.
 *
 * @param stack
 *            the {@link ItemStack} to check
 * @return true if is bottled exp
 */
private boolean isBottledExperience(ItemStack stack) {
    if (stack == null || !stack.hasItemMeta()) {
        return false;
    }

    ItemMeta meta = stack.getItemMeta();
    return meta.hasDisplayName() && meta.getDisplayName().equals(BOTTLED_EXP_DISPLAY_NAME);
}
项目:HCFCore    文件:DeathSignListener.java   
/**
 * Generates a death-sign for a player and killer.
 *
 * @param playerName
 *            the name of the player killed
 * @param killerName
 *            the name of the killer of player
 * @return the death sign featuring the victim and murderer
 */
public static ItemStack getDeathSign(String playerName, String killerName) {
    ItemStack stack = new ItemStack(Material.SIGN, 1);
    ItemMeta meta = stack.getItemMeta();
    meta.setDisplayName(DEATH_SIGN_ITEM_NAME);
    meta.setLore(Lists.newArrayList(ChatColor.RED + playerName, ChatColor.DARK_RED + "slain by", ChatColor.GREEN + killerName,
            DateTimeFormats.DAY_MTH_HR_MIN_SECS.format(System.currentTimeMillis())));
    stack.setItemMeta(meta);
    return stack;
}
项目:SaveableSerializing    文件:PotionMeta.java   
@Override
public SubMeta setFrom(ItemMeta meta) {
    if(meta instanceof org.bukkit.inventory.meta.PotionMeta) {
        org.bukkit.inventory.meta.PotionMeta metar = (org.bukkit.inventory.meta.PotionMeta) meta;
        for(PotionEffect ef : metar.getCustomEffects())
            data.add(new PotionEffects(ef));
    }
    return this;
}
项目:RealSurvival    文件:Items.java   
/**
 * l.add("��2���������Լ��õ����в���ҩ");
    l.add("��eҲ������Ҫע�ⰴʱ��ҩ.");
 * @return ҩ
 */
public static ItemStack getMedicine01(){
    ItemStack sw=new ItemStack(Material.QUARTZ);
    ItemMeta im = sw.getItemMeta();
    im.setDisplayName("��a��lҩ");
    List<String> l=new LinkedList<String>();
    l.add("��2���������Լ��õ����в���ҩ");
    l.add("��2�������������...");
    l.add("��eҲ������Ҫע�ⰴʱ��ҩ.");
    im.setLore(l);
    sw.setItemMeta(im);
    return sw;
}
项目:SaveableSerializing    文件:FireworkEffectsMeta.java   
@Override
public void setTo(ItemMeta meta) {
    if(meta instanceof FireworkEffectMeta){
        FireworkEffectMeta fire = (FireworkEffectMeta) meta;
        FireworkEffect ef = (FireworkEffect) me.getOriginal();
        if(ef != null)
             fire.setEffect(ef);
    }
}
项目:BurkeyShop    文件:Util.java   
public static final ItemStack loreItemStack(ItemStack stack, List<String> lore) {
    if(stack != null) {
        ItemMeta meta = stack.getItemMeta();
        for(int i = 0; i < lore.size(); i ++) { lore.set(i, color(lore.get(i))); }
        meta.setLore(lore);
        stack.setItemMeta(meta);
    }
    return stack;
}
项目:HNRPG    文件:Lore.java   
public void addLore(int ID, int DATA, int STACK, List<String> Lore, CommandSender sender) {
    try {
        Integer.parseInt(String.valueOf(tempStr));

        ItemStack itemStack = new MaterialData(ID, (byte) DATA).toItemStack(STACK);
        ItemMeta itemMeta = itemStack.getItemMeta();

        itemMeta.setLore(Lore);

    } catch (NumberFormatException e) {
        sender.sendMessage("§c[ §4§l! §c] §3§l줄 수§7를 입력해주세요.");
        return;
    }
}
项目:VanillaPlus    文件:Icon.java   
public ItemStack getItemstack(VPPlayer player, Localizer loc){
    ItemStack result = item;
    ItemMeta itemMeta = item.getItemMeta();
    if(name != null)
        itemMeta.setDisplayName(getName(player, loc));
    if(hasLore())
        itemMeta.setLore(getLores(player, loc));
    result.setItemMeta(itemMeta);
    if(skullSelf){
        SkullMeta meta = (SkullMeta) item.getItemMeta();
        meta.setOwner(player.getName());
        result.setItemMeta(meta);
    }
    return result;
}
项目:KingdomFactions    文件:BlockPlace.java   
@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {

    if (event.getItemInHand().getType() != Material.MOB_SPAWNER)
        return;

    ItemStack is = event.getItemInHand();
    if (!is.hasItemMeta())
        return;

    ItemMeta im = is.getItemMeta();

    if (!im.hasLore())
        return;

    String lore = im.getLore().toString();

    if (!lore.contains("Spawner:"))
        return;

    EntityType entity = getEntity(lore);

    if (entity == EntityType.AREA_EFFECT_CLOUD) {
        event.setCancelled(true);
        return;
    }

    setSpawner(event.getBlock(), entity);
}
项目:Transport-Pipes    文件:InventoryUtils.java   
public static ItemStack changeDisplayNameAndLoreConfig(ItemStack is, String displayName, List<String> lore) {
    ItemMeta meta = is.getItemMeta();
    meta.setDisplayName(displayName);
    meta.setLore(lore);
    is.setItemMeta(meta);
    return is;
}
项目:BlockBall    文件:ItemStackBuilder.java   
/**
 * Clears all lore from the itemStack
 * @return builder
 */
public ItemStackBuilder clearLore() {
    final ItemMeta itemMeta = this.getItemMeta();
    itemMeta.setLore(new ArrayList<>());
    this.setItemMeta(itemMeta);
    return this;
}
项目:uppercore    文件:FireworkCustomItem.java   
@Override
public void processMeta(Player player, ItemMeta m) {
    super.processMeta(player, m);
    FireworkMeta meta = (FireworkMeta) m;
    meta.clearEffects();
    meta.addEffects(effects);
    if(power != null)
        meta.setPower(power.resolve(player));
}
项目:MCLibrary    文件:ItemWrapper.java   
public ItemWrapper setLore(Function<String, String> function) {
    ItemMeta meta = getHandle().getItemMeta();
    List<String> lores = meta.getLore();
    if (lores != null) {
        meta.setLore(lores.parallelStream()
                .map(lore -> MCUtils.colorize(function.apply(lore)))
                .collect(Collectors.toList()));
    }
    getHandle().setItemMeta(meta);

    return this;
}
项目:uppercore    文件:LeatherArmorCustomItem.java   
@Override
public void processMeta(Player player, ItemMeta m) {
    super.processMeta(player, m);
    LeatherArmorMeta meta = (LeatherArmorMeta) m;
    if(color != null)
        meta.setColor(color.resolve(player));
}
项目:RealSurvival    文件:Items.java   
public static ItemStack createPItem(short damage,String name){
    ItemStack is=new ItemStack(Material.STAINED_GLASS_PANE,1,damage);
    ItemMeta im=is.getItemMeta();
    im.setDisplayName(name);
    is.setItemMeta(im);
    return is;
}
项目:RealSurvival    文件:Items.java   
/**
 * 
 * @return ����
 */
public static ItemStack getMedicine02(){
    ItemStack sw=new ItemStack(Material.PAPER);
    ItemMeta im = sw.getItemMeta();
    im.setDisplayName("��a��l����");
    List<String> l=new LinkedList<String>();
    l.add("��2���������Լ��Ĺ���");
    l.add("��eҲ������Ҫע�ⰴʱ��һ��.");
    im.setLore(l);
    sw.setItemMeta(im);
    return sw;
}
项目:HCFCore    文件:Crowbar.java   
/**
 * Parses an {@link Crowbar} from a given {@link ItemStack}.
 *
 * @param stack
 *            the stack to parse from
 * @return the {@link Crowbar} instance
 */
public static Optional<Crowbar> fromStack(ItemStack stack) {
    if (stack == null || !stack.hasItemMeta()) {
        return Optional.absent();
    }

    ItemMeta meta = stack.getItemMeta();
    if (!meta.hasDisplayName() || !meta.hasLore() || !meta.getDisplayName().equals(CROWBAR_NAME)) {
        return Optional.absent();
    }

    Crowbar crowbar = new Crowbar();
    List<String> loreList = meta.getLore();
    for (String lore : loreList) {
        lore = ChatColor.stripColor(lore);
        int length = lore.length();
        for (int i = 0; i < length; i++) {
            char character = lore.charAt(i);
            if (Character.isDigit(character)) {
                int amount = Integer.parseInt(String.valueOf(character));
                if (lore.startsWith(END_FRAME_USE_TAG)) {
                    crowbar.setEndFrameUses(amount);
                    break;
                } else if (lore.startsWith(SPAWNER_USE_TAG)) {
                    crowbar.setSpawnerUses(amount);
                    break;
                }
            }
        }
    }

    return Optional.of(crowbar);
}
项目:Transport-Pipes    文件:InventoryUtils.java   
public static ItemStack createGlowingItemStack(Material material, short data) {
    ItemStack is = new ItemStack(material, 1, data);
    ItemMeta im = is.getItemMeta();
    im.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 1, true);
    im.addItemFlags(ItemFlag.HIDE_ENCHANTS);
    is.setItemMeta(im);
    return is;
}