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


Java LeatherArmorMeta类代码示例

本文整理汇总了Java中org.bukkit.inventory.meta.LeatherArmorMeta的典型用法代码示例。如果您正苦于以下问题:Java LeatherArmorMeta类的具体用法?Java LeatherArmorMeta怎么用?Java LeatherArmorMeta使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: apply

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入依赖的package包/类
@Override
public void apply(Player player, MatchTeam matchTeam) {
    // Set leather armor in armor slots to team color if not set initially
    if (slot >= 100 && !hasColor && itemStack.getType().toString().contains("LEATHER_")) {
        LeatherArmorMeta leatherArmorMeta = (LeatherArmorMeta) itemStack.getItemMeta();
        leatherArmorMeta.setColor(ColorConverter.getColor(matchTeam.getColor()));
        itemStack.setItemMeta(leatherArmorMeta);
    }

    if (slot == 100) player.getInventory().setBoots(itemStack);
    else if (slot == 101) player.getInventory().setLeggings(itemStack);
    else if (slot == 102) player.getInventory().setChestplate(itemStack);
    else if (slot == 103) player.getInventory().setHelmet(itemStack);
    else if (slot == -106) player.getInventory().setItemInOffHand(itemStack);
    else player.getInventory().setItem(slot, itemStack);
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:17,代码来源:ItemKitNode.java

示例2: extractTextureFromEntity

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入依赖的package包/类
public static CustomBlockTexture extractTextureFromEntity(ArmorStand e) {
	CustomBlockTexture t = new CustomBlockTexture();
	short tex = (short) e.getHelmet().getDurability();
	Color c = ((LeatherArmorMeta) e.getHelmet().getItemMeta()).getColor();
	boolean g = e.getHelmet().containsEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL);
	t.setLayerPrimary(tex, c, g);
	
	if (e.getEquipment().getItemInMainHand() == null) {
		return t;
	}
	
	short tex2 = (short) e.getEquipment().getItemInMainHand().getDurability();
	Color c2 = ((LeatherArmorMeta) e.getEquipment().getItemInMainHand().getItemMeta()).getColor();
	boolean g2 = e.getEquipment().getItemInMainHand().containsEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL);
	t.setLayerSecondary(tex2, c2, g2);
	
	return t;
}
 
开发者ID:GigaGamma,项目名称:SuperiorCraft,代码行数:19,代码来源:CustomBlockTexture.java

示例3: build

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入依赖的package包/类
/**
 * Get the final {@link ItemStack} with all the attributes you have been adding
 *
 * @return the {@link ItemStack} of this {@link ItemBuilder}
 */
@Override
public ItemStack build() {
    ItemStack s = new ItemStack(this.getMaterial());
    s.setAmount(this.getAmount());
    s.setDurability(this.getDamage());
    LeatherArmorMeta m = (LeatherArmorMeta) s.getItemMeta();

    for (ItemFlag iflag : this.getAllItemflags()) {
        m.addItemFlags(iflag);
    }
    m.setDisplayName(this.getName());
    m.setLore(this.getLore());
    m.setColor(color);
    s.setItemMeta(m);
    for (Map.Entry<Enchantment, Integer> temp : this.getAllEnchantments().entrySet()) {
        s.addUnsafeEnchantment(temp.getKey(), temp.getValue());
    }
    return s;
}
 
开发者ID:AlphaHelixDev,项目名称:AlphaLibary,代码行数:25,代码来源:LeatherItemBuilder.java

