Search in sources :

Example 6 with LeatherArmorMeta

use of org.bukkit.inventory.meta.LeatherArmorMeta in project Minigames by AddstarMC.

the class MenuItemTeam method setTeamIcon.

private void setTeamIcon() {
    LeatherArmorMeta m = (LeatherArmorMeta) getItem().getItemMeta();
    if (team.getColor() == TeamColor.RED)
        m.setColor(Color.RED);
    else if (team.getColor() == TeamColor.BLUE)
        m.setColor(Color.BLUE);
    else if (team.getColor() == TeamColor.GREEN)
        m.setColor(Color.GREEN);
    else if (team.getColor() == TeamColor.YELLOW)
        m.setColor(Color.YELLOW);
    else if (team.getColor() == TeamColor.BLACK)
        m.setColor(Color.BLACK);
    else if (team.getColor() == TeamColor.WHITE)
        m.setColor(Color.WHITE);
    else if (team.getColor() == TeamColor.GRAY)
        m.setColor(Color.GRAY);
    else if (team.getColor() == TeamColor.PURPLE)
        m.setColor(Color.PURPLE);
    else if (team.getColor() == TeamColor.DARK_BLUE)
        m.setColor(Color.BLUE);
    else if (team.getColor() == TeamColor.DARK_GREEN)
        m.setColor(Color.GREEN);
    else if (team.getColor() == TeamColor.DARK_PURPLE)
        m.setColor(Color.PURPLE);
    else if (team.getColor() == TeamColor.DARK_RED)
        m.setColor(Color.RED);
    getItem().setItemMeta(m);
}
Also used : LeatherArmorMeta(org.bukkit.inventory.meta.LeatherArmorMeta)

Example 7 with LeatherArmorMeta

use of org.bukkit.inventory.meta.LeatherArmorMeta in project Glowstone by GlowstoneMC.

the class BlockCauldron method bleachLeatherArmor.

private boolean bleachLeatherArmor(GlowPlayer player, GlowBlock block) {
    if (block.getData() > 0) {
        ItemStack inHand = player.getItemInHand();
        LeatherArmorMeta im = (LeatherArmorMeta) inHand.getItemMeta();
        im.setColor(GlowItemFactory.instance().getDefaultLeatherColor());
        inHand.setItemMeta(im);
        block.setData((byte) (block.getData() - 1));
        return true;
    } else {
        return false;
    }
}
Also used : LeatherArmorMeta(org.bukkit.inventory.meta.LeatherArmorMeta) ItemStack(org.bukkit.inventory.ItemStack)

Example 8 with LeatherArmorMeta

use of org.bukkit.inventory.meta.LeatherArmorMeta in project Glowstone by GlowstoneMC.

the class GlowArmorDyeMatcher method getResult.

@Override
public ItemStack getResult(ItemStack[] matrix) {
    ItemStack armor = null;
    List<Color> colors = new ArrayList<>();
    for (ItemStack item : matrix) {
        if (item == null)
            continue;
        if (item.getType() == Material.INK_SACK) {
            Color color = ((Dye) item.getData()).getColor().getColor();
            colors.add(color);
            continue;
        }
        if (LEATHERS.matches(item.getType())) {
            // Can't dye more than one item
            if (armor != null)
                return null;
            armor = item;
            continue;
        }
        // Non-armor item
        return null;
    }
    // No armor
    if (armor == null)
        return null;
    // No colors
    if (colors.isEmpty())
        return null;
    LeatherArmorMeta meta = (LeatherArmorMeta) armor.getItemMeta();
    Color base = meta.getColor();
    if (meta.getColor() == GlowItemFactory.instance().getDefaultLeatherColor()) {
        base = colors.remove(0);
    }
    Color newColor = base.mixColors(colors.toArray(new Color[colors.size()]));
    ItemStack ret = armor.clone();
    LeatherArmorMeta retMeta = (LeatherArmorMeta) ret.getItemMeta();
    retMeta.setColor(newColor);
    ret.setItemMeta(retMeta);
    return ret;
}
Also used : Color(org.bukkit.Color) ArrayList(java.util.ArrayList) LeatherArmorMeta(org.bukkit.inventory.meta.LeatherArmorMeta) ItemStack(org.bukkit.inventory.ItemStack)

Aggregations

LeatherArmorMeta (org.bukkit.inventory.meta.LeatherArmorMeta)8 ItemStack (org.bukkit.inventory.ItemStack)4 Color (org.bukkit.Color)2 Enchantment (org.bukkit.enchantments.Enchantment)2 BookMeta (org.bukkit.inventory.meta.BookMeta)2 EnchantmentStorageMeta (org.bukkit.inventory.meta.EnchantmentStorageMeta)2 FireworkEffectMeta (org.bukkit.inventory.meta.FireworkEffectMeta)2 ItemMeta (org.bukkit.inventory.meta.ItemMeta)2 SkullMeta (org.bukkit.inventory.meta.SkullMeta)2 ArrayList (java.util.ArrayList)1 Entry (java.util.Map.Entry)1 net.aufdemrand.denizen.objects.dColor (net.aufdemrand.denizen.objects.dColor)1 FireworkEffect (org.bukkit.FireworkEffect)1 Builder (org.bukkit.FireworkEffect.Builder)1 Entity (org.bukkit.entity.Entity)1 Ocelot (org.bukkit.entity.Ocelot)1 Zombie (org.bukkit.entity.Zombie)1 EventHandler (org.bukkit.event.EventHandler)1 FixedMetadataValue (org.bukkit.metadata.FixedMetadataValue)1