9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-21 16:09:29 +00:00

Compare commits

...

6 Commits

Author SHA1 Message Date
Brian Fopiano
b5fb277982 Merge pull request #819 from VolmitSoftware/Development
Development update 2.2.2
2022-07-01 16:11:20 -07:00
Vatuu
e523d3c166 V+ 2022-07-02 01:04:39 +02:00
Vatuu
41477e4aa6 Made the overworld use releases instead. (Hack) 2022-07-02 01:03:18 +02:00
Vatuu
fbaf42a8c4 Merge remote-tracking branch 'origin/Development' into Development 2022-07-01 21:00:17 +02:00
Vatuu
1c3668047b Fixed PlaceholderAPI issues. 2022-07-01 20:59:54 +02:00
Vatuu
7d78c69b6e /iris create now registers to bukkit.yml 2022-07-01 18:40:13 +02:00
7 changed files with 59 additions and 15 deletions

View File

@@ -24,7 +24,7 @@ plugins {
id "de.undercouch.download" version "5.0.1" id "de.undercouch.download" version "5.0.1"
} }
version '2.2.1-1.19' // Needs to be version specific version '2.2.2-1.19' // Needs to be version specific
def nmsVersion = "1.19" def nmsVersion = "1.19"
def apiVersion = '1.19' def apiVersion = '1.19'
def spigotJarVersion = '1.19-R0.1-SNAPSHOT' def spigotJarVersion = '1.19-R0.1-SNAPSHOT'

View File

@@ -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;

View File

@@ -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() {

View File

@@ -20,6 +20,7 @@ package com.volmit.iris.core.link;
import com.volmit.iris.Iris; import com.volmit.iris.Iris;
import com.volmit.iris.core.tools.IrisToolbelt; import com.volmit.iris.core.tools.IrisToolbelt;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.platform.PlatformChunkGenerator; import com.volmit.iris.engine.platform.PlatformChunkGenerator;
import me.clip.placeholderapi.expansion.PlaceholderExpansion; import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.Location; import org.bukkit.Location;
@@ -59,15 +60,15 @@ public class IrisPapiExpansion extends PlaceholderExpansion {
if(p.equalsIgnoreCase("biome_name")) { if(p.equalsIgnoreCase("biome_name")) {
if(a != null) { if(a != null) {
return a.getEngine().getBiome(l).getName(); return getBiome(a, l).getName();
} }
} else if(p.equalsIgnoreCase("biome_id")) { } else if(p.equalsIgnoreCase("biome_id")) {
if(a != null) { if(a != null) {
return a.getEngine().getBiome(l).getLoadKey(); return getBiome(a, l).getLoadKey();
} }
} else if(p.equalsIgnoreCase("biome_file")) { } else if(p.equalsIgnoreCase("biome_file")) {
if(a != null) { if(a != null) {
return a.getEngine().getBiome(l).getLoadFile().getPath(); return getBiome(a, l).getLoadFile().getPath();
} }
} else if(p.equalsIgnoreCase("region_name")) { } else if(p.equalsIgnoreCase("region_name")) {
if(a != null) { if(a != null) {
@@ -107,4 +108,8 @@ public class IrisPapiExpansion extends PlaceholderExpansion {
return null; return null;
} }
private IrisBiome getBiome(PlatformChunkGenerator a, Location l) {
return a.getEngine().getBiome(l.getBlockX(), l.getBlockY() - l.getWorld().getMinHeight(), l.getBlockZ());
}
} }

View File

@@ -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();

View File

@@ -38,8 +38,11 @@ import org.bukkit.GameRule;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.WorldCreator; import org.bukkit.WorldCreator;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File; import java.io.File;
import java.io.IOException;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
@@ -174,7 +177,8 @@ public class IrisCreator {
world.get().setTime(6000); world.get().setTime(6000);
} }
}); });
} } else
addToBukkitYml();
if(pregen != null) { if(pregen != null) {
CompletableFuture<Boolean> ff = new CompletableFuture<>(); CompletableFuture<Boolean> ff = new CompletableFuture<>();
@@ -204,7 +208,24 @@ public class IrisCreator {
e.printStackTrace(); e.printStackTrace();
} }
} }
return world.get(); return world.get();
} }
private static final File BUKKIT_YML = new File(Bukkit.getServer().getWorldContainer(), "bukkit.yml");
private void addToBukkitYml() {
YamlConfiguration yml = YamlConfiguration.loadConfiguration(BUKKIT_YML);
String gen = "Iris:" + dimension;
ConfigurationSection section = yml.contains("worlds") ? yml.getConfigurationSection("worlds") : yml.createSection("worlds");
if(!section.contains(name)) {
section.createSection(name).set("generator", gen);
try {
yml.save(BUKKIT_YML);
Iris.info("Registered \"" + name + "\" in bukkit.yml");
} catch(IOException e) {
Iris.error("Failed to update bukkit.yml!");
e.printStackTrace();
}
}
}
} }

View File

@@ -2,7 +2,7 @@ name: ${name}
version: ${version} version: ${version}
main: ${main} main: ${main}
load: STARTUP load: STARTUP
authors: [ cyberpwn, NextdoorPsycho ] authors: [ cyberpwn, NextdoorPsycho. Vatuu ]
website: volmit.com website: volmit.com
description: More than a Dimension! description: More than a Dimension!
libraries: libraries:
@@ -22,4 +22,4 @@ commands:
aliases: [ ir, irs ] aliases: [ ir, irs ]
api-version: ${apiversion} api-version: ${apiversion}
hotload-dependencies: false hotload-dependencies: false
softdepend: [ "Oraxen", "ItemsAdder", "IrisFeller", "WorldEdit"] softdepend: [ "Oraxen", "ItemsAdder", "IrisFeller", "WorldEdit", "PlaceholderAPI"]