mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Remove legacy auto updater (v3)
This commit is contained in:
parent
24b6b23d25
commit
4ed108b5c0
@ -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 New Issue
Block a user