package net.glowstone.inventory.crafting;

import org.bukkit.Material;
import org.bukkit.inventory.ItemMatcher;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BannerMeta;

import java.util.ArrayList;

public class GlowBannerCopyMatcher extends ItemMatcher {

    /*
    - Must be exactly two banners
    - 1 with no pattern, and 1 with at least one layer
    - Must be same colour
    - No other items allowed in matrix
     */
    @Override
    public ItemStack getResult(ItemStack[] matrix) {
        ArrayList<ItemStack> banners = new ArrayList<>();

        for (ItemStack item : matrix) {
            if (item == null) continue;

            if (item.getType() == Material.BANNER) {
                banners.add(item);
                continue;
            }
            return null; // Non-banner item in matrix
        }

        if (banners.size() != 2) return null; // Must have 2 banners only

        if (banners.get(0).getDurability() != banners.get(1).getDurability()) return null; // Not same color

        ItemStack original = null;
        ItemStack blank = null;

        for (ItemStack banner : banners) {
            BannerMeta meta = (BannerMeta) banner.getItemMeta();
            if (meta.getPattern().getLayers().isEmpty()) {
                if (blank != null) {
                    return null; // More than 1 blank
                }
                blank = banner;
            } else {
                if (original != null) {
                    return null; // More than 1 original
                }
                original = banner;
            }
        }

        if (original == null || blank == null) return null; // Haven't got both needed banners

        return original.clone();
    }

    @Override
    public void cleanup(ItemStack[] matrix, ItemStack result) {
        //TODO: Cleanup
    }
}

@@ -1747,110 +1747,52 @@
     
-@Override%0A    public void cleanup(ItemStack%5B%5D matrix, ItemStack result) %7B%0A        //TODO: Cleanup%0A    %7D
+//TODO: Keep banner in matrix after crafting%0A
 %0A%7D%0A

Update to Glowkit changes