9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-30 04:29:05 +00:00

Fix data managers

This commit is contained in:
Daniel Mills
2020-09-18 15:28:54 -04:00
parent 6e430861d7
commit 03f3b4f8d3
42 changed files with 3480 additions and 951 deletions

View File

@@ -18,6 +18,7 @@ import com.volmit.iris.gen.provisions.ProvisionBukkit;
import com.volmit.iris.gen.scaffold.IrisGenConfiguration;
import com.volmit.iris.gen.scaffold.TerrainTarget;
import com.volmit.iris.manager.IrisDataManager;
import com.volmit.iris.manager.ProjectManager;
import com.volmit.iris.object.IrisDimension;
import com.volmit.iris.util.Form;
import com.volmit.iris.util.IO;
@@ -68,11 +69,11 @@ public class CommandIrisCreate extends MortarCommand
if(dim == null)
{
for(File i : Iris.instance.getDataFolder("packs").listFiles())
for(File i : Iris.proj.getWorkspaceFolder().listFiles())
{
if(i.isFile() && i.getName().equals(type + ".iris"))
{
sender.sendMessage("Found " + type + ".iris in packs folder");
sender.sendMessage("Found " + type + ".iris in " + ProjectManager.workspaceName + " folder");
ZipUtil.unpack(i, iris);
break;
}
@@ -81,7 +82,7 @@ public class CommandIrisCreate extends MortarCommand
else
{
sender.sendMessage("Foind " + type + " dimension in packs folder. Repackaging");
sender.sendMessage("Foind " + type + " dimension in " + ProjectManager.workspaceName + " folder. Repackaging");
ZipUtil.unpack(Iris.proj.compilePackage(sender, type, true, true), iris);
}
@@ -92,7 +93,7 @@ public class CommandIrisCreate extends MortarCommand
Iris.globaldata.dump();
Iris.globaldata.preferFolder(null);
Iris.proj.downloadSearch(sender, type, false);
File downloaded = Iris.instance.getDataFolder("packs", type);
File downloaded = Iris.proj.getWorkspaceFolder(type);
for(File i : downloaded.listFiles())
{

View File

@@ -11,6 +11,7 @@ import org.bukkit.inventory.ItemStack;
import com.volmit.iris.Iris;
import com.volmit.iris.IrisSettings;
import com.volmit.iris.manager.ProjectManager;
import com.volmit.iris.manager.WandManager;
import com.volmit.iris.object.IrisObject;
import com.volmit.iris.util.MortarCommand;
@@ -34,7 +35,7 @@ public class CommandIrisObjectPaste extends MortarCommand
sender.sendMessage("To use Iris Studio Objects, please enable studio in Iris/settings.json");
return true;
}
if(!sender.isPlayer())
{
sender.sendMessage("You don't have a wand");
@@ -55,7 +56,7 @@ public class CommandIrisObjectPaste extends MortarCommand
if(file == null || !file.exists())
{
sender.sendMessage("Can't find " + args[0] + " in the packs folder");
sender.sendMessage("Can't find " + args[0] + " in the " + ProjectManager.workspaceName + " folder");
}
ItemStack wand = sender.player().getInventory().getItemInMainHand();

View File

@@ -60,7 +60,7 @@ public class CommandIrisObjectSave extends MortarCommand
Player p = sender.player();
ItemStack wand = p.getInventory().getItemInMainHand();
IrisObject o = WandManager.createSchematic(wand);
File file = Iris.instance.getDataFile("packs", args[0], "objects", args[1] + ".iob");
File file = Iris.proj.getWorkspaceFile(args[0], "objects", args[1] + ".iob");
if(file.exists())
{

View File

@@ -20,9 +20,6 @@ public class CommandIrisStudio extends MortarCommand
@Command
private CommandIrisStudioPackage pkg;
@Command
private CommandIrisStudioVerify verify;
@Command
private CommandIrisStudioUpdate update;

View File

@@ -40,7 +40,7 @@ public class CommandIrisStudioClose extends MortarCommand
for(World i : Bukkit.getWorlds())
{
if(i.getWorldFolder().getAbsolutePath().equals(Iris.proj.getCurrentProject().getTarget().getFolder().getAbsolutePath()))
if(i.getWorldFolder().getAbsolutePath().equals(Iris.proj.getActiveProject().getActiveProvider().getTarget().getFolder().getAbsolutePath()))
{
continue;
}
@@ -51,7 +51,7 @@ public class CommandIrisStudioClose extends MortarCommand
if(f == null)
{
for(Player i : Iris.proj.getCurrentProject().getTarget().getPlayers())
for(Player i : Iris.proj.getActiveProject().getActiveProvider().getTarget().getPlayers())
{
i.kickPlayer("Project Closing, No other world to put you in. Rejoin Please!");
}
@@ -59,7 +59,7 @@ public class CommandIrisStudioClose extends MortarCommand
else
{
for(Player i : Iris.proj.getCurrentProject().getTarget().getPlayers())
for(Player i : Iris.proj.getActiveProject().getActiveProvider().getTarget().getPlayers())
{
i.teleport(f.getSpawnLocation());
}

View File

@@ -35,7 +35,7 @@ public class CommandIrisStudioEditBiome extends MortarCommand
try
{
File f = Iris.proj.getCurrentProject().sampleTrueBiome(p.getLocation().getBlockX(), p.getLocation().getBlockY(), p.getLocation().getBlockZ()).getLoadFile();
File f = Iris.proj.getActiveProject().getActiveProvider().sampleTrueBiome(p.getLocation().getBlockX(), p.getLocation().getBlockY(), p.getLocation().getBlockZ()).getLoadFile();
Desktop.getDesktop().open(f);
}

View File

@@ -32,7 +32,7 @@ public class CommandIrisStudioExplorerGenerator extends MortarCommand
return true;
}
if(Iris.proj.getCurrentProject() == null)
if(!Iris.proj.isProjectOpen())
{
sender.sendMessage("No project is open");
return true;
@@ -47,13 +47,13 @@ public class CommandIrisStudioExplorerGenerator extends MortarCommand
else
{
String g = args[0];
IrisGenerator b = Iris.proj.getCurrentProject().getData().getGeneratorLoader().load(g);
IrisGenerator b = Iris.proj.getActiveProject().getActiveProvider().getData().getGeneratorLoader().load(g);
if(b != null)
{
NoiseExplorer.launch((x, z) ->
{
return b.getHeight(x, z, Iris.proj.getCurrentProject().getMasterRandom().nextParallelRNG(3245).lmax());
return b.getHeight(x, z, Iris.proj.getActiveProject().getActiveProvider().getMasterRandom().nextParallelRNG(3245).lmax());
}, "Gen: " + b.getLoadKey());
sender.sendMessage("Opening Noise Explorer for gen " + b.getLoadKey());

View File

@@ -41,7 +41,7 @@ public class CommandIrisStudioLoot extends MortarCommand
IrisWorlds.getProvider(sender.player().getWorld()).getPopulators();
KList<IrisLootTable> tables = IrisWorlds.getProvider(sender.player().getWorld()).getGlUpdate().getLootTables(RNG.r, p.getLocation().getBlock());
Inventory inv = Bukkit.createInventory(null, 27 * 2);
Iris.proj.getCurrentProject().getGlUpdate().addItems(true, inv, RNG.r, tables, InventorySlotType.STORAGE, p.getLocation().getBlockX(), p.getLocation().getBlockY(), p.getLocation().getBlockZ(), 1);
Iris.proj.getActiveProject().getActiveProvider().getGlUpdate().addItems(true, inv, RNG.r, tables, InventorySlotType.STORAGE, p.getLocation().getBlockX(), p.getLocation().getBlockY(), p.getLocation().getBlockZ(), 1);
p.openInventory(inv);
for(IrisLootTable i : tables)
@@ -83,7 +83,7 @@ public class CommandIrisStudioLoot extends MortarCommand
inv.clear();
}
Iris.proj.getCurrentProject().getGlUpdate().addItems(true, inv, new RNG(RNG.r.imax()), tables, InventorySlotType.STORAGE, p.getLocation().getBlockX(), p.getLocation().getBlockY(), p.getLocation().getBlockZ(), 1);
Iris.proj.getActiveProject().getActiveProvider().getGlUpdate().addItems(true, inv, new RNG(RNG.r.imax()), tables, InventorySlotType.STORAGE, p.getLocation().getBlockX(), p.getLocation().getBlockY(), p.getLocation().getBlockZ(), 1);
}, 0, fast ? 5 : 35));
return true;

View File

@@ -32,7 +32,7 @@ public class CommandIrisStudioMap extends MortarCommand
return true;
}
IrisTerrainProvider g = Iris.proj.getCurrentProject();
IrisTerrainProvider g = Iris.proj.getActiveProject().getActiveProvider();
IrisVision.launch(g);
sender.sendMessage("Opening Map!");
return true;

View File

@@ -2,6 +2,7 @@ package com.volmit.iris.command;
import com.volmit.iris.Iris;
import com.volmit.iris.IrisSettings;
import com.volmit.iris.manager.IrisProject;
import com.volmit.iris.util.MortarCommand;
import com.volmit.iris.util.MortarSender;
@@ -30,7 +31,7 @@ public class CommandIrisStudioUpdate extends MortarCommand
return true;
}
Iris.proj.updateWorkspace(Iris.proj.getWorkspaceFile(args[0]));
new IrisProject(Iris.proj.getWorkspaceFolder(args[0])).updateWorkspace();
return true;
}

View File

@@ -1,63 +0,0 @@
package com.volmit.iris.command;
import com.volmit.iris.Iris;
import com.volmit.iris.IrisSettings;
import com.volmit.iris.util.KList;
import com.volmit.iris.util.MortarCommand;
import com.volmit.iris.util.MortarSender;
public class CommandIrisStudioVerify extends MortarCommand
{
public CommandIrisStudioVerify()
{
super("verify", "check", "v");
requiresPermission(Iris.perm.studio);
setDescription("Check project for warnings and issues");
setCategory("Studio");
}
@Override
public boolean handle(MortarSender sender, String[] args)
{
if(!IrisSettings.get().isStudio())
{
sender.sendMessage("To use Iris Studio, please enable studio in Iris/settings.json");
return true;
}
if(args.length != 1)
{
sender.sendMessage("/iris std verify <DIMENSION> (file name without .json)");
}
sender.hr();
KList<String> mm = Iris.proj.analyze(Iris.instance.getDataFile("packs", args[0]));
mm.forEach((m) -> sender.sendMessage(m));
int e = 0;
int w = 0;
for(String i : mm)
{
if(i.contains("ERROR"))
{
e++;
}
if(i.contains("WARN"))
{
w++;
}
}
sender.sendMessage(w + " Warning(s), " + e + " Error(s)");
sender.hr();
return true;
}
@Override
protected String getArgsUsage()
{
return "[dimension]";
}
}