mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
Updated PluginAPI with a new way of managing configuration
This commit is contained in:
parent
4b1f1cfd44
commit
6a97750e06
@ -108,6 +108,16 @@ class PluginAPI extends stdClass{
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function configPath(Plugin $plugin){
|
||||
$p = $this->get($plugin);
|
||||
if($p === false){
|
||||
return false;
|
||||
}
|
||||
$path = FILE_PATH."plugins/".$p[1]["name"]."/";
|
||||
$this->plugins[$p[1]["class"]][1]["path"] = $path;
|
||||
return $path;
|
||||
}
|
||||
|
||||
public function createConfig(Plugin $plugin, $default = array()){
|
||||
$p = $this->get($plugin);
|
||||
@ -116,14 +126,8 @@ class PluginAPI extends stdClass{
|
||||
}
|
||||
$path = FILE_PATH."plugins/".$p[1]["name"]."/";
|
||||
$this->plugins[$p[1]["class"]][1]["path"] = $path;
|
||||
if(!file_exists($path."config.yml")){
|
||||
@mkdir($path, 0777);
|
||||
$this->writeYAML($path."config.yml", $default);
|
||||
}else{
|
||||
$data = $this->readYAML($path."config.yml");
|
||||
$this->fillDefaults($default, $data);
|
||||
$this->writeYAML($path."config.yml", $data);
|
||||
}
|
||||
$cnf = new Config($path."config.yml", CONFIG_YAML, $default);
|
||||
$cnf->save();
|
||||
return $path;
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ class ServerAPI{
|
||||
"description" => "Server made using PocketMine-MP",
|
||||
"motd" => "Welcome @username to this server!",
|
||||
"invisible" => false,
|
||||
"port" => 19132
|
||||
"port" => 19132,
|
||||
"memory-limit" => "256M",
|
||||
"last-update" => false,
|
||||
"update-channel" => "stable",
|
||||
|
Loading…
x
Reference in New Issue
Block a user