当前位置: 首页>>代码示例>>Java>>正文


Java ItemStack.getItemMeta方法代码示例

本文整理汇总了Java中org.bukkit.inventory.ItemStack.getItemMeta方法的典型用法代码示例。如果您正苦于以下问题:Java ItemStack.getItemMeta方法的具体用法?Java ItemStack.getItemMeta怎么用?Java ItemStack.getItemMeta使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.inventory.ItemStack的用法示例。


在下文中一共展示了ItemStack.getItemMeta方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createHeadPlayer

import org.bukkit.inventory.ItemStack; //导入方法依赖的package包/类
public static ItemStack createHeadPlayer(String displayname, String username, List<String> lore) {
    ItemStack playerHead = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
    SkullMeta sm = (SkullMeta)playerHead.getItemMeta();
    sm.setOwner(username);
    ArrayList<String> colorLore = new ArrayList<>();
    if (lore != null) {
        lore.forEach(str -> colorLore.add(Utils.colorize(str)));
        sm.setLore(colorLore);
    }

    sm.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS, ItemFlag.HIDE_ATTRIBUTES,
            ItemFlag.HIDE_DESTROYS, ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_PLACED_ON, ItemFlag.HIDE_UNBREAKABLE);
    sm.setDisplayName(Utils.colorize(displayname));
    playerHead.setItemMeta(sm);
    return playerHead;
}
 
开发者ID:cadox8,项目名称:WC,代码行数:17,代码来源:ItemUtil.java

示例2: choosePartner

import org.bukkit.inventory.ItemStack; //导入方法依赖的package包/类
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;
}
 
开发者ID:DRE2N,项目名称:FactionsXL,代码行数:17,代码来源:TradeOfferCommand.java

示例3: getEnchantments

import org.bukkit.inventory.ItemStack; //导入方法依赖的package包/类
public static Map<CustomEnchantment, Integer> getEnchantments(ItemStack item) {
    HashMap<CustomEnchantment, Integer> list = new HashMap<>();
    if (item == null) return list;
    ItemMeta meta = item.getItemMeta();
    if (meta == null) return list;
    if (!meta.hasLore()) return list;
    for (String lore : meta.getLore()) {
        String name = EnchantUtils.parseName(lore);
        int level = EnchantUtils.parseLevel(lore);
        if (name == null) continue;
        if (level == 0) continue;
        if (Main.isEnchantmentRegistered(name)) {
            CustomEnchantment enchant = Main.getEnchantment(name);
            if (enchant.isStackable() && list.containsKey(enchant)) {
                level += list.get(enchant);
            }
            list.put(enchant, level);
        }
    }
    return list;
}
 
开发者ID:Warvale,项目名称:Scorch,代码行数:22,代码来源:CustomEnchantment.java

示例4: getSeaWater

import org.bukkit.inventory.ItemStack; //导入方法依赖的package包/类
/**
 * l.add("��2��ˮ,����...");
	l.add("��4�������ܽ��,��l���м�������!");
	l.add("��b��Ҫ�þ�ˮװ�����������������!");
 * @return ��ˮ
 */
public static ItemStack getSeaWater(){
	ItemStack sw=new ItemStack(Material.POTION);
	PotionMeta im = (PotionMeta) sw.getItemMeta();
	im.setColor(Color.fromRGB(15, 103, 219));
	im.setDisplayName("��1��l��ˮ");
	List<String> l=new LinkedList<String>();
	l.add("��a��l"+rs.getLoreTabel("Thirst")+": ��b��l-"+Utils.random(2, 20)+"%");
	l.add("��2��l"+rs.getLoreTabel("SickKind")+": ��c��l"+rs.defSick.split(";")[(int)Utils.random(0, rs.defSick.split(";").length)]);
	l.add("��2��l"+rs.getLoreTabel("Sickness")+": ��c��l"+Utils.random(20, 30)+"%");
	l.add("");
	l.add("��7��l"+rs.getLoreTabel("Weight")+": 1");
	l.add("");
	l.add("��2��ˮ,����...");
	l.add("��4�������ܽ��,��l���м�������!");
	l.add("��b��Ҫ�þ�ˮװ�����������������!");
	im.setLore(l);
	sw.setItemMeta(im);
	return sw;
}
 
开发者ID:SchoolUniform,项目名称:RealSurvival,代码行数:26,代码来源:Items.java

示例5: isGun

import org.bukkit.inventory.ItemStack; //导入方法依赖的package包/类
@Override
public boolean isGun(ItemStack toCheck) {
	if (!enabled || toCheck == null)
		return false;

	if (!Material.DIAMOND_HOE.equals(toCheck.getType()))
		return false;

	if (!toCheck.hasItemMeta())
		return false;

	ItemMeta meta = toCheck.getItemMeta();

	if (meta.getLore().contains(gunTag()))
		return true;

	return false;
}
 
开发者ID:ProgrammerDan,项目名称:AddGun,代码行数:19,代码来源:RailGun.java

