Fix dim creation

This commit is contained in:
cyberpwn 2021-08-16 19:13:06 -04:00
parent a462ab98e9
commit 8abaac56ff
3 changed files with 8 additions and 74 deletions

View File

@ -1,36 +0,0 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2021 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.core.project;
import lombok.Data;
import java.io.File;
@Data
public class IrisPack {
private final File folder;
public IrisPack(File folder) {
this.folder = folder;
}
public String getName() {
return getFolder().getName();
}
}

View File

@ -163,6 +163,12 @@ public class StudioSVC implements IrisService {
try {
url = getListing(false).get(key);
if(url == null)
{
Iris.warn("ITS ULL for " + key);
}
url = url == null ? key : url;
Iris.info("Assuming URL " + url);
String branch = "master";
@ -289,10 +295,6 @@ public class StudioSVC implements IrisService {
}
public KMap<String, String> getListing(boolean cached) {
if (cached && cacheListing != null) {
return cacheListing;
}
JSONObject a;
if (cached) {
@ -308,6 +310,8 @@ public class StudioSVC implements IrisService {
l.put(i, a.getString(i));
}
l.put("IrisDimensions/overworld/master", "IrisDimensions/overworld/stable");
l.put("overworld", "IrisDimensions/overworld/stable");
return l;
}

View File

@ -180,40 +180,6 @@ public class IrisToolbelt {
return false;
}
/**
* Attempts to ensure that the pack is installed
*
* @param sender the sender
* @param url the dimension
* @throws Throwable shit happens
*/
public static void install(VolmitSender sender, String url) throws Throwable {
IrisProjectRepo r = IrisProjectRepo.from(url);
if (r != null) {
url = r.getRepo();
}
File f = Iris.instance.getDataFolder("packs", url);
IO.delete(f);
KList<Job> j = new KList<>();
File pack = new File(Iris.getTemp(), UUID.nameUUIDFromBytes(r.toURL().getBytes(StandardCharsets.UTF_8)) + ".zip");
j.add(new DownloadJob(r.toURL(), pack));
j.add(new SingleJob("Extracting", () -> {
File work = new File(Iris.getTemp(), "dltk-" + UUID.randomUUID());
ZipUtil.unpack(pack, work);
File raw = work.listFiles()[0];
try {
FileUtils.copyDirectory(raw, f);
} catch (IOException e) {
e.printStackTrace();
}
}));
JobCollection c = new JobCollection("Pack", j);
c.execute(sender);
}
/**
* Evacuate all players from the world
*