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