9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-27 02:59:06 +00:00

lol dual universe

This commit is contained in:
Daniel Mills
2020-07-23 20:28:08 -04:00
parent ae5d0b282c
commit 30dc6e865f
30 changed files with 832 additions and 4428 deletions

View File

@@ -31,7 +31,6 @@ import org.bukkit.util.Vector;
import com.google.gson.Gson;
import ninja.bytecode.iris.generator.IrisChunkGenerator;
import ninja.bytecode.iris.legacy.GenObject;
import ninja.bytecode.iris.object.IrisBiome;
import ninja.bytecode.iris.object.IrisDimension;
import ninja.bytecode.iris.object.IrisObject;
@@ -53,8 +52,6 @@ import ninja.bytecode.iris.wand.WandController;
import ninja.bytecode.shuriken.collections.KList;
import ninja.bytecode.shuriken.collections.KMap;
import ninja.bytecode.shuriken.execution.J;
import ninja.bytecode.shuriken.execution.TaskExecutor;
import ninja.bytecode.shuriken.execution.TaskExecutor.TaskGroup;
import ninja.bytecode.shuriken.format.Form;
import ninja.bytecode.shuriken.json.JSONException;
import ninja.bytecode.shuriken.json.JSONObject;
@@ -219,52 +216,6 @@ public class Iris extends JavaPlugin implements BoardProvider
if(args.length >= 1)
{
if(args[0].equalsIgnoreCase("convert") && args.length == 1)
{
File folder = new File(getDataFolder(), "convert");
if(folder.exists() && folder.isDirectory())
{
KList<File> objects = new KList<>();
lookForObjects(folder, objects);
TaskExecutor tx = new TaskExecutor(32, Thread.MIN_PRIORITY, "Iris Converter");
TaskGroup g = tx.startWork();
info("Converting " + Form.f(objects.size()) + " Objects");
O<Integer> max = new O<Integer>().set(objects.size());
O<Integer> at = new O<Integer>().set(0);
for(File i : objects)
{
g.queue(() ->
{
try
{
IrisObject o = GenObject.loadAsModern(i);
File ff = new File(i.getParentFile(), o.getLoadKey() + ".iob");
o.write(new File(i.getParentFile(), o.getLoadKey() + ".iob"));
Iris.info("Converting [" + at.get() + " of " + max.get() + "]: " + i.getName() + " to " + ff.getName());
}
catch(Throwable e)
{
e.printStackTrace();
error("Failed to convert " + i.getName());
}
i.delete();
at.set(at.get() + 1);
});
}
J.a(() ->
{
g.execute();
Iris.info("Done!");
});
}
}
if(args[0].equalsIgnoreCase("goto") && args.length == 2)
{
if(sender instanceof Player)
@@ -567,7 +518,6 @@ public class Iris extends JavaPlugin implements BoardProvider
imsg(sender, "/iris wand l1 - Set wand pos 1 where looking");
imsg(sender, "/iris wand l2 - Set wand pos 2 where looking");
}
}
if(args[0].equalsIgnoreCase("save") && args.length >= 2)
@@ -578,6 +528,7 @@ public class Iris extends JavaPlugin implements BoardProvider
{
o.write(new File(getDataFolder(), "objects/" + args[1] + ".iob"));
imsg(sender, "Saved " + "objects/" + args[1] + ".iob");
((Player) sender).getWorld().playSound(((Player) sender).getLocation(), Sound.BLOCK_ENCHANTMENT_TABLE_USE, 1f, 1.5f);
}
catch(IOException e)
@@ -613,6 +564,8 @@ public class Iris extends JavaPlugin implements BoardProvider
{
o.read(new File(getDataFolder(), "objects/" + args[1] + ".iob"));
imsg(sender, "Loaded " + "objects/" + args[1] + ".iob");
((Player) sender).getWorld().playSound(((Player) sender).getLocation(), Sound.BLOCK_ENCHANTMENT_TABLE_USE, 1f, 1.5f);
Location block = ((Player) sender).getTargetBlock((Set<Material>) null, 256).getLocation().clone().add(0, 1, 0);
if(intoWand && WandController.isWand(wand))
@@ -716,25 +669,6 @@ public class Iris extends JavaPlugin implements BoardProvider
return false;
}
private void lookForObjects(File folder, KList<File> objects)
{
if(folder.isDirectory())
{
for(File i : folder.listFiles())
{
if(i.isDirectory())
{
lookForObjects(i, objects);
}
if(i.getName().endsWith(".ish"))
{
objects.add(i);
}
}
}
}
public void imsg(CommandSender s, String msg)
{
s.sendMessage(ChatColor.GREEN + "[" + ChatColor.DARK_GRAY + "Iris" + ChatColor.GREEN + "]" + ChatColor.GRAY + ": " + msg);