I've come back, i'm loading a jar plugin in an addons folder, heres the plugins who is doing that
public final class Cloud extends JavaPlugin {
public List<Plugin> addons = new ArrayList<>();
@Override
public void onEnable() {
Path addonPath = Paths.get(getDataFolder().toString() + "/addons");
File dir = new File(addonPath.toString());
if (!dir.exists()) {
dir.mkdir();
}
Bukkit.getLogger().info(addonPath.toString());
File[] listOfFiles = dir.listFiles();
for (File file : listOfFiles) {
if (file.isFile()) {
try {
Plugin addon = getPluginLoader().loadPlugin(file);
addons.add(addon);
getPluginLoader().enablePlugin(addon);
} catch (InvalidPluginException e) {
throw new RuntimeException(e);
}
}
}
// Plugin startup logic
saveDefaultConfig();
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
}