Don't use Config for builtin JSON resources

it doesn't make sense to use a config in these cases, and also it just hides problems when the files are missing.
This commit is contained in:
Dylan K. Taylor
2018-06-16 16:35:47 +01:00
parent cc97f76ec9
commit 9f7f62e9e5
2 changed files with 4 additions and 6 deletions

View File

@ -43,7 +43,6 @@ use pocketmine\nbt\tag\ShortTag;
use pocketmine\nbt\tag\StringTag;
use pocketmine\Player;
use pocketmine\utils\Binary;
use pocketmine\utils\Config;
class Item implements ItemIds, \JsonSerializable{
public const TAG_ENCH = "ench";
@ -119,9 +118,9 @@ class Item implements ItemIds, \JsonSerializable{
public static function initCreativeItems(){
self::clearCreativeItems();
$creativeItems = new Config(\pocketmine\RESOURCE_PATH . "vanilla" . DIRECTORY_SEPARATOR . "creativeitems.json", Config::JSON, []);
$creativeItems = json_decode(file_get_contents(\pocketmine\RESOURCE_PATH . "vanilla" . DIRECTORY_SEPARATOR . "creativeitems.json"), true);
foreach($creativeItems->getAll() as $data){
foreach($creativeItems as $data){
$item = Item::jsonDeserialize($data);
if($item->getName() === "Unknown"){
continue;