private static String[] filterJar(String pattern)
    {
        CodeSource cs = Bukkit.class.getProtectionDomain().getCodeSource();
        if(cs == null)
        {
            return new String[0];
        }
        ArrayList<String> list = new ArrayList<String>();
        try
        {
            JarInputStream jis = new JarInputStream(new FileInputStream(new File(cs.getLocation().toURI())));
            JarEntry je;
            while((je = jis.getNextJarEntry()) != null)
            {
                if(je.isDirectory())
                {
                    String name = je.getName().replace("/", ".");
                    name = name.substring(0, name.length() - 1); // Remove trailing dot
                    if(name.toLowerCase().matches(pattern))
                    {
                        list.add(name);
                    }
                }
            }
            jis.close();
        }
        catch(Exception e)
        {
            NPlugin.error(e);
        }
        return list.toArray(new String[0]);
    }