From f33832c16ecbb6412afe32309ebf9f8559d87036 Mon Sep 17 00:00:00 2001 From: Fangoboyo <77935781+Fangoboyo@users.noreply.github.com> Date: Tue, 7 Jun 2022 22:16:06 -0700 Subject: [PATCH] Update Updater.java --- .../java/tech/nully/PluginUpdater/Updater.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/tech/nully/PluginUpdater/Updater.java b/src/main/java/tech/nully/PluginUpdater/Updater.java index a503b02..0174bee 100644 --- a/src/main/java/tech/nully/PluginUpdater/Updater.java +++ b/src/main/java/tech/nully/PluginUpdater/Updater.java @@ -1,5 +1,19 @@ package tech.nully.PluginUpdater; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URI; +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; + public class Updater { - public void UpdateInstaller + public void UpdateInstaller() throws IOException { + InputStream in = URI.create("https://github.com/darverdevs/PluginInstaller/raw/main/out/artifacts/PluginInstaller_jar/PluginInstaller.jar") + .toURL().openStream(); + File f = new File(Main.getInstance().getDataFolder().getParent() + "/" + "PluginInstaller" + ".jar"); + f.delete(); + Files.copy(in, f.toPath(), StandardCopyOption.REPLACE_EXISTING); + } }