Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save TheFlash787/f404d82bb25f85e51277546d12b153dd to your computer and use it in GitHub Desktop.
Save TheFlash787/f404d82bb25f85e51277546d12b153dd to your computer and use it in GitHub Desktop.
public void update(){
updater.getUpdaterConfiguration().getFileURLs().forEach((plugin, url) -> {
url = url.replace("{name}", plugin);
try{
File pluginFile = new File(updater.getConfigDir().getParent().getParent() + File.separator + "plugins" + File.separator + plugin + ".jar");
FileUtils.copyURLToFile(new URL(url), pluginFile);
updater.getLogger().info("Successfully grabbed the latest build of " + plugin + "!");
} catch (IOException e){
updater.getLogger().warning("Error whilst trying to update " + plugin + " from the given URL (" + url + ")");
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment