9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-22 16:49:14 +00:00
This commit is contained in:
DanLT
2021-09-01 10:27:49 -08:00
parent 44c807aedd
commit d763967d4b
61 changed files with 208 additions and 553 deletions

View File

@@ -26,11 +26,7 @@ import com.volmit.iris.core.link.OraxenLink;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.core.nms.INMS;
import com.volmit.iris.core.service.StudioSVC;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisBiomeCustom;
import com.volmit.iris.engine.object.IrisWorld;
import com.volmit.iris.engine.object.IrisCompat;
import com.volmit.iris.engine.object.IrisDimension;
import com.volmit.iris.engine.object.*;
import com.volmit.iris.engine.platform.BukkitChunkGenerator;
import com.volmit.iris.engine.platform.DummyChunkGenerator;
import com.volmit.iris.util.collection.KList;
@@ -281,8 +277,7 @@ public class Iris extends VolmitPlugin implements Listener {
if (j.getName().endsWith(".json")) {
IrisDimension dim = data.getDimensionLoader().load(j.getName().split("\\Q.\\E")[0]);
if(dim == null)
{
if (dim == null) {
continue;
}
@@ -381,8 +376,7 @@ public class Iris extends VolmitPlugin implements Listener {
if (j.getName().endsWith(".json")) {
IrisDimension dim = data.getDimensionLoader().load(j.getName().split("\\Q.\\E")[0]);
if(dim == null)
{
if (dim == null) {
Iris.error("Failed to load " + j.getPath());
continue;
}

View File

@@ -5,13 +5,7 @@ import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.core.service.ObjectSVC;
import com.volmit.iris.core.service.StudioSVC;
import com.volmit.iris.core.service.WandSVC;
import com.volmit.iris.engine.object.IObjectPlacer;
import com.volmit.iris.engine.object.IrisDimension;
import com.volmit.iris.engine.object.IrisObject;
import com.volmit.iris.engine.object.IrisObjectPlacement;
import com.volmit.iris.engine.object.IrisObjectPlacementScaleInterpolator;
import com.volmit.iris.engine.object.IrisObjectRotation;
import com.volmit.iris.engine.object.TileData;
import com.volmit.iris.engine.object.*;
import com.volmit.iris.util.data.Cuboid;
import com.volmit.iris.util.decree.DecreeExecutor;
import com.volmit.iris.util.decree.DecreeOrigin;

View File

@@ -29,22 +29,7 @@ import com.volmit.iris.core.service.ConversionSVC;
import com.volmit.iris.core.service.StudioSVC;
import com.volmit.iris.core.tools.IrisToolbelt;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.object.IrisPosition;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisBiomePaletteLayer;
import com.volmit.iris.engine.object.IrisScript;
import com.volmit.iris.engine.object.IrisDimension;
import com.volmit.iris.engine.object.IrisEntity;
import com.volmit.iris.engine.object.IrisFeaturePositional;
import com.volmit.iris.engine.object.IrisLootTable;
import com.volmit.iris.engine.object.InventorySlotType;
import com.volmit.iris.engine.object.IrisGenerator;
import com.volmit.iris.engine.object.IrisInterpolator;
import com.volmit.iris.engine.object.IrisNoiseGenerator;
import com.volmit.iris.engine.object.NoiseStyle;
import com.volmit.iris.engine.object.IrisObject;
import com.volmit.iris.engine.object.IrisObjectPlacement;
import com.volmit.iris.engine.object.IrisRegion;
import com.volmit.iris.engine.object.*;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KMap;
import com.volmit.iris.util.collection.KSet;

View File

@@ -134,10 +134,8 @@ public class CommandWhat implements DecreeExecutor {
int m = 1;
AtomicInteger v = new AtomicInteger(0);
for(int xxx = c.getX() - 4; xxx <= c.getX() + 4; xxx++)
{
for(int zzz = c.getZ() - 4; zzz <= c.getZ() + 4; zzz++)
{
for (int xxx = c.getX() - 4; xxx <= c.getX() + 4; xxx++) {
for (int zzz = c.getZ() - 4; zzz <= c.getZ() + 4; zzz++) {
IrisToolbelt.access(c.getWorld()).getEngine().getMantle().findMarkers(xxx, zzz, new MatterMarker(marker))
.convert((i) -> i.toLocation(c.getWorld())).forEach((i) -> {
J.s(() -> BlockSignal.of(i.getBlock(), 100));

View File

@@ -33,6 +33,7 @@ import java.util.concurrent.atomic.AtomicInteger;
@SuppressWarnings("InstantiationOfUtilityClass")
public class BlockSignal {
public static final AtomicInteger active = new AtomicInteger(0);
public static void of(Block block, int ticks) {
new BlockSignal(block, ticks);
}

View File

@@ -32,8 +32,6 @@ import org.bukkit.Sound;
import org.bukkit.World;
import org.bukkit.block.Block;
import java.util.concurrent.atomic.AtomicInteger;
@SuppressWarnings("ALL")
@Data
public class DustRevealer {
@@ -70,13 +68,11 @@ public class DustRevealer {
J.s(() -> {
new BlockSignal(world.getBlockAt(block.getX(), block.getY(), block.getZ()), 7);
if(M.r(0.25))
{
if (M.r(0.25)) {
world.playSound(block.toBlock(world).getLocation(), Sound.BLOCK_AMETHYST_BLOCK_CHIME, 1f, RNG.r.f(0.2f, 2f));
}
J.a(() -> {
while(BlockSignal.active.get() > 128)
{
while (BlockSignal.active.get() > 128) {
J.sleep(5);
}

View File

@@ -21,11 +21,7 @@ package com.volmit.iris.core.edit;
import com.google.gson.Gson;
import com.volmit.iris.Iris;
import com.volmit.iris.core.service.WandSVC;
import com.volmit.iris.engine.object.IrisPosition;
import com.volmit.iris.engine.object.IrisJigsawPiece;
import com.volmit.iris.engine.object.IrisJigsawPieceConnector;
import com.volmit.iris.engine.object.IrisDirection;
import com.volmit.iris.engine.object.IrisObject;
import com.volmit.iris.engine.object.*;
import com.volmit.iris.util.collection.KMap;
import com.volmit.iris.util.data.Cuboid;
import com.volmit.iris.util.io.IO;

View File

@@ -25,8 +25,8 @@ import com.volmit.iris.core.tools.IrisToolbelt;
import com.volmit.iris.engine.IrisComplex;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisWorld;
import com.volmit.iris.engine.object.IrisRegion;
import com.volmit.iris.engine.object.IrisWorld;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KMap;
import com.volmit.iris.util.collection.KSet;

View File

@@ -26,24 +26,8 @@ import com.google.gson.stream.JsonWriter;
import com.volmit.iris.Iris;
import com.volmit.iris.engine.data.cache.AtomicCache;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.object.*;
import com.volmit.iris.engine.object.annotations.Snippet;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisBlockData;
import com.volmit.iris.engine.object.IrisCave;
import com.volmit.iris.engine.object.IrisRavine;
import com.volmit.iris.engine.object.IrisScript;
import com.volmit.iris.engine.object.IrisDimension;
import com.volmit.iris.engine.object.IrisEntity;
import com.volmit.iris.engine.object.IrisJigsawPiece;
import com.volmit.iris.engine.object.IrisJigsawPool;
import com.volmit.iris.engine.object.IrisJigsawStructure;
import com.volmit.iris.engine.object.IrisLootTable;
import com.volmit.iris.engine.object.IrisMod;
import com.volmit.iris.engine.object.IrisExpression;
import com.volmit.iris.engine.object.IrisGenerator;
import com.volmit.iris.engine.object.IrisObject;
import com.volmit.iris.engine.object.IrisRegion;
import com.volmit.iris.engine.object.IrisSpawner;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KMap;
import com.volmit.iris.util.context.IrisContext;
@@ -56,7 +40,6 @@ import lombok.Data;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.Objects;
import java.util.function.Function;
@@ -372,13 +355,9 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
@Override
public boolean shouldSkipClass(Class<?> c) {
if(c.equals(AtomicCache.class))
{
if (c.equals(AtomicCache.class)) {
return true;
}
else if(c.equals(ChronoLatch.class))
{
} else if (c.equals(ChronoLatch.class)) {
return true;
}
@@ -387,8 +366,7 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
if(!typeToken.getRawType().isAnnotationPresent(Snippet.class))
{
if (!typeToken.getRawType().isAnnotationPresent(Snippet.class)) {
return null;
}
@@ -407,26 +385,17 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
if (reader.peek().equals(JsonToken.STRING)) {
String r = reader.nextString();
if(r.startsWith("snippet/" + snippetType + "/"))
{
if (r.startsWith("snippet/" + snippetType + "/")) {
File f = new File(getDataFolder(), r + ".json");
if(f.exists())
{
try
{
if (f.exists()) {
try {
JsonReader snippetReader = new JsonReader(new FileReader(f));
return adapter.read(snippetReader);
}
catch(Throwable e)
{
} catch (Throwable e) {
Iris.error("Couldn't read snippet " + r + " in " + reader.getPath() + " (" + e.getMessage() + ")");
}
}
else
{
} else {
Iris.error("Couldn't find snippet " + r + " in " + reader.getPath());
}
}
@@ -434,13 +403,9 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
return null;
}
try
{
try {
return adapter.read(reader);
}
catch(Throwable e)
{
} catch (Throwable e) {
Iris.error("Failed to read " + typeToken.getRawType().getCanonicalName() + "... faking objects a little to load the file at least.");
try {
return (T) typeToken.getRawType().getConstructor().newInstance();
@@ -459,10 +424,8 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
File snippetFolder = new File(getDataFolder(), "snippet/" + f);
if(snippetFolder.exists() && snippetFolder.isDirectory())
{
for(File i : snippetFolder.listFiles())
{
if (snippetFolder.exists() && snippetFolder.isDirectory()) {
for (File i : snippetFolder.listFiles()) {
l.add("snippet/" + f + "/" + i.getName().split("\\Q.\\E")[0]);
}
}

View File

@@ -20,10 +20,10 @@ package com.volmit.iris.core.loader;
import com.google.gson.GsonBuilder;
import com.volmit.iris.Iris;
import com.volmit.iris.engine.object.IrisScript;
import com.volmit.iris.engine.object.annotations.ArrayType;
import com.volmit.iris.engine.object.annotations.Desc;
import com.volmit.iris.engine.object.annotations.RegistryListResource;
import com.volmit.iris.engine.object.IrisScript;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.json.JSONObject;
import com.volmit.iris.util.plugin.VolmitSender;
@@ -49,8 +49,7 @@ public abstract class IrisRegistrant {
public abstract String getTypeName();
public void registerTypeAdapters(GsonBuilder builder)
{
public void registerTypeAdapters(GsonBuilder builder) {
}

View File

@@ -19,13 +19,8 @@
package com.volmit.iris.core.loader;
import com.google.common.util.concurrent.AtomicDouble;
import com.google.gson.ExclusionStrategy;
import com.google.gson.FieldAttributes;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.volmit.iris.Iris;
import com.volmit.iris.core.project.SchemaBuilder;
import com.volmit.iris.engine.data.cache.AtomicCache;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KMap;
import com.volmit.iris.util.collection.KSet;
@@ -41,7 +36,6 @@ import com.volmit.iris.util.scheduling.PrecisionStopwatch;
import lombok.Data;
import java.io.File;
import java.lang.reflect.Field;
import java.util.Locale;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Predicate;

View File

@@ -22,8 +22,8 @@ import com.volmit.iris.Iris;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.core.loader.ResourceLoader;
import com.volmit.iris.core.service.StudioSVC;
import com.volmit.iris.engine.object.IrisWorld;
import com.volmit.iris.engine.object.IrisDimension;
import com.volmit.iris.engine.object.IrisWorld;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.exceptions.IrisException;
import com.volmit.iris.util.format.Form;

View File

@@ -25,16 +25,7 @@ import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.core.loader.IrisRegistrant;
import com.volmit.iris.core.loader.ResourceLoader;
import com.volmit.iris.core.tools.IrisToolbelt;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisBlockData;
import com.volmit.iris.engine.object.IrisDimension;
import com.volmit.iris.engine.object.IrisEntity;
import com.volmit.iris.engine.object.IrisLootTable;
import com.volmit.iris.engine.object.IrisGenerator;
import com.volmit.iris.engine.object.IrisObject;
import com.volmit.iris.engine.object.IrisObjectPlacement;
import com.volmit.iris.engine.object.IrisRegion;
import com.volmit.iris.engine.object.IrisSpawner;
import com.volmit.iris.engine.object.*;
import com.volmit.iris.engine.object.annotations.Snippet;
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
import com.volmit.iris.util.collection.KList;
@@ -276,10 +267,8 @@ public class IrisProject {
}
}
for(Class<?> i : Iris.getClasses("com.volmit.iris.engine.object.", Snippet.class))
{
try
{
for (Class<?> i : Iris.getClasses("com.volmit.iris.engine.object.", Snippet.class)) {
try {
String snipType = i.getDeclaredAnnotation(Snippet.class).value();
JSONObject o = new JSONObject();
KList<String> fm = new KList<>();
@@ -293,20 +282,13 @@ public class IrisProject {
schemas.put(o);
File a = new File(dm.getDataFolder(), ".iris/schema/snippet/" + snipType + "-schema.json");
J.attemptAsync(() -> {
try
{
try {
IO.writeAll(a, new SchemaBuilder(i, dm).compute().toString(4));
}
catch(Throwable e)
{
} catch (Throwable e) {
e.printStackTrace();
}
});
}
catch(Throwable e)
{
} catch (Throwable e) {
e.printStackTrace();
}
}

View File

@@ -131,8 +131,7 @@ public class SchemaBuilder {
o.put("properties", properties);
if(c.isAnnotationPresent(Snippet.class))
{
if (c.isAnnotationPresent(Snippet.class)) {
JSONObject anyOf = new JSONObject();
JSONArray arr = new JSONArray();
JSONObject str = new JSONObject();
@@ -533,8 +532,7 @@ public class SchemaBuilder {
d.add(fancyType);
d.add(getDescription(k.getType()));
if(k.getType().isAnnotationPresent(Snippet.class))
{
if (k.getType().isAnnotationPresent(Snippet.class)) {
String sm = k.getType().getDeclaredAnnotation(Snippet.class).value();
d.add(" ");
d.add("You can instead specify \"snippet/" + sm + "/some-name.json\" to use a snippet file instead of specifying it here.");
@@ -564,8 +562,7 @@ public class SchemaBuilder {
prop.put("type", type);
prop.put("description", d.toString("\n"));
if(k.getType().isAnnotationPresent(Snippet.class))
{
if (k.getType().isAnnotationPresent(Snippet.class)) {
JSONObject anyOf = new JSONObject();
JSONArray arr = new JSONArray();
JSONObject str = new JSONObject();

View File

@@ -152,8 +152,7 @@ public class BoardSVC implements IrisService, BoardProvider {
v.add(C.LIGHT_PURPLE + "Tasks" + C.GRAY + ": " + Form.f(Iris.jobCount()));
}
if(engine.getBlockUpdatesPerSecond() > 0)
{
if (engine.getBlockUpdatesPerSecond() > 0) {
v.add("&7&m------------------");
v.add(C.LIGHT_PURPLE + "BUD/s" + C.GRAY + ": " + Form.f(engine.getBlockUpdatesPerSecond()));
}

View File

@@ -19,7 +19,6 @@
package com.volmit.iris.core.service;
import com.volmit.iris.Iris;
import com.volmit.iris.core.IrisSettings;
import com.volmit.iris.core.commands.CommandIris;
import com.volmit.iris.engine.data.cache.AtomicCache;
import com.volmit.iris.util.collection.KMap;
@@ -47,17 +46,14 @@ public class CommandSVC implements IrisService, DecreeSystem {
}
@EventHandler
public void on(PlayerCommandPreprocessEvent e)
{
public void on(PlayerCommandPreprocessEvent e) {
String msg = e.getMessage().startsWith("/") ? e.getMessage().substring(1) : e.getMessage();
if(msg.startsWith("irisdecree "))
{
if (msg.startsWith("irisdecree ")) {
String[] args = msg.split("\\Q \\E");
CompletableFuture<String> future = futures.get(args[1]);
if(future != null)
{
if (future != null) {
future.complete(args[2]);
e.setCancelled(true);
}

View File

@@ -20,12 +20,7 @@ package com.volmit.iris.core.service;
import com.google.gson.Gson;
import com.volmit.iris.Iris;
import com.volmit.iris.engine.object.IrisPosition;
import com.volmit.iris.engine.object.IrisJigsawPiece;
import com.volmit.iris.engine.object.IrisJigsawPieceConnector;
import com.volmit.iris.engine.object.IrisJigsawPool;
import com.volmit.iris.engine.object.IrisDirection;
import com.volmit.iris.engine.object.IrisObject;
import com.volmit.iris.engine.object.*;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KMap;
import com.volmit.iris.util.format.Form;

View File

@@ -21,14 +21,7 @@ package com.volmit.iris.core.service;
import com.volmit.iris.Iris;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.core.tools.IrisToolbelt;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IObjectPlacer;
import com.volmit.iris.engine.object.IrisObject;
import com.volmit.iris.engine.object.IrisObjectPlacement;
import com.volmit.iris.engine.object.IrisRegion;
import com.volmit.iris.engine.object.TileData;
import com.volmit.iris.engine.object.IrisTreeModes;
import com.volmit.iris.engine.object.IrisTreeSize;
import com.volmit.iris.engine.object.*;
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KMap;

View File

@@ -19,8 +19,8 @@
package com.volmit.iris.core.tools;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.engine.object.IrisWorld;
import com.volmit.iris.engine.object.IrisDimension;
import com.volmit.iris.engine.object.IrisWorld;
import com.volmit.iris.engine.platform.BukkitChunkGenerator;
import org.bukkit.World;
import org.bukkit.WorldCreator;

View File

@@ -22,13 +22,7 @@ import com.google.common.util.concurrent.AtomicDouble;
import com.volmit.iris.Iris;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.object.InferredType;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisDecorationPart;
import com.volmit.iris.engine.object.IrisDecorator;
import com.volmit.iris.engine.object.IrisFeaturePositional;
import com.volmit.iris.engine.object.IrisGenerator;
import com.volmit.iris.engine.object.IrisRegion;
import com.volmit.iris.engine.object.*;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KMap;
import com.volmit.iris.util.data.DataProvider;

View File

@@ -34,11 +34,7 @@ import com.volmit.iris.engine.mantle.EngineMantle;
import com.volmit.iris.engine.modifier.IrisCarveModifier;
import com.volmit.iris.engine.modifier.IrisDepositModifier;
import com.volmit.iris.engine.modifier.IrisPostModifier;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisBiomePaletteLayer;
import com.volmit.iris.engine.object.IrisDecorator;
import com.volmit.iris.engine.object.IrisEngineData;
import com.volmit.iris.engine.object.IrisObjectPlacement;
import com.volmit.iris.engine.object.*;
import com.volmit.iris.engine.scripting.EngineExecutionEnvironment;
import com.volmit.iris.util.atomics.AtomicRollingSequence;
import com.volmit.iris.util.collection.KMap;
@@ -136,8 +132,7 @@ public class IrisEngine implements Engine {
}
private void tickRandomPlayer() {
if(perSecondBudLatch.flip())
{
if (perSecondBudLatch.flip()) {
buds.set(bud.get());
bud.set(0);
}

View File

@@ -25,7 +25,6 @@ import com.volmit.iris.engine.framework.EnginePlayer;
import com.volmit.iris.util.collection.KMap;
import com.volmit.iris.util.math.M;
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import java.util.List;

View File

@@ -27,14 +27,7 @@ import com.volmit.iris.engine.mantle.components.MantleCarvingComponent;
import com.volmit.iris.engine.mantle.components.MantleFeatureComponent;
import com.volmit.iris.engine.mantle.components.MantleJigsawComponent;
import com.volmit.iris.engine.mantle.components.MantleObjectComponent;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisDepositGenerator;
import com.volmit.iris.engine.object.IrisFeaturePotential;
import com.volmit.iris.engine.object.IrisJigsawStructurePlacement;
import com.volmit.iris.engine.object.IrisObject;
import com.volmit.iris.engine.object.IrisObjectPlacement;
import com.volmit.iris.engine.object.IrisObjectScale;
import com.volmit.iris.engine.object.IrisRegion;
import com.volmit.iris.engine.object.*;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KMap;
import com.volmit.iris.util.collection.KSet;

View File

@@ -22,15 +22,7 @@ import com.volmit.iris.Iris;
import com.volmit.iris.engine.data.cache.Cache;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.framework.EngineAssignedWorldManager;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisBlockDrops;
import com.volmit.iris.engine.object.IRare;
import com.volmit.iris.engine.object.IrisEngineChunkData;
import com.volmit.iris.engine.object.IrisEngineData;
import com.volmit.iris.engine.object.IrisEngineSpawnerCooldown;
import com.volmit.iris.engine.object.IrisEntitySpawn;
import com.volmit.iris.engine.object.IrisRegion;
import com.volmit.iris.engine.object.IrisSpawner;
import com.volmit.iris.engine.object.*;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KMap;
import com.volmit.iris.util.format.Form;
@@ -105,8 +97,7 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
interrupt();
}
if(!getEngine().getWorld().hasRealWorld() && clw.flip())
{
if (!getEngine().getWorld().hasRealWorld() && clw.flip()) {
getEngine().getWorld().tryGetRealWorld();
}
@@ -227,8 +218,7 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
Chunk c = cc[RNG.r.nextInt(cc.length)];
if(!c.isLoaded() || !Chunks.isSafe(c.getWorld(), c.getX(), c.getZ()))
{
if (!c.isLoaded() || !Chunks.isSafe(c.getWorld(), c.getX(), c.getZ())) {
continue;
}

View File

@@ -26,18 +26,7 @@ import com.volmit.iris.engine.IrisComplex;
import com.volmit.iris.engine.data.cache.Cache;
import com.volmit.iris.engine.data.chunk.TerrainChunk;
import com.volmit.iris.engine.mantle.EngineMantle;
import com.volmit.iris.engine.object.IrisColor;
import com.volmit.iris.engine.object.IrisPosition;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisWorld;
import com.volmit.iris.engine.object.IrisDimension;
import com.volmit.iris.engine.object.IrisEngineData;
import com.volmit.iris.engine.object.IrisLootMode;
import com.volmit.iris.engine.object.IrisLootReference;
import com.volmit.iris.engine.object.IrisLootTable;
import com.volmit.iris.engine.object.InventorySlotType;
import com.volmit.iris.engine.object.IrisObjectPlacement;
import com.volmit.iris.engine.object.IrisRegion;
import com.volmit.iris.engine.object.*;
import com.volmit.iris.engine.scripting.EngineExecutionEnvironment;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KMap;

View File

@@ -33,13 +33,9 @@ public abstract class EngineAssignedModifier<T> extends EngineAssignedComponent
@BlockCoordinates
@Override
public void modify(int x, int z, Hunk<T> output, boolean multicore) {
try
{
try {
onModify(x, z, output, multicore);
}
catch(Throwable e)
{
} catch (Throwable e) {
Iris.error("Modifier Failure: " + getName());
e.printStackTrace();
}

View File

@@ -19,8 +19,8 @@
package com.volmit.iris.engine.framework;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.engine.object.IrisWorld;
import com.volmit.iris.engine.object.IrisDimension;
import com.volmit.iris.engine.object.IrisWorld;
import com.volmit.iris.util.parallel.MultiBurst;
import lombok.Data;

View File

@@ -18,9 +18,9 @@
package com.volmit.iris.engine.framework;
import com.volmit.iris.engine.object.InventorySlotType;
import com.volmit.iris.engine.object.IrisLootReference;
import com.volmit.iris.engine.object.IrisLootTable;
import com.volmit.iris.engine.object.InventorySlotType;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.math.RNG;
import org.bukkit.block.Block;

View File

@@ -21,16 +21,7 @@ package com.volmit.iris.engine.jigsaw;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.core.tools.IrisToolbelt;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.object.IrisPosition;
import com.volmit.iris.engine.object.IObjectPlacer;
import com.volmit.iris.engine.object.IrisJigsawPiece;
import com.volmit.iris.engine.object.IrisJigsawPieceConnector;
import com.volmit.iris.engine.object.IrisLootTable;
import com.volmit.iris.engine.object.InventorySlotType;
import com.volmit.iris.engine.object.IrisObject;
import com.volmit.iris.engine.object.IrisObjectRotation;
import com.volmit.iris.engine.object.IrisObjectTranslate;
import com.volmit.iris.engine.object.TileData;
import com.volmit.iris.engine.object.*;
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.math.AxisAlignedBB;

View File

@@ -35,7 +35,6 @@ import com.volmit.iris.util.mantle.MantleFlag;
import com.volmit.iris.util.matter.Matter;
import com.volmit.iris.util.matter.MatterCavern;
import com.volmit.iris.util.matter.MatterMarker;
import com.volmit.iris.util.matter.slices.MarkerMatter;
import com.volmit.iris.util.matter.slices.UpdateMatter;
import com.volmit.iris.util.parallel.BurstExecutor;
import com.volmit.iris.util.parallel.MultiBurst;
@@ -65,12 +64,10 @@ public interface EngineMantle extends IObjectPlacer {
}
@ChunkCoordinates
default KList<IrisPosition> findMarkers(int x, int z, MatterMarker marker)
{
default KList<IrisPosition> findMarkers(int x, int z, MatterMarker marker) {
KList<IrisPosition> p = new KList<>();
getMantle().iterateChunk(x, z, MatterMarker.class, (xx, yy, zz, mm) -> {
if(marker.equals(mm))
{
if (marker.equals(mm)) {
p.add(new IrisPosition(xx + (x << 4), yy, zz + (z << 4)));
}
});

View File

@@ -22,9 +22,9 @@ import com.google.common.collect.ImmutableList;
import com.volmit.iris.Iris;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.engine.data.cache.Cache;
import com.volmit.iris.engine.object.IrisPosition;
import com.volmit.iris.engine.object.IObjectPlacer;
import com.volmit.iris.engine.object.IrisFeaturePositional;
import com.volmit.iris.engine.object.IrisPosition;
import com.volmit.iris.engine.object.TileData;
import com.volmit.iris.util.collection.KMap;
import com.volmit.iris.util.collection.KSet;

View File

@@ -22,13 +22,7 @@ import com.volmit.iris.engine.jigsaw.PlannedStructure;
import com.volmit.iris.engine.mantle.EngineMantle;
import com.volmit.iris.engine.mantle.IrisMantleComponent;
import com.volmit.iris.engine.mantle.MantleWriter;
import com.volmit.iris.engine.object.IrisPosition;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisFeaturePositional;
import com.volmit.iris.engine.object.IrisJigsawStructure;
import com.volmit.iris.engine.object.IrisJigsawStructurePlacement;
import com.volmit.iris.engine.object.NoiseStyle;
import com.volmit.iris.engine.object.IrisRegion;
import com.volmit.iris.engine.object.*;
import com.volmit.iris.util.documentation.BlockCoordinates;
import com.volmit.iris.util.documentation.ChunkCoordinates;
import com.volmit.iris.util.mantle.MantleFlag;

View File

@@ -23,13 +23,7 @@ import com.volmit.iris.engine.data.cache.Cache;
import com.volmit.iris.engine.mantle.EngineMantle;
import com.volmit.iris.engine.mantle.IrisMantleComponent;
import com.volmit.iris.engine.mantle.MantleWriter;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisFeature;
import com.volmit.iris.engine.object.IrisFeaturePositional;
import com.volmit.iris.engine.object.IrisFeaturePotential;
import com.volmit.iris.engine.object.IrisObject;
import com.volmit.iris.engine.object.IrisObjectPlacement;
import com.volmit.iris.engine.object.IrisRegion;
import com.volmit.iris.engine.object.*;
import com.volmit.iris.util.documentation.BlockCoordinates;
import com.volmit.iris.util.documentation.ChunkCoordinates;
import com.volmit.iris.util.mantle.MantleFlag;

View File

@@ -23,11 +23,7 @@ import com.volmit.iris.engine.actuator.IrisDecorantActuator;
import com.volmit.iris.engine.data.cache.Cache;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.framework.EngineAssignedModifier;
import com.volmit.iris.engine.object.IrisPosition;
import com.volmit.iris.engine.object.InferredType;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisDecorationPart;
import com.volmit.iris.engine.object.IrisDecorator;
import com.volmit.iris.engine.object.*;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KMap;
import com.volmit.iris.util.data.B;
@@ -65,8 +61,7 @@ public class IrisCarveModifier extends EngineAssignedModifier<BlockData> {
KMap<Long, KList<Integer>> positions = new KMap<>();
KMap<IrisPosition, MatterCavern> walls = new KMap<>();
Consumer4<Integer, Integer, Integer, MatterCavern> iterator = (xx, yy, zz, c) -> {
if(c == null)
{
if (c == null) {
return;
}
@@ -105,13 +100,9 @@ public class IrisCarveModifier extends EngineAssignedModifier<BlockData> {
return;
}
if(c.isWater())
{
if (c.isWater()) {
output.set(rx, yy, rz, WATER);
}
else
{
} else {
output.set(rx, yy, rz, AIR);
}
};
@@ -176,13 +167,11 @@ public class IrisCarveModifier extends EngineAssignedModifier<BlockData> {
int thickness = zone.airThickness();
String customBiome = "";
if(M.r(1D/16D))
{
if (M.r(1D / 16D)) {
mantle.set(xx, zone.ceiling, zz, MarkerMatter.CAVE_CEILING);
}
if(M.r(1D/16D))
{
if (M.r(1D / 16D)) {
mantle.set(xx, zone.floor, zz, MarkerMatter.CAVE_FLOOR);
}

View File

@@ -74,35 +74,29 @@ public class IrisCave extends IrisRegistrant {
double girth = getWorm().getGirth().get(rng, x, z, engine.getData());
KList<IrisPosition> points = getWorm().generate(rng, engine.getData(), writer, verticalRange, x, y, z,
(at) -> {});
(at) -> {
});
int highestWater = Math.max(waterHint, -1);
boolean water = false;
if(highestWater == -1)
{
for(IrisPosition i : points)
{
if (highestWater == -1) {
for (IrisPosition i : points) {
double yy = i.getY() + girth;
int th = engine.getHeight(x, z, true);
if(yy > th && th < engine.getDimension().getFluidHeight())
{
if (yy > th && th < engine.getDimension().getFluidHeight()) {
highestWater = Math.max(highestWater, (int) yy);
water = true;
break;
}
}
}
else
{
} else {
water = true;
}
int h = Math.min(Math.max(highestWater, waterHint), engine.getDimension().getFluidHeight());
for(IrisPosition i : points)
{
for (IrisPosition i : points) {
fork.doCarving(writer, rng, engine, i.getX(), i.getY(), i.getZ(), h);
}

View File

@@ -62,6 +62,7 @@ public class IrisCavePlacer implements IRare {
public IrisCave getRealCave(IrisData data) {
return caveCache.aquire(() -> data.getCaveLoader().load(getCave()));
}
public void generateCave(MantleWriter mantle, RNG rng, Engine engine, int x, int y, int z) {
generateCave(mantle, rng, engine, x, y, z, -1);
}
@@ -101,8 +102,7 @@ public class IrisCavePlacer implements IRare {
public int getSize(IrisData data) {
IrisCave cave = getRealCave(data);
if(cave != null)
{
if (cave != null) {
return cave.getMaxSize(data);
}

View File

@@ -19,7 +19,6 @@
package com.volmit.iris.engine.object;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.object.IrisRate;
import com.volmit.iris.util.math.M;
import lombok.Data;

View File

@@ -166,8 +166,7 @@ public class IrisEntity extends IrisRegistrant {
}
public Entity spawn(Engine gen, Location at, RNG rng) {
if(!Chunks.isSafe(at))
{
if (!Chunks.isSafe(at)) {
return null;
}
@@ -180,8 +179,7 @@ public class IrisEntity extends IrisRegistrant {
Entity ee = doSpawn(at);
if(ee == null && !Chunks.isSafe(at))
{
if (ee == null && !Chunks.isSafe(at)) {
return null;
}
@@ -345,8 +343,7 @@ public class IrisEntity extends IrisRegistrant {
AtomicInteger t = new AtomicInteger(0);
AtomicInteger v = new AtomicInteger(0);
v.set(J.sr(() -> {
if(t.get() > 100)
{
if (t.get() > 100) {
J.csr(v.get());
return;
}
@@ -389,8 +386,7 @@ public class IrisEntity extends IrisRegistrant {
}
private Entity doSpawn(Location at) {
if(!Chunks.isSafe(at))
{
if (!Chunks.isSafe(at)) {
return null;
}

View File

@@ -19,14 +19,11 @@
package com.volmit.iris.engine.object;
import com.volmit.iris.Iris;
import com.volmit.iris.engine.IrisComplex;
import com.volmit.iris.engine.data.cache.AtomicCache;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.object.annotations.*;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.format.C;
import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.matter.MatterMarker;
import com.volmit.iris.util.matter.slices.MarkerMatter;
import lombok.AllArgsConstructor;
import lombok.Data;

View File

@@ -19,7 +19,6 @@
package com.volmit.iris.engine.object;
import com.volmit.iris.engine.object.annotations.*;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.util.collection.KList;
import lombok.AllArgsConstructor;
import lombok.Data;

View File

@@ -21,8 +21,6 @@ package com.volmit.iris.engine.object;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.engine.data.cache.AtomicCache;
import com.volmit.iris.engine.object.annotations.*;
import com.volmit.iris.engine.object.IrisBlockData;
import com.volmit.iris.engine.object.IrisLootTable;
import com.volmit.iris.util.collection.KList;
import lombok.AllArgsConstructor;
import lombok.Data;

View File

@@ -21,8 +21,6 @@ package com.volmit.iris.engine.object;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.engine.data.cache.AtomicCache;
import com.volmit.iris.engine.object.annotations.*;
import com.volmit.iris.engine.object.IrisBlockData;
import com.volmit.iris.engine.object.IrisMaterialPalette;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.noise.CNG;

View File

@@ -88,51 +88,45 @@ public class IrisRavine extends IrisRegistrant {
public String getTypeName() {
return "Ravine";
}
public void generate(MantleWriter writer, RNG rng, Engine engine, int x, int y, int z) {
generate(writer, rng, engine, x, y, z, -1);
}
public void generate(MantleWriter writer, RNG rng, Engine engine, int x, int y, int z, int waterHint) {
KList<IrisPosition> pos = getWorm().generate(rng, engine.getData(), writer, null, x, y, z, (at) -> {});
KList<IrisPosition> pos = getWorm().generate(rng, engine.getData(), writer, null, x, y, z, (at) -> {
});
CNG dg = depthStyle.getGenerator().createNoCache(rng, engine.getData());
CNG bw = baseWidthStyle.getGenerator().createNoCache(rng, engine.getData());
int highestWater = Math.max(waterHint, -1);
boolean water = false;
if(highestWater == -1)
{
for(IrisPosition i : pos)
{
if (highestWater == -1) {
for (IrisPosition i : pos) {
int rsurface = y == -1 ? engine.getComplex().getHeightStream().get(x, z).intValue() : y;
int depth = (int) Math.round(dg.fitDouble(depthStyle.getMin(), depthStyle.getMax(), i.getX(), i.getZ()));
int surface = (int) Math.round(rsurface - depth * 0.45);
int yy = surface + depth;
int th = engine.getHeight(x, z, true);
if(yy > th && th < engine.getDimension().getFluidHeight())
{
if (yy > th && th < engine.getDimension().getFluidHeight()) {
highestWater = Math.max(highestWater, yy);
water = true;
break;
}
}
}
else
{
} else {
water = true;
}
MatterCavern c = new MatterCavern(true, customBiome, water);
if(pos.size() < nodeThreshold)
{
if (pos.size() < nodeThreshold) {
return;
}
for(IrisPosition p : pos)
{
for (IrisPosition p : pos) {
int rsurface = y == -1 ? engine.getComplex().getHeightStream().get(x, z).intValue() : y;
int depth = (int) Math.round(dg.fitDouble(depthStyle.getMin(), depthStyle.getMax(), p.getX(), p.getZ()));
int width = (int) Math.round(bw.fitDouble(baseWidthStyle.getMin(), baseWidthStyle.getMax(), p.getX(), p.getZ()));
@@ -140,18 +134,15 @@ public class IrisRavine extends IrisRegistrant {
fork.doCarving(writer, rng, engine, p.getX(), rng.i(surface - depth, surface), p.getZ(), Math.max(highestWater, waterHint));
for(int i = surface + depth; i >= surface; i--)
{
for (int i = surface + depth; i >= surface; i--) {
if (i % ribThickness == 0) {
double v = width + ((((surface + depth) - i) * (angle / 360D)));
if(v <= 0.25)
{
if (v <= 0.25) {
break;
}
if(i <= ribThickness+2)
{
if (i <= ribThickness + 2) {
break;
}
@@ -159,18 +150,15 @@ public class IrisRavine extends IrisRegistrant {
}
}
for(int i = surface - depth; i <= surface; i++)
{
for (int i = surface - depth; i <= surface; i++) {
if (i % ribThickness == 0) {
double v = width - ((((surface - depth) - i) * (angle / 360D)));
if(v <= 0.25)
{
if (v <= 0.25) {
break;
}
if(i <= ribThickness+2)
{
if (i <= ribThickness + 2) {
break;
}

View File

@@ -21,7 +21,7 @@ package com.volmit.iris.engine.object.annotations;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Retention(RUNTIME)

View File

@@ -26,8 +26,8 @@ import com.volmit.iris.engine.data.chunk.TerrainChunk;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.framework.EngineTarget;
import com.volmit.iris.engine.framework.WrongEngineBroException;
import com.volmit.iris.engine.object.IrisWorld;
import com.volmit.iris.engine.object.IrisDimension;
import com.volmit.iris.engine.object.IrisWorld;
import com.volmit.iris.engine.object.StudioMode;
import com.volmit.iris.engine.platform.studio.StudioGenerator;
import com.volmit.iris.util.collection.KList;

View File

@@ -59,10 +59,8 @@ public interface DecreeSystem extends CommandExecutor, TabCompleter {
KList<String> v = getRoot().tabComplete(enhanced, enhanced.toString(" "));
v.removeDuplicates();
if(sender instanceof Player)
{
if(IrisSettings.get().getGeneral().isCommandSounds())
{
if (sender instanceof Player) {
if (IrisSettings.get().getGeneral().isCommandSounds()) {
((Player) sender).playSound(((Player) sender).getLocation(), Sound.BLOCK_AMETHYST_BLOCK_CHIME, 0.25f, RNG.r.f(0.125f, 1.95f));
}
}
@@ -79,24 +77,17 @@ public interface DecreeSystem extends CommandExecutor, TabCompleter {
J.aBukkit(() -> {
if (!call(new VolmitSender(sender), args)) {
if(IrisSettings.get().getGeneral().isCommandSounds())
{
if(sender instanceof Player)
{
if (IrisSettings.get().getGeneral().isCommandSounds()) {
if (sender instanceof Player) {
((Player) sender).playSound(((Player) sender).getLocation(), Sound.BLOCK_AMETHYST_CLUSTER_BREAK, 0.77f, 0.25f);
((Player) sender).playSound(((Player) sender).getLocation(), Sound.BLOCK_BEACON_DEACTIVATE, 0.2f, 0.45f);
}
}
sender.sendMessage(C.RED + "Unknown Iris Command");
}
else
{
if(IrisSettings.get().getGeneral().isCommandSounds())
{
if(sender instanceof Player)
{
} else {
if (IrisSettings.get().getGeneral().isCommandSounds()) {
if (sender instanceof Player) {
((Player) sender).playSound(((Player) sender).getLocation(), Sound.BLOCK_AMETHYST_CLUSTER_BREAK, 0.77f, 1.65f);
((Player) sender).playSound(((Player) sender).getLocation(), Sound.BLOCK_RESPAWN_ANCHOR_CHARGE, 0.125f, 2.99f);
}

View File

@@ -65,21 +65,13 @@ public class BiomeHandler implements DecreeParameterHandler<IrisBiome> {
if (options.isEmpty()) {
throw new DecreeParsingException("Unable to find Biome \"" + in + "\"");
} else if (options.size() > 1) {
if(force)
{
try
{
if (force) {
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
}
catch(Throwable e)
{
} catch (Throwable e) {
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
}
}
else
{
} else {
throw new DecreeWhichException();
}
}

View File

@@ -62,21 +62,13 @@ public class DimensionHandler implements DecreeParameterHandler<IrisDimension> {
if (options.isEmpty()) {
throw new DecreeParsingException("Unable to find Dimension \"" + in + "\"");
} else if (options.size() > 1) {
if(force)
{
try
{
if (force) {
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
}
catch(Throwable e)
{
} catch (Throwable e) {
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
}
}
else
{
} else {
throw new DecreeWhichException();
}
}

View File

@@ -82,21 +82,13 @@ public class EntityHandler implements DecreeParameterHandler<IrisEntity> {
if (options.isEmpty()) {
throw new DecreeParsingException("Unable to find Entity \"" + in + "\"");
} else if (options.size() > 1) {
if(force)
{
try
{
if (force) {
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
}
catch(Throwable e)
{
} catch (Throwable e) {
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
}
}
else
{
} else {
throw new DecreeWhichException();
}
}

View File

@@ -62,21 +62,13 @@ public class GeneratorHandler implements DecreeParameterHandler<IrisGenerator> {
if (options.isEmpty()) {
throw new DecreeParsingException("Unable to find Generator \"" + in + "\"");
} else if (options.size() > 1) {
if(force)
{
try
{
if (force) {
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
}
catch(Throwable e)
{
} catch (Throwable e) {
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
}
}
else
{
} else {
throw new DecreeWhichException();
}
}

View File

@@ -46,21 +46,13 @@ public class PlayerHandler implements DecreeParameterHandler<Player> {
if (options.isEmpty()) {
throw new DecreeParsingException("Unable to find Player \"" + in + "\"");
} else if (options.size() > 1) {
if(force)
{
try
{
if (force) {
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
}
catch(Throwable e)
{
} catch (Throwable e) {
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
}
}
else
{
} else {
throw new DecreeWhichException();
}
}

View File

@@ -65,21 +65,13 @@ public class RegionHandler implements DecreeParameterHandler<IrisRegion> {
if (options.isEmpty()) {
throw new DecreeParsingException("Unable to find Region \"" + in + "\"");
} else if (options.size() > 1) {
if(force)
{
try
{
if (force) {
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
}
catch(Throwable e)
{
} catch (Throwable e) {
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
}
}
else
{
} else {
throw new DecreeWhichException();
}
}

View File

@@ -62,21 +62,13 @@ public class ScriptHandler implements DecreeParameterHandler<IrisScript> {
if (options.isEmpty()) {
throw new DecreeParsingException("Unable to find Script \"" + in + "\"");
} else if (options.size() > 1) {
if(force)
{
try
{
if (force) {
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
}
catch(Throwable e)
{
} catch (Throwable e) {
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
}
}
else
{
} else {
throw new DecreeWhichException();
}
}

View File

@@ -51,21 +51,13 @@ public class WorldHandler implements DecreeParameterHandler<World> {
if (options.isEmpty()) {
throw new DecreeParsingException("Unable to find World \"" + in + "\"");
} else if (options.size() > 1) {
if(force)
{
try
{
if (force) {
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
}
catch(Throwable e)
{
} catch (Throwable e) {
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
}
}
else
{
} else {
throw new DecreeWhichException();
}
}

View File

@@ -56,21 +56,13 @@ public class ObjectHandler implements DecreeParameterHandler<String> {
if (options.isEmpty()) {
throw new DecreeParsingException("Unable to find Object \"" + in + "\"");
} else if (options.size() > 1) {
if(force)
{
try
{
if (force) {
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
}
catch(Throwable e)
{
} catch (Throwable e) {
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
}
}
else
{
} else {
throw new DecreeWhichException();
}
}

View File

@@ -34,18 +34,18 @@ import com.volmit.iris.util.plugin.CommandDummy;
import com.volmit.iris.util.plugin.VolmitSender;
import com.volmit.iris.util.scheduling.ChronoLatch;
import com.volmit.iris.util.scheduling.J;
import com.volmit.iris.util.stream.utility.SemaphoreStream;
import lombok.Data;
import org.bukkit.Sound;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Objects;
import java.util.UUID;
import java.util.concurrent.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
@Data
public class VirtualDecreeCommand {
@@ -105,17 +105,14 @@ public class VirtualDecreeCommand {
private ChronoLatch cl = new ChronoLatch(1000);
public void cacheAll()
{
public void cacheAll() {
VolmitSender sender = new VolmitSender(new CommandDummy());
if(isNode())
{
if (isNode()) {
J.a(() -> sender.sendDecreeHelpNode(this));
}
for(VirtualDecreeCommand j : nodes)
{
for (VirtualDecreeCommand j : nodes) {
j.cacheAll();
}
}
@@ -286,8 +283,7 @@ public class VirtualDecreeCommand {
for (int ix = 0; ix < in.size(); ix++) {
String i = in.get(ix);
if(i == null)
{
if (i == null) {
continue;
}
@@ -337,8 +333,7 @@ public class VirtualDecreeCommand {
Iris.debug("Found multiple results for " + key + "=" + value + " in " + getPath() + " using the handler " + param.getHandler().getClass().getSimpleName() + " with potential matches [" + validOptions.toString(",") + "]. Asking client to define one");
String update = pickValidOption(sender, validOptions, param.getHandler(), param.getName(), param.getType().getSimpleName());
if(update == null)
{
if (update == null) {
return null;
}
@@ -360,8 +355,7 @@ public class VirtualDecreeCommand {
KList<?> validOptions = par.getHandler().getPossibilities(i);
String update = pickValidOption(sender, validOptions, par.getHandler(), par.getName(), par.getType().getSimpleName());
if(update == null)
{
if (update == null) {
return null;
}
@@ -403,14 +397,9 @@ public class VirtualDecreeCommand {
sender.sendDecreeHelp(this);
return true;
}
else if(args.size() == 1)
{
for(String i : args)
{
if(i.startsWith("help="))
{
} else if (args.size() == 1) {
for (String i : args) {
if (i.startsWith("help=")) {
sender.sendDecreeHelp(this, Integer.parseInt(i.split("\\Q=\\E")[1]) - 1);
return true;
}
@@ -452,8 +441,7 @@ public class VirtualDecreeCommand {
KList<?> validOptions = i.getHandler().getPossibilities(i.getParam().defaultValue());
String update = pickValidOption(sender, validOptions, i.getHandler(), i.getName(), i.getType().getSimpleName());
if(update == null)
{
if (update == null) {
return false;
}
@@ -530,8 +518,7 @@ public class VirtualDecreeCommand {
String password = UUID.randomUUID().toString().replaceAll("\\Q-\\E", "");
int m = 0;
for(String i : validOptions.convert(handler::toStringForce))
{
for (String i : validOptions.convert(handler::toStringForce)) {
sender.sendMessage("<hover:show_text:'" + gradients[m % gradients.length] + i + "</gradient>'><click:run_command:/irisdecree " + password + " " + i + ">" + "- " + gradients[m % gradients.length] + i + "</gradient></click></hover>");
m++;
}
@@ -539,8 +526,7 @@ public class VirtualDecreeCommand {
CompletableFuture<String> future = new CompletableFuture<>();
Iris.service(CommandSVC.class).post(password, future);
if(IrisSettings.get().getGeneral().isCommandSounds() && sender.isPlayer())
{
if (IrisSettings.get().getGeneral().isCommandSounds() && sender.isPlayer()) {
(sender.player()).playSound((sender.player()).getLocation(), Sound.BLOCK_AMETHYST_CLUSTER_BREAK, 0.77f, 0.65f);
(sender.player()).playSound((sender.player()).getLocation(), Sound.BLOCK_BEACON_DEACTIVATE, 0.125f, 1.99f);
}

View File

@@ -20,7 +20,6 @@ package com.volmit.iris.util.io;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.function.Consumer3;
import com.volmit.iris.util.plugin.VolmitSender;
import java.io.File;
@@ -48,8 +47,7 @@ public class ReactiveFolder {
if (checkCycle % 3 == 0 ? fw.checkModified() : fw.checkModifiedFast()) {
for (File i : fw.getCreated()) {
if (i.getName().endsWith(".iob") || i.getName().endsWith(".json") || i.getName().endsWith(".js")) {
if(i.getPath().contains(".iris"))
{
if (i.getPath().contains(".iris")) {
continue;
}
@@ -60,8 +58,7 @@ public class ReactiveFolder {
if (!modified) {
for (File i : fw.getChanged()) {
if(i.getPath().contains(".iris"))
{
if (i.getPath().contains(".iris")) {
continue;
}
@@ -74,8 +71,7 @@ public class ReactiveFolder {
if (!modified) {
for (File i : fw.getDeleted()) {
if(i.getPath().contains(".iris"))
{
if (i.getPath().contains(".iris")) {
continue;
}

View File

@@ -18,7 +18,6 @@
package com.volmit.iris.util.matter;
import com.volmit.iris.util.matter.slices.MarkerMatter;
import lombok.AllArgsConstructor;
import lombok.Data;

View File

@@ -23,8 +23,7 @@ import org.bukkit.World;
import org.bukkit.entity.Player;
public class Chunks {
public static boolean isSafe(World w, int x, int z)
{
public static boolean isSafe(World w, int x, int z) {
return w.isChunkLoaded(x, z)
&& w.isChunkLoaded(x + 1, z)
&& w.isChunkLoaded(x, z + 1)
@@ -36,18 +35,14 @@ public class Chunks {
&& w.isChunkLoaded(x - 1, z + 1);
}
public static boolean isSafe(Location l)
{
public static boolean isSafe(Location l) {
return isSafe(l.getWorld(), l.getBlockX() >> 4, l.getBlockZ() >> 4);
}
public static boolean hasPlayersNearby(Location at) {
try {
return !at.getWorld().getNearbyEntities(at, 32, 32, 32, (i) -> i instanceof Player).isEmpty();
}
catch(Throwable ignored)
{
} catch (Throwable ignored) {
return false;
}
}

View File

@@ -42,7 +42,6 @@ import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.Plugin;
import org.bukkit.util.ChatPaginator;
import java.time.Duration;
import java.util.Set;
@@ -251,8 +250,7 @@ public class VolmitSender implements CommandSender {
}
private Component createNoPrefixComponent(String message) {
if(!IrisSettings.get().getGeneral().canUseCustomColors(this))
{
if (!IrisSettings.get().getGeneral().canUseCustomColors(this)) {
String t = C.translateAlternateColorCodes('&', MiniMessage.get().stripTokens(message));
return MiniMessage.get().parse(t);
}
@@ -267,8 +265,7 @@ public class VolmitSender implements CommandSender {
}
private Component createComponent(String message) {
if(!IrisSettings.get().getGeneral().canUseCustomColors(this))
{
if (!IrisSettings.get().getGeneral().canUseCustomColors(this)) {
String t = C.translateAlternateColorCodes('&', MiniMessage.get().stripTokens(getTag() + message));
return MiniMessage.get().parse(t);
}
@@ -279,8 +276,7 @@ public class VolmitSender implements CommandSender {
}
private Component createComponentRaw(String message) {
if(!IrisSettings.get().getGeneral().canUseCustomColors(this))
{
if (!IrisSettings.get().getGeneral().canUseCustomColors(this)) {
String t = C.translateAlternateColorCodes('&', MiniMessage.get().stripTokens(getTag() + message));
return MiniMessage.get().parse(t);
}
@@ -315,8 +311,7 @@ public class VolmitSender implements CommandSender {
@Override
public void sendMessage(String message) {
if(s instanceof CommandDummy)
{
if (s instanceof CommandDummy) {
return;
}
@@ -341,8 +336,7 @@ public class VolmitSender implements CommandSender {
}
public void sendMessageRaw(String message) {
if(s instanceof CommandDummy)
{
if (s instanceof CommandDummy) {
return;
}
@@ -445,15 +439,13 @@ public class VolmitSender implements CommandSender {
}
public static <T> KList<T> paginate(KList<T> all, int linesPerPage, int page, AtomicBoolean hasNext)
{
public static <T> KList<T> paginate(KList<T> all, int linesPerPage, int page, AtomicBoolean hasNext) {
int totalPages = (int) Math.ceil((double) all.size() / linesPerPage);
page = page < 0 ? 0 : page >= totalPages ? totalPages - 1 : page;
hasNext.set(page < totalPages - 1);
KList<T> d = new KList<>();
for(int i = linesPerPage * page; i < Math.min(all.size(), linesPerPage * (page + 1)); i++)
{
for (int i = linesPerPage * page; i < Math.min(all.size(), linesPerPage * (page + 1)); i++) {
d.add(all.get(i));
}
@@ -461,8 +453,7 @@ public class VolmitSender implements CommandSender {
}
public void sendDecreeHelp(VirtualDecreeCommand v, int page) {
if(!isPlayer())
{
if (!isPlayer()) {
for (VirtualDecreeCommand i : v.getNodes()) {
sendDecreeHelpNode(i);
}
@@ -488,15 +479,13 @@ public class VolmitSender implements CommandSender {
String s = "";
int l = 75 - (page > 0 ? 10 : 0) - (next.get() ? 10 : 0);
if(page > 0)
{
if (page > 0) {
s += "<hover:show_text:'<green>Click to go back to page " + page + "'><click:run_command:" + v.getPath() + " help=" + page + "><gradient:#27b84d:#2770b8>〈 Page " + page + "</click></hover><reset> ";
}
s += "<reset><font:minecraft:uniform><strikethrough><gradient:#32bfad:#34eb6b>" + Form.repeat(" ", l) + "<reset>";
if(next.get())
{
if (next.get()) {
s += " <hover:show_text:'<green>Click to go to back to page " + (page + 2) + "'><click:run_command:" + v.getPath() + " help=" + (page + 2) + "><gradient:#2770b8:#27b84d>Page " + (page + 2) + " ❭</click></hover>";
}
@@ -512,8 +501,7 @@ public class VolmitSender implements CommandSender {
public void sendDecreeHelpNode(VirtualDecreeCommand i) {
if (isPlayer() || s instanceof CommandDummy) {
sendMessageRaw(helpCache.compute(i.getPath(), (k, v) -> {
if(v != null)
{
if (v != null) {
return v;
}