mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 07:06:44 +01:00
update to latest nukkit
This commit is contained in:
parent
d9a17bd379
commit
c98f2b4261
@ -1,13 +1,14 @@
|
|||||||
repositories {
|
repositories {
|
||||||
maven { url = "https://oss.sonatype.org/content/repositories/snapshots/"}
|
maven { url = "https://oss.sonatype.org/content/repositories/snapshots/"}
|
||||||
maven {url "http://nexus.hc.to/content/repositories/pub_releases"}
|
maven {url "http://nexus.hc.to/content/repositories/pub_releases"}
|
||||||
|
maven {url "https://repo.potestas.xyz/main/"}
|
||||||
flatDir {dirs 'lib'}
|
flatDir {dirs 'lib'}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':Core')
|
compile project(':Core')
|
||||||
compile 'com.google.guava:guava:17.0'
|
compile 'com.google.guava:guava:17.0'
|
||||||
compile name: 'nukkit-1.0-SNAPSHOT'
|
compile 'cn.nukkit:nukkit:1.0-SNAPSHOT'
|
||||||
}
|
}
|
||||||
|
|
||||||
configurations.all {
|
configurations.all {
|
||||||
|
@ -388,9 +388,7 @@ public final class NukkitMain extends PluginBase implements Listener, IPlotMain
|
|||||||
}
|
}
|
||||||
if (world != null) {
|
if (world != null) {
|
||||||
try {
|
try {
|
||||||
Field fieldInstance = Level.class.getDeclaredField("generatorInstance");
|
Generator gen = world.getGenerator();
|
||||||
fieldInstance.setAccessible(true);
|
|
||||||
Generator gen = (Generator) fieldInstance.get(world);
|
|
||||||
if (gen instanceof NukkitPlotGenerator) {
|
if (gen instanceof NukkitPlotGenerator) {
|
||||||
PS.get().loadWorld(worldName, (NukkitPlotGenerator) gen);
|
PS.get().loadWorld(worldName, (NukkitPlotGenerator) gen);
|
||||||
} else if (gen instanceof GeneratorWrapper) {
|
} else if (gen instanceof GeneratorWrapper) {
|
||||||
|
@ -11,20 +11,11 @@ import com.intellectualcrafters.plot.PS;
|
|||||||
import com.intellectualcrafters.plot.generator.GeneratorWrapper;
|
import com.intellectualcrafters.plot.generator.GeneratorWrapper;
|
||||||
import com.intellectualcrafters.plot.object.PlotArea;
|
import com.intellectualcrafters.plot.object.PlotArea;
|
||||||
import com.plotsquared.nukkit.generator.NukkitPlotGenerator;
|
import com.plotsquared.nukkit.generator.NukkitPlotGenerator;
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class WorldEvents implements Listener {
|
public class WorldEvents implements Listener {
|
||||||
|
|
||||||
private final Field instance;
|
|
||||||
|
|
||||||
public WorldEvents() {
|
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)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
@ -40,7 +31,7 @@ public class WorldEvents implements Listener {
|
|||||||
private void handle(Level level) {
|
private void handle(Level level) {
|
||||||
String name = level.getName();
|
String name = level.getName();
|
||||||
try {
|
try {
|
||||||
Generator gen = (Generator) instance.get(level);
|
Generator gen = level.getGenerator();
|
||||||
if (gen instanceof GeneratorWrapper) {
|
if (gen instanceof GeneratorWrapper) {
|
||||||
PS.get().loadWorld(name, (GeneratorWrapper<?>) gen);
|
PS.get().loadWorld(name, (GeneratorWrapper<?>) gen);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user