SPIGOT-4190: Move ChunkLoadEvent call

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2018-07-30 13:09:04 +10:00
parent 94950beea7
commit e3f89384f6
2 changed files with 26 additions and 16 deletions

View File

@@ -1,19 +1,10 @@
--- a/net/minecraft/server/ChunkMap.java
+++ b/net/minecraft/server/ChunkMap.java
@@ -31,6 +31,54 @@
@@ -31,6 +31,46 @@
}
}
+ org.bukkit.Server server = chunk.world.getServer();
+ if (server != null) {
+ /*
+ * If it's a new world, the first few chunks are generated inside
+ * the World constructor. We can't reliably alter that, so we have
+ * no way of creating a CraftWorld/CraftServer at that point.
+ */
+ server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(chunk.bukkitChunk, chunk.newChunk));
+ }
+
+ // CraftBukkit start
+ // Update neighbor counts
+ for (int x = -2; x < 3; x++) {
+ for (int z = -2; z < 3; z++) {
@@ -51,11 +42,12 @@
+ BlockSand.instaFall = false;
+ chunk.world.getServer().getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(chunk.bukkitChunk));
+ }
+ // CraftBukkit end
+
return chunk1;
}
@@ -69,23 +117,25 @@
@@ -69,23 +109,25 @@
throw new RuntimeException("Not yet implemented");
}