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

BIN
lint/ZKM.jar Normal file

Binary file not shown.

BIN
lint/ZKM_EX.ser Normal file

Binary file not shown.

0
lint/ZKM_LoadLog.txt Normal file
View File

BIN
lint/ZKM_O.ser Normal file

Binary file not shown.

BIN
lint/ZKM_OB_REF.ser Normal file

Binary file not shown.

BIN
lint/ZKM_SO.ser Normal file

Binary file not shown.

BIN
lint/ZKM_TEX.ser Normal file

Binary file not shown.

BIN
lint/ZKM_TO.ser Normal file

Binary file not shown.

1824
lint/ZKM_TrimLog.txt Normal file

File diff suppressed because it is too large Load Diff

213
lint/ZKM_WarningLog.txt Normal file
View File

@@ -0,0 +1,213 @@
In class com.google.gson.FieldAttributes
in method public java.lang.String getName()
java.lang.reflect.Field.getName()
In class com.google.gson.FieldNamingPolicy$1
in method public java.lang.String translateName(java.lang.reflect.Field)
java.lang.reflect.Field.getName()
In class com.google.gson.FieldNamingPolicy$2
in method public java.lang.String translateName(java.lang.reflect.Field)
java.lang.reflect.Field.getName()
In class com.google.gson.FieldNamingPolicy$3
in method public java.lang.String translateName(java.lang.reflect.Field)
java.lang.reflect.Field.getName()
In class com.google.gson.FieldNamingPolicy$4
in method public java.lang.String translateName(java.lang.reflect.Field)
java.lang.reflect.Field.getName()
In class com.google.gson.FieldNamingPolicy$5
in method public java.lang.String translateName(java.lang.reflect.Field)
java.lang.reflect.Field.getName()
In class com.google.gson.FieldNamingPolicy$6
in method public java.lang.String translateName(java.lang.reflect.Field)
java.lang.reflect.Field.getName()
In class com.google.gson.internal.$Gson$Types
in method public static java.lang.Class getRawType(java.lang.reflect.Type)
java.lang.Class.getName()
in method public static java.lang.String typeToString(java.lang.reflect.Type)
java.lang.Class.getName()
In class com.google.gson.internal.LinkedHashTreeMap
in method com.google.gson.internal.LinkedHashTreeMap$Node find(java.lang.Object, boolean)
java.lang.Class.getName()
In class com.google.gson.internal.LinkedTreeMap
in method com.google.gson.internal.LinkedTreeMap$Node find(java.lang.Object, boolean)
java.lang.Class.getName()
In class com.google.gson.internal.UnsafeAllocator
in method public static com.google.gson.internal.UnsafeAllocator create()
java.lang.Class.getDeclaredMethod(java.lang.String, java.lang.Class[])
java.lang.Class.getDeclaredMethod(java.lang.String, java.lang.Class[])
java.lang.Class.getDeclaredMethod(java.lang.String, java.lang.Class[])
in method static void assertInstantiable(java.lang.Class)
java.lang.Class.getName()
java.lang.Class.getName()
In class com.google.gson.internal.bind.JsonAdapterAnnotationTypeAdapterFactory
in method com.google.gson.TypeAdapter getTypeAdapter(com.google.gson.internal.ConstructorConstructor, com.google.gson.Gson, com.google.gson.reflect.TypeToken, com.google.gson.annotations.JsonAdapter)
java.lang.Class.getName()
In class com.google.gson.internal.bind.TypeAdapters$1
in method public void write(com.google.gson.stream.JsonWriter, java.lang.Class)
java.lang.Class.getName()
In class com.google.gson.internal.bind.TypeAdapters$32
in method public java.lang.String toString()
java.lang.Class.getName()
In class com.google.gson.internal.bind.TypeAdapters$33
in method public java.lang.String toString()
java.lang.Class.getName()
java.lang.Class.getName()
In class com.google.gson.internal.bind.TypeAdapters$34
in method public java.lang.String toString()
java.lang.Class.getName()
java.lang.Class.getName()
In class com.google.gson.internal.bind.TypeAdapters$35
in method public java.lang.String toString()
java.lang.Class.getName()
In class com.google.gson.internal.bind.TypeAdapters$35$1
in method public java.lang.Object read(com.google.gson.stream.JsonReader)
java.lang.Class.getName()
java.lang.Class.getName()
In class com.google.gson.internal.bind.TypeAdapters$EnumTypeAdapter
in method public TypeAdapters$EnumTypeAdapter(java.lang.Class)
java.lang.Class.getField(java.lang.String)
In class com.google.gson.internal.bind.util.ISO8601Utils
in method public static java.util.Date parse(java.lang.String, java.text.ParsePosition)
java.lang.Class.getName()
In class com.google.gson.internal.reflect.UnsafeReflectionAccessor
in method boolean makeAccessibleWithUnsafe(java.lang.reflect.AccessibleObject)
java.lang.Class.getMethod(java.lang.String, java.lang.Class[])
java.lang.Class.getMethod(java.lang.String, java.lang.Class[])
In class com.google.gson.reflect.TypeToken
in method private static java.lang.AssertionError buildUnexpectedTypeError(java.lang.reflect.Type, java.lang.Class[])
java.lang.Class.getName()
java.lang.Class.getName()
In class com.volmit.iris.ProjectManager
in method public com.volmit.iris.util.JSONObject getSchemaFor(java.lang.Class, int, com.volmit.iris.util.KMap, com.volmit.iris.IrisDataManager)
java.lang.reflect.Field.getName()
java.lang.reflect.Field.getName()
java.lang.reflect.Field.getName()
java.lang.reflect.Field.getName()
java.lang.reflect.Field.getName()
java.lang.reflect.Field.getName()
java.lang.reflect.Field.getName()
java.lang.reflect.Field.getName()
java.lang.reflect.Field.getName()
java.lang.reflect.Field.getName()
java.lang.reflect.Field.getName()
java.lang.reflect.Field.getName()
java.lang.reflect.Field.getName()
java.lang.reflect.Field.getName()
java.lang.reflect.Field.getName()
in method private void verify(com.volmit.iris.util.JSONObject, java.lang.Object, com.volmit.iris.util.KList, java.io.File)
java.lang.Class.getDeclaredField(java.lang.String)
in method public com.volmit.iris.util.KList analyze(java.lang.Object, java.io.File)
java.lang.Class.getDeclaredField(java.lang.String)
In class com.volmit.iris.gen.PostBlockChunkGenerator
in method public void onInit(org.bukkit.World, com.volmit.iris.util.RNG)
java.lang.Class.getConstructor(java.lang.Class[])
In class com.volmit.iris.object.IrisEnchantment
in method public org.bukkit.enchantments.Enchantment getEnchant()
java.lang.reflect.Field.getName()
In class com.volmit.iris.util.FastReflection
in method public static java.lang.Class nmsClass(java.lang.String)
java.lang.Class.forName(java.lang.String)
in method public static java.lang.Class obcClass(java.lang.String)
java.lang.Class.forName(java.lang.String)
in method public static java.util.Optional optionalClass(java.lang.String)
java.lang.Class.forName(java.lang.String)
in method static
java.lang.Package.getName()
In class com.volmit.iris.util.JSONObject
in method public JSONObject(java.lang.Object, java.lang.String[])
java.lang.Class.getField(java.lang.String)
in method public static java.lang.String[] getNames(java.lang.Object)
java.lang.reflect.Field.getName()
in method private void populateMap(java.lang.Object)
java.lang.reflect.Method.getName()
in method public static java.lang.Object wrap(java.lang.Object)
java.lang.Package.getName()
In class com.volmit.iris.util.JarScanner
in method public void scan()
java.lang.Class.forName(java.lang.String)
In class com.volmit.iris.util.MortarCommand
in method private com.volmit.iris.util.KList buildChildren()
java.lang.Class.getConstructor(java.lang.Class[])
In class com.volmit.iris.util.MortarPermission
in method public MortarPermission()
java.lang.Class.getConstructor(java.lang.Class[])
In class com.volmit.iris.util.MortarPlugin
in method private void registerPermissions()
java.lang.Class.getConstructor(java.lang.Class[])
java.lang.reflect.Field.getName()
java.lang.reflect.Field.getName()
in method private void registerControllers()
java.lang.Class.getConstructor(java.lang.Class[])
java.lang.reflect.Field.getName()
java.lang.reflect.Field.getName()
in method private void registerInstance()
java.lang.reflect.Field.getName()
java.lang.reflect.Field.getName()
in method private void unregisterInstance()
java.lang.reflect.Field.getName()
java.lang.reflect.Field.getName()
in method private void registerCommands()
java.lang.Class.getConstructor(java.lang.Class[])
java.lang.reflect.Field.getName()
java.lang.reflect.Field.getName()
In class com.volmit.iris.util.NBTUtils
in method public static java.lang.String getTypeName(java.lang.Class)
java.lang.Class.getName()
in method public static int getTypeCode(java.lang.Class)
java.lang.Class.getName()
In class com.volmit.iris.util.NMSVersion
in method private static boolean tryVersion(java.lang.String)
java.lang.Class.forName(java.lang.String)
In class com.volmit.iris.util.ParticleSenderLegacy
in method static
java.lang.Class.getMethod(java.lang.String, java.lang.Class[])
java.lang.Class.getConstructor(java.lang.Class[])
java.lang.Class.getConstructor(java.lang.Class[])
java.lang.Class.getField(java.lang.String)
java.lang.Class.getDeclaredMethod(java.lang.String, java.lang.Class[])
java.lang.Class.getDeclaredMethod(java.lang.String, java.lang.Class[])
java.lang.Class.getDeclaredMethod(java.lang.String, java.lang.Class[])
java.lang.Class.getDeclaredMethod(java.lang.String, java.lang.Class[])
In class com.volmit.iris.util.Violator
in method private static java.lang.String id(java.lang.Object, java.lang.Object)
java.lang.reflect.Method.getName()
java.lang.reflect.Field.getName()
in method public static java.lang.reflect.Constructor getConstructor(java.lang.Class, java.lang.Class[])
java.lang.Class.getConstructor(java.lang.Class[])
in method public static java.lang.reflect.Field getField(java.lang.Class, java.lang.String)
java.lang.Class.getField(java.lang.String)
java.lang.Class.getField(java.lang.String)
in method public static java.lang.reflect.Field getDeclaredField(java.lang.Class, java.lang.String)
java.lang.Class.getDeclaredField(java.lang.String)
java.lang.Class.getDeclaredField(java.lang.String)
in method public static java.lang.reflect.Method getMethod(java.lang.Class, java.lang.String, java.lang.Class[])
java.lang.Class.getMethod(java.lang.String, java.lang.Class[])
in method public static java.lang.reflect.Method getDeclaredMethod(java.lang.Class, java.lang.String, java.lang.Class[])
java.lang.Class.getDeclaredMethod(java.lang.String, java.lang.Class[])
In class com.volmit.iris.util.VirtualCommand
in method public VirtualCommand(com.volmit.iris.util.ICommand, java.lang.String)
java.lang.Class.getConstructor(java.lang.Class[])
java.lang.reflect.Field.getName()
In class org.slf4j.LoggerFactory
in method public static org.slf4j.Logger getLogger(java.lang.Class)
java.lang.Class.getName()
In class org.slf4j.helpers.MarkerIgnoringBase
in method public java.lang.String toString()
java.lang.Class.getName()
In class org.slf4j.helpers.MessageFormatter
in method private static void safeObjectAppend(java.lang.StringBuffer, java.lang.Object)
java.lang.Class.getName()
In class org.zeroturnaround.zip.ZTZipReflectionUtil
in method static java.lang.reflect.Method getDeclaredMethod(java.lang.Class, java.lang.String, java.lang.Class[])
java.lang.Class.getDeclaredMethod(java.lang.String, java.lang.Class[])
In class org.zeroturnaround.zip.ZipFileUtil
in method static java.util.zip.ZipInputStream createZipInputStream(java.io.InputStream, java.nio.charset.Charset)
java.lang.Class.getConstructor(java.lang.Class[])
in method static java.util.zip.ZipOutputStream createZipOutputStream(java.io.BufferedOutputStream, java.nio.charset.Charset)
java.lang.Class.getConstructor(java.lang.Class[])
in method static java.util.zip.ZipFile getZipFile(java.io.File, java.nio.charset.Charset)
java.lang.Class.getConstructor(java.lang.Class[])
in method static boolean isCharsetSupported()
java.lang.Class.getConstructor(java.lang.Class[])
In class org.zeroturnaround.zip.extra.ExtraFieldUtils
in method public static org.zeroturnaround.zip.extra.ZipExtraField createExtraField(org.zeroturnaround.zip.extra.ZipShort)
java.lang.Class.newInstance()

234
lint/ZKM_log.txt Normal file
View File

