public static String encodeInventory(Inventory inventory) {
        YamlConfiguration configuration = new YamlConfiguration();
        configuration.set("Title", StringUtil.limitCharacters(inventory.getTitle(), 32));
        configuration.set("Size", inventory.getSize());
        for (int a = 0; a < inventory.getSize(); a++) {
            ItemStack s = inventory.getItem(a);
            if (s != null) {
                configuration.set("Contents." + a, s);
            }
        }
        return Base64Coder.encodeString(configuration.saveToString());
    }