mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-07 18:41:47 +00:00
Fixed plugin loaders trying to load plugins they aren't able to load
closes #2125 This is an API break for things implementing the PluginLoader interface.
This commit is contained in:
parent
476ac39988
commit
5f52e00213
@ -101,6 +101,11 @@ class PharPluginLoader implements PluginLoader{
|
|||||||
return "/\\.phar$/i";
|
return "/\\.phar$/i";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function canLoadPlugin(string $path) : bool{
|
||||||
|
$ext = ".phar";
|
||||||
|
return is_file($path) and substr($path, -strlen($ext)) === $ext;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param PluginBase $plugin
|
* @param PluginBase $plugin
|
||||||
* @param PluginDescription $description
|
* @param PluginDescription $description
|
||||||
|
@ -53,6 +53,15 @@ interface PluginLoader{
|
|||||||
*/
|
*/
|
||||||
public function getPluginFilters() : string;
|
public function getPluginFilters() : string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether this PluginLoader can load the plugin in the given path.
|
||||||
|
*
|
||||||
|
* @param string $path
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function canLoadPlugin(string $path) : bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Plugin $plugin
|
* @param Plugin $plugin
|
||||||
*
|
*
|
||||||
|
@ -210,6 +210,9 @@ class PluginManager{
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$file = $directory . $file;
|
$file = $directory . $file;
|
||||||
|
if(!$loader->canLoadPlugin($file)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
try{
|
try{
|
||||||
$description = $loader->getPluginDescription($file);
|
$description = $loader->getPluginDescription($file);
|
||||||
if($description instanceof PluginDescription){
|
if($description instanceof PluginDescription){
|
||||||
|
@ -124,6 +124,11 @@ class ScriptPluginLoader implements PluginLoader{
|
|||||||
return "/\\.php$/i";
|
return "/\\.php$/i";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function canLoadPlugin(string $path) : bool{
|
||||||
|
$ext = ".php";
|
||||||
|
return is_file($path) and substr($path, -strlen($ext)) === $ext;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param PluginBase $plugin
|
* @param PluginBase $plugin
|
||||||
* @param PluginDescription $description
|
* @param PluginDescription $description
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 96fa93a3b4ee417ea5aff9ebb4e85d1fc6c7f960
|
Subproject commit a897b84de445069dee898eaed95a9ff708a19383
|
Loading…
x
Reference in New Issue
Block a user