Remove legacy auto updater (v3)

This commit is contained in:
NotMyFault 2020-02-16 01:36:24 +01:00
parent 24b6b23d25
commit 4ed108b5c0

View File

@ -1437,38 +1437,6 @@ import java.util.zip.ZipInputStream;
return Arrays.stream(split).map(s -> String.format("%4s", s)).collect(Collectors.joining());
}
private boolean update(PlotPlayer sender, URL url) {
try {
String name = this.jarFile.getName();
MainUtil.sendMessage(sender, "$1Downloading from provided URL: &7" + url);
URLConnection con = url.openConnection();
try (InputStream stream = con.getInputStream()) {
File newJar = new File("plugins/update/" + name);
File parent = newJar.getParentFile();
if (!parent.exists()) {
parent.mkdirs();
}
MainUtil.sendMessage(sender, "$2 - Output: " + newJar);
if (!newJar.delete()) {
MainUtil.sendMessage(sender, "Failed to update " + IMP.getPluginName() + "");
MainUtil.sendMessage(sender, "Jar file failed to delete.");
MainUtil.sendMessage(sender, " - Please update manually");
}
Files.copy(stream, newJar.toPath());
}
MainUtil.sendMessage(sender,
"$1The update will take effect when the server is restarted next");
return true;
} catch (IOException e) {
MainUtil.sendMessage(sender, "Failed to update " + IMP.getPluginName() + "");
MainUtil.sendMessage(sender, " - Please update manually");
PlotSquared.log("============ Stacktrace ============");
e.printStackTrace();
PlotSquared.log("====================================");
}
return false;
}
/**
* Copies a file from inside the jar to a location
*