mirror of
				https://e.coding.net/circlecloud/YumCore.git
				synced 2025-11-03 23:06:02 +00:00 
			
		
		
		
	@@ -6,8 +6,6 @@ import java.lang.reflect.Field;
 | 
				
			|||||||
import java.lang.reflect.InvocationTargetException;
 | 
					import java.lang.reflect.InvocationTargetException;
 | 
				
			||||||
import java.lang.reflect.Method;
 | 
					import java.lang.reflect.Method;
 | 
				
			||||||
import java.net.URL;
 | 
					import java.net.URL;
 | 
				
			||||||
import java.util.Enumeration;
 | 
					 | 
				
			||||||
import java.util.jar.JarEntry;
 | 
					 | 
				
			||||||
import java.util.jar.JarFile;
 | 
					import java.util.jar.JarFile;
 | 
				
			||||||
import java.util.logging.Logger;
 | 
					import java.util.logging.Logger;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -130,14 +128,15 @@ public class P {
 | 
				
			|||||||
     *            目录
 | 
					     *            目录
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static void saveFile(final String... dirs) {
 | 
					    public static void saveFile(final String... dirs) {
 | 
				
			||||||
        try {
 | 
					        URL url = instance.getClass().getClassLoader().getResource("plugin.yml");
 | 
				
			||||||
            final URL url = instance.getClass().getClassLoader().getResource("plugin.yml");
 | 
					 | 
				
			||||||
        if (url == null) { return; }
 | 
					        if (url == null) { return; }
 | 
				
			||||||
            final String upath = url.getFile().substring(url.getFile().indexOf("/") + 1);
 | 
					        String upath = url.getFile().substring(url.getFile().indexOf("/") + 1);
 | 
				
			||||||
            final String jarPath = upath.substring(0, upath.indexOf('!'));
 | 
					        String jarPath = upath.substring(0, upath.indexOf('!'));
 | 
				
			||||||
            JarFile jar = new JarFile(jarPath);
 | 
					        if (!new File(jarPath).exists()) {
 | 
				
			||||||
            final Enumeration<JarEntry> jes = jar.entries();
 | 
					            jarPath = "/" + jarPath;
 | 
				
			||||||
            for (JarEntry je = jes.nextElement(); jes.hasMoreElements();) {
 | 
					        }
 | 
				
			||||||
 | 
					        try (JarFile jar = new JarFile(jarPath)) {
 | 
				
			||||||
 | 
					            jar.stream().forEach(je -> {
 | 
				
			||||||
                if (!je.isDirectory()) {
 | 
					                if (!je.isDirectory()) {
 | 
				
			||||||
                    for (final String dir : dirs) {
 | 
					                    for (final String dir : dirs) {
 | 
				
			||||||
                        if (je.getName().startsWith(dir)) {
 | 
					                        if (je.getName().startsWith(dir)) {
 | 
				
			||||||
@@ -145,9 +144,9 @@ public class P {
 | 
				
			|||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            });
 | 
				
			||||||
            jar.close();
 | 
					        } catch (IOException e) {
 | 
				
			||||||
        } catch (IOException ignored) {
 | 
					            Log.d(e);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user