diff --git a/src/main/java/com/volmit/iris/core/commands/CommandIris.java b/src/main/java/com/volmit/iris/core/commands/CommandIris.java index 45a360f8f..92f9784a5 100644 --- a/src/main/java/com/volmit/iris/core/commands/CommandIris.java +++ b/src/main/java/com/volmit/iris/core/commands/CommandIris.java @@ -39,6 +39,7 @@ import com.volmit.iris.util.plugin.VolmitSender; import com.volmit.iris.util.scheduling.J; import com.volmit.iris.util.scheduling.jobs.QueueJob; import org.bukkit.Chunk; +import org.bukkit.World; import java.io.File; import java.util.concurrent.ExecutionException; @@ -252,4 +253,40 @@ public class CommandIris implements DecreeExecutor { sender().sendMessage(C.RED + "You must be in an Iris World to use regen!"); } } + + @Decree(description = "Update the pack of a world (UNSAFE!)", name = "^world", aliases = "update-world") + public void updateWorld( + @Param(description = "The world to update", contextual = true) + World world, + @Param(description = "The pack to install into the world", contextual = true, aliases = "dimension") + IrisDimension pack, + @Param(description = "Make sure to make a backup & read the warnings first!", defaultValue = "false", aliases = "c") + boolean confirm, + @Param(description = "Should Iris download the pack again for you", defaultValue = "false", name = "fresh-download", aliases = {"fresh", "new"}) + boolean freshDownload + ) { + if (!confirm) { + sender().sendMessage(new String[]{ + C.RED + "You should always make a backup before using this", + C.YELLOW + "Issues caused by this can be, but are not limited to:", + C.YELLOW + " - Broken chunks (cut-offs) between old and new chunks (before & after the update)", + C.YELLOW + " - Regenerated chunks that do not fit in with the old chunks", + C.YELLOW + " - Structures not spawning again when regenerating", + C.YELLOW + " - Caves not lining up", + C.YELLOW + " - Terrain layers not lining up", + C.RED + "Now that you are aware of the risks, and have made a back-up:", + C.RED + "/iris ^world confirm=true" + }); + return; + } + + File folder = world.getWorldFolder(); + folder.mkdirs(); + + if (freshDownload) { + Iris.service(StudioSVC.class).downloadSearch(sender(), pack.getLoadKey(), false, true); + } + + Iris.service(StudioSVC.class).installIntoWorld(sender(), pack.getLoadKey(), folder); + } } diff --git a/src/main/java/com/volmit/iris/core/commands/CommandStudio.java b/src/main/java/com/volmit/iris/core/commands/CommandStudio.java index b99055c39..2c06be6c4 100644 --- a/src/main/java/com/volmit/iris/core/commands/CommandStudio.java +++ b/src/main/java/com/volmit/iris/core/commands/CommandStudio.java @@ -658,7 +658,7 @@ public class CommandStudio implements DecreeExecutor { player().setGameMode(GameMode.SPECTATOR); } - @Decree(description = "Update your dimension project") + @Decree(description = "Update your dimension projects VSCode workspace") public void update( @Param(description = "The dimension to update the workspace of", contextual = true, defaultValue = "overworld") IrisDimension dimension diff --git a/src/main/java/com/volmit/iris/core/project/IrisProject.java b/src/main/java/com/volmit/iris/core/project/IrisProject.java index b46bcb6f9..8e2735f60 100644 --- a/src/main/java/com/volmit/iris/core/project/IrisProject.java +++ b/src/main/java/com/volmit/iris/core/project/IrisProject.java @@ -525,9 +525,9 @@ public class IrisProject { public void compile(VolmitSender sender) { IrisData data = IrisData.get(getPath()); - KList jobs = new KList(); - KList files = new KList(); - KList objects = new KList(); + KList jobs = new KList<>(); + KList files = new KList<>(); + KList objects = new KList<>(); files(getPath(), files); filesObjects(getPath(), objects);