mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
update to latest nukkit
This commit is contained in:
parent
d9a17bd379
commit
c98f2b4261
@ -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 {
|
||||
|
@ -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) {
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user