Added non-packaged plugins & pocketmine warnings

This commit is contained in:
Shoghi Cervantes 2014-04-01 04:59:44 +02:00
parent 207c2c4aba
commit 05a42712bf
5 changed files with 17 additions and 13 deletions

View File

@ -356,6 +356,9 @@ namespace pocketmine {
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();

View File

@ -50,7 +50,8 @@ class FolderPluginLoader implements PluginLoader{
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);
@ -123,7 +124,7 @@ class FolderPluginLoader implements PluginLoader{
*/
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);
@ -136,7 +137,7 @@ class FolderPluginLoader implements PluginLoader{
*/
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));

View File

@ -49,7 +49,7 @@ class PharPluginLoader implements PluginLoader{
*/
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);
@ -122,7 +122,7 @@ class PharPluginLoader implements PluginLoader{
*/
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);
@ -135,7 +135,7 @@ class PharPluginLoader implements PluginLoader{
*/
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));

View File

@ -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

View File

@ -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