Type-hinted NBT tag constructors, made getValue() and setValue() more strict, fix dozens of assorted related bugs

This commit is contained in:
Dylan K. Taylor
2017-06-08 19:17:41 +01:00
parent 595e1ab52f
commit 890f72dbf2
24 changed files with 348 additions and 65 deletions

View File

@ -30,15 +30,15 @@ use pocketmine\nbt\tag\StringTag;
class EnchantTable extends Spawnable implements Nameable{
public function getName(){
public function getName() : string{
return isset($this->namedtag->CustomName) ? $this->namedtag->CustomName->getValue() : "Enchanting Table";
}
public function hasName(){
public function hasName() : bool{
return isset($this->namedtag->CustomName);
}
public function setName($str){
public function setName(string $str){
if($str === ""){
unset($this->namedtag->CustomName);
return;