mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Added API to allow flagging an entity not to be saved to disk when its chunk is saved (#1452)
This commit is contained in:
@ -337,6 +337,9 @@ abstract class Entity extends Location implements Metadatable{
|
||||
/** @var bool */
|
||||
protected $isStatic = false;
|
||||
|
||||
/** @var bool */
|
||||
private $savedWithChunk = true;
|
||||
|
||||
/** @var bool */
|
||||
public $isCollided = false;
|
||||
/** @var bool */
|
||||
@ -764,6 +767,24 @@ abstract class Entity extends Location implements Metadatable{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this entity will be saved when its chunk is unloaded.
|
||||
* @return bool
|
||||
*/
|
||||
public function canSaveWithChunk() : bool{
|
||||
return $this->savedWithChunk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether this entity will be saved when its chunk is unloaded. This can be used to prevent the entity being
|
||||
* saved to disk.
|
||||
*
|
||||
* @param bool $value
|
||||
*/
|
||||
public function setCanSaveWithChunk(bool $value) : void{
|
||||
$this->savedWithChunk = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the short save name
|
||||
*
|
||||
|
Reference in New Issue
Block a user