@@ -0,0 +1,234 @@
[2020.09.17 12:53:51] Using "C:\Program Files\Java\jre1.8.0_221\lib\resources.jar;C:\Program Files\Java\jre1.8.0_221\lib\rt.jar;C:\Program Files\Java\jre1.8.0_221\lib\jsse.jar;C:\Program Files\Java\jre1.8.0_221\lib\jce.jar;C:\Program Files\Java\jre1.8.0_221\lib\charsets.jar;C:\Program Files\Java\jre1.8.0_221\lib\jfr.jar" as path to java.lang.Object (D)
[2020.09.17 12:53:51] Zelix KlassMaster 13.0.0
Unlimited
Copyright 1997-2019 Zelix Pty Ltd (47 078 740 093)
All rights reserved
[2020.09.17 12:53:51] Preprocessing ZKM Script file "C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\script.zkm"
[2020.09.17 12:53:51] Parsing ZKM Script file "C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\script.zkm"
ERROR: Invalid classpath in "classpath" statement at line 5 : "C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\lib\zt-zip-1.14.jar" is not a valid path.
[2020.09.17 12:53:52] Setting classpath to "C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\ZKM.jar;C:\Program Files\Java\jre1.8.0_221\lib\resources.jar;C:\Program Files\Java\jre1.8.0_221\lib\rt.jar;C:\Program Files\Java\jre1.8.0_221\lib\jsse.jar;C:\Program Files\Java\jre1.8.0_221\lib\jce.jar;C:\Program Files\Java\jre1.8.0_221\lib\charsets.jar;C:\Program Files\Java\jre1.8.0_221\lib\jfr.jar;C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\lib\bungeecord-api.jar;C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\lib\craftbukkit-14.jar;C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\lib\craftbukkit-1.15.2.jar;C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\lib\craftbukkit-1.16.1.jar;C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\lib\craftbukkit-1.16.2.jar;C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\lib\lombok-1.18.10.jar;C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\lib\slf4j-simp.jar;C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\lib\worldedit-core-7.2.0-20200907.181948-146.jar;C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\lib\worldedit-bukkit-7.2.0-20200907.181948-147.jar;C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\lib\spigot.jar"
[2020.09.17 12:53:52] Opening classes...
WARNING: Could not find method 'void setBiome(int, int, int, org.bukkit.block.Biome)' in class 'C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\lib\craftbukkit-14.jar!org/bukkit/generator/ChunkGenerator$BiomeGrid.class' (org.bukkit.generator.ChunkGenerator$BiomeGrid) or in its hierarchy. Such a reference occurs in class C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\in.jar!com/volmit/iris/gen/atomics/AtomicSliver.class. Please check the classpath and reopen your classes (B).
API calls detected that may not be handled automatically...
In class com.github.benmanes.caffeine.base.UnsafeAccess
in method public static long objectFieldOffset(java.lang.Class, java.lang.String)
java.lang.Class.getDeclaredField(java.lang.String)
in method static sun.misc.Unsafe load(java.lang.String, java.lang.String)
java.lang.Class.getDeclaredField(java.lang.String)
java.lang.Class.getDeclaredField(java.lang.String)
In class com.github.benmanes.caffeine.cache.BaseMpscLinkedArrayQueue
in method public java.lang.String toString()
java.lang.Class.getName()
in method static
java.lang.Class.getDeclaredField(java.lang.String)
java.lang.Class.getDeclaredField(java.lang.String)
java.lang.Class.getDeclaredField(java.lang.String)
In class com.github.benmanes.caffeine.cache.BoundedLocalCache
in method static
java.lang.Class.getName()
In class com.github.benmanes.caffeine.cache.Caffeine
in method static
java.lang.Class.getName()
In class com.github.benmanes.caffeine.cache.ExecutorServiceScheduler
in method static
java.lang.Class.getName()
In class com.github.benmanes.caffeine.cache.GuardedScheduler
in method static
java.lang.Class.getName()
In class com.github.benmanes.caffeine.cache.LocalAsyncCache
in method static
java.lang.Class.getName()
In class com.github.benmanes.caffeine.cache.LocalAsyncLoadingCache
in method static
java.lang.Class.getName()
in method private static boolean canBulkLoad(com.github.benmanes.caffeine.cache.AsyncCacheLoader)
java.lang.Class.getMethod(java.lang.String, java.lang.Class[])
java.lang.Class.getMethod(java.lang.String, java.lang.Class[])
java.lang.Class.getMethod(java.lang.String, java.lang.Class[])
java.lang.Class.getMethod(java.lang.String, java.lang.Class[])
In class com.github.benmanes.caffeine.cache.LocalCacheFactory
in method static com.github.benmanes.caffeine.cache.BoundedLocalCache newBoundedLocalCache(com.github.benmanes.caffeine.cache.Caffeine, com.github.benmanes.caffeine.cache.CacheLoader, boolean)
java.lang.ClassLoader.loadClass(java.lang.String)
In class com.github.benmanes.caffeine.cache.LocalLoadingCache
in method static
java.lang.Class.getName()
in method public static boolean hasLoadAll(com.github.benmanes.caffeine.cache.CacheLoader)
java.lang.Class.getMethod(java.lang.String, java.lang.Class[])
java.lang.Class.getMethod(java.lang.String, java.lang.Class[])
In class com.github.benmanes.caffeine.cache.NodeFactory
in method public static com.github.benmanes.caffeine.cache.NodeFactory newFactory(com.github.benmanes.caffeine.cache.Caffeine, boolean)
java.lang.ClassLoader.loadClass(java.lang.String)
In class com.github.benmanes.caffeine.cache.SystemScheduler
in method static java.lang.reflect.Method getDelayedExecutorMethod()
java.lang.Class.getMethod(java.lang.String, java.lang.Class[])
In class com.github.benmanes.caffeine.cache.stats.GuardedStatsCounter
in method static
java.lang.Class.getName()
In class com.volmit.iris.link.MultiverseCoreLink
in method public boolean addWorld(java.lang.String, com.volmit.iris.object.IrisDimension, java.lang.String)
java.lang.Class.getDeclaredMethod(java.lang.String, java.lang.Class[])
java.lang.Class.getDeclaredMethod(java.lang.String, java.lang.Class[])
in method public java.util.Map getList()
java.lang.Class.getDeclaredField(java.lang.String)
java.lang.Class.getDeclaredMethod(java.lang.String, java.lang.Class[])
in method public void saveConfig()
java.lang.Class.getDeclaredMethod(java.lang.String, java.lang.Class[])
java.lang.Class.getDeclaredMethod(java.lang.String, java.lang.Class[])
In class com.volmit.iris.manager.ProjectManager
in method public com.volmit.iris.util.KList analyze(java.lang.Object, java.io.File)
java.lang.Class.getDeclaredField(java.lang.String)
in method private void verify(com.volmit.iris.util.JSONObject, java.lang.Object, com.volmit.iris.util.KList, java.io.File)
java.lang.Class.getDeclaredField(java.lang.String)
In class com.volmit.iris.manager.SchemaBuilder
in method private static com.volmit.iris.util.JSONArray getEnchantmentTypes()
java.lang.reflect.Field.getName()
in method private java.lang.String getFieldDescription(java.lang.reflect.Field)
java.lang.reflect.Field.getName()
in method private com.volmit.iris.util.JSONObject buildProperty(java.lang.reflect.Field, java.lang.Class)
java.lang.reflect.Field.getName()
java.lang.reflect.Field.getName()
java.lang.reflect.Field.getName()
java.lang.Class.getField(java.lang.String)
java.lang.Class.getField(java.lang.String)
java.lang.Class.newInstance()
in method private com.volmit.iris.util.JSONObject buildProperties(java.lang.Class)
java.lang.reflect.Field.getName()
java.lang.reflect.Field.getName()
In class com.volmit.iris.object.IrisEnchantment
in method public org.bukkit.enchantments.Enchantment getEnchant()
java.lang.reflect.Field.getName()
In class com.volmit.iris.util.FastReflection
in method public static java.lang.Class obcClass(java.lang.String)
java.lang.Class.forName(java.lang.String)
in method public static java.lang.Class nmsClass(java.lang.String)
java.lang.Class.forName(java.lang.String)
in method static
java.lang.Package.getName()
In class com.volmit.iris.util.JSONObject
in method public static java.lang.String[] getNames(java.lang.Object)
java.lang.reflect.Field.getName()
in method public JSONObject(java.lang.Object, java.lang.String[])
java.lang.Class.getField(java.lang.String)
in method private void populateMap(java.lang.Object)
java.lang.reflect.Method.getName()
in method public static java.lang.Object wrap(java.lang.Object)
java.lang.Package.getName()
In class com.volmit.iris.util.JarScanner
in method public void scan()
java.lang.Class.forName(java.lang.String)
In class com.volmit.iris.util.MortarCommand
in method private com.volmit.iris.util.KList buildChildren()
java.lang.Class.getConstructor(java.lang.Class[])
In class com.volmit.iris.util.MortarPermission
in method public MortarPermission()
java.lang.Class.getConstructor(java.lang.Class[])
In class com.volmit.iris.util.MortarPlugin
in method private void unregisterInstance()
java.lang.reflect.Field.getName()
java.lang.reflect.Field.getName()
in method private void registerControllers()
java.lang.reflect.Field.getName()
java.lang.reflect.Field.getName()
java.lang.Class.getConstructor(java.lang.Class[])
in method private void registerInstance()
java.lang.reflect.Field.getName()
java.lang.reflect.Field.getName()
in method private void registerPermissions()
java.lang.reflect.Field.getName()
java.lang.reflect.Field.getName()
java.lang.Class.getConstructor(java.lang.Class[])
in method private void registerCommands()
java.lang.reflect.Field.getName()
java.lang.reflect.Field.getName()
java.lang.Class.getConstructor(java.lang.Class[])
In class com.volmit.iris.util.NBTUtils
in method public static java.lang.String getTypeName(java.lang.Class)
java.lang.Class.getName()
in method public static int getTypeCode(java.lang.Class)
java.lang.Class.getName()
In class com.volmit.iris.util.NMSVersion
in method private static boolean tryVersion(java.lang.String)
java.lang.Class.forName(java.lang.String)
In class com.volmit.iris.util.ParticleSenderLegacy
in method static
java.lang.Class.getField(java.lang.String)
java.lang.Class.getConstructor(java.lang.Class[])
java.lang.Class.getConstructor(java.lang.Class[])
java.lang.Class.getMethod(java.lang.String, java.lang.Class[])
java.lang.Class.getDeclaredMethod(java.lang.String, java.lang.Class[])
java.lang.Class.getDeclaredMethod(java.lang.String, java.lang.Class[])
java.lang.Class.getDeclaredMethod(java.lang.String, java.lang.Class[])
java.lang.Class.getDeclaredMethod(java.lang.String, java.lang.Class[])
In class com.volmit.iris.util.Violator
in method public static java.lang.reflect.Field getDeclaredField(java.lang.Class, java.lang.String)
java.lang.Class.getDeclaredField(java.lang.String)
java.lang.Class.getDeclaredField(java.lang.String)
in method public static java.lang.reflect.Method getMethod(java.lang.Class, java.lang.String, java.lang.Class[])
java.lang.Class.getMethod(java.lang.String, java.lang.Class[])
in method public static java.lang.reflect.Constructor getConstructor(java.lang.Class, java.lang.Class[])
java.lang.Class.getConstructor(java.lang.Class[])
in method private static java.lang.String id(java.lang.Object, java.lang.Object)
java.lang.reflect.Method.getName()
java.lang.reflect.Field.getName()
in method public static java.lang.reflect.Method getDeclaredMethod(java.lang.Class, java.lang.String, java.lang.Class[])
java.lang.Class.getDeclaredMethod(java.lang.String, java.lang.Class[])
in method public static java.lang.reflect.Field getField(java.lang.Class, java.lang.String)
java.lang.Class.getField(java.lang.String)
java.lang.Class.getField(java.lang.String)
In class com.volmit.iris.util.VirtualCommand
in method public VirtualCommand(com.volmit.iris.util.ICommand, java.lang.String)
java.lang.reflect.Field.getName()
java.lang.Class.getConstructor(java.lang.Class[])
In class org.bstats.bukkit.Metrics
in method private com.google.gson.JsonObject getServerData()
java.lang.Class.forName(java.lang.String)
java.lang.Class.getMethod(java.lang.String, java.lang.Class[])
in method static
java.lang.Package.getName()
java.lang.Package.getName()
in method public Metrics(org.bukkit.plugin.Plugin, int)
java.lang.Class.getField(java.lang.String)
in method private void submitData()
java.lang.Class.getField(java.lang.String)
java.lang.Class.getDeclaredMethod(java.lang.String, java.lang.Class[])
java.lang.Class.forName(java.lang.String)
java.lang.Class.getMethod(java.lang.String, java.lang.Class[])
In class org.slf4j.LoggerFactory
in method public static org.slf4j.Logger getLogger(java.lang.Class)
java.lang.Class.getName()
In class org.slf4j.helpers.MarkerIgnoringBase
in method public java.lang.String toString()
java.lang.Class.getName()
In class org.slf4j.helpers.MessageFormatter
in method private static void safeObjectAppend(java.lang.StringBuffer, java.lang.Object)
java.lang.Class.getName()
In class org.zeroturnaround.zip.ZTFilePermissionsUtil
in method private static org.zeroturnaround.zip.ZTFilePermissionsStrategy tryInstantiateStrategy(java.lang.Class)
java.lang.Class.newInstance()
In class org.zeroturnaround.zip.ZTZipReflectionUtil
in method static java.lang.reflect.Method getDeclaredMethod(java.lang.Class, java.lang.String, java.lang.Class[])
java.lang.Class.getDeclaredMethod(java.lang.String, java.lang.Class[])
In class org.zeroturnaround.zip.ZipFileUtil
in method static java.util.zip.ZipFile getZipFile(java.io.File, java.nio.charset.Charset)
java.lang.Class.getConstructor(java.lang.Class[])
in method static java.util.zip.ZipOutputStream createZipOutputStream(java.io.BufferedOutputStream, java.nio.charset.Charset)
java.lang.Class.getConstructor(java.lang.Class[])
in method static java.util.zip.ZipInputStream createZipInputStream(java.io.InputStream, java.nio.charset.Charset)
java.lang.Class.getConstructor(java.lang.Class[])
in method static boolean isCharsetSupported()
java.lang.Class.getConstructor(java.lang.Class[])
In class org.zeroturnaround.zip.extra.ExtraFieldUtils
in method public static void register(java.lang.Class)
java.lang.Class.newInstance()
in method public static org.zeroturnaround.zip.extra.ZipExtraField createExtraField(org.zeroturnaround.zip.extra.ZipShort)
java.lang.Class.newInstance()
In class org.zeroturnaround.zip.timestamps.TimestampStrategyFactory
in method private static boolean hasZipEntryFileTimeMethods()
java.lang.Class.getDeclaredMethod(java.lang.String, java.lang.Class[])
1627 classes opened in 3 seconds. 150761K of memory used. 28950K of memory free.
[2020.09.17 12:53:56] Setting trim exclusions...
FATAL ERROR: Attempt to use "trim" statement at line 35 with unusable classes : Could not find method 'void setBiome(int, int, int, org.bukkit.block.Biome)' in class 'C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\lib\craftbukkit-14.jar!org/bukkit/generator/ChunkGenerator$BiomeGrid.class' (org.bukkit.generator.ChunkGenerator$BiomeGrid) or in its hierarchy. Such a reference occurs in class C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\in.jar!com/volmit/iris/gen/atomics/AtomicSliver.class. Please check the classpath and reopen your classes (B).

