Improve documentation of world-related events

This commit is contained in:
Dylan K. Taylor 2022-05-21 21:46:53 +01:00
parent 1154c7c1ab
commit 351cd4bfd7
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
7 changed files with 12 additions and 7 deletions

View File

@ -27,7 +27,7 @@ use pocketmine\world\format\Chunk;
use pocketmine\world\World; use pocketmine\world\World;
/** /**
* Called when a Chunk is loaded * Called when a Chunk is loaded or newly created by the world generator.
*/ */
class ChunkLoadEvent extends ChunkEvent{ class ChunkLoadEvent extends ChunkEvent{
/** @var bool */ /** @var bool */
@ -38,6 +38,10 @@ class ChunkLoadEvent extends ChunkEvent{
$this->newChunk = $newChunk; $this->newChunk = $newChunk;
} }
/**
* Returns whether the chunk is newly generated.
* If false, the chunk was loaded from storage.
*/
public function isNewChunk() : bool{ public function isNewChunk() : bool{
return $this->newChunk; return $this->newChunk;
} }

View File

@ -24,7 +24,8 @@ declare(strict_types=1);
namespace pocketmine\event\world; namespace pocketmine\event\world;
/** /**
* Called when a Chunk is populated (after receiving it on the main thread) * Called when a Chunk is fully populated by the world generator.
* This means that the terrain has been generated, and all artifacts (e.g. trees, grass, ponds, etc.) have been placed.
*/ */
class ChunkPopulateEvent extends ChunkEvent{ class ChunkPopulateEvent extends ChunkEvent{

View File

@ -27,7 +27,7 @@ use pocketmine\event\Cancellable;
use pocketmine\event\CancellableTrait; use pocketmine\event\CancellableTrait;
/** /**
* Called when a Chunk is unloaded * Called when a Chunk is unloaded from memory.
*/ */
class ChunkUnloadEvent extends ChunkEvent implements Cancellable{ class ChunkUnloadEvent extends ChunkEvent implements Cancellable{
use CancellableTrait; use CancellableTrait;

View File

@ -24,7 +24,7 @@ declare(strict_types=1);
namespace pocketmine\event\world; namespace pocketmine\event\world;
/** /**
* Called when a World is initializing * Called when a new world is created/generated.
*/ */
class WorldInitEvent extends WorldEvent{ class WorldInitEvent extends WorldEvent{

View File

@ -24,7 +24,7 @@ declare(strict_types=1);
namespace pocketmine\event\world; namespace pocketmine\event\world;
/** /**
* Called when a World is loaded * Called when a world is loaded or newly created/generated.
*/ */
class WorldLoadEvent extends WorldEvent{ class WorldLoadEvent extends WorldEvent{

View File

@ -24,7 +24,7 @@ declare(strict_types=1);
namespace pocketmine\event\world; namespace pocketmine\event\world;
/** /**
* Called when a World is saved * Called when a world is saved. Saving may be triggered manually (e.g. via commands) or automatically (autosave).
*/ */
class WorldSaveEvent extends WorldEvent{ class WorldSaveEvent extends WorldEvent{

View File

@ -27,7 +27,7 @@ use pocketmine\event\Cancellable;
use pocketmine\event\CancellableTrait; use pocketmine\event\CancellableTrait;
/** /**
* Called when a World is unloaded * Called when a world is unloaded from memory.
*/ */
class WorldUnloadEvent extends WorldEvent implements Cancellable{ class WorldUnloadEvent extends WorldEvent implements Cancellable{
use CancellableTrait; use CancellableTrait;