mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-10 13:35:29 +00:00
Item: make setter methods fluent (#6678)
- `Item::clearCustomBlockData` previously, the instance was returned, but the return type has been changed - `Item::setCanPlaceOn`, `Item::setCanDestroy` and `Item::setKeepOnDeath` now return `$this`
This commit is contained in:
parent
18b6b1742c
commit
05eda887b1
@ -125,7 +125,7 @@ class Item implements \JsonSerializable{
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function clearCustomBlockData(){
|
||||
public function clearCustomBlockData() : Item{
|
||||
$this->blockEntityTag = null;
|
||||
return $this;
|
||||
}
|
||||
@ -202,11 +202,12 @@ class Item implements \JsonSerializable{
|
||||
/**
|
||||
* @param string[] $canPlaceOn
|
||||
*/
|
||||
public function setCanPlaceOn(array $canPlaceOn) : void{
|
||||
public function setCanPlaceOn(array $canPlaceOn) : Item{
|
||||
$this->canPlaceOn = [];
|
||||
foreach($canPlaceOn as $value){
|
||||
$this->canPlaceOn[$value] = $value;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -220,11 +221,12 @@ class Item implements \JsonSerializable{
|
||||
/**
|
||||
* @param string[] $canDestroy
|
||||
*/
|
||||
public function setCanDestroy(array $canDestroy) : void{
|
||||
public function setCanDestroy(array $canDestroy) : Item{
|
||||
$this->canDestroy = [];
|
||||
foreach($canDestroy as $value){
|
||||
$this->canDestroy[$value] = $value;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -234,8 +236,9 @@ class Item implements \JsonSerializable{
|
||||
return $this->keepOnDeath;
|
||||
}
|
||||
|
||||
public function setKeepOnDeath(bool $keepOnDeath) : void{
|
||||
public function setKeepOnDeath(bool $keepOnDeath) : Item{
|
||||
$this->keepOnDeath = $keepOnDeath;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user