mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-05 17:36:12 +00:00
Type-hinted NBT tag constructors, made getValue() and setValue() more strict, fix dozens of assorted related bugs
This commit is contained in:
@ -190,15 +190,24 @@ class Chest extends Spawnable implements InventoryHolder, Container, Nameable{
|
||||
}
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName() : string{
|
||||
return isset($this->namedtag->CustomName) ? $this->namedtag->CustomName->getValue() : "Chest";
|
||||
}
|
||||
|
||||
public function hasName(){
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasName() : bool{
|
||||
return isset($this->namedtag->CustomName);
|
||||
}
|
||||
|
||||
public function setName($str){
|
||||
/**
|
||||
* @param string $str
|
||||
*/
|
||||
public function setName(string $str){
|
||||
if($str === ""){
|
||||
unset($this->namedtag->CustomName);
|
||||
return;
|
||||
|
Reference in New Issue
Block a user