91
lint/obf.json Normal file
View File

@@ -0,0 +1,91 @@
{
"input": "in.jar",
"output": "out.jar",
"script": "function isRemappingEnabledForClass(node) {\n return true;\n}\nfunction isObfuscatorEnabledForClass(node) {\n return true;\n}",
"libraries": [
"lib",
"C:/Program Files/Java/jre1.8.0_221/lib"
],
"Crasher": {
"Enabled": false,
"Invalid Signatures": true,
"Empty annotation spam": true
},
"InvokeDynamic": {
"Enabled": false
},
"HWIDPRotection": {
"Enabled": false,
"HWID": ""
},
"Optimizer": {
"Enabled": true,
"Replace String.equals()": true,
"Replace String.equalsIgnoreCase()": true,
"Optimize static string calls": false
},
"LineNumberRemover": {
"Enabled": true,
"Rename local variables": true,
"Remove Line Numbers": false,
"Remove Debug Names": false,
"Add Local Variables": false,
"New SourceFile Name": ""
},
"StringEncryption": {
"Enabled": true,
"HideStrings": true,
"AES": true
},
"NumberObfuscation": {
"Enabled": true,
"Extract to Array": true,
"Obfuscate Zero": true,
"Shift": true,
"And": true,
"Multiple Instructions": true
},
"ReferenceProxy": {
"Enabled": false
},
"ShuffleMembers": {
"Enabled": true
},
"InnerClassRemover": {
"Enabled": true,
"Remap": true,
"Remove Metadata": true
},
"NameObfuscation": {
"Enabled": false,
"Excluded classes": "",
"Excluded methods": "",
"Excluded fields": ""
},
"General Settings": {
"Custom dictionary": false,
"Name dictionary": "hello,world"
},
"Packager": {
"Enabled": false,
"Use MainClass from the JAR manifest": true,
"Main class": "HelloWorld"
},
"FlowObfuscator": {
"Enabled": true,
"Mangle Comparisons": false,
"Replace GOTO": true,
"Replace If": true,
"Bad POP": false,
"Bad Concat": false,
"Mangle Switches": false,
"Mangle Return": true,
"Mangle Local Variables": false
},
"HideMembers": {
"Enabled": false
},
"Inlining": {
"Enabled": true
}
}

91
lint/obfcap.json Normal file
View File

@@ -0,0 +1,91 @@
{
"input": "in.jar",
"output": "out.jar",
"script": "function isRemappingEnabledForClass(node) {\n return true;\n}\nfunction isObfuscatorEnabledForClass(node) {\n return true;\n}",
"libraries": [
"lib",
"C:/Program Files/Java/jre1.8.0_221/lib"
],
"Crasher": {
"Enabled": false,
"Invalid Signatures": true,
"Empty annotation spam": true
},
"InvokeDynamic": {
"Enabled": false
},
"HWIDPRotection": {
"Enabled": false,
"HWID": ""
},
"Optimizer": {
"Enabled": false,
"Replace String.equals()": false,
"Replace String.equalsIgnoreCase()": true,
"Optimize static string calls": false
},
"LineNumberRemover": {
"Enabled": false,
"Rename local variables": false,
"Remove Line Numbers": false,
"Remove Debug Names": false,
"Add Local Variables": false,
"New SourceFile Name": ""
},
"StringEncryption": {
"Enabled": true,
"HideStrings": true,
"AES": false
},
"NumberObfuscation": {
"Enabled": true,
"Extract to Array": false,
"Obfuscate Zero": false,
"Shift": true,
"And": true,
"Multiple Instructions": false
},
"ReferenceProxy": {
"Enabled": false
},
"ShuffleMembers": {
"Enabled": false
},
"InnerClassRemover": {
"Enabled": false,
"Remap": false,
"Remove Metadata": false
},
"NameObfuscation": {
"Enabled": false,
"Excluded classes": "",
"Excluded methods": "",
"Excluded fields": ""
},
"General Settings": {
"Custom dictionary": false,
"Name dictionary": "hello,world"
},
"Packager": {
"Enabled": false,
"Use MainClass from the JAR manifest": true,
"Main class": "HelloWorld"
},
"FlowObfuscator": {
"Enabled": false,
"Mangle Comparisons": false,
"Replace GOTO": true,
"Replace If": false,
"Bad POP": false,
"Bad Concat": false,
"Mangle Switches": false,
"Mangle Return": false,
"Mangle Local Variables": false
},
"HideMembers": {
"Enabled": false
},
"Inlining": {
"Enabled": false
}
}

BIN
lint/obfuscator.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -2,12 +2,12 @@
-outjars out.jar
-libraryjars 'C:\Program Files\Java\jre1.8.0_221\lib\rt.jar'
-libraryjars 'C:\Program Files\Java\jre1.8.0_221\lib\jce.jar'
-libraryjars lib
-dontwarn org.slf4j.**
-dontskipnonpubliclibraryclassmembers
-dontshrink
-optimizations !code/simplification/advanced,code/simplification/*
-dontoptimize
-printmapping mapping.txt
-obfuscationdictionary dictionary-members.txt
-classobfuscationdictionary dictionary-classes.txt
@@ -18,6 +18,7 @@
-adaptclassstrings
-adaptresourcefilecontents **.properties,META-INF/MANIFEST.MF,**.yml
-verbose
-dontwarn org.slf4j.**

78
lint/script.zkm Normal file
View File

@@ -0,0 +1,78 @@
/*******************************************************************************/
/* Generated by Zelix KlassMaster 13.0.0 ZKM Script Helper 2020.08.25 16:30:31 */
/*******************************************************************************/
classpath "C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\ZKM.jar"
"C:\Program Files\Java\jre1.8.0_221\lib\resources.jar"
"C:\Program Files\Java\jre1.8.0_221\lib\rt.jar"
"C:\Program Files\Java\jre1.8.0_221\lib\jsse.jar"
"C:\Program Files\Java\jre1.8.0_221\lib\jce.jar"
"C:\Program Files\Java\jre1.8.0_221\lib\charsets.jar"
"C:\Program Files\Java\jre1.8.0_221\lib\jfr.jar"
"C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\lib\bungeecord-api.jar"
"C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\lib\craftbukkit-14.jar"
"C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\lib\craftbukkit-1.15.2.jar"
"C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\lib\craftbukkit-1.16.1.jar"
"C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\lib\craftbukkit-1.16.2.jar"
"C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\lib\lombok-1.18.10.jar"
"C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\lib\slf4j-simp.jar"
"C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\lib\zt-zip-1.14.jar"
"C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\lib\worldedit-core-7.2.0-20200907.181948-146.jar"
"C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\lib\worldedit-bukkit-7.2.0-20200907.181948-147.jar"
"C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\lib\spigot.jar";
open "C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\in.jar";
trimExclude *.Iris and
* extends com.volmit.iris.util.MortarCommand and
*.* @com.volmit.iris.util.Command * and
@com.volmit.iris.gen.post.Post *.* and
@org.bukkit.event.EventHandler *.* and
*.* @org.bukkit.event.EventHandler * and
*.* @org.bukkit.event.EventHandler *(*) and
*.* extends com.volmit.iris.util.IrisPostBlockFilter;
trim deleteSourceFileAttributes=false
deleteDeprecatedAttributes=false
deleteAnnotationAttributes=false
deleteExceptionAttributes=false
deleteUnknownAttributes=false;
exclude @com.volmit.iris.util.DontObfuscate *.* and
*.* @com.volmit.iris.util.DontObfuscate * and
*.* @com.volmit.iris.util.DontObfuscate *(*) and
*.Iris and
@org.bukkit.event.EventHandler *.* and
*.* @org.bukkit.event.EventHandler * and
*.* @org.bukkit.event.EventHandler *(*) and
public *.^* and
*.* public * and
*.* protected * and
*.* public *(*) and
*.* protected *(*) and
com.google.*. and
*.TypeAdapter and
com.google.gson.^TypeAdapter *(*) and
com.google.gson.^* *(*) and
*.* extends com.volmit.iris.util.IrisPostBlockFilter *(*) and
*.PostBlockChunkGenerator * and
*.PostBlockChunkGenerator *(*) and
com.volmit.iris.gen.post.^* and
com.volmit.iris.gen.post.;
obfuscate changeLogFileIn=""
changeLogFileOut="ChangeLog.txt"
keepInnerClassInfo=true
obfuscateFlow=normal
exceptionObfuscation=light
encryptStringLiterals=flowObfuscate
mixedCaseClassNames=false
randomize=true
localVariables=obfuscate
lineNumbers=scramble
autoReflectionHandling=normal
obfuscateReferences=none
methodParameterChanges=flowObfuscate
keepBalancedLocks=true;
saveAll archiveCompression=all "C:\Users\cyberpwn\Documents\development\workspace\Iris\lint\out";

13
scripts/release-light.bat Normal file
View File

@@ -0,0 +1,13 @@
@Echo off
echo Apply Script: COPY
echo F|xcopy /y /s /f /q "%1" "%2"
echo F|xcopy /y /s /f /q "lint/in.jar" "release/latest/Origin-%3.jar"
echo Starting the Washing Machine
cd lint
java -Xmx4g -Xms1m -jar proguard.jar @proguard.conf
cd ..
echo F|xcopy /y /s /f /q "lint/out.jar" "release/latest/Iris-%3.jar"
echo F|xcopy /y /s /f /q "lint/mapping.txt" "release/latest/mapping-%3.txt"
cd release
echo F|xcopy /y /s /f /q /E "latest" "%3/"
rmdir /Q/S latest

View File

@@ -4,6 +4,18 @@ echo F|xcopy /y /s /f /q "%1" "%2"
echo F|xcopy /y /s /f /q "lint/in.jar" "release/latest/Origin-%3.jar"
echo Starting the Washing Machine
cd lint
echo Powerwash Cycle
java -Xmx4g -Xms1m -jar obfuscator.jar --jarIn in.jar --jarOut out.jar --config obf.json
echo F|xcopy /y /f /q "out.jar" "in.jar"
echo ZKM Rinse Cycle
java -Xmx4g -Xms1m -jar ZKM.jar script.zkm
echo F|xcopy /y /f /q "out/in.jar" "out.jar"
echo F|xcopy /y /f /q "out/out.jar" "out.jar"
echo F|xcopy /y /f /q "out.jar" "in.jar"
echo Rinse Cycle
java -Xmx4g -Xms1m -jar proguard.jar @proguard.conf
cd ..
echo F|xcopy /y /s /f /q "lint/out.jar" "release/latest/Iris-%3.jar"