示例6: getNameFromItemStack

import org.bukkit.inventory.ItemStack; //导入方法依赖的package包/类
public static String getNameFromItemStack(ItemStack itemStack) {
    if (itemStack.getItemMeta() instanceof SkullMeta) {
        final SkullMeta meta = (SkullMeta) itemStack.getItemMeta();
        return meta.getOwner();
    }
    return null;
}
 
开发者ID:Shynixn,项目名称:BlockBall,代码行数:8,代码来源:SSKulls.java

示例7: getTeamSelector

import org.bukkit.inventory.ItemStack; //导入方法依赖的package包/类
public static ItemStack getTeamSelector()
{
    ItemStack stack = new ItemStack(Material.WOOL, 1);
    ItemMeta meta = stack.getItemMeta();

    meta.setDisplayName(ChatColor.GOLD + "Select Team " + ChatColor.GRAY + "(Right click)");
    meta.setLore(null);

    stack.setItemMeta(meta);

    return stack;
}
 
开发者ID:WoutDev,项目名称:Mega-Walls,代码行数:13,代码来源:ItemHelper.java

示例8: unplaceable

import org.bukkit.inventory.ItemStack; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void unplaceable(BlockPlaceEvent evt) {
    ItemStack stack = evt.getItemInHand();
    if (stack == null) return;
    ItemMeta meta = stack.getItemMeta();
    if (!meta.hasLore()) return;
    
    for (String lore : meta.getLore()) {
        Item item = ItemFactory.items.get(lore);
        if (item instanceof UnplaceableItem) {
            evt.setCancelled(true);
        }
    }
}
 
开发者ID:Recraft,项目名称:Recreator,代码行数:15,代码来源:ItemActionListener.java

示例9: getFormattedIcon

