mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-11 20:35:15 +00:00
Improved plugin loading
This commit is contained in:
parent
adcbc67a71
commit
0d91be62cf
@ -58,7 +58,7 @@ class PharPluginLoader implements PluginLoader{
|
|||||||
}
|
}
|
||||||
$file = "phar://$file";
|
$file = "phar://$file";
|
||||||
$className = $description->getMain();
|
$className = $description->getMain();
|
||||||
$this->server->getLoader()->add(substr($className, 0, strpos($className, "\\")), array(
|
$this->server->getLoader()->add(substr($className, 0, strrpos($className, "\\")), array(
|
||||||
"$file/src"
|
"$file/src"
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -122,8 +122,16 @@ class SplClassLoader implements SplAutoloader{
|
|||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function add($resource, $resourcePath = null){
|
public function add($resource, $resourcePath = null){
|
||||||
|
if(isset($this->resources[$resource])){
|
||||||
|
foreach((array) $resourcePath as $path){
|
||||||
|
if(!in_array($path, $this->resources[$resource], true)){
|
||||||
|
$this->resources[$resource][] = $path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
$this->resources[$resource] = (array) $resourcePath;
|
$this->resources[$resource] = (array) $resourcePath;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user