示例4: parse

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入依赖的package包/类
public static ItemMeta parse(Element xml, ItemMeta source) {
    if (source instanceof BannerMeta) {
        return parseBanner(xml, (BannerMeta) source);
    } else if (source instanceof BookMeta) {
        return parseBook(xml, (BookMeta) source);
    } else if (source instanceof EnchantmentStorageMeta) {
        return parseEnchantmentStorage(xml, (EnchantmentStorageMeta) source);
    } else if (source instanceof FireworkMeta) {
        return parseFirework(xml, (FireworkMeta) source);
    } else if (source instanceof FireworkEffectMeta) {
        return parseFireworkEffect(xml, (FireworkEffectMeta) source);
    } else if (source instanceof LeatherArmorMeta) {
        return parseLeatherArmor(xml, (LeatherArmorMeta) source);
    } else if (source instanceof MapMeta) {
        return parseMap(xml, (MapMeta) source);
    } else if (source instanceof PotionMeta) {
        return parsePotion(xml, (PotionMeta) source);
    } else if (source instanceof SkullMeta) {
        return parseSkull(xml, (SkullMeta) source);
    } else if (source instanceof SpawnEggMeta) {
        return parseSpawnEgg(xml, (SpawnEggMeta) source);
    }

    return source;
}
 
开发者ID:ShootGame,项目名称:Arcade2,代码行数:26,代码来源:XMLItemMeta.java

示例5: isConvertable

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入依赖的package包/类
public static boolean isConvertable(ItemStack is)
{
	if (is.hasItemMeta())
	{
		ItemMeta im = is.getItemMeta();
		if (im instanceof LeatherArmorMeta)
			try
			{
				Integer.parseInt(im.getLore().get(0).substring(15));
				return true;
			}
			catch (Exception e)
			{
			}
	}
	return false;
}
 
开发者ID:Limeth,项目名称:Breakpoint,代码行数:18,代码来源:BPArmor.java

示例6: coloredArmor

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入依赖的package包/类
private static ItemStack[] coloredArmor(AnniTeam team)
{
	Color c;
	if(team.getColor() == ChatColor.RED)
		c = Color.RED;
	else if(team.getColor() == ChatColor.BLUE)
		c = Color.BLUE;
	else if(team.getColor() == ChatColor.GREEN)
		c = Color.GREEN;
	else
		c = Color.YELLOW;
	ItemStack[] stacks = KitUtils.getLeatherArmor();
	for(ItemStack stack : stacks)
	{
		LeatherArmorMeta meta = (LeatherArmorMeta) stack.getItemMeta();
		meta.setColor(c);
		stack.setItemMeta(meta);
	}
	return stacks;
}
 
开发者ID:MrLittleKitty,项目名称:AnnihilationPro,代码行数:21,代码来源:Loadout.java

示例7: disguise

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入依赖的package包/类
public boolean disguise(Player player, String teamName) {
    if (!isValid(teamName)) {
        return false;
    }
    Team team = teams.get(teamName);
    ItemStack tshirt = new ItemStack(Material.LEATHER_CHESTPLATE);
    LeatherArmorMeta tShirtMeta = (LeatherArmorMeta) tshirt.getItemMeta();
    tShirtMeta.setColor(team.tshirtColor);
    tShirtMeta.setDisplayName(team.chatColor + team.tshirtName);
    backToNormal(player, false);
    player.setDisplayName(team.chatColor + player.getName());
    tshirt.setItemMeta(tShirtMeta);
    player.getInventory().setChestplate(tshirt);
    player.setGameMode(GameMode.ADVENTURE);
    TagAPI.refreshPlayer(player);
    _disguisedPlayers_mutex.lock();
    try {
        disguisedPlayers.put(player, team);
    } finally {
        _disguisedPlayers_mutex.unlock();
    }
    score.scoreTeams.get(teamName).addPlayer(player);
    updateScoreboards();
    return true;
}
 
开发者ID:ddonofrio,项目名称:libelula,代码行数:26,代码来源:TeamManager.java

示例8: build

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入依赖的package包/类
public ItemStack build() {
   Material mat = this.mat;
   if (mat == null) {
      mat = Material.AIR;
      Bukkit.getLogger().warning("Null material!");
   }
   ItemStack item = new ItemStack(this.mat, this.amount, this.data);
   ItemMeta meta = item.getItemMeta();
   if (this.title != null) {
      meta.setDisplayName(this.title);
   }
   if (!this.lore.isEmpty()) {
      meta.setLore(this.lore);
   }
   if (meta instanceof LeatherArmorMeta) {
      ((LeatherArmorMeta) meta).setColor(this.color);
   }
   item.setItemMeta(meta);
   item.addUnsafeEnchantments(this.enchants);
   if (this.potion != null) {
      this.potion.apply(item);
   }
   return item;
}
 
