1
0
mirror of https://github.com/ZeroDream-CN/PHPMC7 synced 2024-11-30 17:52:52 +08:00

修复重复加载插件的bug

人生就是在不断地修复bug...
This commit is contained in:
Akkariin Meiko 2018-09-16 22:01:26 +08:00
parent 577f59708b
commit f4eb01463d
2 changed files with 11 additions and 1 deletions

View File

@ -1,7 +1,7 @@
<?php <?php
// PHPMC 7 Version define // PHPMC 7 Version define
// Don't change this, because it will interfere your update. // Don't change this, because it will interfere your update.
define("PHPMC_VERSION", "7.3.3199"); define("PHPMC_VERSION", "7.3.3200");
include(ROOT . "/include/core/PHPMC/Event.php"); include(ROOT . "/include/core/PHPMC/Event.php");
include(ROOT . "/include/core/PHPMC/User.php"); include(ROOT . "/include/core/PHPMC/User.php");

View File

@ -1,6 +1,8 @@
<?php <?php
class Plugin { class Plugin {
public $plugins;
public function __construct() { public function __construct() {
if(!file_exists("plugins/")) { if(!file_exists("plugins/")) {
mkdir("plugins/", 0775); mkdir("plugins/", 0775);
@ -21,7 +23,11 @@ class Plugin {
if(!$info) { if(!$info) {
PHPMC::Error()->Println("Error when load plugin: " . $files . ": No such plugin info file: " . $target . "<br>" . $data); PHPMC::Error()->Println("Error when load plugin: " . $files . ": No such plugin info file: " . $target . "<br>" . $data);
} }
if(stristr($this->plugins, $info['package'] . ";")) {
continue;
}
include("{$realpath}/{$file}/{$files}"); include("{$realpath}/{$file}/{$files}");
$this->plugin .= $info['package'] . ";";
eval('$' . $info['main'] . ' = new ' . $info['main'] . '();'); eval('$' . $info['main'] . ' = new ' . $info['main'] . '();');
eval('$' . $info['main'] . '->onload();'); eval('$' . $info['main'] . '->onload();');
} else { } else {
@ -36,7 +42,11 @@ class Plugin {
if(!$info) { if(!$info) {
PHPMC::Error()->Println("Error when load plugin: " . $file . ": No such plugin info file: " . $target . "<br>" . $data); PHPMC::Error()->Println("Error when load plugin: " . $file . ": No such plugin info file: " . $target . "<br>" . $data);
} }
if(stristr($this->plugins, $info['package'] . ";")) {
continue;
}
include("{$realpath}/{$file}"); include("{$realpath}/{$file}");
$this->plugin .= $info['package'] . ";";
eval('$' . $info['main'] . ' = new ' . $info['main'] . '();'); eval('$' . $info['main'] . ' = new ' . $info['main'] . '();');
eval('$' . $info['main'] . '->onload();'); eval('$' . $info['main'] . '->onload();');
} }