diff --git a/nms/v1_19_R1/src/main/java/com/volmit/iris/core/nms/v1_19_R1/MemoryWorld.java b/nms/v1_19_R1/src/main/java/com/volmit/iris/core/nms/v1_19_R1/MemoryWorld.java index 86b3e5833..b786e9c0b 100644 --- a/nms/v1_19_R1/src/main/java/com/volmit/iris/core/nms/v1_19_R1/MemoryWorld.java +++ b/nms/v1_19_R1/src/main/java/com/volmit/iris/core/nms/v1_19_R1/MemoryWorld.java @@ -52,15 +52,18 @@ import org.jetbrains.annotations.NotNull; import java.io.IOException; import java.lang.ref.WeakReference; +import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.nio.file.Files; +import java.util.Arrays; import java.util.Locale; import java.util.Map; import java.util.Objects; import java.util.concurrent.CompletableFuture; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; public class MemoryWorld implements IMemoryWorld { private static final AtomicLong C = new AtomicLong(); @@ -112,7 +115,10 @@ public class MemoryWorld implements IMemoryWorld { worldInfo = c.newInstance(worldData, access, creator.environment(), levelStem.typeHolder().value(), levelStem.generator(), server.registryAccess()); } catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException ex) { - throw new RuntimeException(ex); + var constructors = Arrays.stream(CraftWorldInfo.class.getDeclaredConstructors()) + .map(Constructor::toGenericString) + .collect(Collectors.joining("\n")); + throw new IOException("Failed to find CraftWorldInfo constructor found: " + constructors, ex); } } if (biomeProvider == null && generator != null) { diff --git a/nms/v1_19_R2/src/main/java/com/volmit/iris/core/nms/v1_19_R2/MemoryWorld.java b/nms/v1_19_R2/src/main/java/com/volmit/iris/core/nms/v1_19_R2/MemoryWorld.java index e4cfd9434..769056d66 100644 --- a/nms/v1_19_R2/src/main/java/com/volmit/iris/core/nms/v1_19_R2/MemoryWorld.java +++ b/nms/v1_19_R2/src/main/java/com/volmit/iris/core/nms/v1_19_R2/MemoryWorld.java @@ -55,13 +55,16 @@ import org.jetbrains.annotations.NotNull; import java.io.IOException; import java.lang.ref.WeakReference; +import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.nio.file.Files; +import java.util.Arrays; import java.util.Locale; import java.util.Map; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; public class MemoryWorld implements IMemoryWorld { private static final AtomicLong C = new AtomicLong(); @@ -118,7 +121,10 @@ public class MemoryWorld implements IMemoryWorld { worldInfo = c.newInstance(worldData, access, creator.environment(), levelStem.type().value(), levelStem.generator(), server.registryAccess()); } catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException ex) { - throw new RuntimeException(ex); + var constructors = Arrays.stream(CraftWorldInfo.class.getDeclaredConstructors()) + .map(Constructor::toGenericString) + .collect(Collectors.joining("\n")); + throw new IOException("Failed to find CraftWorldInfo constructor found: " + constructors, ex); } } if (biomeProvider == null && generator != null) { diff --git a/nms/v1_19_R3/src/main/java/com/volmit/iris/core/nms/v1_19_R3/MemoryWorld.java b/nms/v1_19_R3/src/main/java/com/volmit/iris/core/nms/v1_19_R3/MemoryWorld.java index ea9e9e8fe..68b5bf12f 100644 --- a/nms/v1_19_R3/src/main/java/com/volmit/iris/core/nms/v1_19_R3/MemoryWorld.java +++ b/nms/v1_19_R3/src/main/java/com/volmit/iris/core/nms/v1_19_R3/MemoryWorld.java @@ -56,14 +56,17 @@ import org.jetbrains.annotations.NotNull; import java.io.IOException; import java.lang.ref.WeakReference; +import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.nio.file.Files; +import java.util.Arrays; import java.util.Locale; import java.util.Map; import java.util.concurrent.CompletableFuture; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; public class MemoryWorld implements IMemoryWorld { private static final AtomicLong C = new AtomicLong(); @@ -120,7 +123,10 @@ public class MemoryWorld implements IMemoryWorld { worldInfo = c.newInstance(worldData, access, creator.environment(), levelStem.type().value(), levelStem.generator(), server.registryAccess()); } catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException ex) { - throw new RuntimeException(ex); + var constructors = Arrays.stream(CraftWorldInfo.class.getDeclaredConstructors()) + .map(Constructor::toGenericString) + .collect(Collectors.joining("\n")); + throw new IOException("Failed to find CraftWorldInfo constructor found: " + constructors, ex); } } if (biomeProvider == null && generator != null) { diff --git a/nms/v1_20_R1/src/main/java/com/volmit/iris/core/nms/v1_20_R1/MemoryWorld.java b/nms/v1_20_R1/src/main/java/com/volmit/iris/core/nms/v1_20_R1/MemoryWorld.java index bdccdd5d2..3249a437e 100644 --- a/nms/v1_20_R1/src/main/java/com/volmit/iris/core/nms/v1_20_R1/MemoryWorld.java +++ b/nms/v1_20_R1/src/main/java/com/volmit/iris/core/nms/v1_20_R1/MemoryWorld.java @@ -42,6 +42,7 @@ import org.bukkit.block.Biome; import org.bukkit.block.data.BlockData; import org.bukkit.craftbukkit.v1_20_R1.CraftChunk; import org.bukkit.craftbukkit.v1_20_R1.CraftServer; +import org.bukkit.craftbukkit.v1_20_R1.attribute.CraftAttributeInstance; import org.bukkit.craftbukkit.v1_20_R1.block.CraftBlock; import org.bukkit.craftbukkit.v1_20_R1.block.data.CraftBlockData; import org.bukkit.craftbukkit.v1_20_R1.generator.CraftWorldInfo; @@ -56,14 +57,17 @@ import org.jetbrains.annotations.NotNull; import java.io.IOException; import java.lang.ref.WeakReference; +import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.nio.file.Files; +import java.util.Arrays; import java.util.Locale; import java.util.Map; import java.util.concurrent.CompletableFuture; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; public class MemoryWorld implements IMemoryWorld { private static final AtomicLong C = new AtomicLong(); @@ -120,7 +124,11 @@ public class MemoryWorld implements IMemoryWorld { worldInfo = c.newInstance(worldData, access, creator.environment(), levelStem.type().value(), levelStem.generator(), server.registryAccess()); } catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException ex) { - throw new RuntimeException(ex); + var constructors = Arrays.stream(CraftWorldInfo.class.getDeclaredConstructors()) + .map(Constructor::toGenericString) + .collect(Collectors.joining("\n")); + CraftAttributeInstance + throw new IOException("Failed to find CraftWorldInfo constructor found: " + constructors, ex); } } if (biomeProvider == null && generator != null) { diff --git a/nms/v1_20_R2/src/main/java/com/volmit/iris/core/nms/v1_20_R2/MemoryWorld.java b/nms/v1_20_R2/src/main/java/com/volmit/iris/core/nms/v1_20_R2/MemoryWorld.java index 37cd66128..81f0ba35b 100644 --- a/nms/v1_20_R2/src/main/java/com/volmit/iris/core/nms/v1_20_R2/MemoryWorld.java +++ b/nms/v1_20_R2/src/main/java/com/volmit/iris/core/nms/v1_20_R2/MemoryWorld.java @@ -56,14 +56,17 @@ import org.jetbrains.annotations.NotNull; import java.io.IOException; import java.lang.ref.WeakReference; +import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.nio.file.Files; +import java.util.Arrays; import java.util.Locale; import java.util.Map; import java.util.concurrent.CompletableFuture; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; public class MemoryWorld implements IMemoryWorld { private static final AtomicLong C = new AtomicLong(); @@ -120,7 +123,10 @@ public class MemoryWorld implements IMemoryWorld { worldInfo = c.newInstance(worldData, access, creator.environment(), levelStem.type().value(), levelStem.generator(), server.registryAccess()); } catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException ex) { - throw new RuntimeException(ex); + var constructors = Arrays.stream(CraftWorldInfo.class.getDeclaredConstructors()) + .map(Constructor::toGenericString) + .collect(Collectors.joining("\n")); + throw new IOException("Failed to find CraftWorldInfo constructor found: " + constructors, ex); } } if (biomeProvider == null && generator != null) { diff --git a/nms/v1_20_R3/src/main/java/com/volmit/iris/core/nms/v1_20_R3/MemoryWorld.java b/nms/v1_20_R3/src/main/java/com/volmit/iris/core/nms/v1_20_R3/MemoryWorld.java index 2239fcaff..c3007b488 100644 --- a/nms/v1_20_R3/src/main/java/com/volmit/iris/core/nms/v1_20_R3/MemoryWorld.java +++ b/nms/v1_20_R3/src/main/java/com/volmit/iris/core/nms/v1_20_R3/MemoryWorld.java @@ -60,14 +60,17 @@ import org.jetbrains.annotations.NotNull; import java.io.IOException; import java.lang.ref.WeakReference; +import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.nio.file.Files; +import java.util.Arrays; import java.util.Locale; import java.util.Map; import java.util.concurrent.CompletableFuture; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; public class MemoryWorld implements IMemoryWorld { private static final AtomicLong C = new AtomicLong(); @@ -124,7 +127,10 @@ public class MemoryWorld implements IMemoryWorld { worldInfo = c.newInstance(worldData, access, creator.environment(), levelStem.type().value(), levelStem.generator(), server.registryAccess()); } catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException ex) { - throw new RuntimeException(ex); + var constructors = Arrays.stream(CraftWorldInfo.class.getDeclaredConstructors()) + .map(Constructor::toGenericString) + .collect(Collectors.joining("\n")); + throw new IOException("Failed to find CraftWorldInfo constructor found: " + constructors, ex); } } if (biomeProvider == null && generator != null) { diff --git a/nms/v1_20_R4/src/main/java/com/volmit/iris/core/nms/v1_20_R4/MemoryWorld.java b/nms/v1_20_R4/src/main/java/com/volmit/iris/core/nms/v1_20_R4/MemoryWorld.java index aa0d67f83..d2f4bf856 100644 --- a/nms/v1_20_R4/src/main/java/com/volmit/iris/core/nms/v1_20_R4/MemoryWorld.java +++ b/nms/v1_20_R4/src/main/java/com/volmit/iris/core/nms/v1_20_R4/MemoryWorld.java @@ -57,14 +57,17 @@ import org.jetbrains.annotations.NotNull; import java.io.IOException; import java.lang.ref.WeakReference; +import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.nio.file.Files; +import java.util.Arrays; import java.util.Locale; import java.util.Map; import java.util.concurrent.CompletableFuture; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; public class MemoryWorld implements IMemoryWorld { private static final AtomicLong C = new AtomicLong(); @@ -122,7 +125,10 @@ public class MemoryWorld implements IMemoryWorld { worldInfo = c.newInstance(worldData, access, creator.environment(), levelStem.type().value(), levelStem.generator(), server.registryAccess()); } catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException ex) { - throw new RuntimeException(ex); + var constructors = Arrays.stream(CraftWorldInfo.class.getDeclaredConstructors()) + .map(Constructor::toGenericString) + .collect(Collectors.joining("\n")); + throw new IOException("Failed to find CraftWorldInfo constructor found: " + constructors, ex); } } if (biomeProvider == null && generator != null) { diff --git a/nms/v1_21_R1/src/main/java/com/volmit/iris/core/nms/v1_21_R1/MemoryWorld.java b/nms/v1_21_R1/src/main/java/com/volmit/iris/core/nms/v1_21_R1/MemoryWorld.java index 7678e33f5..a4e901df1 100644 --- a/nms/v1_21_R1/src/main/java/com/volmit/iris/core/nms/v1_21_R1/MemoryWorld.java +++ b/nms/v1_21_R1/src/main/java/com/volmit/iris/core/nms/v1_21_R1/MemoryWorld.java @@ -57,8 +57,10 @@ import org.jetbrains.annotations.NotNull; import java.io.IOException; import java.lang.ref.WeakReference; +import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Modifier; import java.nio.file.Files; import java.util.Arrays; import java.util.Locale; @@ -124,7 +126,10 @@ public class MemoryWorld implements IMemoryWorld { worldInfo = c.newInstance(worldData, access, creator.environment(), levelStem.type().value(), levelStem.generator(), server.registryAccess()); } catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException ex) { - throw new RuntimeException(ex); + var constructors = Arrays.stream(CraftWorldInfo.class.getDeclaredConstructors()) + .map(Constructor::toGenericString) + .collect(Collectors.joining("\n")); + throw new IOException("Failed to find CraftWorldInfo constructor found: " + constructors, ex); } } if (biomeProvider == null && generator != null) {