I have two things i need help with. The first question is how can i spawn a tree? Is it something like this: PHP: Tree::growTree($x, $y, $z, $level) Or is it something else The second question is how can i make multiple config files? I know i can do this: PHP: $newConfig = new Config($this->getDataFolder()."newConfig.yml" Config::YAML) but then how can i get the data from that config?
1. Yes. More accurately, PHP: Tree::growTree($level, $x, $y, $z, new Random(mt_rand()), Sapling::OAK); Of course you can easily change the tree type by adjusting the last parameter to something else. 2. Just like what you'll normally get data from a config. PHP: $duration = $newConfig->get("speed-boost-duration", 40); // Get configuration value of key "speed-boost-duration" from config, if it does not exist, return default value 40
The reason i'm asking this is because on my SkyBlock plugin I want to have a file for every island. So when a player makes an island it makes a config for that island PHP: $islandConfig = new Config($this->getDataFolder()."Islands/".$player->getName().".yml", Config::YAML) In the config it sets the coordinates and the world that it is in. When a player wants to teleport back to their island I need to get the world, and the position from that config. That would be easy if there was only one config file, but I need to find one file out of hundreds. I have this function later in my plugin: PHP: public function getIsland($island){ $file = new Config($this->getDataFolder()."Islands/".$island.".yml", Config::YAML); return $file->getAll(); } But when i call that function it crashes the server and says i can't use the get() function on an array
Of course you can't use get() on an array! You have to use $file[$string_here] to get it from the file. Mind if I take a look at the code?
So right now i have the files set up to where the island coordinates are. (You can see an example file below) When i do file_get_contents or yaml_parse_file it only returns 163, which is the X coordinate How can i fix this?
It used to work fine, but i changed it a bit and now it won't work (i'm using the same way i did before i changed it)