Make addon non-public and provide getter to address minor vulnerability.

This commit is contained in:
tastybento 2018-02-06 16:04:22 -08:00
parent 7e2f8052da
commit 04a4394752
2 changed files with 9 additions and 2 deletions

View File

@ -22,7 +22,7 @@ import us.tastybento.bskyblock.managers.AddonsManager;
public class AddonClassLoader extends URLClassLoader {
private final Map<String, Class<?>> classes = new HashMap<String, Class<?>>();
public Addon addon;
private Addon addon;
private AddonsManager loader;
public AddonClassLoader(AddonsManager addonsManager, Map<String, String>data, File path, BufferedReader reader, ClassLoader parent)
@ -116,4 +116,11 @@ public class AddonClassLoader extends URLClassLoader {
return result;
}
/**
* @return the addon
*/
public Addon getAddon() {
return addon;
}
}

View File

@ -121,7 +121,7 @@ public final class AddonsManager {
this.loader.add(loader);
// Get the addon itself
addon = loader.addon;
addon = loader.getAddon();
// Initialize some settings
addon.setDataFolder(new File(f.getParent(), addon.getDescription().getName()));
addon.setAddonFile(f);