开发者ID:PaulBGD,项目名称:MiniMiniGames,代码行数:25,代码来源:ItemBuilder.java

示例9: setLore

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入依赖的package包/类
/**
 * Sets lore to a players armor
 * 
 * @param player {@code ItemMeta} to set lore for armor
 * @param str Lore string
 */
public static void setLore(Player player, String str) {
    List<String> lores = new ArrayList<String>();
    ItemStack[] armor = player.getInventory().getArmorContents();
    lores.add(str);
    ItemMeta meta;
    for (ItemStack is : armor) {
        if (is != null && (meta = is.getItemMeta()) instanceof LeatherArmorMeta) {
            if (meta.hasLore()) {
                List<String> localAdd = new ArrayList<String>();
                for (String l : meta.getLore()) {
                    if (!l.startsWith(Lang.TITLE_PREFIX.toString() + "|")) {
                        localAdd.add(l);
                    }
                }
                lores.addAll(localAdd);
            }
            meta.setLore(lores);
            is.setItemMeta(meta);
        }
    }
}
 
开发者ID:nsporillo,项目名称:RBGArmor,代码行数:28,代码来源:Utility.java

示例10: run

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入依赖的package包/类
@Override
public void run() {
    Color c = getNext(player.getHealth());
    if(last == c) {
        // dont update armor if health didnt change
        return;
    }
    for (ItemStack is : inv.getArmorContents()){
        if (is != null && is.getItemMeta() instanceof LeatherArmorMeta) {
            if (!Utility.isWorthy(is.getItemMeta())) {
                continue;
            }
            LeatherArmorMeta lam = (LeatherArmorMeta) is.getItemMeta();
            lam.setColor(c);
            is.setItemMeta(lam);
        }
    }
}
 
开发者ID:nsporillo,项目名称:RBGArmor,代码行数:19,代码来源:HealthWorker.java

示例11: getSpecialMetaString

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入依赖的package包/类
/**
 * Gets a String representing all special meta of this ItemStack, if any.
 *
 * @param is         the ItemStack
 * @param separators the separators
 *
 * @return a String representing this ItemStack's special meta or an empty String
 *
 * @throws InventoryUtilException if something goes wrong
 */
public static String getSpecialMetaString(final ItemStack is, final String[] separators) throws InventoryUtilException {
    final ItemMeta meta = is.getItemMeta();

    if (meta instanceof BookMeta) {
        return getBookMetaString((BookMeta)meta);
    } else if (meta instanceof EnchantmentStorageMeta) {
        return getEnchantmentStorageMetaString((EnchantmentStorageMeta)meta, separators);
    } else if (meta instanceof FireworkEffectMeta) {
        return getFireworkEffectMetaString((FireworkEffectMeta)meta);
    } else if (meta instanceof FireworkMeta) {
        return getFireworkMetaString((FireworkMeta)meta, separators);
    } else if (meta instanceof LeatherArmorMeta) {
        return getLeatherArmorMetaString((LeatherArmorMeta)meta);
    } else if (meta instanceof MapMeta) {
        return getMapMetaString((MapMeta)meta);
    } else if (meta instanceof PotionMeta) {
        return getPotionMetaString((PotionMeta)meta, separators);
    } else if (meta instanceof SkullMeta) {
        return getSkullMetaString((SkullMeta)meta);
    } else {
        throw new InventoryUtilException("Unknown Meta type '" + meta.getClass().getName() + "', please report this to the author (Ribesg)!");
    }
}
 
开发者ID:Ribesg,项目名称:NPlugins,代码行数:34,代码来源:ItemMetaUtil.java

