From c98f2b4261d3a6644319386b667843a135c0271c Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Tue, 13 Feb 2018 02:16:13 +1100 Subject: [PATCH] update to latest nukkit --- Nukkit/build.gradle | 3 ++- .../main/java/com/plotsquared/nukkit/NukkitMain.java | 4 +--- .../com/plotsquared/nukkit/listeners/WorldEvents.java | 11 +---------- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/Nukkit/build.gradle b/Nukkit/build.gradle index 499b62e91..9bb1aa80c 100644 --- a/Nukkit/build.gradle +++ b/Nukkit/build.gradle @@ -1,13 +1,14 @@ repositories { maven { url = "https://oss.sonatype.org/content/repositories/snapshots/"} maven {url "http://nexus.hc.to/content/repositories/pub_releases"} + maven {url "https://repo.potestas.xyz/main/"} flatDir {dirs 'lib'} } dependencies { compile project(':Core') compile 'com.google.guava:guava:17.0' - compile name: 'nukkit-1.0-SNAPSHOT' + compile 'cn.nukkit:nukkit:1.0-SNAPSHOT' } configurations.all { diff --git a/Nukkit/src/main/java/com/plotsquared/nukkit/NukkitMain.java b/Nukkit/src/main/java/com/plotsquared/nukkit/NukkitMain.java index a08b48d6e..d2f689a91 100644 --- a/Nukkit/src/main/java/com/plotsquared/nukkit/NukkitMain.java +++ b/Nukkit/src/main/java/com/plotsquared/nukkit/NukkitMain.java @@ -388,9 +388,7 @@ public final class NukkitMain extends PluginBase implements Listener, IPlotMain } if (world != null) { try { - Field fieldInstance = Level.class.getDeclaredField("generatorInstance"); - fieldInstance.setAccessible(true); - Generator gen = (Generator) fieldInstance.get(world); + Generator gen = world.getGenerator(); if (gen instanceof NukkitPlotGenerator) { PS.get().loadWorld(worldName, (NukkitPlotGenerator) gen); } else if (gen instanceof GeneratorWrapper) { diff --git a/Nukkit/src/main/java/com/plotsquared/nukkit/listeners/WorldEvents.java b/Nukkit/src/main/java/com/plotsquared/nukkit/listeners/WorldEvents.java index 77dd58816..b4206a397 100644 --- a/Nukkit/src/main/java/com/plotsquared/nukkit/listeners/WorldEvents.java +++ b/Nukkit/src/main/java/com/plotsquared/nukkit/listeners/WorldEvents.java @@ -11,20 +11,11 @@ import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.generator.GeneratorWrapper; import com.intellectualcrafters.plot.object.PlotArea; import com.plotsquared.nukkit.generator.NukkitPlotGenerator; -import java.lang.reflect.Field; import java.util.HashMap; public class WorldEvents implements Listener { - private final Field instance; - public WorldEvents() { - try { - this.instance = Level.class.getDeclaredField("generatorInstance"); - this.instance.setAccessible(true); - } catch (Throwable e) { - throw new RuntimeException(e); - } } @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @@ -40,7 +31,7 @@ public class WorldEvents implements Listener { private void handle(Level level) { String name = level.getName(); try { - Generator gen = (Generator) instance.get(level); + Generator gen = level.getGenerator(); if (gen instanceof GeneratorWrapper) { PS.get().loadWorld(name, (GeneratorWrapper) gen); } else {