mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-11 08:19:45 +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:
parent
c42a6d7552
commit
505d4e402f
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user