示例12: reload

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入依赖的package包/类
public void reload() {
    fake.setContents(real.getContents());
    Iterator<ItemStack> it = fake.iterator();
    while (it.hasNext()) {
        ItemStack item = it.next();
        RPGItem rItem = ItemManager.toRPGItem(item);
        if (rItem == null)
            continue;
        item.setType(rItem.getItem());
        ItemMeta meta = rItem.getLocaleMeta(locale);
        if (!(meta instanceof LeatherArmorMeta) && rItem.getItem().isBlock())
            item.setDurability(rItem.getDataValue());
        item.setItemMeta(meta);
    }
    fake.setContents(fake.getContents());
}
 
开发者ID:Thinkofname,项目名称:RPG-Items,代码行数:17,代码来源:LocaleInventory.java

示例13: setItemItem

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入依赖的package包/类
@CommandString("rpgitem $n[] item $m[] $data:i[]")
@CommandDocumentation("$command.rpgitem.item.set.data")
@CommandGroup("item_item")
public void setItemItem(CommandSender sender, RPGItem item, Material material, int data) {
    String locale = sender instanceof Player ? Locale.getPlayerLocale((Player) sender) : "en_GB";
    item.setItem(material, false);
    ItemMeta meta = item.getLocaleMeta(locale);
    if (meta instanceof LeatherArmorMeta) {
        ((LeatherArmorMeta) meta).setColor(Color.fromRGB(data));
    } else {
        item.setDataValue((short) data);
    }
    for (String locales : Locale.getLocales()) {
        item.setLocaleMeta(locales, meta.clone());
    }
    item.rebuild();
    sender.sendMessage(ChatColor.AQUA + String.format(Locale.get("message.item.set", locale), item.getName(), item.getItem(), item.getDataValue()));
    ItemManager.save(Plugin.plugin);
}
 
开发者ID:Thinkofname,项目名称:RPG-Items,代码行数:20,代码来源:Handler.java

示例14: addLeatherArmorMeta

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入依赖的package包/类
/**
 * Adds color to LeatherArmorMeta
 *
 * @param meta   ItemMeta to change
 * @param config Config to read from
 * @throws Exception if there was an error
 */
private void addLeatherArmorMeta(ItemMeta meta, ConfigurationSection config) throws Exception {
    if (!config.contains(LEATHER_ARMOR)) {
        return;
    }

    String color = config.getString(LEATHER_ARMOR);
    String[] rgb = color.split(",");
    if (rgb.length < 3) {
        throw new Exception("Color tag '" + color + "' is invalid");
    }

    ((LeatherArmorMeta) meta).setColor(
            Color.fromRGB(Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]),
                    Integer.parseInt(rgb[2])));
}
 
开发者ID:t7seven7t,项目名称:CraftFX,代码行数:23,代码来源:ItemLoader.java

示例15: setItemItem

import org.bukkit.inventory.meta.LeatherArmorMeta; //导入依赖的package包/类
@CommandString("rpgitem $n[] item $m[] $data:i[]")
@CommandDocumentation("$command.rpgitem.item.set.data")
@CommandGroup("item_item")
public void setItemItem(CommandSender sender, RPGItem item, Material material, int data) {
	String locale = Locale.getPlayerLocale((Player) sender);
	item.setItem(material, false);
    ItemMeta meta = item.getLocaleMeta(locale);
    if (meta instanceof LeatherArmorMeta) {
        ((LeatherArmorMeta) meta).setColor(Color.fromRGB(data));
    } else {
        item.setDataValue((short) data);
    }
    for (String locales : Locale.getLocales()) {
        item.setLocaleMeta(locales, meta.clone());
    }
    item.rebuild();
    sender.sendMessage(ChatColor.AQUA + String.format(Locale.get("message.item.set", locale), item.getName(), item.getItem(), item.getDataValue()));
    ItemManager.save(Plugin.plugin);
}
 
开发者ID:TheCreeperOfRedstone,项目名称:RPG-Items-2,代码行数:20,代码来源:Handler.java


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