PHP: <?php/*__PocketMine Plugin__name=ConfigTestdescription=Sends a message to a userversion=1.0author=<your username>class=Sendapiversion=10*/class Send implements Plugin{ private $api; public function __construct(ServerAPI $api, $server = false){ $this->api = $api; } public function init(){ $this->readConfig(); $this->api->plugin->configPath($this); } public function readConfig(){ if (file_exists($this->api->plugin->configPath($this))) { $homepage = file_get_contents($this->api->plugin->configPath($this)); console ($homepage); } else { $arr = array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5); $this->path = $this->api->plugin->createConfig($this, array((json_encode($arr)))); $homepage = file_get_contents($this->api->plugin->configPath($this)); console ($homepage); };}public function __destruct(){ }}?> I don't know what i'm doing wrong!!! .
I use this in the init to make the file: PHP: $this->config = new Config($this->api->plugin->configPath($this)."config.yml", CONFIG_YAML, array("contents","here"); Then read the file like: PHP: $this->api->plugin->readYAML($this->api->plugin->configPath($this). "config.yml"); And write: PHP: $this->api->plugin->writeYAML($this->api->plugin->configPath($this)."config.yml", $array_to_write);
the configpath function is for finding the plugin's distributed folderr. It should be used for collecting the folder path unless you only want it to vreate a folder.