From 2fb3b41b8d501e0929f844ea9007371363b9d55c Mon Sep 17 00:00:00 2001 From: PEMapModder Date: Wed, 23 Mar 2016 02:32:11 +0800 Subject: [PATCH 1/2] Added the @notscript tag in potential script plugins Then we can have .php files in the plugins folder that contain /** but are not script plugins --- src/pocketmine/plugin/ScriptPluginLoader.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pocketmine/plugin/ScriptPluginLoader.php b/src/pocketmine/plugin/ScriptPluginLoader.php index 95a2e2f973..1961255031 100644 --- a/src/pocketmine/plugin/ScriptPluginLoader.php +++ b/src/pocketmine/plugin/ScriptPluginLoader.php @@ -98,6 +98,10 @@ class ScriptPluginLoader implements PluginLoader{ $key = $matches[1]; $content = trim($matches[2]); + if($key === "notscript"){ + return null; + } + $data[$key] = $content; } From 73f24786cda1bc794d633f06cdd496b10ed300cf Mon Sep 17 00:00:00 2001 From: PEMapModder Date: Mon, 28 Mar 2016 01:26:15 +0800 Subject: [PATCH 2/2] Fixed @notscript without trailing spaces not detected --- src/pocketmine/plugin/ScriptPluginLoader.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pocketmine/plugin/ScriptPluginLoader.php b/src/pocketmine/plugin/ScriptPluginLoader.php index 1961255031..2ef1c746ba 100644 --- a/src/pocketmine/plugin/ScriptPluginLoader.php +++ b/src/pocketmine/plugin/ScriptPluginLoader.php @@ -94,9 +94,9 @@ class ScriptPluginLoader implements PluginLoader{ $insideHeader = true; } - if(preg_match("/^[ \t]+\\*[ \t]+@([a-zA-Z]+)[ \t]+(.*)$/", $line, $matches) > 0){ + if(preg_match("/^[ \t]+\\*[ \t]+@([a-zA-Z]+)([ \t]+(.*))?$/", $line, $matches) > 0){ $key = $matches[1]; - $content = trim($matches[2]); + $content = trim($matches[3]); if($key === "notscript"){ return null; @@ -161,4 +161,4 @@ class ScriptPluginLoader implements PluginLoader{ $plugin->setEnabled(false); } } -} \ No newline at end of file +}