private boolean bleachLeatherArmor(GlowPlayer player, GlowBlock block) { // fired when a player bleaches a leather armor piece using the cauldron if (block.getData() > LEVEL_EMPTY) { if (!setCauldronLevel(block, block.getData() - 1, player, CauldronLevelChangeEvent.ChangeReason.ARMOR_WASH)) { return false; } ItemStack inHand = player.getItemInHand(); LeatherArmorMeta im = (LeatherArmorMeta) inHand.getItemMeta(); im.setColor(GlowItemFactory.instance().getDefaultLeatherColor()); inHand.setItemMeta(im); return true; } else { return false; } }
meta.setColor(team.getColor().getColor()); meta.setDisplayName(team.getChatColor() + team.getDisplayName()); chestplate.setItemMeta(meta);
/** * Creates an instance by copying from the given {@link ItemMeta}. If that item is another * {@link LeatherArmorMeta}, its color is copied; otherwise, the new item is undyed. * @param meta the {@link ItemMeta} to copy */ public GlowMetaLeatherArmor(ItemMeta meta) { super(meta); if (meta instanceof LeatherArmorMeta) { color = ((LeatherArmorMeta) meta).getColor(); } }
meta.setColor(team.getColor().getColor()); meta.setDisplayName(team.getChatColor() + team.getDisplayName()); chestplate.setItemMeta(meta);
@Override public MCColor getColor() { return BukkitMCColor.GetMCColor(lam.getColor()); }
public ItemBuilder color(Color color) { if (itemMeta instanceof LeatherArmorMeta) { ((LeatherArmorMeta) itemMeta).setColor(color); } return this; }
public ItemStackBuilder color(Color color) { if (itemMeta instanceof LeatherArmorMeta) { ((LeatherArmorMeta) itemMeta).setColor(color); } return this; }
skyMetaList.add(new SkyArmorColorMeta(((LeatherArmorMeta) itemMeta).getColor()));
@Override public void setColor(MCColor color) { lam.setColor(BukkitMCColor.GetColor(color)); }
public MaterialAndData(ItemStack item) { this.material = item.getType(); this.data = item.getDurability(); if (DefaultMaterials.isPlayerSkull(this)) { ItemMeta meta = item.getItemMeta(); Object profile = InventoryUtils.getSkullProfile(meta); extraData = new BlockSkull(profile); } else if (DefaultMaterials.isBanner(this.material)) { ItemMeta meta = item.getItemMeta(); if (meta != null && meta instanceof BannerMeta) { BannerMeta banner = (BannerMeta)meta; extraData = new BlockBanner(banner.getPatterns(), DeprecatedUtils.getBaseColor(banner)); } } else if (this.material == Material.LEATHER_BOOTS || this.material == Material.LEATHER_CHESTPLATE || this.material == Material.LEATHER_HELMET || this.material == Material.LEATHER_LEGGINGS) { ItemMeta meta = item.getItemMeta(); if (meta != null && meta instanceof LeatherArmorMeta) { extraData = new LeatherArmorData(((LeatherArmorMeta)meta).getColor()); } } else if (this.material == Material.POTION) { ItemMeta meta = item.getItemMeta(); if (meta != null && meta instanceof PotionMeta) { extraData = new PotionData(CompatibilityUtils.getColor((PotionMeta)meta)); } } }
switch (team.getColor()) { case RED: m.setColor(Color.RED); break; case BLUE: m.setColor(Color.BLUE); break; case GREEN: m.setColor(Color.GREEN); break; case YELLOW: m.setColor(Color.YELLOW); break; case BLACK: m.setColor(Color.BLACK); break; case WHITE: m.setColor(Color.WHITE); break; case GRAY: m.setColor(Color.GRAY); break; case PURPLE: m.setColor(Color.PURPLE); break; case DARK_BLUE: m.setColor(Color.BLUE); break; case DARK_GREEN:
Color color = armor.getColor(); key.setInt("armor.color", color.asRGB()); } else {
public ItemStackBuilder color(Color color) { return transform(itemStack -> { Material type = itemStack.getType(); if (type == Material.LEATHER_BOOTS || type == Material.LEATHER_CHESTPLATE || type == Material.LEATHER_HELMET || type == Material.LEATHER_LEGGINGS) { LeatherArmorMeta meta = (LeatherArmorMeta) itemStack.getItemMeta(); meta.setColor(color); itemStack.setItemMeta(meta); } }); }
if (!color.check(armorMeta.getColor())) { return false;
public ItemStackBuilder color(Color color) { return transform(itemStack -> { Material type = itemStack.getType(); if (type == Material.LEATHER_BOOTS || type == Material.LEATHER_CHESTPLATE || type == Material.LEATHER_HELMET || type == Material.LEATHER_LEGGINGS) { LeatherArmorMeta meta = (LeatherArmorMeta) itemStack.getItemMeta(); meta.setColor(color); itemStack.setItemMeta(meta); } }); }
((LeatherArmorMeta) item.getMeta()).setColor(Color.fromRGB(Integer.parseInt(color[0]), Integer.parseInt(color[1]), Integer.parseInt(color[2]))); item.refreshMeta();
public static void equipArmorStand(LivingEntity armor, Team team) { if (!(armor instanceof ArmorStand)) { return; } ArmorStand stand = (ArmorStand) armor; // helmet ItemStack helmet = new ItemStack(Material.LEATHER_HELMET, 1); LeatherArmorMeta meta = (LeatherArmorMeta) helmet.getItemMeta(); meta.setColor(team.getColor().getColor()); helmet.setItemMeta(meta); // chestplate ItemStack chestplate = new ItemStack(Material.LEATHER_CHESTPLATE, 1); meta = (LeatherArmorMeta) chestplate.getItemMeta(); meta.setColor(team.getColor().getColor()); chestplate.setItemMeta(meta); // leggings ItemStack leggings = new ItemStack(Material.LEATHER_LEGGINGS, 1); meta = (LeatherArmorMeta) leggings.getItemMeta(); meta.setColor(team.getColor().getColor()); leggings.setItemMeta(meta); // boots ItemStack boots = new ItemStack(Material.LEATHER_BOOTS, 1); meta = (LeatherArmorMeta) boots.getItemMeta(); meta.setColor(team.getColor().getColor()); boots.setItemMeta(meta); stand.setHelmet(helmet); stand.setChestplate(chestplate); stand.setLeggings(leggings); stand.setBoots(boots); }
public static void equipArmorStand(LivingEntity armor, Team team) { if (!(armor instanceof ArmorStand)) { return; } ArmorStand stand = (ArmorStand) armor; // helmet ItemStack helmet = new ItemStack(Material.LEATHER_HELMET, 1); LeatherArmorMeta meta = (LeatherArmorMeta) helmet.getItemMeta(); meta.setColor(team.getColor().getColor()); helmet.setItemMeta(meta); // chestplate ItemStack chestplate = new ItemStack(Material.LEATHER_CHESTPLATE, 1); meta = (LeatherArmorMeta) chestplate.getItemMeta(); meta.setColor(team.getColor().getColor()); chestplate.setItemMeta(meta); // leggings ItemStack leggings = new ItemStack(Material.LEATHER_LEGGINGS, 1); meta = (LeatherArmorMeta) leggings.getItemMeta(); meta.setColor(team.getColor().getColor()); leggings.setItemMeta(meta); // boots ItemStack boots = new ItemStack(Material.LEATHER_BOOTS, 1); meta = (LeatherArmorMeta) boots.getItemMeta(); meta.setColor(team.getColor().getColor()); boots.setItemMeta(meta); stand.setHelmet(helmet); stand.setChestplate(chestplate); stand.setLeggings(leggings); stand.setBoots(boots); }