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

Commit 2dff574

Browse files
committed
Version 1.9.0
1 parent 5fb7984 commit 2dff574

File tree

7 files changed

+24
-24
lines changed

7 files changed

+24
-24
lines changed

plugin.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
name: DevTools
22
main: DevTools\DevTools
3-
version: 1.8.1
3+
version: 1.9.0
44
api: 1.3.1
55
load: STARTUP
66
author: PocketMine Team
7-
authors: [shoghicp]
87
description: Helps develop and distribute PocketMine-MP plugins
98
website: https://github.com/PocketMine/DevTools
109
commands:

src/DevTools/ConsoleScript.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/*
44
* DevTools plugin for PocketMine-MP
5-
* Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/SimpleAuth>
5+
* Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/DevTools>
66
*
77
* This program is free software: you can redistribute it and/or modify
88
* it under the terms of the GNU Lesser General Public License as published by
@@ -15,7 +15,7 @@
1515
* GNU General Public License for more details.
1616
*/
1717

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

2020
if(!isset($opts["make"])){
2121
echo "== PocketMine-MP DevTools CLI interface ==\n\n";
@@ -55,7 +55,7 @@
5555
$maxLen = 0;
5656
$count = 0;
5757
foreach(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($folderPath)) as $file){
58-
$path = rtrim(str_replace(array("\\", $relativePath), array("/", ""), $file), "/");
58+
$path = rtrim(str_replace(["\\", $relativePath], ["/", ""], $file), "/");
5959
if($path{0} === "." or strpos($path, "/.") !== false){
6060
continue;
6161
}
@@ -65,8 +65,10 @@
6565
}
6666
echo "\r[".(++$count)."] ".str_pad($path, $maxLen, " ");
6767
}
68-
echo "\nCompressing...\n";
69-
$phar->compressFiles(\Phar::GZ);
68+
if(isset($opts["compress"])){
69+
echo "\nCompressing...\n";
70+
$phar->compressFiles(\Phar::GZ);
71+
}
7072
$phar->stopBuffering();
7173

7274
echo "Done!\n";

src/DevTools/DevTools.php

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/*
44
* DevTools plugin for PocketMine-MP
5-
* Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/SimpleAuth>
5+
* Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/DevTools>
66
*
77
* This program is free software: you can redistribute it and/or modify
88
* it under the terms of the GNU Lesser General Public License as published by
@@ -39,12 +39,10 @@ public function onLoad(){
3939

4040
public function onEnable(){
4141
@mkdir($this->getDataFolder());
42-
$this->getServer()->getLoader()->add("FolderPluginLoader", array(
43-
$this->getFile() . "src"
44-
));
42+
4543
if(!class_exists("FolderPluginLoader\\FolderPluginLoader", false)){
4644
$this->getServer()->getPluginManager()->registerInterface("FolderPluginLoader\\FolderPluginLoader");
47-
$this->getServer()->getPluginManager()->loadPlugins($this->getServer()->getPluginPath(), array("FolderPluginLoader\\FolderPluginLoader"));
45+
$this->getServer()->getPluginManager()->loadPlugins($this->getServer()->getPluginPath(), ["FolderPluginLoader\\FolderPluginLoader"]);
4846
$this->getLogger()->info("Registered folder plugin loader");
4947
$this->getServer()->enablePlugins(PluginLoadOrder::STARTUP);
5048
}
@@ -116,10 +114,10 @@ private function makePluginLoader(CommandSender $sender, Command $command, $labe
116114
"name" => "FolderPluginLoader",
117115
"version" => "1.0.0",
118116
"main" => "FolderPluginLoader\\Main",
119-
"api" => array("1.0.0"),
120-
"depend" => array(),
117+
"api" => ["1.0.0"],
118+
"depend" => [],
121119
"description" => "Loader of folder plugins",
122-
"authors" => array("PocketMine Team"),
120+
"authors" => ["PocketMine Team"],
123121
"website" => "https://github.com/PocketMine/DevTools",
124122
"creationDate" => time()
125123
]);
@@ -179,11 +177,12 @@ private function makePluginCommand(CommandSender $sender, Command $command, $lab
179177
$filePath = rtrim(str_replace("\\", "/", $file->getValue($plugin)), "/") . "/";
180178
$phar->startBuffering();
181179
foreach(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($filePath)) as $file){
182-
$path = ltrim(str_replace(array("\\", $filePath), array("/", ""), $file), "/");
180+
$path = ltrim(str_replace(["\\", $filePath], ["/", ""], $file), "/");
183181
if($path{0} === "." or strpos($path, "/.") !== false){
184182
continue;
185183
}
186184
$phar->addFile($file, $path);
185+
$sender->sendMessage("[DevTools] Adding $path");
187186
}
188187

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

195194
private function makeServerCommand(CommandSender $sender, Command $command, $label, array $args){
196-
$server = Server::getInstance();
195+
$server = $sender->getServer();
197196
$pharPath = $this->getDataFolder() . DIRECTORY_SEPARATOR . $server->getName()."_".$server->getPocketMineVersion().".phar";
198197
if(file_exists($pharPath)){
199198
$sender->sendMessage("Phar file already exists, overwriting...");
@@ -215,16 +214,16 @@ private function makeServerCommand(CommandSender $sender, Command $command, $lab
215214
$filePath = substr(\pocketmine\PATH, 0, 7) === "phar://" ? \pocketmine\PATH : realpath(\pocketmine\PATH) . "/";
216215
$filePath = rtrim(str_replace("\\", "/", $filePath), "/") . "/";
217216
foreach(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($filePath . "src")) as $file){
218-
$path = ltrim(str_replace(array("\\", $filePath), array("/", ""), $file), "/");
217+
$path = ltrim(str_replace(["\\", $filePath], ["/", ""], $file), "/");
219218
if($path{0} === "." or strpos($path, "/.") !== false or substr($path, 0, 4) !== "src/"){
220219
continue;
221220
}
222221
$phar->addFile($file, $path);
222+
$sender->sendMessage("[DevTools] Adding $path");
223223
}
224-
$phar->compressFiles(\Phar::GZ);
225224
$phar->stopBuffering();
226225

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

229228
return true;
230229
}

src/DevTools/commands/DevToolsCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/*
44
* DevTools plugin for PocketMine-MP
5-
* Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/SimpleAuth>
5+
* Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/DevTools>
66
*
77
* This program is free software: you can redistribute it and/or modify
88
* it under the terms of the GNU Lesser General Public License as published by

src/DevTools/commands/ExtractPluginCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/*
44
* DevTools plugin for PocketMine-MP
5-
* Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/SimpleAuth>
5+
* Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/DevTools>
66
*
77
* This program is free software: you can redistribute it and/or modify
88
* it under the terms of the GNU Lesser General Public License as published by

src/FolderPluginLoader/FolderPluginLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/*
44
* DevTools plugin for PocketMine-MP
5-
* Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/SimpleAuth>
5+
* Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/DevTools>
66
*
77
* This program is free software: you can redistribute it and/or modify
88
* it under the terms of the GNU Lesser General Public License as published by

src/FolderPluginLoader/Main.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function onLoad(){
2828

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

0 commit comments

Comments
 (0)