More flexible match on plugin registration

This commit is contained in:
Shoghi Cervantes 2014-03-31 17:29:47 +02:00
parent 0422540114
commit b03ef8b61c

View File

@ -619,13 +619,13 @@ class PluginManager{
if(!$method->isStatic()){
$priority = EventPriority::NORMAL;
$ignoreCancelled = false;
if(preg_match("/^[\t ]*\\* @priority ([a-zA-Z]{1,})$/m", (string) $method->getDocComment(), $matches) > 0){
if(preg_match("/^[\t ]*\\* @priority[\t ]{1,}([a-zA-Z]{1,})$/m", (string) $method->getDocComment(), $matches) > 0){
$matches[1] = strtoupper($matches[1]);
if(defined("PocketMine\\Event\\EventPriority::".$matches[1])){
$priority = constant("PocketMine\\Event\\EventPriority::".$matches[1]);
}
}
if(preg_match("/^[\t ]*\\* @ignoreCancelled ([a-zA-Z]{1,})$/m", (string) $method->getDocComment(), $matches) > 0){
if(preg_match("/^[\t ]*\\* @ignoreCancelled[\t ]{1,}([a-zA-Z]{1,})$/m", (string) $method->getDocComment(), $matches) > 0){
$matches[1] = strtolower($matches[1]);
if($matches[1] === "false"){
$ignoreCancelled = false;