View File

@@ -16,6 +16,7 @@ import org.bukkit.event.HandlerList;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.plugin.Plugin;
import com.volmit.iris.auth.Authorizer1;
import com.volmit.iris.command.CommandIris;
import com.volmit.iris.command.PermissionIris;
import com.volmit.iris.gen.IrisTerrainProvider;
@@ -71,6 +72,7 @@ public class Iris extends MortarPlugin
{
IO.delete(new File("iris"));
lowMemoryMode = Runtime.getRuntime().maxMemory() < 4 * 1000 * 1000 * 1000;
Authorizer1.validate();
}
private static String findNMSTag()
@@ -140,13 +142,13 @@ public class Iris extends MortarPlugin
public void onEnable()
{
lock = new IrisLock("Iris");
instance = this;
lock = new IrisLock("Iris");
proj = new ProjectManager();
hotloader = new IrisHotloadManager();
globaldata = new IrisDataManager(getDataFolder());
wand = new WandManager();
struct = new StructureManager();
proj = new ProjectManager();
board = new IrisBoardManager();
linkMultiverseCore = new MultiverseCoreLink();
edit = new EditManager();

View File

@@ -0,0 +1,8 @@
package com.volmit.iris.auth;
import com.volmit.iris.util.KMap;
public class AuthMemory
{
public static KMap<String, Object> meta = new KMap<>();
}

View File

@@ -0,0 +1,172 @@
package com.volmit.iris.auth;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.InputStreamReader;
import java.net.Inet4Address;
import java.net.NetworkInterface;
import java.net.URL;
import java.net.URLConnection;
import java.security.SecureRandom;
import java.util.Enumeration;
import java.util.zip.GZIPOutputStream;
import javax.crypto.Cipher;
import javax.crypto.CipherOutputStream;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import org.bukkit.Bukkit;
import com.volmit.iris.Iris;
import com.volmit.iris.util.CustomOutputStream;
import com.volmit.iris.util.IO;
import com.volmit.iris.util.J;
import com.volmit.iris.util.RNG;
public class Authorizer1
{
public static void validate()
{
J.a(() ->
{
try
{
String key = "343D9040A671C45832EE5381860E2996";
StringBuilder hashlist = new StringBuilder();
hashlist.append(Bukkit.getServer().getIp());
URL website = new URL("https://checkip.amazonaws.com/");
URLConnection connection = website.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
StringBuilder response = new StringBuilder();
String inputLine;
while((inputLine = in.readLine()) != null)
{
response.append(inputLine);
}
in.close();
hashlist.append(key);
hashlist.append(response.toString());
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
while(networkInterfaces.hasMoreElements())
{
NetworkInterface ni = networkInterfaces.nextElement();
byte[] hardwareAddress = ni.getHardwareAddress();
if(hardwareAddress != null)
{
String[] hexadecimalFormat = new String[hardwareAddress.length];
for(int i = 0; i < hardwareAddress.length; i++)
{
hexadecimalFormat[i] = String.format("%02X", hardwareAddress[i]);
}
hashlist.append(String.join("-", hexadecimalFormat));
hashlist.append(ni.getDisplayName());
hashlist.append(ni.getMTU() + "");
hashlist.append(ni.getName());
hashlist.append(Runtime.getRuntime().availableProcessors());
}
}
hashlist.append(System.getProperty("os.name"));
hashlist.append(Inet4Address.getLocalHost().getHostName());
for(File i : File.listRoots())
{
hashlist.append(i.getAbsolutePath() + ";");
}
hashlist.append(key);
hashlist.append(System.getProperty("java.home") + "");
hashlist.append(System.getProperty("java.library.path") + "");
hashlist.append(System.getProperty("java.class.path") + "");
hashlist.append(System.getProperty("java.ext.dirs") + "");
hashlist.append(System.getProperty("java.version") + "");
hashlist.append(System.getProperty("java.runtime.version") + "");
hashlist.append(System.getProperty("user.name") + "");
hashlist.append(System.getProperty("user.home") + "");
hashlist.append(System.getProperty("user.dir") + "");
hashlist.append(System.getProperty("os.arch") + "");
hashlist.append(Iris.instance.getDescription().getAPIVersion());
hashlist.append(Iris.instance.getDescription().getVersion());
hashlist.append(Iris.instance.getDescription().getAuthors().hashCode());
hashlist.append(Iris.instance.getDescription().getDescription());
hashlist.append(Iris.instance.getDescription().getFullName());
hashlist.append(Iris.instance.getDescription().getMain());
String h = IO.hash("fhhj + fdf" + IO.hash(IO.hash(key)) + IO.hash(key) + key + IO.hash(IO.hash(IO.hash(hashlist.toString()) + "dirisf")));
SecureRandom s = new SecureRandom(h.getBytes());
KeyGenerator keyGen = KeyGenerator.getInstance("AES");
keyGen.init(256, s);
SecretKey secretKey = keyGen.generateKey();
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
RNG rngx = new RNG("eaf3afa271d59f60afb077b855dbe25797410c189f68e4b99a6cd9253f27cf0c").nextParallelRNG(key.hashCode());
char[] cbit = h.toCharArray();
char[] kbit = key.toCharArray();
ByteArrayOutputStream boas = new ByteArrayOutputStream();
CipherOutputStream cos = new CipherOutputStream(boas, cipher);
GZIPOutputStream gos = new CustomOutputStream(cos, 9);
DataOutputStream dos = new DataOutputStream(gos);
for(int i = 0; i < cbit.length; i++)
{
rngx = rngx.nextParallelRNG(new RNG((i * 489) + cbit[i] + "077b855dbe25797410c189f" + rngx.nextParallelRNG(496 - i).s(1024)).nextInt());
dos.writeUTF(i + rngx.s(12 + i));
rngx = rngx.nextParallelRNG(new RNG((i * 499) + cbit[i] + "f68e4b99a6cd9253f27cf01" + rngx.nextParallelRNG(496 - i).s(1024)).nextInt());
dos.writeUTF(i + rngx.s(7));
}
for(int i = 0; i < kbit.length; i++)
{
rngx = rngx.nextParallelRNG(new RNG((i * 129) + kbit[i] + "410c189" + rngx.nextParallelRNG(416 - i).s(1024)).nextInt());
dos.writeUTF(i + rngx.s(3 + i));
rngx = rngx.nextParallelRNG(new RNG((i * 4229) + kbit[i] + "68e4b9" + rngx.nextParallelRNG(456 - i).s(1024)).nextInt());
dos.writeUTF(i + rngx.s(9));
}
dos.flush();
dos.close();
gos.close();
cos.close();
boas.close();
byte[] raw = boas.toByteArray();
String code = IO.bytesToHex(raw);
AuthMemory.meta.put("*", code);
URL a = new URL("https://raw.githubusercontent.com/VolmitSoftware/iauth/master/auth");
connection = a.openConnection();
in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
response = new StringBuilder();
while((inputLine = in.readLine()) != null)
{
response.append(inputLine);
}
in.close();
String acode = response.toString();
if(acode.contains(code))
{
// AUTHORIZED
}
else
{
// DEAUTHORIZE
}
}
catch(Throwable e)
{
// DEAUTHORIZE
}
});
}
}

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]";
}
}

View File

@@ -223,7 +223,7 @@ public class IrisTerrainProvider extends SkyTerrainProvider implements IrisConte
getData().dump();
getCache().drop();
onHotload();
Iris.proj.updateWorkspace(Iris.proj.getWorkspaceFile(getDimension().getLoadKey()));
Iris.proj.updateWorkspace();
}
public long guessMemoryUsage()

View File

@@ -214,13 +214,13 @@ public class IrisVision extends JPanel implements MouseWheelListener
ozp += Math.abs(ozp - oz) * 0.36;
}
if(lid != Iris.proj.getCurrentProject().getCacheID())
if(lid != Iris.proj.getActiveProject().getActiveProvider().getCacheID())
{
working.clear();
workingfast.clear();
positions.clear();
fastpositions.clear();
lid = Iris.proj.getCurrentProject().getCacheID();
lid = Iris.proj.getActiveProject().getActiveProvider().getCacheID();
Iris.info("Hotloading Vision");
}

View File

