/**
   * Gets the name of the item passed
   *
   * @param item the item to check, cannot be null
   * @param ignoreMeta if true, item meta will be ignored
   * @return the item name
   */
  public static String getName(ItemStack item, boolean ignoreMeta) {
    String def = item.getType().name();
    if (DumbAuction.getInstance().getConfig().getString("aliases." + item.getType().name())
        != null) {
      def = DumbAuction.getInstance().getConfig().getString("aliases." + item.getType().name());
    }

    DyeColor color = getDyeColor(item);
    if (color != null) {
      def = color.name() + "_" + def; // underscore is stripped later, capitals are also fixed
    }

    // ItemMeta always overrides everything else
    if (!ignoreMeta && item.hasItemMeta()) {
      ItemMeta meta = item.getItemMeta();
      if (meta.hasDisplayName()) {
        def = ChatColor.ITALIC + meta.getDisplayName();
      }
    }

    String[] parts = def.split("_");
    StringBuilder builder = new StringBuilder();
    for (int i = 0; i < parts.length; i++) {
      builder.append(parts[i].substring(0, 1).toUpperCase() + parts[i].substring(1).toLowerCase());
      builder.append(" ");
    }
    return builder.toString().trim();
  }