mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Update docs
This commit is contained in:
parent
185d0d8817
commit
e777566339
@ -1,64 +1,43 @@
|
||||
package com.volmit.iris;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.volmit.iris.command.CommandIris;
|
||||
import com.volmit.iris.command.PermissionIris;
|
||||
import com.volmit.iris.gen.IrisChunkGenerator;
|
||||
import com.volmit.iris.gen.post.Post;
|
||||
import com.volmit.iris.gen.post.PostFloatingNibDeleter;
|
||||
import com.volmit.iris.gen.post.PostNibSmoother;
|
||||
import com.volmit.iris.gen.post.PostPotholeFiller;
|
||||
import com.volmit.iris.gen.post.PostSlabber;
|
||||
import com.volmit.iris.gen.post.PostWallPatcher;
|
||||
import com.volmit.iris.gen.post.PostWaterlogger;
|
||||
import com.volmit.iris.object.DecorationPart;
|
||||
import com.volmit.iris.object.Dispersion;
|
||||
import com.volmit.iris.object.Envelope;
|
||||
import com.volmit.iris.object.InterpolationMethod;
|
||||
import com.volmit.iris.object.IrisBiome;
|
||||
import com.volmit.iris.object.StructureTileCondition;
|
||||
import com.volmit.iris.util.BiomeResult;
|
||||
import com.volmit.iris.util.BoardManager;
|
||||
import com.volmit.iris.util.BoardProvider;
|
||||
import com.volmit.iris.util.BoardSettings;
|
||||
import com.volmit.iris.util.CNG;
|
||||
import com.volmit.iris.util.ChronoLatch;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.Form;
|
||||
import com.volmit.iris.util.GroupedExecutor;
|
||||
import com.volmit.iris.util.IO;
|
||||
import com.volmit.iris.util.IrisLock;
|
||||
import com.volmit.iris.util.IrisPostBlockFilter;
|
||||
import com.volmit.iris.util.IrisStructureResult;
|
||||
import com.volmit.iris.util.J;
|
||||
import com.volmit.iris.util.JSONArray;
|
||||
import com.volmit.iris.util.JSONException;
|
||||
import com.volmit.iris.util.JSONObject;
|
||||
import com.volmit.iris.util.JarScanner;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.KMap;
|
||||
import com.volmit.iris.util.MortarPlugin;
|
||||
import com.volmit.iris.util.Permission;
|
||||
import com.volmit.iris.util.Required;
|
||||
import com.volmit.iris.util.RollingSequence;
|
||||
import com.volmit.iris.util.ScoreDirection;
|
||||
|
||||
@ -121,18 +100,6 @@ public class Iris extends MortarPlugin implements BoardProvider
|
||||
proj = new ProjectManager();
|
||||
manager = new BoardManager(this, BoardSettings.builder().boardProvider(this).scoreDirection(ScoreDirection.UP).build());
|
||||
|
||||
J.a(() ->
|
||||
{
|
||||
try
|
||||
{
|
||||
writeDocs();
|
||||
}
|
||||
|
||||
catch(JSONException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException | IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
super.onEnable();
|
||||
}
|
||||
|
||||
@ -240,193 +207,6 @@ public class Iris extends MortarPlugin implements BoardProvider
|
||||
return g;
|
||||
}
|
||||
|
||||
public void writeDocs() throws IOException, JSONException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException
|
||||
{
|
||||
JarScanner j = new JarScanner(getFile(), "com.volmit.iris.object");
|
||||
j.scan();
|
||||
File of = new File(getDataFolder(), "docs");
|
||||
of.mkdirs();
|
||||
KMap<String, String> files = new KMap<>();
|
||||
|
||||
for(Class<?> i : j.getClasses())
|
||||
{
|
||||
if(i.isAnnotationPresent(Desc.class))
|
||||
{
|
||||
JSONObject schema = new JSONObject();
|
||||
schema.put("$schema", "http://json-schema.org/draft-07/schema#");
|
||||
schema.put("$id", "http://volmit.com/iris-schema/" + i.getSimpleName().toLowerCase() + ".json");
|
||||
schema.put("title", i.getSimpleName().replaceAll("\\QIris\\E", ""));
|
||||
schema.put("type", "object");
|
||||
|
||||
Desc d = i.getAnnotation(Desc.class);
|
||||
schema.put("description", d.value());
|
||||
|
||||
KList<String> page = new KList<>();
|
||||
page.add("# " + i.getSimpleName());
|
||||
page.add("> " + d.value());
|
||||
|
||||
page.add("```json");
|
||||
page.add(new JSONObject(new Gson().toJson(i.getConstructor().newInstance())).toString(4));
|
||||
page.add("```");
|
||||
|
||||
page.add("");
|
||||
|
||||
JSONObject properties = new JSONObject();
|
||||
JSONArray req = new JSONArray();
|
||||
|
||||
for(java.lang.reflect.Field k : i.getDeclaredFields())
|
||||
{
|
||||
JSONObject prop = new JSONObject();
|
||||
|
||||
if(k.isAnnotationPresent(Desc.class))
|
||||
{
|
||||
page.add("## " + k.getName());
|
||||
page.add("> " + k.getAnnotation(Desc.class).value());
|
||||
page.add("");
|
||||
|
||||
String tp = "object";
|
||||
|
||||
if(k.getType().equals(int.class) || k.getType().equals(long.class))
|
||||
{
|
||||
tp = "integer";
|
||||
}
|
||||
|
||||
if(k.getType().equals(double.class) || k.getType().equals(float.class))
|
||||
{
|
||||
tp = "number";
|
||||
}
|
||||
|
||||
if(k.getType().equals(boolean.class))
|
||||
{
|
||||
tp = "boolean";
|
||||
}
|
||||
|
||||
if(k.getType().equals(String.class))
|
||||
{
|
||||
tp = "string";
|
||||
}
|
||||
|
||||
if(k.getType().equals(String.class))
|
||||
{
|
||||
tp = "string";
|
||||
}
|
||||
|
||||
if(k.getType().isEnum())
|
||||
{
|
||||
tp = "string";
|
||||
}
|
||||
|
||||
if(k.getType().equals(KList.class))
|
||||
{
|
||||
tp = "array";
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(Required.class))
|
||||
{
|
||||
req.put(k.getName());
|
||||
}
|
||||
|
||||
prop.put("description", k.getAnnotation(Desc.class).value());
|
||||
prop.put("type", tp);
|
||||
properties.put(k.getName(), prop);
|
||||
}
|
||||
}
|
||||
|
||||
schema.put("properties", properties);
|
||||
schema.put("required", req);
|
||||
String pge = page.toString("\n");
|
||||
files.put(i.getSimpleName() + ".md", pge);
|
||||
files.put("schema/" + i.getSimpleName() + ".json", schema.toString(4));
|
||||
}
|
||||
}
|
||||
|
||||
KList<String> m = new KList<>();
|
||||
|
||||
for(Biome i : Biome.values())
|
||||
{
|
||||
m.add(i.name());
|
||||
}
|
||||
|
||||
IO.writeAll(new File(of, "types/biomes.txt"), m.toString("\n"));
|
||||
m = new KList<>();
|
||||
|
||||
for(Particle i : Particle.values())
|
||||
{
|
||||
m.add(i.name());
|
||||
}
|
||||
|
||||
IO.writeAll(new File(of, "types/particles.txt"), m.toString("\n"));
|
||||
m = new KList<>();
|
||||
|
||||
for(Dispersion i : Dispersion.values())
|
||||
{
|
||||
m.add(i.name());
|
||||
}
|
||||
|
||||
IO.writeAll(new File(of, "types/dispersion.txt"), m.toString("\n"));
|
||||
m = new KList<>();
|
||||
|
||||
for(DecorationPart i : DecorationPart.values())
|
||||
{
|
||||
m.add(i.name());
|
||||
}
|
||||
|
||||
IO.writeAll(new File(of, "types/decoration-part.txt"), m.toString("\n"));
|
||||
m = new KList<>();
|
||||
|
||||
for(Envelope i : Envelope.values())
|
||||
{
|
||||
m.add(i.name());
|
||||
}
|
||||
|
||||
IO.writeAll(new File(of, "types/envelope.txt"), m.toString("\n"));
|
||||
m = new KList<>();
|
||||
|
||||
for(Environment i : Environment.values())
|
||||
{
|
||||
m.add(i.name());
|
||||
}
|
||||
|
||||
IO.writeAll(new File(of, "types/environment.txt"), m.toString("\n"));
|
||||
m = new KList<>();
|
||||
|
||||
for(StructureTileCondition i : StructureTileCondition.values())
|
||||
{
|
||||
m.add(i.name());
|
||||
}
|
||||
|
||||
IO.writeAll(new File(of, "types/structure-tile-condition.txt"), m.toString("\n"));
|
||||
m = new KList<>();
|
||||
|
||||
for(InterpolationMethod i : InterpolationMethod.values())
|
||||
{
|
||||
m.add(i.name());
|
||||
}
|
||||
|
||||
IO.writeAll(new File(of, "types/interpolation-method.txt"), m.toString("\n"));
|
||||
m = new KList<>();
|
||||
|
||||
for(Class<? extends IrisPostBlockFilter> i : Iris.postProcessors)
|
||||
{
|
||||
m.add(i.getDeclaredAnnotation(Post.class).value());
|
||||
}
|
||||
|
||||
IO.writeAll(new File(of, "types/post-processors.txt"), m.toString("\n"));
|
||||
m = new KList<>();
|
||||
|
||||
for(PotionEffectType i : PotionEffectType.values())
|
||||
{
|
||||
m.add(i.getName().toUpperCase().replaceAll("\\Q \\E", "_"));
|
||||
}
|
||||
|
||||
IO.writeAll(new File(of, "types/potion-effect.txt"), m.toString("\n"));
|
||||
|
||||
for(String i : files.k())
|
||||
{
|
||||
IO.writeAll(new File(of, i), files.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
|
||||
{
|
||||
|
@ -3,19 +3,27 @@ package com.volmit.iris;
|
||||
import java.awt.Desktop;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.WorldType;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.zeroturnaround.zip.ZipUtil;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.volmit.iris.gen.IrisChunkGenerator;
|
||||
import com.volmit.iris.gen.post.Post;
|
||||
import com.volmit.iris.object.DecorationPart;
|
||||
import com.volmit.iris.object.Dispersion;
|
||||
import com.volmit.iris.object.Envelope;
|
||||
import com.volmit.iris.object.InterpolationMethod;
|
||||
import com.volmit.iris.object.IrisBiome;
|
||||
import com.volmit.iris.object.IrisBiomeGeneratorLink;
|
||||
@ -27,11 +35,13 @@ import com.volmit.iris.object.IrisObjectPlacement;
|
||||
import com.volmit.iris.object.IrisRegion;
|
||||
import com.volmit.iris.object.IrisStructure;
|
||||
import com.volmit.iris.object.IrisStructureTile;
|
||||
import com.volmit.iris.object.StructureTileCondition;
|
||||
import com.volmit.iris.util.ArrayType;
|
||||
import com.volmit.iris.util.ChronoLatch;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.Form;
|
||||
import com.volmit.iris.util.IO;
|
||||
import com.volmit.iris.util.IrisPostBlockFilter;
|
||||
import com.volmit.iris.util.J;
|
||||
import com.volmit.iris.util.JSONArray;
|
||||
import com.volmit.iris.util.JSONException;
|
||||
@ -494,7 +504,6 @@ public class ProjectManager
|
||||
try
|
||||
{
|
||||
JSONObject ws = newWorkspaceConfig();
|
||||
|
||||
IO.writeAll(Iris.instance.getDataFile("packs", dimension.getLoadKey(), "dimensions", dimension.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(dimension)).toString(4));
|
||||
IO.writeAll(Iris.instance.getDataFile("packs", dimension.getLoadKey(), "regions", exampleRegion.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(exampleRegion)).toString(4));
|
||||
IO.writeAll(Iris.instance.getDataFile("packs", dimension.getLoadKey(), "biomes", exampleLand1.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(exampleLand1)).toString(4));
|
||||
@ -540,6 +549,7 @@ public class ProjectManager
|
||||
{
|
||||
try
|
||||
{
|
||||
J.attemptAsync(() -> writeDocs(ws.getParentFile()));
|
||||
JSONObject j = new JSONObject(IO.readAll(ws));
|
||||
JSONObject s = j.getJSONObject("settings");
|
||||
s.put("json.schemas", buildSchemas());
|
||||
@ -844,4 +854,87 @@ public class ProjectManager
|
||||
|
||||
return schema;
|
||||
}
|
||||
|
||||
public void writeDocs(File folder) throws IOException, JSONException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException
|
||||
{
|
||||
File of = new File(folder, "_docs");
|
||||
KList<String> m = new KList<>();
|
||||
|
||||
for(Biome i : Biome.values())
|
||||
{
|
||||
m.add(i.name());
|
||||
}
|
||||
|
||||
IO.writeAll(new File(of, "biomes.txt"), m.toString("\n"));
|
||||
m = new KList<>();
|
||||
|
||||
for(Particle i : Particle.values())
|
||||
{
|
||||
m.add(i.name());
|
||||
}
|
||||
|
||||
IO.writeAll(new File(of, "particles.txt"), m.toString("\n"));
|
||||
m = new KList<>();
|
||||
|
||||
for(Dispersion i : Dispersion.values())
|
||||
{
|
||||
m.add(i.name());
|
||||
}
|
||||
|
||||
IO.writeAll(new File(of, "dispersion.txt"), m.toString("\n"));
|
||||
m = new KList<>();
|
||||
|
||||
for(DecorationPart i : DecorationPart.values())
|
||||
{
|
||||
m.add(i.name());
|
||||
}
|
||||
|
||||
IO.writeAll(new File(of, "decoration-part.txt"), m.toString("\n"));
|
||||
m = new KList<>();
|
||||
|
||||
for(Envelope i : Envelope.values())
|
||||
{
|
||||
m.add(i.name());
|
||||
}
|
||||
|
||||
IO.writeAll(new File(of, "envelope.txt"), m.toString("\n"));
|
||||
m = new KList<>();
|
||||
|
||||
for(Environment i : Environment.values())
|
||||
{
|
||||
m.add(i.name());
|
||||
}
|
||||
|
||||
IO.writeAll(new File(of, "environment.txt"), m.toString("\n"));
|
||||
m = new KList<>();
|
||||
|
||||
for(StructureTileCondition i : StructureTileCondition.values())
|
||||
{
|
||||
m.add(i.name());
|
||||
}
|
||||
|
||||
IO.writeAll(new File(of, "structure-tile-condition.txt"), m.toString("\n"));
|
||||
m = new KList<>();
|
||||
|
||||
for(InterpolationMethod i : InterpolationMethod.values())
|
||||
{
|
||||
m.add(i.name());
|
||||
}
|
||||
|
||||
IO.writeAll(new File(of, "interpolation-method.txt"), m.toString("\n"));
|
||||
m = new KList<>();
|
||||
|
||||
for(Class<? extends IrisPostBlockFilter> i : Iris.postProcessors)
|
||||
{
|
||||
m.add(i.getDeclaredAnnotation(Post.class).value());
|
||||
}
|
||||
|
||||
IO.writeAll(new File(of, "post-processors.txt"), m.toString("\n"));
|
||||
m = new KList<>();
|
||||
|
||||
for(PotionEffectType i : PotionEffectType.values())
|
||||
{
|
||||
m.add(i.getName().toUpperCase().replaceAll("\\Q \\E", "_"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,6 @@
|
||||
package com.volmit.iris.command;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.object.InterpolationMethod;
|
||||
import com.volmit.iris.object.IrisBiome;
|
||||
import com.volmit.iris.object.IrisBiomeGeneratorLink;
|
||||
import com.volmit.iris.object.IrisDimension;
|
||||
import com.volmit.iris.object.IrisGenerator;
|
||||
import com.volmit.iris.object.IrisNoiseGenerator;
|
||||
import com.volmit.iris.object.IrisRegion;
|
||||
import com.volmit.iris.util.Form;
|
||||
import com.volmit.iris.util.IO;
|
||||
import com.volmit.iris.util.JSONException;
|
||||
import com.volmit.iris.util.JSONObject;
|
||||
import com.volmit.iris.util.MortarCommand;
|
||||
import com.volmit.iris.util.MortarSender;
|
||||
|
||||
|
@ -9,7 +9,7 @@ import com.volmit.iris.util.Required;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Desc("Represents a rotation axis with intervals and maxes")
|
||||
@Desc("Represents a rotation axis with intervals and maxes. The x and z axis values are defaulted to disabled. The Y axis defaults to on, rotating by 90 degree increments.")
|
||||
@Data
|
||||
public class IrisAxisRotationClamp
|
||||
{
|
||||
@ -35,7 +35,7 @@ public class IrisAxisRotationClamp
|
||||
@MinNumber(0)
|
||||
@MaxNumber(360)
|
||||
@DontObfuscate
|
||||
@Desc("Iris spins the axis but not freely. For example an interval of 90 would mean 4 possible angles (right angles) degrees")
|
||||
@Desc("Iris spins the axis but not freely. For example an interval of 90 would mean 4 possible angles (right angles) degrees. \nSetting this to 0 means totally free rotation.\n\nNote that a lot of structures can have issues with non 90 degree intervals because the minecraft block resolution is so low.")
|
||||
private double interval = 0;
|
||||
|
||||
public IrisAxisRotationClamp()
|
||||
|
@ -23,7 +23,7 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("Represents a biome in iris.")
|
||||
@Desc("Represents a biome in iris. Biomes are placed inside of regions and hold objects.")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IrisBiome extends IrisRegistrant implements IRare
|
||||
@ -35,11 +35,11 @@ public class IrisBiome extends IrisRegistrant implements IRare
|
||||
|
||||
@ArrayType(min = 1, type = IrisEffect.class)
|
||||
@DontObfuscate
|
||||
@Desc("The name of the region")
|
||||
@Desc("Effects are ambient effects such as potion effects, random sounds, or even particles around each player. All of these effects are played via packets so two players won't see/hear each others effects.\nDue to performance reasons, effects will play arround the player even if where the effect was played is no longer in the biome the player is in.")
|
||||
private KList<IrisEffect> effects = new KList<>();
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("This changes the dispersion of the biome colors if multiple derivatives are chosen")
|
||||
@Desc("This changes the dispersion of the biome colors if multiple derivatives are chosen.")
|
||||
private Dispersion biomeDispersion = Dispersion.SCATTER;
|
||||
|
||||
@MinNumber(0.0001)
|
||||
|
@ -31,7 +31,7 @@ public class IrisRegion extends IrisRegistrant implements IRare
|
||||
|
||||
@ArrayType(min = 1, type = IrisEffect.class)
|
||||
@DontObfuscate
|
||||
@Desc("The name of the region")
|
||||
@Desc("Effects are ambient effects such as potion effects, random sounds, or even particles around each player. All of these effects are played via packets so two players won't see/hear each others effects.\nDue to performance reasons, effects will play arround the player even if where the effect was played is no longer in the biome the player is in.")
|
||||
private KList<IrisEffect> effects = new KList<>();
|
||||
|
||||
@MinNumber(1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user