mirror of
https://github.com/TotalFreedomMC/TF-PlotSquared.git
synced 2024-12-23 00:15:06 +00:00
Remove legacy auto updater (v3)
This commit is contained in:
parent
24b6b23d25
commit
4ed108b5c0
1 changed files with 1 additions and 33 deletions
|
@ -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
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue