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

Commit

Permalink
Added non-packaged plugins & pocketmine warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
shoghicp committed Apr 1, 2014
1 parent 207c2c4 commit 05a4271
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 13 deletions.
3 changes: 3 additions & 0 deletions src/PocketMine/PocketMine.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@ function log($message, $name, $EOL = true, $level = 2, $close = false){
new Installer();
}

if(substr(__FILE__, 0, 7) !== "phar"){
console("[WARNING] Non-packaged PocketMine-MP installation detected, do not use on production.");
}

$server = new Server($autoloader, \pocketmine\PATH, \pocketmine\DATA, \pocketmine\PLUGIN_PATH);
$server->start();
Expand Down
7 changes: 4 additions & 3 deletions src/PocketMine/plugin/FolderPluginLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public function __construct(Server $server){
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){
console("[INFO] Loading " . $description->getName());
console("[INFO] Loading " . $description->getFullName());
console("[WARNING] Non-packaged plugin ".$description->getName() ." detected, do not use on production.");
$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);
Expand Down Expand Up @@ -123,7 +124,7 @@ private function initPlugin(PluginBase $plugin, PluginDescription $description,
*/
public function enablePlugin(Plugin $plugin){
if($plugin instanceof PluginBase and !$plugin->isEnabled()){
console("[INFO] Enabling " . $plugin->getDescription()->getName());
console("[INFO] Enabling " . $plugin->getDescription()->getFullName());

$plugin->setEnabled(true);

Expand All @@ -136,7 +137,7 @@ public function enablePlugin(Plugin $plugin){
*/
public function disablePlugin(Plugin $plugin){
if($plugin instanceof PluginBase and $plugin->isEnabled()){
console("[INFO] Disabling " . $plugin->getDescription()->getName());
console("[INFO] Disabling " . $plugin->getDescription()->getFullName());

Server::getInstance()->getPluginManager()->callEvent(new PluginDisableEvent($plugin));

Expand Down
6 changes: 3 additions & 3 deletions src/PocketMine/plugin/PharPluginLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function __construct(Server $server){
*/
public function loadPlugin($file){
if(\Phar::isValidPharFilename($file) and ($description = $this->getPluginDescription($file)) instanceof PluginDescription){
console("[INFO] Loading " . $description->getName());
console("[INFO] Loading " . $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);
Expand Down Expand Up @@ -122,7 +122,7 @@ private function initPlugin(PluginBase $plugin, PluginDescription $description,
*/
public function enablePlugin(Plugin $plugin){
if($plugin instanceof PluginBase and !$plugin->isEnabled()){
console("[INFO] Enabling " . $plugin->getDescription()->getName());
console("[INFO] Enabling " . $plugin->getDescription()->getFullName());

$plugin->setEnabled(true);

Expand All @@ -135,7 +135,7 @@ public function enablePlugin(Plugin $plugin){
*/
public function disablePlugin(Plugin $plugin){
if($plugin instanceof PluginBase and $plugin->isEnabled()){
console("[INFO] Disabling " . $plugin->getDescription()->getName());
console("[INFO] Disabling " . $plugin->getDescription()->getFullName());

Server::getInstance()->getPluginManager()->callEvent(new PluginDisableEvent($plugin));

Expand Down
8 changes: 4 additions & 4 deletions start.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ if exist bin\php\php.exe (
set PHP_BINARY=php
)

if exist src\pocketmine\PocketMine.php (
set POCKETMINE_FILE=src\pocketmine\PocketMine.php
if exist PocketMine-MP.phar (
set POCKETMINE_FILE=PocketMine-MP.phar
) else (
if exist PocketMine-MP.phar (
set POCKETMINE_FILE=PocketMine-MP.phar
if exist src\pocketmine\PocketMine.php (
set POCKETMINE_FILE=src\pocketmine\PocketMine.php
) else (
echo "Couldn't find a valid PocketMine-MP installation"
pause
Expand Down
6 changes: 3 additions & 3 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ if [ "$PHP_BINARY" == "" ]; then
fi

if [ "$POCKETMINE_FILE" == "" ]; then
if [ -f ./src/PocketMine/PocketMine.php ]; then
POCKETMINE_FILE="./src/pocketmine/PocketMine.php"
elif [ -f ./PocketMine-MP.phar ]; then
if [ -f ./PocketMine-MP.phar ]; then
POCKETMINE_FILE="./PocketMine-MP.phar"
elif [ -f ./src/PocketMine/PocketMine.php ]; then
POCKETMINE_FILE="./src/pocketmine/PocketMine.php"
else
echo "Couldn't find a valid PocketMine-MP installation"
exit 1
Expand Down

0 comments on commit 05a4271

Please sign in to comment.