import org.bukkit.inventory.ItemStack; //导入方法依赖的package包/类
@Override
public ItemStack getFormattedIcon(Player player)
{
    ItemStack stack = getIcon().clone();
    ItemMeta meta = stack.getItemMeta();
    List<String> lore = meta.getLore() != null ? meta.getLore() : new ArrayList<>();

    if (CosmeticAccessibility.valueOf(this.itemDescription.getRankAccessibility()) != CosmeticAccessibility.ALL)
    {
        lore.add("");
        lore.add(ChatColor.GRAY + "Vous devez posséder le grade");
        lore.add(CosmeticAccessibility.valueOf(this.itemDescription.getRankAccessibility()).getDisplay() + ChatColor.GRAY + " pour pouvoir utiliser cet");
        lore.add(ChatColor.GRAY + "objet.");
    }

    lore.add("");

    if (this.isActive(player))
        lore.add(ChatColor.GREEN + "Objet actif");
    else if (this.isOwned(player) || this.isDefaultItem())
        lore.add(ChatColor.GREEN + "Objet possédé");
    else if (( this.dependsOn != null && this.hasDepend(player)) || this.dependsOn == null)
        lore.add(ChatColor.GRAY + "Prix : " + ChatColor.GOLD + this.itemDescription.getPriceCoins() + " pièces");
    else
        lore.add(ChatColor.RED + "Nécessite " + ChatColor.AQUA + this.dependsOn.getIcon().getItemMeta().getDisplayName());

    meta.setLore(lore);
    stack.setItemMeta(meta);

    return stack;
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:32,代码来源:ShopDependsItem.java

示例10: SimpleWand

import org.bukkit.inventory.ItemStack; //导入方法依赖的package包/类
public SimpleWand() {
	baseItem = new ItemStack(Material.STICK, 1);
	ItemMeta meta = baseItem.getItemMeta();
	meta.setDisplayName(displayName + "none");
	meta.setLore(Arrays.asList(new String[]{"Right click to cast", "'/bind <spell>' to bind"}));
	meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
	meta.addEnchant(Enchantment.MENDING, 1, true);
	baseItem.setItemMeta(meta);
}
 
开发者ID:mcardy,项目名称:MystiCraft,代码行数:10,代码来源:SimpleWand.java

示例11: chooseExport

import org.bukkit.inventory.ItemStack; //导入方法依赖的package包/类
private Inventory chooseExport() {
    Inventory gui = Bukkit.createInventory(null, 9, FMessage.TRADE_OFFER_CHOOSE_EXPORT.getMessage());
    ItemStack exportIcon = GUIButton.E.clone();
    ItemMeta exMeta = exportIcon.getItemMeta();
    exMeta.setDisplayName(ChatColor.GREEN + FMessage.TRADE_EXPORT.getMessage());
    exportIcon.setItemMeta(exMeta);
    ItemStack importIcon = GUIButton.I.clone();
    ItemMeta imMeta = importIcon.getItemMeta();
    imMeta.setDisplayName(ChatColor.GREEN + FMessage.TRADE_IMPORT.getMessage());
    importIcon.setItemMeta(imMeta);
    gui.setItem(3, exportIcon);
    gui.setItem(5, importIcon);
    return gui;
}
 
开发者ID:DRE2N,项目名称:FactionsXL,代码行数:15,代码来源:TradeOfferCommand.java

示例12: getRepresentation

import org.bukkit.inventory.ItemStack; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public default ItemStack getRepresentation() {
	ItemStack stack = new ItemStack(Material.MAP);
	ItemMeta meta = stack.getItemMeta();
	meta.setDisplayName(ChatColor.GRAY + "Map Extend");
	stack.setItemMeta(meta);
	return stack;
}
 
开发者ID:Jannyboy11,项目名称:CustomRecipes,代码行数:12,代码来源:MapExtendRecipe.java

示例13: getItem

import org.bukkit.inventory.ItemStack; //导入方法依赖的package包/类
@Override
public ItemStack getItem() {
    ItemStack item = new ItemStack(Material.END_CRYSTAL);
    List<String> lore = new ArrayList<>();
    lore.add(ChatColor.GRAY + getName());
    lore.add(ChatColor.GRAY + getDescription());
    lore.add(ChatColor.GRAY + "Rarity: " + getRarity().getName());
    ItemMeta itemMeta = item.getItemMeta();
    itemMeta.setDisplayName(getRarity().getColor() + "Enchanted Crystal");
    itemMeta.setLore(lore);
    item.setItemMeta(itemMeta);
    return item;
}
 
开发者ID:Warvale,项目名称:Scorch,代码行数:14,代码来源:EXPSteal.java

示例14: createItemKey

import org.bukkit.inventory.ItemStack; //导入方法依赖的package包/类
public static ItemStack createItemKey(Material type,short damage,String key){
	ItemStack is=new ItemStack(type,1,damage);
	ItemMeta im=is.getItemMeta();
	//set Key
	im.setDisplayName(key);
	is.setItemMeta(im);
	return is;
}
 
开发者ID:SchoolUniform,项目名称:RealSurvival,代码行数:9,代码来源:Items.java

示例15: newInventory

import org.bukkit.inventory.ItemStack; //导入方法依赖的package包/类
public static void newInventory(CommandSender sender) {
Inventory tpheremenu = Bukkit.createInventory(null, 54, ChatColor.DARK_GRAY + "Teleport Here Menu - Page 1");

ItemStack empty = new ItemStack(Material.STAINED_GLASS_PANE, 1, (byte) 15);
ItemMeta emptyMeta = empty.getItemMeta();
emptyMeta.setDisplayName(" ");
empty.setItemMeta(emptyMeta);

ItemStack close = new ItemStack(Material.BARRIER);
ItemStack nextpage = new ItemStack(Material.SIGN);
ItemStack previouspage = new ItemStack(Material.SIGN);
ItemMeta npMeta = nextpage.getItemMeta();
ItemMeta ppMeta = previouspage.getItemMeta();
ItemMeta closeMeta = close.getItemMeta();
closeMeta.setDisplayName(ChatColor.RED + "Close the menu.");
   npMeta.setDisplayName(ChatColor.AQUA + "" + ChatColor.BOLD + "Next Page");
   ppMeta.setDisplayName(ChatColor.AQUA + "" + ChatColor.BOLD + "Previous Page");
   
   for (int i = 0; i < Bukkit.getOnlinePlayers().size(); i++) {
   	Player targetPlayer = (Player) Bukkit.getOnlinePlayers().toArray()[i];
    ItemStack skulls = new ItemStack(Material.SKULL_ITEM, 1,(byte) 3);
    SkullMeta skullsMeta = (SkullMeta) skulls.getItemMeta();
    skullsMeta.setDisplayName(ChatColor.YELLOW + "Teleport " + ChatColor.GREEN + targetPlayer.getName() + ChatColor.YELLOW + " to you.");
    skullsMeta.setOwner(targetPlayer.getName());
    skulls.setItemMeta(skullsMeta);
    
    int beginningSlot = 9;
    tpheremenu.setItem(i+beginningSlot, skulls);
   }
   
tpheremenu.setItem(0, empty);
tpheremenu.setItem(1, empty);
tpheremenu.setItem(2, empty);
tpheremenu.setItem(3, empty);
tpheremenu.setItem(4, empty);
tpheremenu.setItem(5, empty);
tpheremenu.setItem(6, empty);
tpheremenu.setItem(7, empty);
tpheremenu.setItem(8, empty);
tpheremenu.setItem(45, empty);
tpheremenu.setItem(46, empty);
tpheremenu.setItem(47, empty);
tpheremenu.setItem(48, empty);
tpheremenu.setItem(49, close);
tpheremenu.setItem(50, empty);
tpheremenu.setItem(51, empty);
tpheremenu.setItem(52, empty);
tpheremenu.setItem(53, nextpage);

((HumanEntity) sender).openInventory(tpheremenu);
  }
 
开发者ID:SlamTheHam,项目名称:UltraCore,代码行数:52,代码来源:TeleportHereMenu.java


注:本文中的org.bukkit.inventory.ItemStack.getItemMeta方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。