Used try-with-resources to ensure jar is closed.

This commit is contained in:
tastybento 2018-02-06 14:07:35 -08:00
parent 28b88763e6
commit 56ff9f62e4

View File

@ -101,7 +101,7 @@ public final class AddonsManager {
if (!f.getName().endsWith(".jar")) {
return;
}
JarFile jar = new JarFile(f);
try (JarFile jar = new JarFile(f)) {
// Obtain the addon.yml file
JarEntry entry = jar.getJarEntry("addon.yml");
@ -145,9 +145,8 @@ public final class AddonsManager {
// Inform the console
plugin.getLogger().info("Loading BSkyBlock addon " + addon.getDescription().getName() + "...");
}
// Close the jar
jar.close();
} catch (Exception e) {
if (DEBUG) {
plugin.getLogger().info(f.getName() + "is not a jarfile, ignoring...");