mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-28 13:36:16 +01:00
Implemented ChunkPopulateEvent
This commit is contained in:
parent
6f1d6a4ca8
commit
e08568de4a
@ -10,6 +10,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.craftbukkit.CraftChunk;
|
import org.bukkit.craftbukkit.CraftChunk;
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
@ -17,6 +18,7 @@ import org.bukkit.craftbukkit.CraftWorld;
|
|||||||
import org.bukkit.craftbukkit.util.LongHashset;
|
import org.bukkit.craftbukkit.util.LongHashset;
|
||||||
import org.bukkit.craftbukkit.util.LongHashtable;
|
import org.bukkit.craftbukkit.util.LongHashtable;
|
||||||
import org.bukkit.event.world.ChunkLoadEvent;
|
import org.bukkit.event.world.ChunkLoadEvent;
|
||||||
|
import org.bukkit.event.world.ChunkPopulateEvent;
|
||||||
import org.bukkit.event.world.ChunkUnloadEvent;
|
import org.bukkit.event.world.ChunkUnloadEvent;
|
||||||
import org.bukkit.generator.BlockPopulator;
|
import org.bukkit.generator.BlockPopulator;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
@ -60,6 +62,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
|||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
this.unloadQueue.remove(i, j);
|
this.unloadQueue.remove(i, j);
|
||||||
Chunk chunk = (Chunk) this.chunks.get(i, j);
|
Chunk chunk = (Chunk) this.chunks.get(i, j);
|
||||||
|
boolean newChunk = false;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
if (chunk == null) {
|
if (chunk == null) {
|
||||||
@ -70,6 +73,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
|||||||
} else {
|
} else {
|
||||||
chunk = this.chunkProvider.getOrCreateChunk(i, j);
|
chunk = this.chunkProvider.getOrCreateChunk(i, j);
|
||||||
}
|
}
|
||||||
|
newChunk = true; // Craftbukkit
|
||||||
}
|
}
|
||||||
|
|
||||||
this.chunks.put(i, j, chunk); // CraftBukkit
|
this.chunks.put(i, j, chunk); // CraftBukkit
|
||||||
@ -87,7 +91,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
|||||||
* the World constructor. We can't reliably alter that, so we have
|
* the World constructor. We can't reliably alter that, so we have
|
||||||
* no way of creating a CraftWorld/CraftServer at that point.
|
* no way of creating a CraftWorld/CraftServer at that point.
|
||||||
*/
|
*/
|
||||||
server.getPluginManager().callEvent(new ChunkLoadEvent(chunk.bukkitChunk));
|
server.getPluginManager().callEvent(new ChunkLoadEvent(chunk.bukkitChunk, newChunk));
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -190,6 +194,7 @@ public class ChunkProviderServer implements IChunkProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
BlockSand.a = false;
|
BlockSand.a = false;
|
||||||
|
Bukkit.getServer().getPluginManager().callEvent(new ChunkPopulateEvent(chunk.bukkitChunk));
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
chunk.f();
|
chunk.f();
|
||||||
|
Loading…
Reference in New Issue
Block a user