Skip to content
This repository has been archived by the owner on Jan 9, 2018. It is now read-only.

Commit

Permalink
Version 1.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
shoghicp committed Sep 5, 2014
1 parent 5fb7984 commit 2dff574
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 24 deletions.
3 changes: 1 addition & 2 deletions plugin.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: DevTools
main: DevTools\DevTools
version: 1.8.1
version: 1.9.0
api: 1.3.1
load: STARTUP
author: PocketMine Team
authors: [shoghicp]
description: Helps develop and distribute PocketMine-MP plugins
website: https://github.com/PocketMine/DevTools
commands:
Expand Down
12 changes: 7 additions & 5 deletions src/DevTools/ConsoleScript.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/*
* DevTools plugin for PocketMine-MP
* Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/SimpleAuth>
* 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
Expand All @@ -15,7 +15,7 @@
* GNU General Public License for more details.
*/

$opts = getopt("", array("make:", "relative:", "out:", "entry:"));
$opts = getopt("", ["make:", "relative:", "out:", "entry:", "compress"]);

if(!isset($opts["make"])){
echo "== PocketMine-MP DevTools CLI interface ==\n\n";
Expand Down Expand Up @@ -55,7 +55,7 @@
$maxLen = 0;
$count = 0;
foreach(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($folderPath)) as $file){
$path = rtrim(str_replace(array("\\", $relativePath), array("/", ""), $file), "/");
$path = rtrim(str_replace(["\\", $relativePath], ["/", ""], $file), "/");
if($path{0} === "." or strpos($path, "/.") !== false){
continue;
}
Expand All @@ -65,8 +65,10 @@
}
echo "\r[".(++$count)."] ".str_pad($path, $maxLen, " ");
}
echo "\nCompressing...\n";
$phar->compressFiles(\Phar::GZ);
if(isset($opts["compress"])){
echo "\nCompressing...\n";
$phar->compressFiles(\Phar::GZ);
}
$phar->stopBuffering();

echo "Done!\n";
Expand Down
25 changes: 12 additions & 13 deletions src/DevTools/DevTools.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/*
* DevTools plugin for PocketMine-MP
* Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/SimpleAuth>
* 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
Expand Down Expand Up @@ -39,12 +39,10 @@ public function onLoad(){

public function onEnable(){
@mkdir($this->getDataFolder());
$this->getServer()->getLoader()->add("FolderPluginLoader", array(
$this->getFile() . "src"
));

if(!class_exists("FolderPluginLoader\\FolderPluginLoader", false)){
$this->getServer()->getPluginManager()->registerInterface("FolderPluginLoader\\FolderPluginLoader");
$this->getServer()->getPluginManager()->loadPlugins($this->getServer()->getPluginPath(), array("FolderPluginLoader\\FolderPluginLoader"));
$this->getServer()->getPluginManager()->loadPlugins($this->getServer()->getPluginPath(), ["FolderPluginLoader\\FolderPluginLoader"]);
$this->getLogger()->info("Registered folder plugin loader");
$this->getServer()->enablePlugins(PluginLoadOrder::STARTUP);
}
Expand Down Expand Up @@ -116,10 +114,10 @@ private function makePluginLoader(CommandSender $sender, Command $command, $labe
"name" => "FolderPluginLoader",
"version" => "1.0.0",
"main" => "FolderPluginLoader\\Main",
"api" => array("1.0.0"),
"depend" => array(),
"api" => ["1.0.0"],
"depend" => [],
"description" => "Loader of folder plugins",
"authors" => array("PocketMine Team"),
"authors" => ["PocketMine Team"],
"website" => "https://github.com/PocketMine/DevTools",
"creationDate" => time()
]);
Expand Down Expand Up @@ -179,11 +177,12 @@ private function makePluginCommand(CommandSender $sender, Command $command, $lab
$filePath = rtrim(str_replace("\\", "/", $file->getValue($plugin)), "/") . "/";
$phar->startBuffering();
foreach(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($filePath)) as $file){
$path = ltrim(str_replace(array("\\", $filePath), array("/", ""), $file), "/");
$path = ltrim(str_replace(["\\", $filePath], ["/", ""], $file), "/");
if($path{0} === "." or strpos($path, "/.") !== false){
continue;
}
$phar->addFile($file, $path);
$sender->sendMessage("[DevTools] Adding $path");
}

$phar->compressFiles(\Phar::GZ);
Expand All @@ -193,7 +192,7 @@ private function makePluginCommand(CommandSender $sender, Command $command, $lab
}

private function makeServerCommand(CommandSender $sender, Command $command, $label, array $args){
$server = Server::getInstance();
$server = $sender->getServer();
$pharPath = $this->getDataFolder() . DIRECTORY_SEPARATOR . $server->getName()."_".$server->getPocketMineVersion().".phar";
if(file_exists($pharPath)){
$sender->sendMessage("Phar file already exists, overwriting...");
Expand All @@ -215,16 +214,16 @@ private function makeServerCommand(CommandSender $sender, Command $command, $lab
$filePath = substr(\pocketmine\PATH, 0, 7) === "phar://" ? \pocketmine\PATH : realpath(\pocketmine\PATH) . "/";
$filePath = rtrim(str_replace("\\", "/", $filePath), "/") . "/";
foreach(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($filePath . "src")) as $file){
$path = ltrim(str_replace(array("\\", $filePath), array("/", ""), $file), "/");
$path = ltrim(str_replace(["\\", $filePath], ["/", ""], $file), "/");
if($path{0} === "." or strpos($path, "/.") !== false or substr($path, 0, 4) !== "src/"){
continue;
}
$phar->addFile($file, $path);
$sender->sendMessage("[DevTools] Adding $path");
}
$phar->compressFiles(\Phar::GZ);
$phar->stopBuffering();

$sender->sendMessage("PocketMine-MP Phar file has been created on ".$pharPath);
$sender->sendMessage($server->getName() . " " . $server->getPocketMineVersion() . " Phar file has been created on ".$pharPath);

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/DevTools/commands/DevToolsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/*
* DevTools plugin for PocketMine-MP
* Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/SimpleAuth>
* 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
Expand Down
2 changes: 1 addition & 1 deletion src/DevTools/commands/ExtractPluginCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/*
* DevTools plugin for PocketMine-MP
* Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/SimpleAuth>
* 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
Expand Down
2 changes: 1 addition & 1 deletion src/FolderPluginLoader/FolderPluginLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/*
* DevTools plugin for PocketMine-MP
* Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/SimpleAuth>
* 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
Expand Down
2 changes: 1 addition & 1 deletion src/FolderPluginLoader/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function onLoad(){

public function onEnable(){
$this->getServer()->getPluginManager()->registerInterface("FolderPluginLoader\\FolderPluginLoader");
$this->getServer()->getPluginManager()->loadPlugins($this->getServer()->getPluginPath(), array("FolderPluginLoader\\FolderPluginLoader"));
$this->getServer()->getPluginManager()->loadPlugins($this->getServer()->getPluginPath(), ["FolderPluginLoader\\FolderPluginLoader"]);
$this->getServer()->enablePlugins(PluginLoadOrder::STARTUP);
}
}

2 comments on commit 2dff574

@PEMapModder
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

XD the SimpleAuth things

Why not compress with GZip by default now?

@shoghicp
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PEMapModder That's only for the CLI script. The server phar won't be compressed anymore, but plugins will. This causes less performance degradation when the server has started - it includes a large amount of files and if they are compressed they have to be extracted to a temporal directory, then read.

Please sign in to comment.