Skip to content

Commit e102cac

Browse files
committed
PM6 compatibility as of pmmp/PocketMine-MP@9e773ed
1 parent a030d39 commit e102cac

File tree

2 files changed

+9
-73
lines changed

2 files changed

+9
-73
lines changed

src/DevTools.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
use pocketmine\plugin\Plugin;
3636
use pocketmine\plugin\PluginBase;
3737
use pocketmine\Server;
38-
use pocketmine\utils\AssumptionFailedError;
3938
use pocketmine\utils\TextFormat;
4039
use pocketmine\utils\Utils;
4140
use function assert;
@@ -45,6 +44,7 @@
4544
use function generatePluginMetadataFromYml;
4645
use function implode;
4746
use function ini_get;
47+
use function is_dir;
4848
use function ksort;
4949
use function php_ini_loaded_file;
5050
use function realpath;
@@ -75,7 +75,6 @@ public function onLoad() : void{
7575
$map->register("devtools", new ExtractPluginCommand($this));
7676
$map->register("devtools", new GeneratePluginCommand($this));
7777

78-
$this->getServer()->getPluginManager()->registerInterface(new FolderPluginLoader($this->getServer()->getLoader()));
7978
$this->getLogger()->info("Registered folder plugin loader");
8079
}
8180

@@ -87,7 +86,7 @@ public function onCommand(CommandSender $sender, Command $command, string $label
8786
$succeeded = $failed = [];
8887
$skipped = 0;
8988
foreach($plugins as $plugin){
90-
if(!$plugin->getPluginLoader() instanceof FolderPluginLoader){
89+
if(!self::isFolderPlugin($plugin)){
9190
$skipped++;
9291
continue;
9392
}
@@ -254,17 +253,14 @@ private function makePluginCommand(CommandSender $sender, array $args) : bool{
254253
}
255254
$description = $plugin->getDescription();
256255

257-
if(!($plugin->getPluginLoader() instanceof FolderPluginLoader)){
256+
if(!self::isFolderPlugin($plugin)){
258257
$sender->sendMessage(TextFormat::RED . "Plugin " . $description->getName() . " is not in folder structure.");
259258
return false;
260259
}
261260

262261
$pharPath = $this->getDataFolder() . $description->getName() . "_v" . $description->getVersion() . ".phar";
263262

264-
$reflection = new \ReflectionClass(PluginBase::class);
265-
$file = $reflection->getProperty("file");
266-
$file->setAccessible(true);
267-
$pfile = rtrim($file->getValue($plugin), '/');
263+
$pfile = rtrim($plugin->getFile(), '/');
268264
$filePath = realpath($pfile);
269265
if($filePath === false){
270266
$sender->sendMessage(TextFormat::RED . "Plugin " . $description->getName() . " not found at $pfile (maybe deleted?)");
@@ -406,4 +402,9 @@ private function handlerListByPluginCommand(CommandSender $sender, array $args)
406402

407403
return true;
408404
}
405+
406+
private static function isFolderPlugin(Plugin $plugin) : bool{
407+
$realPath = realpath($plugin->getFile());
408+
return $realPath !== false && is_dir($realPath);
409+
}
409410
}

src/FolderPluginLoader.php

Lines changed: 0 additions & 65 deletions
This file was deleted.

0 commit comments

Comments
 (0)