Merge remote-tracking branch 'upstream/master' into DecreeCommands

This commit is contained in:
CocoTheOwner 2021-08-16 23:54:14 +02:00
commit ca63b412cb
3 changed files with 87 additions and 39 deletions

View File

@ -0,0 +1,40 @@
/*
* 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 com.volmit.iris.core.project.loader.IrisData;
import com.volmit.iris.engine.object.dimensional.IrisDimension;
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

@ -185,29 +185,20 @@ public class IrisToolbelt {
/**
* Attempts to ensure that the pack is installed
* @param sender the sender
* @param dimension the dimension key
* @param force force install even if it already exists
* @param url the dimension
* @throws Throwable shit happens
*/
public static void ensureInstalled(VolmitSender sender, String dimension, boolean force) throws Throwable {
IrisProjectRepo r = IrisProjectRepo.from(dimension);
public static void install(VolmitSender sender, String url) throws Throwable {
IrisProjectRepo r = IrisProjectRepo.from(url);
if(r != null)
{
dimension = r.getRepo();
url = r.getRepo();
}
File f = Iris.instance.getDataFolder("packs", dimension);
if(f.exists() && force)
{
File f = Iris.instance.getDataFolder("packs", url);
IO.delete(f);
}
KList<Job> j = new KList<>();
if(!f.exists())
{
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", () -> {
@ -220,20 +211,10 @@ public class IrisToolbelt {
e.printStackTrace();
}
}));
}
if(j.isNotEmpty())
{
JobCollection c = new JobCollection("Pack", j);
c.execute(sender);
}
}
public static void download(VolmitSender sender, IrisProjectRepo repository)
{
String url = repository.toURL();
Iris.info("Downmload");
}
/**
* Evacuate all players from the world

View File

@ -0,0 +1,27 @@
/*
* 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.util.plugin;
import org.bukkit.event.Listener;
public interface IrisService extends Listener {
void onEnable();
void onDisable();
}