Made block and item factory lists private to stop people doing stupid things with them

This commit is contained in:
Dylan K. Taylor
2017-08-29 10:52:50 +01:00
parent 9902d29734
commit 6abef6b22d
4 changed files with 20 additions and 17 deletions

View File

@@ -202,7 +202,7 @@ class Item implements ItemIds, \JsonSerializable{
$this->id = $id & 0xffff;
$this->meta = $meta !== -1 ? $meta & 0xffff : -1;
$this->name = $name;
if(!isset($this->block) and $this->id <= 0xff and isset(BlockFactory::$list[$this->id])){
if(!isset($this->block) and $this->id <= 0xff){
$this->block = BlockFactory::get($this->id, $this->meta);
$this->name = $this->block->getName();
}

View File

@@ -32,7 +32,7 @@ use pocketmine\nbt\tag\CompoundTag;
class ItemFactory{
/** @var \SplFixedArray */
public static $list = null;
private static $list = null;
public static function init(){
if(self::$list === null){