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);
}
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;
}
}
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;
}
Aggregations