update to latest nukkit

This commit is contained in:
Jesse Boyd 2018-02-13 02:16:13 +11:00
parent d9a17bd379
commit c98f2b4261
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
3 changed files with 4 additions and 14 deletions

View File

@ -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 {

View File

@ -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) {

View File

@ -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 {