java类org.bukkit.inventory.meta.LeatherArmorMeta的实例源码

ItemKitNode.java 文件源码 项目:Warzone 阅读 18 收藏 0 点赞 0 评论 0
@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);
}
CustomBlockTexture.java 文件源码 项目:SuperiorCraft 阅读 28 收藏 0 点赞 0 评论 0
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;
}
LeatherItemBuilder.java 文件源码 项目:AlphaLibary 阅读 25 收藏 0 点赞 0 评论 0
/**
 * 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;
}
CustomBlockTexture.java 文件源码 项目:SuperiorCraft 阅读 27 收藏 0 点赞 0 评论 0
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;
}
XMLItemMeta.java 文件源码 项目:Arcade2 阅读 24 收藏 0 点赞 0 评论 0
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;
}
BPArmor.java 文件源码 项目:Breakpoint 阅读 26 收藏 0 点赞 0 评论 0
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;
}
Loadout.java 文件源码 项目:AnnihilationPro 阅读 21 收藏 0 点赞 0 评论 0
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;
}
BPArmor.java 文件源码 项目:Breakpoint 阅读 19 收藏 0 点赞 0 评论 0
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;
}
TeamManager.java 文件源码 项目:libelula 阅读 26 收藏 0 点赞 0 评论 0
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;
}
ItemBuilder.java 文件源码 项目:MiniMiniGames 阅读 25 收藏 0 点赞 0 评论 0
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;
}
Utility.java 文件源码 项目:RBGArmor 阅读 31 收藏 0 点赞 0 评论 0
/**
 * 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);
        }
    }
}
HealthWorker.java 文件源码 项目:RBGArmor 阅读 21 收藏 0 点赞 0 评论 0
@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);
        }
    }
}
ItemMetaUtil.java 文件源码 项目:NPlugins 阅读 20 收藏 0 点赞 0 评论 0
/**
 * 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)!");
    }
}
LocaleInventory.java 文件源码 项目:RPG-Items 阅读 20 收藏 0 点赞 0 评论 0
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());
}
Handler.java 文件源码 项目:RPG-Items 阅读 26 收藏 0 点赞 0 评论 0
@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);
}
Handler.java 文件源码 项目:RPG-Items 阅读 21 收藏 0 点赞 0 评论 0
@CommandString("rpgitem $n[] item $m[] hex $hexcolour:s[]")
@CommandDocumentation("$command.rpgitem.item.set.data.hex")
@CommandGroup("item_item")
public void setItemItem(CommandSender sender, RPGItem item, Material material, String hexColour) {
    String locale = sender instanceof Player ? Locale.getPlayerLocale((Player) sender) : "en_GB";
    int dam;
    try {
        dam = Integer.parseInt((String) hexColour, 16);
    } catch (NumberFormatException e) {
        sender.sendMessage(ChatColor.RED + "Failed to parse " + hexColour);
        return;
    }
    item.setItem(material, true);
    ItemMeta meta = item.getLocaleMeta(locale);
    if (meta instanceof LeatherArmorMeta) {
        ((LeatherArmorMeta) meta).setColor(Color.fromRGB(dam));
    } else {
        item.setDataValue((short) dam);
    }
    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);
}
Handler.java 文件源码 项目:RPG-Items 阅读 29 收藏 0 点赞 0 评论 0
@CommandString("rpgitem $n[] item $itemid:i[] $data:i[]")
@CommandDocumentation("$command.rpgitem.item.set.id.data")
@CommandGroup("item_item")
public void setItemItem(CommandSender sender, RPGItem item, int id, int data) {
    String locale = sender instanceof Player ? Locale.getPlayerLocale((Player) sender) : "en_GB";
    Material mat = Material.getMaterial(id);
    if (mat == null) {
        sender.sendMessage(ChatColor.RED + Locale.get("message.item.cant.find", locale));
        return;
    }
    item.setItem(mat, true);
    ItemMeta meta = item.toItemStack(locale).getItemMeta();
    if (meta instanceof LeatherArmorMeta) {
        ((LeatherArmorMeta) meta).setColor(Color.fromRGB(data));
    } else {
        item.setDataValue((short) data);
    }
    for (String locales : Locale.getLocales()) {
        item.setLocaleMeta(locales, meta);
    }
    item.rebuild();
    sender.sendMessage(ChatColor.AQUA + String.format(Locale.get("message.item.set", locale), item.getName(), item.getItem(), item.getDataValue()));
    ItemManager.save(Plugin.plugin);
}
ItemLoader.java 文件源码 项目:CraftFX 阅读 23 收藏 0 点赞 0 评论 0
/**
 * 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])));
}
LocaleInventory.java 文件源码 项目:RPG-Items-2 阅读 20 收藏 0 点赞 0 评论 0
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());
}
Handler.java 文件源码 项目:RPG-Items-2 阅读 32 收藏 0 点赞 0 评论 0
@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);
}
Handler.java 文件源码 项目:RPG-Items-2 阅读 31 收藏 0 点赞 0 评论 0
@CommandString("rpgitem $n[] item $m[] hex $hexcolour:s[]")
@CommandDocumentation("$command.rpgitem.item.set.data.hex")
@CommandGroup("item_item")
public void setItemItem(CommandSender sender, RPGItem item, Material material, String hexColour) {
    String locale = Locale.getPlayerLocale((Player) sender);
    int dam;
    try {
        dam = Integer.parseInt((String) hexColour, 16);
    } catch (NumberFormatException e) {
        sender.sendMessage(ChatColor.RED + "Failed to parse " + hexColour);
        return;
    }
    item.setItem(material, true);
    ItemMeta meta = item.getLocaleMeta(locale);
    if (meta instanceof LeatherArmorMeta) {
        ((LeatherArmorMeta) meta).setColor(Color.fromRGB(dam));
    } else {
        item.setDataValue((short) dam);
    }
    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);
}
Handler.java 文件源码 项目:RPG-Items-2 阅读 24 收藏 0 点赞 0 评论 0
@CommandString("rpgitem $n[] item $itemid:i[] $data:i[]")
@CommandDocumentation("$command.rpgitem.item.set.id.data")
@CommandGroup("item_item")
public void setItemItem(CommandSender sender, RPGItem item, int id, int data) {
    String locale = Locale.getPlayerLocale((Player) sender);
    Material mat = Material.getMaterial(id);
    if (mat == null) {
        sender.sendMessage(ChatColor.RED + Locale.get("message.item.cant.find", locale));
        return;
    }
    item.setItem(mat, true);
    ItemMeta meta = item.toItemStack(locale).getItemMeta();
    if (meta instanceof LeatherArmorMeta) {
        ((LeatherArmorMeta) meta).setColor(Color.fromRGB(data));
    } else {
        item.setDataValue((short) data);
    }
    for (String locales : Locale.getLocales()) {
        item.setLocaleMeta(locales, meta);
    }
    item.rebuild();
    sender.sendMessage(ChatColor.AQUA + String.format(Locale.get("message.item.set", locale), item.getName(), item.getItem(), item.getDataValue()));
    ItemManager.save(Plugin.plugin);
}
LeatherArmorCustomItem.java 文件源码 项目:uppercore 阅读 24 收藏 0 点赞 0 评论 0
@Override
public void processMeta(Player player, ItemMeta m) {
    super.processMeta(player, m);
    LeatherArmorMeta meta = (LeatherArmorMeta) m;
    if(color != null)
        meta.setColor(color.resolve(player));
}
EquipItem.java 文件源码 项目:ZentrelaRPG 阅读 22 收藏 0 点赞 0 评论 0
@Override
public ItemStack generate() {
    ItemStack item = new ItemStack(material);
    ItemMeta im = item.getItemMeta();
    // prepend reset to clear the default name coloring
    im.setDisplayName(ChatColor.RESET + name);
    // Get lore from string
    List<String> lore = stats.lore();
    if (soulbound) {
        lore.add(ChatColor.RED + ChatColor.ITALIC.toString() + "Soulbound");
    }
    // Get description, if it exists
    if (description != null && description.length() > 0) {
        if (lore.size() > 0 && lore.get(lore.size() - 1).length() > 0)
            lore.add("");
        lore.addAll(RFormatter.stringToLore(description, ChatColor.GRAY));
    }

    im.setLore(lore);
    im.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
    im.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
    im.addItemFlags(ItemFlag.HIDE_DESTROYS);
    im.addItemFlags(ItemFlag.HIDE_ENCHANTS);
    im.addItemFlags(ItemFlag.HIDE_PLACED_ON);
    im.addItemFlags(ItemFlag.HIDE_UNBREAKABLE);

    // Add color for leather armors
    if (leatherColor != null) {
        ((LeatherArmorMeta) im).setColor(leatherColor);
    }

    item.setItemMeta(im);
    return item;
}
CustomBlockTexture.java 文件源码 项目:SuperiorCraft 阅读 24 收藏 0 点赞 0 评论 0
public ArmorStand placeBlock(Location l) {
    ArmorStand block = (ArmorStand) l.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);
    block.setSmall(true);
    block.setGravity(false);
    block.setCustomName("CustomBlock");
    block.setCustomNameVisible(false);
    block.setInvulnerable(true);
    block.setVisible(false);
    block.setMarker(true);
    block.setSilent(true);

    ItemStack a = new ItemStack(Material.LEATHER_BOOTS);
    a.setDurability((short) primary.getTexture());
    LeatherArmorMeta am = (LeatherArmorMeta) a.getItemMeta();
    am.setColor(primary.getColor());
    am.setUnbreakable(true);
    if (primary.isGlowing()) {
        am.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 3, true);
    }
    a.setItemMeta(am);
    block.setHelmet(a);

    if (secondary != null) {
        ItemStack b = new ItemStack(Material.LEATHER_BOOTS);
        b.setDurability((short) secondary.getTexture());
        LeatherArmorMeta bm = (LeatherArmorMeta) b.getItemMeta();
        bm.setColor(secondary.getColor());
        bm.setUnbreakable(true);
        if (secondary.isGlowing()) {
            System.out.println("H");
            bm.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 3, true);
        }
        b.setItemMeta(bm);
        block.getEquipment().setItemInMainHand(b);
    }

    return block;
}
PickerMatchModule.java 文件源码 项目:ProjectAres 阅读 26 收藏 0 点赞 0 评论 0
private ItemStack createTeamJoinButton(final MatchPlayer player, final Team team) {
    ItemStack item = new ItemStack(Button.TEAM_JOIN.material);
    String capacityMessage = this.getTeamSizeDescription(team.getPlayers().size(), team.getMaxPlayers());
    List<String> lore = Lists.newArrayList(capacityMessage);

    final JoinResult result = jmm.queryJoin(player, JoinRequest.user(team));
    if(result.isAllowed()) {
        final String label = result.isRejoin() ? "teamSelection.picker.clickToRejoin"
                                               : "teamSelection.picker.clickToJoin";
        lore.add(renderer.renderLegacy(new Component(new TranslatableComponent(label), ChatColor.GREEN), player.getBukkit()));
    } else if(result.message().isPresent()) {
        lore.add(renderer.renderLegacy(new Component(result.message().get(), ChatColor.RED), player.getBukkit()));
        result.extra().forEach(line -> {
            lore.add(renderer.renderLegacy(line, player.getBukkit()));
        });
    }

    LeatherArmorMeta meta = (LeatherArmorMeta) item.getItemMeta();
    meta.addItemFlags(ItemFlag.values());
    meta.setColor(team.getFullColor());
    meta.setDisplayName(team.getColor().toString() + ChatColor.BOLD + team.getName());
    meta.setLore(lore);
    meta.addItemFlags(ItemFlag.values()); // Hides a lot more than potion effects
    item.setItemMeta(meta);

    return item;
}
ExpressBotaniaDisplayer.java 文件源码 项目:Hub 阅读 19 收藏 0 点赞 0 评论 0
private ItemStack colorArmor(ItemStack stack, Color color)
{
    LeatherArmorMeta meta = (LeatherArmorMeta) stack.getItemMeta();
    meta.setColor(color);
    stack.setItemMeta(meta);

    return stack;
}
UtilItem.java 文件源码 项目:OnlineChecker-Spigot-SQL-Support 阅读 24 收藏 0 点赞 0 评论 0
public static ItemStack createColouredArmour(Material m, Color colour) {
    ItemStack i = new ItemStack(m);
    i = applyItemFlags(i);
    LeatherArmorMeta lam = (LeatherArmorMeta) i.getItemMeta();
    lam.setColor(colour);
    i.setItemMeta(lam);
    return i;
}
UtilItem.java 文件源码 项目:OnlineChecker-Spigot-SQL-Support 阅读 19 收藏 0 点赞 0 评论 0
public static ItemStack createColouredArmour(Material m, Color colour, String n, List<String> l) {
    ItemStack i = new ItemStack(m);
    i = applyItemFlags(i);
    LeatherArmorMeta lam = (LeatherArmorMeta) i.getItemMeta();
    lam.setDisplayName(n);
    lam.setLore(l);
    lam.setColor(colour);
    i.setItemMeta(lam);
    return i;
}
UtilItem.java 文件源码 项目:OnlineChecker-Spigot-SQL-Support 阅读 27 收藏 0 点赞 0 评论 0
public static ItemStack createColouredArmour(Material m, Color colour, String n) {
    ItemStack i = new ItemStack(m);
    i = applyItemFlags(i);
    LeatherArmorMeta lam = (LeatherArmorMeta) i.getItemMeta();
    lam.setDisplayName(n);
    lam.setColor(colour);
    i.setItemMeta(lam);
    return i;
}


问题


面经


文章

微信
公众号

扫码关注公众号