mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-03 08:39:53 +00:00
Extract plugins/ path lookup to pluginsPath() function in PluginAPI
This commit is contained in:
parent
ca0d682d87
commit
9f211bd7fb
@ -121,12 +121,19 @@ class PluginAPI extends stdClass{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function pluginsPath(){
|
||||||
|
$path = join(DIRECTORY_SEPARATOR, array(DATA_PATH."plugins", $p[1]["name"], ""));
|
||||||
|
@mkdir($path);
|
||||||
|
return $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function configPath(Plugin $plugin){
|
public function configPath(Plugin $plugin){
|
||||||
$p = $this->get($plugin);
|
$p = $this->get($plugin);
|
||||||
if($p === false){
|
if($p === false){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$path = join(DIRECTORY_SEPARATOR, array(DATA_PATH."plugins", $p[1]["name"], ""));
|
$path = $this->pluginsPath() . $p[1]["name"] . DIRECTORY_SEPARATOR;
|
||||||
$this->plugins[$p[1]["class"]][1]["path"] = $path;
|
$this->plugins[$p[1]["class"]][1]["path"] = $path;
|
||||||
@mkdir($path);
|
@mkdir($path);
|
||||||
return $path;
|
return $path;
|
||||||
@ -170,7 +177,7 @@ class PluginAPI extends stdClass{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function loadAll(){
|
public function loadAll(){
|
||||||
$dir = dir(DATA_PATH."plugins" . DIRECTORY_SEPARATOR);
|
$dir = dir($this->pluginsPath());
|
||||||
while(false !== ($file = $dir->read())){
|
while(false !== ($file = $dir->read())){
|
||||||
if($file{0} !== "."){
|
if($file{0} !== "."){
|
||||||
$ext = strtolower(substr($file, -3));
|
$ext = strtolower(substr($file, -3));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user