mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
Merge branch 'stable'
This commit is contained in:
commit
0fe6038c41
@ -23,13 +23,14 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace pocketmine\plugin;
|
namespace pocketmine\plugin;
|
||||||
|
|
||||||
|
use pocketmine\utils\Utils;
|
||||||
|
use function count;
|
||||||
use function file;
|
use function file;
|
||||||
|
use function implode;
|
||||||
use function is_file;
|
use function is_file;
|
||||||
use function preg_match;
|
|
||||||
use function strlen;
|
use function strlen;
|
||||||
use function strpos;
|
use function strpos;
|
||||||
use function substr;
|
use function substr;
|
||||||
use function trim;
|
|
||||||
use const FILE_IGNORE_NEW_LINES;
|
use const FILE_IGNORE_NEW_LINES;
|
||||||
use const FILE_SKIP_EMPTY_LINES;
|
use const FILE_SKIP_EMPTY_LINES;
|
||||||
|
|
||||||
@ -60,30 +61,27 @@ class ScriptPluginLoader implements PluginLoader{
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = [];
|
|
||||||
|
|
||||||
$insideHeader = false;
|
$insideHeader = false;
|
||||||
|
|
||||||
|
$docCommentLines = [];
|
||||||
foreach($content as $line){
|
foreach($content as $line){
|
||||||
if(!$insideHeader and strpos($line, "/**") !== false){
|
if(!$insideHeader){
|
||||||
|
if(strpos($line, "/**") !== false){
|
||||||
$insideHeader = true;
|
$insideHeader = true;
|
||||||
|
}else{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(preg_match("/^[ \t]+\\*[ \t]+@([a-zA-Z]+)([ \t]+(.*))?$/", $line, $matches) > 0){
|
$docCommentLines[] = $line;
|
||||||
$key = $matches[1];
|
|
||||||
$content = trim($matches[3] ?? "");
|
|
||||||
|
|
||||||
if($key === "notscript"){
|
if(strpos($line, "*/") !== false){
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$data[$key] = $content;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($insideHeader and strpos($line, "*/") !== false){
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($insideHeader){
|
|
||||||
|
$data = Utils::parseDocComment(implode("\n", $docCommentLines));
|
||||||
|
if(count($data) !== 0){
|
||||||
return new PluginDescription($data);
|
return new PluginDescription($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user