mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-20 15:41:33 +00:00
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.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user