mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-08-29 23:49:52 +02:00
Remove legacy auto updater (v3)
This commit is contained in:
parent
24b6b23d25
commit
4ed108b5c0
|
@ -1437,42 +1437,10 @@ 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
|
||||
*
|
||||
* @param file Name of the file inside PlotSquared.jar
|
||||
* @param file Name of the file inside PlotSquared.jar
|
||||
* @param folder The output location relative to /plugins/PlotSquared/
|
||||
*/
|
||||
public void copyFile(String file, String folder) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user