I have a yaml_parse error at line 3 and line 13 for some reason Code: --- # Set to false to stop the generator being registered enabled: true # The world type used # - normal # - nether world-type: nether blocks: 1: 120 # Stone 2: 80 # Grass 3: 20 # Dirt 9: 10 # Still Water 11: 5 # Still Lava 12: 20 # Sand 13: 10 # Gravel 14: 10 # Gold Ore 15: 20O # Iron Ore 16: 40 # Coal Ore 17: 100 # Trunk 18: 40 # Leaves 20: 1 # Glass 21: 5 # Lapis Ore 24: 10 # Sandstone 30: 10 # Cobweb 31: 3 # Tall Grass 32: 3 # Dead Bush 35: 25 # Wool 37: 2 # Dandelion 38: 2 # Rose 39: 2 # Brown Mushroom 40: 2 # Red Mushroom 46: 2 # TNT 47: 3 # Bookshelf 48: 5 # Mossy Stone 49: 5 # Obsidian 54: 1 # Chest 52: 1 # Monster Spawner 56: 1 # Diamond Ore 73: 8 # Redstone Ore 79: 4 # Ice 80: 8 # Snow Block 81: 1 # Cactus 82: 20 # Clay Block 83: 15 # Sugarcane Block 86: 5 # Pumpkin 103: 5 # Melon Block 110: 15 # Mycelium ... Error Code: Warning: yaml_parse(): parsing error encountered during parsing: did not find expected key (line 12, column 3), context while parsing a block mapping (line 3, column 1) in phar:///storage/emulated/0/PocketMine/PocketMine-MP.phar/src/pocketmine/utils/Config.php on line 143 Warning: yaml_parse(): parsing error encountered during parsing: did not find expected key (line 12, column 3), context while parsing a block mapping (line 3, column 1) in phar:///storage/emulated/0/PocketMine/PocketMine-MP.phar/src/pocketmine/plugin/PluginBase.php on line 262 [20:36:44] [Server thread/CRITICAL]: TypeError: "Argument 1 passed to pocketmine\utils\Config::setDefaults() must be of the type array, boolean given, called in phar:///storage/emulated/0/PocketMine/PocketMine-MP.phar/src/pocketmine/plugin/PluginBase.php on line 262" (EXCEPTION) in "/src/pocketmine/utils/Config" at line 441
Although I see no errors, to easily fix errors like this, just hardcode the YAML data into your code and then remove it afterwards when your config has been generated.
http://www.yamllint.com/ says the file should be right and valid. I'm not sure what could be the issue. Are the values entered in the file those values that you showed too? You might also want to try and change the spacing before the keys.
I generated this code from an array and var_dump(yaml_emit(array)) and copied it and how i think about it that could be why
Copying your YAML code from Chrome, the data are parsed correctly using PHP 7.0.6 CLI with YAML 2.0.0RC8. Try copying the data here back?
I printed it using var_dump but i changed it to yaml_emit_file and it works now... Now my problem is i need to access the config from a custom generator class but its in a different thread
Read in the main thread, serialize it and pass the serialized string to the main thread if you don't want to parse on the other thread? Otherwise, what's wrong with parsing directly on the other thread?
I asked dylan and it doesnt work i cant access static methods (Loader::getInstance()) from the generator thread. Technically i just need to pass an array
For example, in libasynql, the MySQL credentials from the config are formatted into a MysqlCredentials object and serialized in the AsyncTask. https://github.com/poggit/libasynql/blob/master/libasynql/src/libasynql/QueryMysqlTask.php#L42 Is this so hard? Or did I get you wrong?
I dont construct the task myself... Its a generator so i do PHP: Generator::registerGenerator(Example::class, "example");