diff --git a/src/PocketMine/PocketMine.php b/src/PocketMine/PocketMine.php index b2f15c57a..edad137da 100644 --- a/src/PocketMine/PocketMine.php +++ b/src/PocketMine/PocketMine.php @@ -96,17 +96,6 @@ namespace PocketMine { if(file_exists($fPath)){ require_once($fPath); } - }else{ //Try plugin - $className = array_pop($path); - if(count($path) > 0){ - $path = implode(DIRECTORY_SEPARATOR, array_map("strtolower", $path)) . DIRECTORY_SEPARATOR; - }else{ - $path = ""; - } - $fPath = \PocketMine\PATH . "plugins" . DIRECTORY_SEPARATOR . $parent . DIRECTORY_SEPARATOR . "src" . DIRECTORY_SEPARATOR . $path . $className . ".php"; - if(file_exists($fPath)){ - require_once($fPath); - } } }); diff --git a/src/PocketMine/plugin/FolderPluginLoader.php b/src/PocketMine/plugin/FolderPluginLoader.php index 87adbed22..30f4c1aa7 100644 --- a/src/PocketMine/plugin/FolderPluginLoader.php +++ b/src/PocketMine/plugin/FolderPluginLoader.php @@ -59,6 +59,12 @@ class FolderPluginLoader implements PluginLoader{ return null; } + foreach(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($file . "/src/")) as $fName){ + if(strtolower(substr($fName, -4)) === ".php"){ + include_once($fName); + } + } + $className = $description->getMain(); if(class_exists($className, true)){ //call autoloader, TODO: replace this with a specific Plugin autoload $plugin = new $className();