Improve some commands

This commit is contained in:
CocoTheOwner 2021-09-18 15:07:36 +02:00
parent c99c61cc7a
commit 826b0ad4ce
3 changed files with 41 additions and 4 deletions

View File

@ -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 <world> <pack> 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);
}
}

View File

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

View File

@ -525,9 +525,9 @@ public class IrisProject {
public void compile(VolmitSender sender) {
IrisData data = IrisData.get(getPath());
KList<Job> jobs = new KList<Job>();
KList<File> files = new KList<File>();
KList<File> objects = new KList<File>();
KList<Job> jobs = new KList<>();
KList<File> files = new KList<>();
KList<File> objects = new KList<>();
files(getPath(), files);
filesObjects(getPath(), objects);