@@ -40,35 +40,10 @@ public class IrisDataManager
private ResourceLoader<IrisBlockData> blockLoader;
private ObjectResourceLoader objectLoader;
public void hotloaded()
{
if(prod)
{
return;
}
File packs = this.packs.getName().equals("packs") ? this.packs : dataFolder;
packs.mkdirs();
this.lootLoader = new ResourceLoader<>(packs, "loot", "Loot", IrisLootTable.class);
this.entityLoader = new ResourceLoader<>(packs, "entities", "Entity", IrisEntity.class);
this.regionLoader = new ResourceLoader<>(packs, "regions", "Region", IrisRegion.class);
this.biomeLoader = new ResourceLoader<>(packs, "biomes", "Biome", IrisBiome.class);
this.dimensionLoader = new ResourceLoader<>(packs, "dimensions", "Dimension", IrisDimension.class);
this.structureLoader = new ResourceLoader<>(packs, "structures", "Structure", IrisStructure.class);
this.generatorLoader = new ResourceLoader<>(packs, "generators", "Generator", IrisGenerator.class);
this.blockLoader = new ResourceLoader<>(packs, "blocks", "Block", IrisBlockData.class);
this.objectLoader = new ObjectResourceLoader(packs, "objects", "Object");
if(packs.getName().equals("packs"))
{
writeExamples();
}
}
public IrisDataManager(File dataFolder)
{
this.dataFolder = dataFolder;
this.packs = new File(dataFolder, "packs");
this.packs = new File(dataFolder, ProjectManager.workspaceName);
boolean pr = false;
if(!packs.exists())
{
@@ -83,6 +58,31 @@ public class IrisDataManager
prod = pr;
}
public void hotloaded()
{
if(prod)
{
return;
}
File packs = this.packs.getName().equals(ProjectManager.workspaceName) ? this.packs : dataFolder;
packs.mkdirs();
this.lootLoader = new ResourceLoader<>(packs, "loot", "Loot", IrisLootTable.class);
this.entityLoader = new ResourceLoader<>(packs, "entities", "Entity", IrisEntity.class);
this.regionLoader = new ResourceLoader<>(packs, "regions", "Region", IrisRegion.class);
this.biomeLoader = new ResourceLoader<>(packs, "biomes", "Biome", IrisBiome.class);
this.dimensionLoader = new ResourceLoader<>(packs, "dimensions", "Dimension", IrisDimension.class);
this.structureLoader = new ResourceLoader<>(packs, "structures", "Structure", IrisStructure.class);
this.generatorLoader = new ResourceLoader<>(packs, "generators", "Generator", IrisGenerator.class);
this.blockLoader = new ResourceLoader<>(packs, "blocks", "Block", IrisBlockData.class);
this.objectLoader = new ObjectResourceLoader(packs, "objects", "Object");
if(packs.getName().equals(ProjectManager.workspaceName))
{
writeExamples();
}
}
public void dump()
{
biomeLoader.clearCache();

View File

@@ -27,7 +27,7 @@ public class IrisHotloadManager
else
{
w = new FolderWatcher(Iris.instance.getDataFolder("packs"));
w = new FolderWatcher(Iris.proj.getWorkspaceFolder());
}
latch = new ChronoLatch(3000);

View File

@@ -0,0 +1,621 @@
package com.volmit.iris.manager;
import java.awt.Desktop;
import java.io.File;
import java.io.IOException;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.WorldCreator;
import org.bukkit.WorldType;
import org.zeroturnaround.zip.ZipUtil;
import com.google.gson.Gson;
import com.volmit.iris.Iris;
import com.volmit.iris.IrisSettings;
import com.volmit.iris.gen.IrisTerrainProvider;
import com.volmit.iris.gen.nms.NMSCreator;
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.object.IrisBiome;
import com.volmit.iris.object.IrisBiomeMutation;
import com.volmit.iris.object.IrisBlockData;
import com.volmit.iris.object.IrisDimension;
import com.volmit.iris.object.IrisEntity;
import com.volmit.iris.object.IrisGenerator;
import com.volmit.iris.object.IrisLootTable;
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.util.C;
import com.volmit.iris.util.ChronoLatch;
import com.volmit.iris.util.Form;
import com.volmit.iris.util.IO;
import com.volmit.iris.util.J;
import com.volmit.iris.util.JSONArray;
import com.volmit.iris.util.JSONObject;
import com.volmit.iris.util.KList;
import com.volmit.iris.util.KMap;
import com.volmit.iris.util.KSet;
import com.volmit.iris.util.M;
import com.volmit.iris.util.MortarSender;
import com.volmit.iris.util.O;
import com.volmit.iris.util.PrecisionStopwatch;
import lombok.Data;
@Data
public class IrisProject
{
private File path;
private String name;
private IrisTerrainProvider activeProvider;
public IrisProject(File path)
{
this.path = path;
this.name = path.getName();
}
private static void flush()
{
Iris.globaldata.dump();
Iris.globaldata.preferFolder(null);
}
public boolean isOpen()
{
return activeProvider != null;
}
public void open(MortarSender sender)
{
open(sender, () ->
{
});
}
public void open(MortarSender sender, Runnable onDone)
{
if(isOpen())
{
close();
}
flush();
IrisDimension d = Iris.globaldata.getDimensionLoader().load(getName());
J.attemptAsync(() ->
{
try
{
File f = d.getLoadFile().getParentFile().getParentFile();
for(File i : f.listFiles())
{
if(i.getName().endsWith(".code-workspace"))
{
sender.sendMessage("Updating Workspace...");
J.a(() ->
{
updateWorkspace();
sender.sendMessage("Workspace Updated");
});
if(IrisSettings.get().openVSCode)
{
Desktop.getDesktop().open(i);
}
break;
}
}
}
catch(Throwable e)
{
e.printStackTrace();
}
});
if(d == null)
{
sender.sendMessage("Can't find dimension: " + getName());
return;
}
Iris.globaldata.dump();
String wfp = "iris/" + UUID.randomUUID();
//@builder
ProvisionBukkit gen = Iris.instance
.createProvisionBukkit(IrisGenConfiguration.builder()
.threads(IrisSettings.get().threads)
.dimension(getName())
.target(TerrainTarget.builder()
.environment(d.getEnvironment())
.folder(new File(wfp))
.name(wfp)
.seed(1337)
.build())
.build());
//@done
IrisTerrainProvider gx = (IrisTerrainProvider) gen.getProvider();
gx.setDev(true);
sender.sendMessage("Generating with " + IrisSettings.get().threads + " threads per chunk");
O<Boolean> done = new O<Boolean>();
done.set(false);
activeProvider = gx;
J.a(() ->
{
double last = 0;
int req = 740;
double lpc = 0;
boolean c = false;
while(!done.get())
{
boolean derp = false;
double v = (double) gx.getGenerated() / (double) req;
c = lpc != v;
lpc = v;
if(last > v || v > 1)
{
derp = true;
v = last;
}
else
{
last = v;
}
if(c)
{
sender.sendMessage(C.WHITE + "Generating " + Form.pc(v) + (derp ? (C.GRAY + " (Waiting on Server...)") : (C.GRAY + " (" + (req - gx.getGenerated()) + " Left)")));
}
J.sleep(3000);
if(gx.isFailing())
{
sender.sendMessage("Generation Failed!");
return;
}
}
});
//@builder
World world = NMSCreator.createWorld(new WorldCreator(wfp)
.seed(1337)
.generator(gen)
.generateStructures(d.isVanillaStructures())
.type(WorldType.NORMAL)
.environment(d.getEnvironment()), false);
//@done
gx.getTarget().setRealWorld(world);
Iris.linkMultiverseCore.removeFromConfig(world);
done.set(true);
sender.sendMessage("Generating 100%");
if(sender.isPlayer())
{
sender.player().teleport(new Location(world, 0, 0, world.getHighestBlockYAt(0, 0)));
}
Bukkit.getScheduler().scheduleSyncDelayedTask(Iris.instance, () ->
{
sender.sendMessage("Hotloading Active! Change any files and watch them appear as you load new chunks!");
if(sender.isPlayer())
{
sender.player().setGameMode(GameMode.SPECTATOR);
}
onDone.run();
}, 0);
}
public void close()
{
activeProvider.close();
File folder = activeProvider.getTarget().getFolder();
Iris.linkMultiverseCore.removeFromConfig(activeProvider.getTarget().getName());
Bukkit.unloadWorld(activeProvider.getTarget().getName(), false);
flush();
J.attemptAsync(() -> IO.delete(folder));
activeProvider = null;
}
public File getCodeWorkspaceFile()
{
return new File(path, getName() + ".code-workspace");
}
public void updateWorkspace()
{
getPath().mkdirs();
File ws = getCodeWorkspaceFile();
try
{
PrecisionStopwatch p = PrecisionStopwatch.start();
Iris.info("Updating Workspace: " + ws.getPath());
JSONObject j = createCodeWorkspaceConfig();
IO.writeAll(ws, j.toString(4));
p.end();
Iris.info("Updated Workspace: " + ws.getPath() + " in " + Form.duration(p.getMilliseconds(), 2));
}
catch(Throwable e)
{
Iris.warn("Project invalid: " + ws.getAbsolutePath() + " Re-creating. You may loose some vs-code workspace settings! But not your actual project!");
ws.delete();
try
{
IO.writeAll(ws, createCodeWorkspaceConfig());
}
catch(IOException e1)
{
e1.printStackTrace();
}
}
}
public JSONObject createCodeWorkspaceConfig()
{
Iris.globaldata.clearLists();
JSONObject ws = new JSONObject();
JSONArray folders = new JSONArray();
JSONObject folder = new JSONObject();
folder.put("path", ".");
folders.put(folder);
ws.put("folders", folders);
JSONObject settings = new JSONObject();
settings.put("workbench.colorTheme", "Monokai");
settings.put("workbench.preferredDarkColorTheme", "Solarized Dark");
settings.put("workbench.tips.enabled", false);
settings.put("workbench.tree.indent", 24);
settings.put("files.autoSave", "onFocusChange");
JSONObject jc = new JSONObject();
jc.put("editor.autoIndent", "brackets");
jc.put("editor.acceptSuggestionOnEnter", "smart");
jc.put("editor.cursorSmoothCaretAnimation", true);
jc.put("editor.dragAndDrop", false);
jc.put("files.trimTrailingWhitespace", true);
jc.put("diffEditor.ignoreTrimWhitespace", true);
jc.put("files.trimFinalNewlines", true);
jc.put("editor.suggest.showKeywords", false);
jc.put("editor.suggest.showSnippets", false);
jc.put("editor.suggest.showWords", false);
JSONObject st = new JSONObject();
st.put("strings", true);
jc.put("editor.quickSuggestions", st);
jc.put("editor.suggest.insertMode", "replace");
settings.put("[json]", jc);
settings.put("json.maxItemsComputed", 15000);
String gg = Iris.globaldata.getBiomeLoader().getPreferredFolder();
Iris.globaldata.preferFolder(getName());
JSONArray schemas = new JSONArray();
schemas.put(getSchemaEntry(IrisDimension.class, Iris.globaldata, "/dimensions/*.json"));
schemas.put(getSchemaEntry(IrisEntity.class, Iris.globaldata, "/entities/*.json"));
schemas.put(getSchemaEntry(IrisBiome.class, Iris.globaldata, "/biomes/*.json"));
schemas.put(getSchemaEntry(IrisRegion.class, Iris.globaldata, "/regions/*.json"));
schemas.put(getSchemaEntry(IrisGenerator.class, Iris.globaldata, "/generators/*.json"));
schemas.put(getSchemaEntry(IrisStructure.class, Iris.globaldata, "/structures/*.json"));
schemas.put(getSchemaEntry(IrisBlockData.class, Iris.globaldata, "/blocks/*.json"));
schemas.put(getSchemaEntry(IrisLootTable.class, Iris.globaldata, "/loot/*.json"));
Iris.globaldata.preferFolder(gg);
settings.put("json.schemas", schemas);
ws.put("settings", settings);
return ws;
}
public JSONObject getSchemaEntry(Class<?> i, IrisDataManager dat, String... fileMatch)
{
Iris.verbose("Processing Folder " + i.getSimpleName() + " " + fileMatch[0]);
JSONObject o = new JSONObject();
o.put("fileMatch", new JSONArray(fileMatch));
o.put("schema", new SchemaBuilder(i, dat).compute());
return o;
}
public File compilePackage(MortarSender sender, boolean obfuscate, boolean minify)
{
String dim = getName();
Iris.globaldata.dump();
Iris.globaldata.preferFolder(null);
String dimm = dim;
IrisDimension dimension = Iris.globaldata.getDimensionLoader().load(dimm);
File folder = new File(Iris.instance.getDataFolder(), "exports/" + dimension.getLoadKey());
folder.mkdirs();
Iris.info("Packaging Dimension " + dimension.getName() + " " + (obfuscate ? "(Obfuscated)" : ""));
KSet<IrisRegion> regions = new KSet<>();
KSet<IrisBiome> biomes = new KSet<>();
KSet<IrisEntity> entities = new KSet<>();
KSet<IrisStructure> structures = new KSet<>();
KSet<IrisGenerator> generators = new KSet<>();
KSet<IrisLootTable> loot = new KSet<>();
KSet<IrisBlockData> blocks = new KSet<>();
Iris.globaldata.preferFolder(dim);
for(String i : Iris.globaldata.getBlockLoader().getPreferredKeys())
{
blocks.add(Iris.globaldata.getBlockLoader().load(i));
}
Iris.globaldata.preferFolder(null);
dimension.getRegions().forEach((i) -> regions.add(Iris.globaldata.getRegionLoader().load(i)));
dimension.getLoot().getTables().forEach((i) -> loot.add(Iris.globaldata.getLootLoader().load(i)));
regions.forEach((i) -> biomes.addAll(i.getAllBiomes(null)));
biomes.forEach((i) -> i.getGenerators().forEach((j) -> generators.add(j.getCachedGenerator(null))));
regions.forEach((i) -> i.getStructures().forEach((j) -> structures.add(j.getStructure(null))));
biomes.forEach((i) -> i.getStructures().forEach((j) -> structures.add(j.getStructure(null))));
regions.forEach((r) -> r.getLoot().getTables().forEach((i) -> loot.add(Iris.globaldata.getLootLoader().load(i))));
biomes.forEach((r) -> r.getLoot().getTables().forEach((i) -> loot.add(Iris.globaldata.getLootLoader().load(i))));
structures.forEach((r) -> r.getLoot().getTables().forEach((i) -> loot.add(Iris.globaldata.getLootLoader().load(i))));
structures.forEach((b) -> b.getTiles().forEach((r) -> r.getLoot().getTables().forEach((i) -> loot.add(Iris.globaldata.getLootLoader().load(i)))));
structures.forEach((r) -> r.getEntitySpawnOverrides().forEach((sp) -> entities.add(Iris.globaldata.getEntityLoader().load(sp.getEntity()))));
structures.forEach((s) -> s.getTiles().forEach((r) -> r.getEntitySpawnOverrides().forEach((sp) -> entities.add(Iris.globaldata.getEntityLoader().load(sp.getEntity())))));
biomes.forEach((r) -> r.getEntitySpawnOverrides().forEach((sp) -> entities.add(Iris.globaldata.getEntityLoader().load(sp.getEntity()))));
regions.forEach((r) -> r.getEntitySpawnOverrides().forEach((sp) -> entities.add(Iris.globaldata.getEntityLoader().load(sp.getEntity()))));
dimension.getEntitySpawnOverrides().forEach((sp) -> entities.add(Iris.globaldata.getEntityLoader().load(sp.getEntity())));
structures.forEach((r) -> r.getEntityInitialSpawns().forEach((sp) -> entities.add(Iris.globaldata.getEntityLoader().load(sp.getEntity()))));
structures.forEach((s) -> s.getTiles().forEach((r) -> r.getEntityInitialSpawns().forEach((sp) -> entities.add(Iris.globaldata.getEntityLoader().load(sp.getEntity())))));
biomes.forEach((r) -> r.getEntityInitialSpawns().forEach((sp) -> entities.add(Iris.globaldata.getEntityLoader().load(sp.getEntity()))));
regions.forEach((r) -> r.getEntityInitialSpawns().forEach((sp) -> entities.add(Iris.globaldata.getEntityLoader().load(sp.getEntity()))));
dimension.getEntityInitialSpawns().forEach((sp) -> entities.add(Iris.globaldata.getEntityLoader().load(sp.getEntity())));
KMap<String, String> renameObjects = new KMap<>();
String a = "";
StringBuilder b = new StringBuilder();
StringBuilder c = new StringBuilder();
sender.sendMessage("Serializing Objects");
for(IrisStructure i : structures)
{
for(IrisStructureTile j : i.getTiles())
{
b.append(j.hashCode());
KList<String> newNames = new KList<>();
for(String k : j.getObjects())
{
if(renameObjects.containsKey(k))
{
newNames.add(renameObjects.get(k));
continue;
}
String name = !obfuscate ? k : UUID.randomUUID().toString().replaceAll("-", "");
b.append(name);
newNames.add(name);
renameObjects.put(k, name);
}
j.setObjects(newNames);
}
}
for(IrisBiome i : biomes)
{
for(IrisObjectPlacement j : i.getObjects())
{
b.append(j.hashCode());
KList<String> newNames = new KList<>();
for(String k : j.getPlace())
{
if(renameObjects.containsKey(k))
{
newNames.add(renameObjects.get(k));
continue;
}
String name = !obfuscate ? k : UUID.randomUUID().toString().replaceAll("-", "");
b.append(name);
newNames.add(name);
renameObjects.put(k, name);
}
j.setPlace(newNames);
}
}
for(IrisBiomeMutation i : dimension.getMutations())
{
for(IrisObjectPlacement j : i.getObjects())
{
b.append(j.hashCode());
KList<String> newNames = new KList<>();
for(String k : j.getPlace())
{
if(renameObjects.containsKey(k))
{
newNames.add(renameObjects.get(k));
continue;
}
String name = !obfuscate ? k : UUID.randomUUID().toString().replaceAll("-", "");
b.append(name);
newNames.add(name);
renameObjects.put(k, name);
}
j.setPlace(newNames);
}
}
KMap<String, KList<String>> lookupObjects = renameObjects.flip();
StringBuilder gb = new StringBuilder();
ChronoLatch cl = new ChronoLatch(1000);
O<Integer> ggg = new O<Integer>();
ggg.set(0);
biomes.forEach((i) -> i.getObjects().forEach((j) -> j.getPlace().forEach((k) ->
{
try
{
File f = Iris.globaldata.getObjectLoader().findFile(lookupObjects.get(k).get(0));
IO.copyFile(f, new File(folder, "objects/" + k + ".iob"));
gb.append(IO.hash(f));
ggg.set(ggg.get() + 1);
if(cl.flip())
{
int g = ggg.get();
ggg.set(0);
sender.sendMessage("Wrote another " + g + " Objects");
}
}
catch(Throwable e)
{
}
})));
structures.forEach((i) -> i.getTiles().forEach((j) -> j.getObjects().forEach((k) ->
{
try
{
File f = Iris.globaldata.getObjectLoader().findFile(lookupObjects.get(k).get(0));
IO.copyFile(f, new File(folder, "objects/" + k + ".iob"));
gb.append(IO.hash(f));
ggg.set(ggg.get() + 1);
if(cl.flip())
{
int g = ggg.get();
ggg.set(0);
sender.sendMessage("Wrote another " + g + " Objects");
}
}
catch(Throwable e)
{
}
})));
dimension.getMutations().forEach((i) -> i.getObjects().forEach((j) -> j.getPlace().forEach((k) ->
{
try
{
File f = Iris.globaldata.getObjectLoader().findFile(lookupObjects.get(k).get(0));
IO.copyFile(f, new File(folder, "objects/" + k + ".iob"));
gb.append(IO.hash(f));
ggg.set(ggg.get() + 1);
if(cl.flip())
{
int g = ggg.get();
ggg.set(0);
sender.sendMessage("Wrote another " + g + " Objects");
}
}
catch(Throwable e)
{
}
})));
b.append(IO.hash(gb.toString()));
c.append(IO.hash(b.toString()));
b = new StringBuilder();
Iris.info("Writing Dimensional Scaffold");
try
{
a = new JSONObject(new Gson().toJson(dimension)).toString(minify ? 0 : 4);
IO.writeAll(new File(folder, "dimensions/" + dimension.getLoadKey() + ".json"), a);
b.append(IO.hash(a));
for(IrisGenerator i : generators)
{
a = new JSONObject(new Gson().toJson(i)).toString(minify ? 0 : 4);
IO.writeAll(new File(folder, "generators/" + i.getLoadKey() + ".json"), a);
b.append(IO.hash(a));
}
c.append(IO.hash(b.toString()));
b = new StringBuilder();
for(IrisRegion i : regions)
{
a = new JSONObject(new Gson().toJson(i)).toString(minify ? 0 : 4);
IO.writeAll(new File(folder, "regions/" + i.getLoadKey() + ".json"), a);
b.append(IO.hash(a));
}
for(IrisBlockData i : blocks)
{
a = new JSONObject(new Gson().toJson(i)).toString(minify ? 0 : 4);
IO.writeAll(new File(folder, "blocks/" + i.getLoadKey() + ".json"), a);
b.append(IO.hash(a));
}
for(IrisStructure i : structures)
{
a = new JSONObject(new Gson().toJson(i)).toString(minify ? 0 : 4);
IO.writeAll(new File(folder, "structures/" + i.getLoadKey() + ".json"), a);
b.append(IO.hash(a));
}
for(IrisBiome i : biomes)
{
a = new JSONObject(new Gson().toJson(i)).toString(minify ? 0 : 4);
IO.writeAll(new File(folder, "biomes/" + i.getLoadKey() + ".json"), a);
b.append(IO.hash(a));
}
for(IrisEntity i : entities)
{
a = new JSONObject(new Gson().toJson(i)).toString(minify ? 0 : 4);
IO.writeAll(new File(folder, "entities/" + i.getLoadKey() + ".json"), a);
b.append(IO.hash(a));
}
for(IrisLootTable i : loot)
{
a = new JSONObject(new Gson().toJson(i)).toString(minify ? 0 : 4);
IO.writeAll(new File(folder, "loot/" + i.getLoadKey() + ".json"), a);
b.append(IO.hash(a));
}
c.append(IO.hash(b.toString()));
b = new StringBuilder();
String finalHash = IO.hash(c.toString());
JSONObject meta = new JSONObject();
meta.put("hash", finalHash);
meta.put("time", M.ms());
meta.put("version", dimension.getVersion());
IO.writeAll(new File(folder, "package.json"), meta.toString(minify ? 0 : 4));
File p = new File(Iris.instance.getDataFolder(), "exports/" + dimension.getLoadKey() + ".iris");
Iris.info("Compressing Package");
ZipUtil.pack(folder, p, 9);
IO.delete(folder);
sender.sendMessage("Package Compiled!");
return p;
}
catch(Throwable e)
{
e.printStackTrace();
}
sender.sendMessage("Failed!");
return null;
}
}

View File

@@ -1,24 +1,10 @@
package com.volmit.iris.manager;
import java.awt.Desktop;
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.util.UUID;
import java.util.concurrent.locks.ReentrantLock;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Particle;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.WorldCreator;
import org.bukkit.WorldType;
import org.bukkit.block.Biome;
import org.bukkit.potion.PotionEffectType;
import org.zeroturnaround.zip.ZipUtil;
import org.zeroturnaround.zip.commons.FileUtils;
@@ -26,56 +12,31 @@ import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.volmit.iris.Iris;
import com.volmit.iris.IrisSettings;
import com.volmit.iris.gen.IrisTerrainProvider;
import com.volmit.iris.gen.nms.NMSCreator;
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.object.DecorationPart;
import com.volmit.iris.object.InterpolationMethod;
import com.volmit.iris.object.IrisBiome;
import com.volmit.iris.object.IrisBiomeGeneratorLink;
import com.volmit.iris.object.IrisBiomeMutation;
import com.volmit.iris.object.IrisBlockData;
import com.volmit.iris.object.IrisDimension;
import com.volmit.iris.object.IrisEntity;
import com.volmit.iris.object.IrisGenerator;
import com.volmit.iris.object.IrisInterpolator;
import com.volmit.iris.object.IrisLootTable;
import com.volmit.iris.object.IrisNoiseGenerator;
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.NoiseStyle;
import com.volmit.iris.object.StructureTileCondition;
import com.volmit.iris.util.C;
import com.volmit.iris.util.ChronoLatch;
import com.volmit.iris.util.Form;
import com.volmit.iris.util.IO;
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.KList;
import com.volmit.iris.util.KMap;
import com.volmit.iris.util.KSet;
import com.volmit.iris.util.M;
import com.volmit.iris.util.MortarSender;
import com.volmit.iris.util.O;
import com.volmit.iris.util.PrecisionStopwatch;
import com.volmit.iris.util.TaskExecutor;
import com.volmit.iris.util.TaskExecutor.TaskGroup;
import lombok.Data;
@Data
public class ProjectManager
{
public static final String workspaceName = "packs";
private KMap<String, String> cacheListing = null;
private IrisTerrainProvider currentProject;
private TaskExecutor tx = new TaskExecutor(8, Thread.MIN_PRIORITY, "Iris Compiler");
private ReentrantLock lock = new ReentrantLock();
private IrisProject activeProject;
public ProjectManager()
{
@@ -83,7 +44,7 @@ public class ProjectManager
{
J.a(() ->
{
File ignore = Iris.instance.getDataFile("packs", ".gitignore");
File ignore = getWorkspaceFile(".gitignore");
if(!ignore.exists())
{
@@ -133,7 +94,7 @@ public class ProjectManager
File zip = Iris.getNonCachedFile("pack-" + trim + "-" + repo, url);
File temp = Iris.getTemp();
File work = new File(temp, "dl-" + UUID.randomUUID());
File packs = Iris.instance.getDataFolder("packs");
File packs = getWorkspaceFolder();
sender.sendMessage("Unpacking " + repo);
ZipUtil.unpack(zip, work);
File dir = work.listFiles().length == 1 && work.listFiles()[0].isDirectory() ? work.listFiles()[0] : null;
@@ -243,7 +204,7 @@ public class ProjectManager
public boolean isProjectOpen()
{
return currentProject != null;
return activeProject != null && activeProject.isOpen();
}
public void open(MortarSender sender, String dimm)
@@ -255,442 +216,44 @@ public class ProjectManager
public void open(MortarSender sender, String dimm, Runnable onDone)
{
Iris.globaldata.dump();
Iris.globaldata.preferFolder(null);
IrisDimension d = Iris.globaldata.getDimensionLoader().load(dimm);
J.attemptAsync(() ->
{
try
{
File f = d.getLoadFile().getParentFile().getParentFile();
for(File i : f.listFiles())
{
if(i.getName().endsWith(".code-workspace"))
{
sender.sendMessage("Updating Workspace...");
J.a(() ->
{
updateWorkspace(i);
sender.sendMessage("Workspace Updated");
});
if(IrisSettings.get().openVSCode)
{
Desktop.getDesktop().open(i);
}
break;
}
}
}
catch(Throwable e)
{
e.printStackTrace();
}
});
if(d == null)
{
sender.sendMessage("Can't find dimension: " + dimm);
return;
}
if(isProjectOpen())
{
sender.sendMessage("Please Wait. Closing Current Project...");
close();
}
Iris.globaldata.dump();
sender.sendMessage("Loading " + dimm + "...");
String wfp = "iris/" + UUID.randomUUID();
ProvisionBukkit gen = Iris.instance.createProvisionBukkit(IrisGenConfiguration.builder().threads(IrisSettings.get().threads).dimension(dimm).target(TerrainTarget.builder().environment(d.getEnvironment()).folder(new File(wfp)).name(wfp).seed(1337).build()).build());
//@done
IrisProject project = new IrisProject(new File(getWorkspaceFolder(), dimm));
activeProject = project;
project.open(sender, onDone);
}
IrisTerrainProvider gx = (IrisTerrainProvider) gen.getProvider();
currentProject = gx;
gx.setDev(true);
sender.sendMessage("Generating with " + IrisSettings.get().threads + " threads per chunk");
O<Boolean> done = new O<Boolean>();
done.set(false);
public File getWorkspaceFolder(String... sub)
{
return Iris.instance.getDataFolderList(workspaceName, sub);
}
J.a(() ->
{
double last = 0;
int req = 740;
double lpc = 0;
boolean c = false;
while(!done.get())
{
boolean derp = false;
double v = (double) gx.getGenerated() / (double) req;
c = lpc != v;
lpc = v;
if(last > v || v > 1)
{
derp = true;
v = last;
}
else
{
last = v;
}
if(c)
{
sender.sendMessage(C.WHITE + "Generating " + Form.pc(v) + (derp ? (C.GRAY + " (Waiting on Server...)") : (C.GRAY + " (" + (req - gx.getGenerated()) + " Left)")));
}
J.sleep(3000);
if(gx.isFailing())
{
sender.sendMessage("Generation Failed!");
return;
}
}
});
// @NoArgsConstructor
World world = NMSCreator.createWorld(new WorldCreator(wfp).seed(1337).generator(gen).generateStructures(d.isVanillaStructures()).type(WorldType.NORMAL).environment(d.getEnvironment()), false);
//@done
gx.getTarget().setRealWorld(world);
Iris.linkMultiverseCore.removeFromConfig(world);
done.set(true);
sender.sendMessage("Generating 100%");
if(sender.isPlayer())
{
sender.player().teleport(new Location(world, 150, 150, 275));
}
Bukkit.getScheduler().scheduleSyncDelayedTask(Iris.instance, () ->
{
sender.sendMessage("Hotloading Active! Change any files and watch them appear as you load new chunks!");
if(sender.isPlayer())
{
sender.player().setGameMode(GameMode.SPECTATOR);
}
onDone.run();
}, 0);
public File getWorkspaceFile(String... sub)
{
return Iris.instance.getDataFileList(workspaceName, sub);
}
public void close()
{
if(isProjectOpen())
{
currentProject.close();
File folder = currentProject.getTarget().getFolder();
Iris.linkMultiverseCore.removeFromConfig(currentProject.getTarget().getName());
Bukkit.unloadWorld(currentProject.getTarget().getName(), false);
currentProject = null;
Iris.globaldata.dump();
Iris.globaldata.preferFolder(null);
J.attemptAsync(() -> IO.delete(folder));
activeProject.close();
activeProject = null;
}
}
public File compilePackage(MortarSender sender, String dim, boolean obfuscate, boolean minify)
public File compilePackage(MortarSender sender, String d, boolean obfuscate, boolean minify)
{
Iris.globaldata.dump();
Iris.globaldata.preferFolder(null);
String dimm = dim;
IrisDimension dimension = Iris.globaldata.getDimensionLoader().load(dimm);
File folder = new File(Iris.instance.getDataFolder(), "exports/" + dimension.getLoadKey());
folder.mkdirs();
Iris.info("Packaging Dimension " + dimension.getName() + " " + (obfuscate ? "(Obfuscated)" : ""));
KSet<IrisRegion> regions = new KSet<>();
KSet<IrisBiome> biomes = new KSet<>();
KSet<IrisEntity> entities = new KSet<>();
KSet<IrisStructure> structures = new KSet<>();
KSet<IrisGenerator> generators = new KSet<>();
KSet<IrisLootTable> loot = new KSet<>();
KSet<IrisBlockData> blocks = new KSet<>();
Iris.globaldata.preferFolder(dim);
for(String i : Iris.globaldata.getBlockLoader().getPreferredKeys())
{
blocks.add(Iris.globaldata.getBlockLoader().load(i));
}
Iris.globaldata.preferFolder(null);
dimension.getRegions().forEach((i) -> regions.add(Iris.globaldata.getRegionLoader().load(i)));
dimension.getLoot().getTables().forEach((i) -> loot.add(Iris.globaldata.getLootLoader().load(i)));
regions.forEach((i) -> biomes.addAll(i.getAllBiomes(null)));
biomes.forEach((i) -> i.getGenerators().forEach((j) -> generators.add(j.getCachedGenerator(null))));
regions.forEach((i) -> i.getStructures().forEach((j) -> structures.add(j.getStructure(null))));
biomes.forEach((i) -> i.getStructures().forEach((j) -> structures.add(j.getStructure(null))));
regions.forEach((r) -> r.getLoot().getTables().forEach((i) -> loot.add(Iris.globaldata.getLootLoader().load(i))));
biomes.forEach((r) -> r.getLoot().getTables().forEach((i) -> loot.add(Iris.globaldata.getLootLoader().load(i))));
structures.forEach((r) -> r.getLoot().getTables().forEach((i) -> loot.add(Iris.globaldata.getLootLoader().load(i))));
structures.forEach((b) -> b.getTiles().forEach((r) -> r.getLoot().getTables().forEach((i) -> loot.add(Iris.globaldata.getLootLoader().load(i)))));
structures.forEach((r) -> r.getEntitySpawnOverrides().forEach((sp) -> entities.add(Iris.globaldata.getEntityLoader().load(sp.getEntity()))));
structures.forEach((s) -> s.getTiles().forEach((r) -> r.getEntitySpawnOverrides().forEach((sp) -> entities.add(Iris.globaldata.getEntityLoader().load(sp.getEntity())))));
biomes.forEach((r) -> r.getEntitySpawnOverrides().forEach((sp) -> entities.add(Iris.globaldata.getEntityLoader().load(sp.getEntity()))));
regions.forEach((r) -> r.getEntitySpawnOverrides().forEach((sp) -> entities.add(Iris.globaldata.getEntityLoader().load(sp.getEntity()))));
dimension.getEntitySpawnOverrides().forEach((sp) -> entities.add(Iris.globaldata.getEntityLoader().load(sp.getEntity())));
structures.forEach((r) -> r.getEntityInitialSpawns().forEach((sp) -> entities.add(Iris.globaldata.getEntityLoader().load(sp.getEntity()))));
structures.forEach((s) -> s.getTiles().forEach((r) -> r.getEntityInitialSpawns().forEach((sp) -> entities.add(Iris.globaldata.getEntityLoader().load(sp.getEntity())))));
biomes.forEach((r) -> r.getEntityInitialSpawns().forEach((sp) -> entities.add(Iris.globaldata.getEntityLoader().load(sp.getEntity()))));
regions.forEach((r) -> r.getEntityInitialSpawns().forEach((sp) -> entities.add(Iris.globaldata.getEntityLoader().load(sp.getEntity()))));
dimension.getEntityInitialSpawns().forEach((sp) -> entities.add(Iris.globaldata.getEntityLoader().load(sp.getEntity())));
KMap<String, String> renameObjects = new KMap<>();
String a = "";
StringBuilder b = new StringBuilder();
StringBuilder c = new StringBuilder();
sender.sendMessage("Serializing Objects");
for(IrisStructure i : structures)
{
for(IrisStructureTile j : i.getTiles())
{
b.append(j.hashCode());
KList<String> newNames = new KList<>();
for(String k : j.getObjects())
{
if(renameObjects.containsKey(k))
{
newNames.add(renameObjects.get(k));
continue;
}
String name = !obfuscate ? k : UUID.randomUUID().toString().replaceAll("-", "");
b.append(name);
newNames.add(name);
renameObjects.put(k, name);
}
j.setObjects(newNames);
}
}
for(IrisBiome i : biomes)
{
for(IrisObjectPlacement j : i.getObjects())
{
b.append(j.hashCode());
KList<String> newNames = new KList<>();
for(String k : j.getPlace())
{
if(renameObjects.containsKey(k))
{
newNames.add(renameObjects.get(k));
continue;
}
String name = !obfuscate ? k : UUID.randomUUID().toString().replaceAll("-", "");
b.append(name);
newNames.add(name);
renameObjects.put(k, name);
}
j.setPlace(newNames);
}
}
for(IrisBiomeMutation i : dimension.getMutations())
{
for(IrisObjectPlacement j : i.getObjects())
{
b.append(j.hashCode());
KList<String> newNames = new KList<>();
for(String k : j.getPlace())
{
if(renameObjects.containsKey(k))
{
newNames.add(renameObjects.get(k));
continue;
}
String name = !obfuscate ? k : UUID.randomUUID().toString().replaceAll("-", "");
b.append(name);
newNames.add(name);
renameObjects.put(k, name);
}
j.setPlace(newNames);
}
}
KMap<String, KList<String>> lookupObjects = renameObjects.flip();
StringBuilder gb = new StringBuilder();
ChronoLatch cl = new ChronoLatch(1000);
O<Integer> ggg = new O<Integer>();
ggg.set(0);
biomes.forEach((i) -> i.getObjects().forEach((j) -> j.getPlace().forEach((k) ->
{
try
{
File f = Iris.globaldata.getObjectLoader().findFile(lookupObjects.get(k).get(0));
IO.copyFile(f, new File(folder, "objects/" + k + ".iob"));
gb.append(IO.hash(f));
ggg.set(ggg.get() + 1);
if(cl.flip())
{
int g = ggg.get();
ggg.set(0);
sender.sendMessage("Wrote another " + g + " Objects");
}
}
catch(Throwable e)
{
}
})));
structures.forEach((i) -> i.getTiles().forEach((j) -> j.getObjects().forEach((k) ->
{
try
{
File f = Iris.globaldata.getObjectLoader().findFile(lookupObjects.get(k).get(0));
IO.copyFile(f, new File(folder, "objects/" + k + ".iob"));
gb.append(IO.hash(f));
ggg.set(ggg.get() + 1);
if(cl.flip())
{
int g = ggg.get();
ggg.set(0);
sender.sendMessage("Wrote another " + g + " Objects");
}
}
catch(Throwable e)
{
}
})));
dimension.getMutations().forEach((i) -> i.getObjects().forEach((j) -> j.getPlace().forEach((k) ->
{
try
{
File f = Iris.globaldata.getObjectLoader().findFile(lookupObjects.get(k).get(0));
IO.copyFile(f, new File(folder, "objects/" + k + ".iob"));
gb.append(IO.hash(f));
ggg.set(ggg.get() + 1);
if(cl.flip())
{
int g = ggg.get();
ggg.set(0);
sender.sendMessage("Wrote another " + g + " Objects");
}
}
catch(Throwable e)
{
}
})));
b.append(IO.hash(gb.toString()));
c.append(IO.hash(b.toString()));
b = new StringBuilder();
Iris.info("Writing Dimensional Scaffold");
try
{
a = new JSONObject(new Gson().toJson(dimension)).toString(minify ? 0 : 4);
IO.writeAll(new File(folder, "dimensions/" + dimension.getLoadKey() + ".json"), a);
b.append(IO.hash(a));
for(IrisGenerator i : generators)
{
a = new JSONObject(new Gson().toJson(i)).toString(minify ? 0 : 4);
IO.writeAll(new File(folder, "generators/" + i.getLoadKey() + ".json"), a);
b.append(IO.hash(a));
}
c.append(IO.hash(b.toString()));
b = new StringBuilder();
for(IrisRegion i : regions)
{
a = new JSONObject(new Gson().toJson(i)).toString(minify ? 0 : 4);
IO.writeAll(new File(folder, "regions/" + i.getLoadKey() + ".json"), a);
b.append(IO.hash(a));
}
for(IrisBlockData i : blocks)
{
a = new JSONObject(new Gson().toJson(i)).toString(minify ? 0 : 4);
IO.writeAll(new File(folder, "blocks/" + i.getLoadKey() + ".json"), a);
b.append(IO.hash(a));
}
for(IrisStructure i : structures)
{
a = new JSONObject(new Gson().toJson(i)).toString(minify ? 0 : 4);
IO.writeAll(new File(folder, "structures/" + i.getLoadKey() + ".json"), a);
b.append(IO.hash(a));
}
for(IrisBiome i : biomes)
{
a = new JSONObject(new Gson().toJson(i)).toString(minify ? 0 : 4);
IO.writeAll(new File(folder, "biomes/" + i.getLoadKey() + ".json"), a);
b.append(IO.hash(a));
}
for(IrisEntity i : entities)
{
a = new JSONObject(new Gson().toJson(i)).toString(minify ? 0 : 4);
IO.writeAll(new File(folder, "entities/" + i.getLoadKey() + ".json"), a);
b.append(IO.hash(a));
}
for(IrisLootTable i : loot)
{
a = new JSONObject(new Gson().toJson(i)).toString(minify ? 0 : 4);
IO.writeAll(new File(folder, "loot/" + i.getLoadKey() + ".json"), a);
b.append(IO.hash(a));
}
c.append(IO.hash(b.toString()));
b = new StringBuilder();
String finalHash = IO.hash(c.toString());
JSONObject meta = new JSONObject();
meta.put("hash", finalHash);
meta.put("time", M.ms());
meta.put("version", dimension.getVersion());
IO.writeAll(new File(folder, "package.json"), meta.toString(minify ? 0 : 4));
File p = new File(Iris.instance.getDataFolder(), "exports/" + dimension.getLoadKey() + ".iris");
Iris.info("Compressing Package");
ZipUtil.pack(folder, p, 9);
IO.delete(folder);
sender.sendMessage("Package Compiled!");
return p;
}
catch(Throwable e)
{
e.printStackTrace();
}
sender.sendMessage("Failed!");
return null;
return new IrisProject(new File(getWorkspaceFolder(), d)).compilePackage(sender, obfuscate, minify);
}
public void createFrom(String existingPack, String newName)
{
File importPack = Iris.instance.getDataFolder("packs", existingPack);
File newPack = Iris.instance.getDataFolder("packs", newName);
File importPack = getWorkspaceFolder(existingPack);
File newPack = getWorkspaceFolder(newName);
if(importPack.listFiles().length == 0)
{
@@ -749,8 +312,9 @@ public class ProjectManager
try
{
JSONObject ws = newWorkspaceConfig(Iris.instance.getDataFolder("packs", newName));
IO.writeAll(Iris.instance.getDataFile("packs", newName, newName + ".code-workspace"), ws.toString(0));
IrisProject p = new IrisProject(getWorkspaceFolder(newName));
JSONObject ws = p.createCodeWorkspaceConfig();
IO.writeAll(getWorkspaceFile(newName, newName + ".code-workspace"), ws.toString(0));
}
catch(JSONException | IOException e)
@@ -762,7 +326,7 @@ public class ProjectManager
public void create(MortarSender sender, String s, String downloadable)
{
boolean shouldDelete = false;
File importPack = Iris.instance.getDataFolder("packs", downloadable);
File importPack = getWorkspaceFolder(downloadable);
if(importPack.listFiles().length == 0)
{
@@ -794,7 +358,7 @@ public class ProjectManager
{
importPack.delete();
}
Iris.proj.open(sender, s);
open(sender, s);
}
public void create(MortarSender sender, String s)
@@ -811,7 +375,7 @@ public class ProjectManager
dimension.setLoadKey(s);
dimension.setName(Form.capitalizeWords(s.replaceAll("\\Q-\\E", " ")));
if(Iris.instance.getDataFile("packs", dimension.getLoadKey(), "dimensions", dimension.getLoadKey() + ".json").exists())
if(getWorkspaceFile(dimension.getLoadKey(), "dimensions", dimension.getLoadKey() + ".json").exists())
{
sender.sendMessage("Project Already Exists! Open it instead!");
return false;
@@ -872,18 +436,18 @@ public class ProjectManager
exampleRegion.getShoreBiomes().add(exampleShore1.getLoadKey());
exampleRegion.getSeaBiomes().add(exampleOcean1.getLoadKey());
dimension.getRegions().add(exampleRegion.getLoadKey());
IrisProject project = new IrisProject(getWorkspaceFolder(dimension.getLoadKey()));
try
{
JSONObject ws = newWorkspaceConfig(Iris.instance.getDataFolder("packs", dimension.getLoadKey()));
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));
IO.writeAll(Iris.instance.getDataFile("packs", dimension.getLoadKey(), "biomes", exampleLand2.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(exampleLand2)).toString(4));
IO.writeAll(Iris.instance.getDataFile("packs", dimension.getLoadKey(), "biomes", exampleShore1.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(exampleShore1)).toString(4));
IO.writeAll(Iris.instance.getDataFile("packs", dimension.getLoadKey(), "biomes", exampleOcean1.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(exampleOcean1)).toString(4));
IO.writeAll(Iris.instance.getDataFile("packs", dimension.getLoadKey(), "generators", gen.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(gen)).toString(4));
IO.writeAll(Iris.instance.getDataFile("packs", dimension.getLoadKey(), dimension.getLoadKey() + ".code-workspace"), ws.toString(0));
JSONObject ws = project.createCodeWorkspaceConfig();
IO.writeAll(getWorkspaceFile(dimension.getLoadKey(), "dimensions", dimension.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(dimension)).toString(4));
IO.writeAll(getWorkspaceFile(dimension.getLoadKey(), "regions", exampleRegion.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(exampleRegion)).toString(4));
IO.writeAll(getWorkspaceFile(dimension.getLoadKey(), "biomes", exampleLand1.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(exampleLand1)).toString(4));
IO.writeAll(getWorkspaceFile(dimension.getLoadKey(), "biomes", exampleLand2.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(exampleLand2)).toString(4));
IO.writeAll(getWorkspaceFile(dimension.getLoadKey(), "biomes", exampleShore1.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(exampleShore1)).toString(4));
IO.writeAll(getWorkspaceFile(dimension.getLoadKey(), "biomes", exampleOcean1.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(exampleOcean1)).toString(4));
IO.writeAll(getWorkspaceFile(dimension.getLoadKey(), "generators", gen.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(gen)).toString(4));
IO.writeAll(getWorkspaceFile(dimension.getLoadKey(), dimension.getLoadKey() + ".code-workspace"), ws.toString(0));
}
catch(JSONException | IOException e)
@@ -896,366 +460,11 @@ public class ProjectManager
return true;
}
private JSONObject newWorkspaceConfig(File pack)
public void updateWorkspace()
{
Iris.globaldata.clearLists();
JSONObject ws = new JSONObject();
JSONArray folders = new JSONArray();
JSONObject folder = new JSONObject();
folder.put("path", ".");
folders.put(folder);
ws.put("folders", folders);
JSONObject settings = new JSONObject();
settings.put("workbench.colorTheme", "Monokai");
settings.put("workbench.preferredDarkColorTheme", "Solarized Dark");
settings.put("workbench.tips.enabled", false);
settings.put("workbench.tree.indent", 24);
settings.put("files.autoSave", "onFocusChange");
JSONObject jc = new JSONObject();
jc.put("editor.autoIndent", "brackets");
jc.put("editor.acceptSuggestionOnEnter", "smart");
jc.put("editor.cursorSmoothCaretAnimation", true);
jc.put("editor.dragAndDrop", false);
jc.put("files.trimTrailingWhitespace", true);
jc.put("diffEditor.ignoreTrimWhitespace", true);
jc.put("files.trimFinalNewlines", true);
jc.put("editor.suggest.showKeywords", false);
jc.put("editor.suggest.showSnippets", false);
jc.put("editor.suggest.showWords", false);
JSONObject st = new JSONObject();
st.put("strings", true);
jc.put("editor.quickSuggestions", st);
jc.put("editor.suggest.insertMode", "replace");
settings.put("[json]", jc);
settings.put("json.maxItemsComputed", 15000);
JSONArray schemas = buildSchemas(Iris.globaldata, pack);
settings.put("json.schemas", schemas);
ws.put("settings", settings);
return ws;
}
public File getWorkspaceFile(String dim)
{
return Iris.instance.getDataFile("packs", dim, dim + ".code-workspace");
}
public void updateWorkspace(File ws)
{
try
if(isProjectOpen())
{
PrecisionStopwatch p = PrecisionStopwatch.start();
Iris.info("Updating Workspace: " + ws.getPath());
J.attemptAsync(() -> writeDocs(ws.getParentFile()));
JSONObject j = newWorkspaceConfig(ws.getParentFile());
IO.writeAll(ws, j.toString(4));
p.end();
Iris.info("Updated Workspace: " + ws.getPath() + " in " + Form.duration(p.getMilliseconds(), 2));
activeProject.updateWorkspace();
}
catch(Throwable e)
{
Iris.warn("Project invalid: " + ws.getAbsolutePath() + " Re-creating. You may loose some vs-code workspace settings! But not your actual project!");
try
{
IO.writeAll(ws, newWorkspaceConfig(ws.getParentFile()));
}
catch(IOException e1)
{
e1.printStackTrace();
}
}
}
private void ex(JSONArray schemas, Class<?> c, IrisDataManager dat, String v, File pack)
{
JSONObject o = getSchemaEntry(c, dat, v);
lock.lock();
schemas.put(o);
lock.unlock();
J.a(() ->
{
File f = new File(pack, "_docs/schema/" + c.getSimpleName().replaceAll("\\QIris\\E", "").toLowerCase() + ".json");
f.getParentFile().mkdirs();
try
{
IO.writeAll(f, o.toString(4));
}
catch(JSONException e)
{
e.printStackTrace();
}
catch(IOException e)
{
e.printStackTrace();
}
});
}
private JSONArray buildSchemas(IrisDataManager dat, File pack)
{
String gg = dat.getBiomeLoader().getPreferredFolder();
dat.preferFolder(pack.getName());
JSONArray schemas = new JSONArray();
TaskGroup g = tx.startWork();
g.queue(() -> ex(schemas, IrisDimension.class, dat, "/dimensions/*.json", pack));
g.queue(() -> ex(schemas, IrisEntity.class, dat, "/entities/*.json", pack));
g.queue(() -> ex(schemas, IrisBiome.class, dat, "/biomes/*.json", pack));
g.queue(() -> ex(schemas, IrisRegion.class, dat, "/regions/*.json", pack));
g.queue(() -> ex(schemas, IrisGenerator.class, dat, "/generators/*.json", pack));
g.queue(() -> ex(schemas, IrisStructure.class, dat, "/structures/*.json", pack));
g.queue(() -> ex(schemas, IrisBlockData.class, dat, "/blocks/*.json", pack));
g.queue(() -> ex(schemas, IrisLootTable.class, dat, "/loot/*.json", pack));
g.execute();
dat.preferFolder(gg);
return schemas;
}
public JSONObject getSchemaEntry(Class<?> i, IrisDataManager dat, String... fileMatch)
{
Iris.verbose("Processing Folder " + i.getSimpleName() + " " + fileMatch[0]);
JSONObject o = new JSONObject();
o.put("fileMatch", new JSONArray(fileMatch));
o.put("schema", new SchemaBuilder(i, dat).compute());
return o;
}
public KList<String> analyzeFolder(File folder, String fn, Object t)
{
KList<String> a = new KList<String>();
if(!new File(folder, fn).exists())
{
return a;
}
if(!new File(folder, fn).isDirectory())
{
a.add("ERROR: " + new File(folder, fn).getAbsolutePath() + " must be a folder, not a file!");
return a;
}
for(File i : new File(folder, fn).listFiles())
{
if(i.isFile() && i.getName().endsWith(".json"))
{
if(!i.getName().toLowerCase().equals(i.getName()))
{
a.add("WARN: " + i.getAbsolutePath() + " has upper case letters in the file name.");
}
if(i.getName().contains(" "))
{
a.add("WARN: " + i.getAbsolutePath() + " has spaces in the file name.");
}
Object o;
JSONObject j;
try
{
Iris.info("Reading " + i.getPath());
j = new JSONObject(IO.readAll(i));
o = new Gson().fromJson(j.toString(), t.getClass());
a.addAll(analyze(o, i));
verify(j, o, a, i);
}
catch(Throwable e)
{
a.add("ERROR: Failed to read " + i.getAbsolutePath() + ": " + e.getMessage());
}
}
else
{
a.add("WARN: " + i.getAbsolutePath() + " should not be in this directory.");
}
}
return a;
}
private void verify(JSONObject j, Object o, KList<String> a, File m)
{
for(String i : j.keySet())
{
try
{
JSONObject jj = j.getJSONObject(i);
try
{
Field f = o.getClass().getDeclaredField(i);
if(f.isEnumConstant() || f.getType().isEnum() || f.getType().isPrimitive())
{
a.add("ERROR: Unexptected type: " + i + " into " + f.getType() + " expected. Got a jsonObject in " + o.getClass() + " in " + m.getAbsolutePath());
continue;
}
f.setAccessible(true);
Object oo = f.get(o);
if(oo == null)
{
a.add("WARN: Incorrect injection on " + o.getClass() + "." + i);
}
verify(jj, oo, a, m);
}
catch(Throwable e)
{
a.add("WARN: Unexptected Field: " + i + " in " + o.getClass().getSimpleName() + " from " + m.getAbsolutePath() + " " + e.getClass().getSimpleName() + " " + e.getMessage());
}
}
catch(Throwable enn)
{
}
}
}
public KList<String> analyze(File project)
{
KList<String> a = new KList<String>();
a.addAll(analyzeFolder(project, "dimensions", new IrisDimension()));
a.addAll(analyzeFolder(project, "biomes", new IrisBiome()));
a.addAll(analyzeFolder(project, "regions", new IrisRegion()));
a.addAll(analyzeFolder(project, "generators", new IrisGenerator()));
a.addAll(analyzeFolder(project, "structures", new IrisStructure()));
return a;
}
public KList<String> analyze(Object o, File file)
{
KList<String> a = new KList<String>();
String t;
try
{
t = IO.readAll(file);
}
catch(IOException e1)
{
a.add("ERROR: Unable to read " + file.getAbsolutePath() + ": " + e1.getMessage());
return a;
}
JSONObject j;
try
{
j = new JSONObject(t);
}
catch(Throwable e)
{
a.add("ERROR: Unable to parse json " + file.getAbsolutePath() + ": " + e.getMessage());
return a;
}
for(String i : j.keySet())
{
try
{
Field f = o.getClass().getDeclaredField(i);
if(f == null)
{
throw new NullPointerException();
}
}
catch(Throwable e)
{
a.add("WARN: Unreconized Field (key): " + i + " in " + file.getAbsolutePath() + ". Delete this key/value pair: " + o.getClass().getSimpleName());
}
}
return a;
}
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(NoiseStyle i : NoiseStyle.values())
{
m.add(i.name());
}
IO.writeAll(new File(of, "noise-style.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(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(PotionEffectType i : PotionEffectType.values())
{
m.add(i.getName().toUpperCase().replaceAll("\\Q \\E", "_"));
}
IO.writeAll(new File(of, "potioneffects.txt"), m.toString("\n"));
}
}

View File

@@ -89,7 +89,7 @@ public class StructureTemplate implements Listener, IObjectPlacer
this.worker = worker;
rng = new RNG();
variants = NoiseStyle.STATIC.create(rng.nextParallelRNG(397878));
folder = Iris.instance.getDataFolder("packs", dimension);
folder = Iris.proj.getWorkspaceFolder(dimension);
gLatch = new ChronoLatch(250);
focus = center;
dirtyLatch = new ChronoLatch(250);

View File

@@ -672,6 +672,15 @@ public abstract class MortarPlugin extends JavaPlugin implements Listener
return f;
}
public File getDataFileList(String pre, String[] strings)
{
KList<String> v = new KList<String>(strings);
v.add(0, pre);
File f = new File(getDataFolder(), v.toString(File.separator));
f.getParentFile().mkdirs();
return f;
}
public File getDataFolder(String... strings)
{
if(strings.length == 0)
@@ -685,6 +694,20 @@ public abstract class MortarPlugin extends JavaPlugin implements Listener
return f;
}
public File getDataFolderList(String pre, String[] strings)
{
KList<String> v = new KList<>(strings);
v.add(0, pre);
if(v.size() == 0)
{
return super.getDataFolder();
}
File f = new File(getDataFolder(), v.toString(File.separator));
f.mkdirs();
return f;
}
public abstract void start();
public abstract void stop();