From 505d4e402f48d2cf2397aca2305cc4b8a5689e0c Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 4 Oct 2020 18:36:46 +0100 Subject: [PATCH] ItemFactory: do not reuse the same itemstack instance for air() this is mutable, so it's possible for plugins to mess with it and break everything that references it. --- src/item/ItemFactory.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/item/ItemFactory.php b/src/item/ItemFactory.php index 2d4df058a..80ea9810b 100644 --- a/src/item/ItemFactory.php +++ b/src/item/ItemFactory.php @@ -52,9 +52,6 @@ class ItemFactory{ /** @var Item[] */ private $list = []; - /** @var Item|null */ - private static $air = null; - public function __construct(){ $this->registerArmorItems(); $this->registerSpawnEggs(); @@ -448,7 +445,7 @@ class ItemFactory{ } public static function air() : Item{ - return self::$air ?? (self::$air = self::getInstance()->get(ItemIds::AIR, 0, 0)); + return self::getInstance()->get(ItemIds::AIR, 0, 0); } /**