package com.loganmagnan.eventcore.utils;

import java.util.List;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;

public class PlayerHeadUtils {

  private Material material = Material.PLAYER_HEAD;
  
  private Short durability = Short.valueOf((short)3);
  
  private int amount = 1;
  
  private String name;
  
  private Object owner = "steve";
  
  private List<String> lore;
  
  public PlayerHeadUtils name(String name) {
    this.name = name;
    return this;
  }
  
  public PlayerHeadUtils owner(Object owner) {
    this.owner = owner;
    return this;
  }
  
  public PlayerHeadUtils lore(List<String> lore) {
    this.lore = lore;
    return this;
  }
  
  public ItemStack makeItemStack() {
    ItemStack itemStack = new ItemStack(Material.PLAYER_HEAD);
    SkullMeta meta = (SkullMeta)itemStack.getItemMeta();
    itemStack.setAmount(1);
    itemStack.setDurability((short)3);
    if (this.name != null)
      meta.setDisplayName(ColorUtils.getMessageType("&r" + this.name));
    if (this.lore != null && this.lore.size() > 0)
      meta.setLore(ColorUtils.getMessageType(this.lore));
    meta.setOwner((String)this.owner);
    itemStack.setItemMeta(meta);
    return itemStack;
  }
}
