mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Entity: Cater for old data with CustomNameVisible as a StringTag
This was a bug in older versions, fixed by 890f72dbf23a77f294169b79590770470041adc4. However since ALPHA10 this has been moved to the new, strict-ified CompoundTag API, which shits its pants when it encounters a tag of the wrong type. Closes jojoe77777/Slapper#119
This commit is contained in:
parent
6c8a1a5b80
commit
6fd4b9f1e2
@ -848,7 +848,14 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
|
||||
if($this->namedtag->hasTag("CustomName", StringTag::class)){
|
||||
$this->setNameTag($this->namedtag->getString("CustomName"));
|
||||
$this->setNameTagVisible($this->namedtag->getByte("CustomNameVisible", 1) !== 0);
|
||||
|
||||
if($this->namedtag->hasTag("CustomNameVisible", StringTag::class)){
|
||||
//Older versions incorrectly saved this as a string (see 890f72dbf23a77f294169b79590770470041adc4)
|
||||
$this->setNameTagVisible($this->namedtag->getString("CustomNameVisible") !== "");
|
||||
$this->namedtag->removeTag("CustomNameVisible");
|
||||
}else{
|
||||
$this->setNameTagVisible($this->namedtag->getByte("CustomNameVisible", 1) !== 0);
|
||||
}
|
||||
}
|
||||
|
||||
$this->scheduleUpdate();
|
||||
|
Loading…
x
Reference in New Issue
Block a user