mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-22 08:39:14 +00:00
Made the overworld use releases instead. (Hack)
This commit is contained in:
@@ -85,7 +85,11 @@ import java.util.Objects;
|
|||||||
|
|
||||||
@SuppressWarnings("CanBeFinal")
|
@SuppressWarnings("CanBeFinal")
|
||||||
public class Iris extends VolmitPlugin implements Listener {
|
public class Iris extends VolmitPlugin implements Listener {
|
||||||
|
|
||||||
|
public static final String OVERWORLD_TAG = "2086";
|
||||||
|
|
||||||
private static final Queue<Runnable> syncJobs = new ShurikenQueue<>();
|
private static final Queue<Runnable> syncJobs = new ShurikenQueue<>();
|
||||||
|
|
||||||
public static Iris instance;
|
public static Iris instance;
|
||||||
public static BukkitAudiences audiences;
|
public static BukkitAudiences audiences;
|
||||||
public static MultiverseCoreLink linkMultiverseCore;
|
public static MultiverseCoreLink linkMultiverseCore;
|
||||||
|
|||||||
@@ -170,10 +170,14 @@ public class CommandIris implements DecreeExecutor {
|
|||||||
@Param(name = "overwrite", description = "Whether or not to overwrite the pack with the downloaded one", aliases = "force", defaultValue = "false")
|
@Param(name = "overwrite", description = "Whether or not to overwrite the pack with the downloaded one", aliases = "force", defaultValue = "false")
|
||||||
boolean overwrite
|
boolean overwrite
|
||||||
) {
|
) {
|
||||||
branch = pack.equals("overworld") ? "stable" : branch;
|
|
||||||
sender().sendMessage(C.GREEN + "Downloading pack: " + pack + "/" + branch + (trim ? " trimmed" : "") + (overwrite ? " overwriting" : ""));
|
sender().sendMessage(C.GREEN + "Downloading pack: " + pack + "/" + branch + (trim ? " trimmed" : "") + (overwrite ? " overwriting" : ""));
|
||||||
|
if(pack.equals("overworld")) {
|
||||||
|
String url = "https://github.com/IrisDimensions/overworld/releases/download/" + Iris.OVERWORLD_TAG + "/overworld.zip";
|
||||||
|
Iris.service(StudioSVC.class).downloadRelease(sender(), url, trim, overwrite);
|
||||||
|
} else {
|
||||||
Iris.service(StudioSVC.class).downloadSearch(sender(), "IrisDimensions/" + pack + "/" + branch, trim, overwrite);
|
Iris.service(StudioSVC.class).downloadSearch(sender(), "IrisDimensions/" + pack + "/" + branch, trim, overwrite);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Decree(description = "Get metrics for your world", aliases = "measure", origin = DecreeOrigin.PLAYER)
|
@Decree(description = "Get metrics for your world", aliases = "measure", origin = DecreeOrigin.PLAYER)
|
||||||
public void metrics() {
|
public void metrics() {
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ public class StudioSVC implements IrisService {
|
|||||||
String[] nodes = url.split("\\Q/\\E");
|
String[] nodes = url.split("\\Q/\\E");
|
||||||
String repo = nodes.length == 1 ? "IrisDimensions/" + nodes[0] : nodes[0] + "/" + nodes[1];
|
String repo = nodes.length == 1 ? "IrisDimensions/" + nodes[0] : nodes[0] + "/" + nodes[1];
|
||||||
branch = nodes.length > 2 ? nodes[2] : branch;
|
branch = nodes.length > 2 ? nodes[2] : branch;
|
||||||
download(sender, repo, branch, trim, forceOverwrite);
|
download(sender, repo, branch, trim, forceOverwrite, false);
|
||||||
} catch(Throwable e) {
|
} catch(Throwable e) {
|
||||||
Iris.reportError(e);
|
Iris.reportError(e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -179,12 +179,22 @@ public class StudioSVC implements IrisService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void download(VolmitSender sender, String repo, String branch, boolean trim) throws JsonSyntaxException, IOException {
|
public void downloadRelease(VolmitSender sender, String url, boolean trim, boolean forceOverwrite) {
|
||||||
download(sender, repo, branch, trim, false);
|
try {
|
||||||
|
download(sender, "IrisDimensions", url, trim, forceOverwrite, true);
|
||||||
|
} catch(Throwable e) {
|
||||||
|
Iris.reportError(e);
|
||||||
|
e.printStackTrace();
|
||||||
|
sender.sendMessage("Failed to download 'IrisDimensions/overworld' from " + url + ".");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void download(VolmitSender sender, String repo, String branch, boolean trim, boolean forceOverwrite) throws JsonSyntaxException, IOException {
|
public void download(VolmitSender sender, String repo, String branch, boolean trim) throws JsonSyntaxException, IOException {
|
||||||
String url = "https://codeload.github.com/" + repo + "/zip/refs/heads/" + branch;
|
download(sender, repo, branch, trim, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void download(VolmitSender sender, String repo, String branch, boolean trim, boolean forceOverwrite, boolean directUrl) throws JsonSyntaxException, IOException {
|
||||||
|
String url = directUrl ? branch : "https://codeload.github.com/" + repo + "/zip/refs/heads/" + branch;
|
||||||
sender.sendMessage("Downloading " + url + " "); //The extra space stops a bug in adventure API from repeating the last letter of the URL
|
sender.sendMessage("Downloading " + url + " "); //The extra space stops a bug in adventure API from repeating the last letter of the URL
|
||||||
File zip = Iris.getNonCachedFile("pack-" + trim + "-" + repo, url);
|
File zip = Iris.getNonCachedFile("pack-" + trim + "-" + repo, url);
|
||||||
File temp = Iris.getTemp();
|
File temp = Iris.getTemp();
|
||||||
|
|||||||
Reference in New Issue
Block a user