Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void downloadUpdatedPlugin(String pluginName, String dboFileUrl) {
- String location = "http://dev.bukkit.org/media/files/" + dboFileUrl;
- File output = new File(Bukkit.getUpdateFolder(), pluginName + ".jar");
- try {
- URL url = new URL(location);
- BufferedInputStream in = new BufferedInputStream(url.openStream());
- BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(output));
- byte[] buf = new byte[4096];
- int tmp;
- while ((tmp = in.read(buf)) != -1) {
- out.write(buf, 0, tmp);
- }
- in.close();
- out.flush();
- out.close();
- //} catch (MalformedURLException e) {
- //} catch (IOException e) {
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement