From 00bf190e546752dda68edefbac6ebfc54ad1a529 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 8 Oct 2017 12:17:18 +0100 Subject: [PATCH] Make Item->getNamedTag() a bit less ugly --- src/pocketmine/item/Item.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pocketmine/item/Item.php b/src/pocketmine/item/Item.php index f261ac54f..cd685228a 100644 --- a/src/pocketmine/item/Item.php +++ b/src/pocketmine/item/Item.php @@ -595,10 +595,9 @@ class Item implements ItemIds, \JsonSerializable{ public function getNamedTag(){ if(!$this->hasCompoundTag()){ return null; - }elseif($this->cachedNBT !== null){ - return $this->cachedNBT; } - return $this->cachedNBT = self::parseCompoundTag($this->tags); + + return $this->cachedNBT ?? ($this->cachedNBT = $this->cachedNBT = self::parseCompoundTag($this->tags)); } /**