Removed redundant checks from ItemFactory::init() and BlockFactory::init()

These are never called accidentally, or at least it's highly unlikely to do so. It might be reasonable to throw exceptions for this, but for the meantime they are redundant - extra indentation for no good reason.

This also removes the $force parameter from BlockFactory::init().
This commit is contained in:
Dylan K. Taylor 2018-02-15 17:42:03 +00:00
parent 456987e212
commit af2435f199
3 changed files with 457 additions and 463 deletions

View File

@ -53,11 +53,8 @@ class BlockFactory{
/**
* Initializes the block factory. By default this is called only once on server start, however you may wish to use
* this if you need to reset the block factory back to its original defaults for whatever reason.
*
* @param bool $force
*/
public static function init(bool $force = false) : void{
if(self::$list === null or $force){
public static function init() : void{
self::$list = new \SplFixedArray(256);
self::$fullList = new \SplFixedArray(4096);
@ -326,7 +323,6 @@ class BlockFactory{
}
}
}
}
/**
* Registers a block type into the index. Plugins may use this method to register new block types or override

View File

@ -36,7 +36,6 @@ class ItemFactory{
private static $list = null;
public static function init(){
if(self::$list === null){
self::$list = new \SplFixedArray(65536);
self::registerItem(new Shovel(Item::IRON_SHOVEL, 0, "Iron Shovel", TieredTool::TIER_IRON));
@ -254,7 +253,6 @@ class ItemFactory{
//TODO: RECORD_11
//TODO: RECORD_WAIT
}
}
/**
* Registers an item type into the index. Plugins may use this method to register new item types or override existing

@ -1 +1 @@
Subproject commit cc9a6402efa486e5dd7c39732f81702af1569707
Subproject commit b41d9836e4edec015cb92e3a4b42cfdaa566b34b