mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
Fixed phar plugins not reading resources correctly
This commit is contained in:
parent
78eae28a3e
commit
c835c97aba
@ -50,7 +50,7 @@ class PharPluginLoader implements PluginLoader{
|
||||
* @param string $file
|
||||
*/
|
||||
public function loadPlugin(string $file) : void{
|
||||
$this->loader->addPath("phar://$file/src");
|
||||
$this->loader->addPath("$file/src");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -71,4 +71,8 @@ class PharPluginLoader implements PluginLoader{
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getAccessProtocol() : string{
|
||||
return "phar://";
|
||||
}
|
||||
}
|
||||
|
@ -52,4 +52,11 @@ interface PluginLoader{
|
||||
* @return null|PluginDescription
|
||||
*/
|
||||
public function getPluginDescription(string $file) : ?PluginDescription;
|
||||
|
||||
/**
|
||||
* Returns the protocol prefix used to access files in this plugin, e.g. file://, phar://
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAccessProtocol() : string;
|
||||
}
|
||||
|
@ -158,7 +158,8 @@ class PluginManager{
|
||||
return null;
|
||||
}
|
||||
|
||||
$loader->loadPlugin($path);
|
||||
$prefixed = $loader->getAccessProtocol() . $path;
|
||||
$loader->loadPlugin($prefixed);
|
||||
|
||||
$mainClass = $description->getMain();
|
||||
if(!class_exists($mainClass, true)){
|
||||
@ -175,7 +176,7 @@ class PluginManager{
|
||||
* @var Plugin $plugin
|
||||
* @see Plugin::__construct()
|
||||
*/
|
||||
$plugin = new $mainClass($loader, $this->server, $description, $dataFolder, $path);
|
||||
$plugin = new $mainClass($loader, $this->server, $description, $dataFolder, $prefixed);
|
||||
$plugin->onLoad();
|
||||
$this->plugins[$plugin->getDescription()->getName()] = $plugin;
|
||||
|
||||
|
@ -86,4 +86,8 @@ class ScriptPluginLoader implements PluginLoader{
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getAccessProtocol() : string{
|
||||
return "file://";
|
||||
}
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 19fcbf0f9751b4d9d27cdfb007e0fb2bbf3acd04
|
||||
Subproject commit 1fae225ac376c1a0f4dd57a181dbba591f62944a
|
Loading…
x
Reference in New Issue
Block a user