From 2d98da47cf0dd0fbcaae5e2a1c7ca5fe8f5de227 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Fri, 27 Jul 2018 10:56:53 +1000 Subject: [PATCH] Debug generator error --- .../java/com/plotsquared/nukkit/NukkitMain.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Nukkit/src/main/java/com/plotsquared/nukkit/NukkitMain.java b/Nukkit/src/main/java/com/plotsquared/nukkit/NukkitMain.java index d2f689a91..771c55888 100644 --- a/Nukkit/src/main/java/com/plotsquared/nukkit/NukkitMain.java +++ b/Nukkit/src/main/java/com/plotsquared/nukkit/NukkitMain.java @@ -8,6 +8,7 @@ import cn.nukkit.event.Listener; import cn.nukkit.level.Level; import cn.nukkit.level.format.FullChunk; import cn.nukkit.level.generator.Generator; +import cn.nukkit.level.generator.Normal; import cn.nukkit.metadata.MetadataValue; import cn.nukkit.plugin.Plugin; import cn.nukkit.plugin.PluginBase; @@ -36,6 +37,7 @@ import com.plotsquared.nukkit.uuid.LowerOfflineUUIDWrapper; import com.sk89q.worldedit.WorldEdit; import java.io.File; import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; import java.util.*; public final class NukkitMain extends PluginBase implements Listener, IPlotMain { @@ -294,18 +296,19 @@ public final class NukkitMain extends PluginBase implements Listener, IPlotMain } HashMap map = new HashMap(); map.put("world", world); - try { - Class gen = Generator.getGenerator(name); - if (gen != null) { + Class gen = Generator.getGenerator(name); + if (gen != null) { + try { Generator instance = gen.getConstructor(Map.class).newInstance(map); if (instance instanceof GeneratorWrapper) { return (GeneratorWrapper) instance; } map.put("generator", instance); return new NukkitPlotGenerator(map); + } catch (Throwable e) { + System.out.println("Failed to create generator for " + name + " | " + gen); + e.printStackTrace(); } - } catch (Throwable e) { - e.printStackTrace(); } return new NukkitHybridGen(map); }