mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-05 11:27:07 +00:00
Added non-packaged plugins & pocketmine warnings
This commit is contained in:
parent
207c2c4aba
commit
05a42712bf
@ -356,6 +356,9 @@ namespace pocketmine {
|
|||||||
new Installer();
|
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 = new Server($autoloader, \pocketmine\PATH, \pocketmine\DATA, \pocketmine\PLUGIN_PATH);
|
||||||
$server->start();
|
$server->start();
|
||||||
|
@ -50,7 +50,8 @@ class FolderPluginLoader implements PluginLoader{
|
|||||||
public function loadPlugin($file){
|
public function loadPlugin($file){
|
||||||
if(is_dir($file) and file_exists($file . "/plugin.yml") and file_exists($file . "/src/")){
|
if(is_dir($file) and file_exists($file . "/plugin.yml") and file_exists($file . "/src/")){
|
||||||
if(($description = $this->getPluginDescription($file)) instanceof PluginDescription){
|
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();
|
$dataFolder = dirname($file) . DIRECTORY_SEPARATOR . $description->getName();
|
||||||
if(file_exists($dataFolder) and !is_dir($dataFolder)){
|
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);
|
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){
|
public function enablePlugin(Plugin $plugin){
|
||||||
if($plugin instanceof PluginBase and !$plugin->isEnabled()){
|
if($plugin instanceof PluginBase and !$plugin->isEnabled()){
|
||||||
console("[INFO] Enabling " . $plugin->getDescription()->getName());
|
console("[INFO] Enabling " . $plugin->getDescription()->getFullName());
|
||||||
|
|
||||||
$plugin->setEnabled(true);
|
$plugin->setEnabled(true);
|
||||||
|
|
||||||
@ -136,7 +137,7 @@ class FolderPluginLoader implements PluginLoader{
|
|||||||
*/
|
*/
|
||||||
public function disablePlugin(Plugin $plugin){
|
public function disablePlugin(Plugin $plugin){
|
||||||
if($plugin instanceof PluginBase and $plugin->isEnabled()){
|
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));
|
Server::getInstance()->getPluginManager()->callEvent(new PluginDisableEvent($plugin));
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ class PharPluginLoader implements PluginLoader{
|
|||||||
*/
|
*/
|
||||||
public function loadPlugin($file){
|
public function loadPlugin($file){
|
||||||
if(\Phar::isValidPharFilename($file) and ($description = $this->getPluginDescription($file)) instanceof PluginDescription){
|
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();
|
$dataFolder = dirname($file) . DIRECTORY_SEPARATOR . $description->getName();
|
||||||
if(file_exists($dataFolder) and !is_dir($dataFolder)){
|
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);
|
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){
|
public function enablePlugin(Plugin $plugin){
|
||||||
if($plugin instanceof PluginBase and !$plugin->isEnabled()){
|
if($plugin instanceof PluginBase and !$plugin->isEnabled()){
|
||||||
console("[INFO] Enabling " . $plugin->getDescription()->getName());
|
console("[INFO] Enabling " . $plugin->getDescription()->getFullName());
|
||||||
|
|
||||||
$plugin->setEnabled(true);
|
$plugin->setEnabled(true);
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ class PharPluginLoader implements PluginLoader{
|
|||||||
*/
|
*/
|
||||||
public function disablePlugin(Plugin $plugin){
|
public function disablePlugin(Plugin $plugin){
|
||||||
if($plugin instanceof PluginBase and $plugin->isEnabled()){
|
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));
|
Server::getInstance()->getPluginManager()->callEvent(new PluginDisableEvent($plugin));
|
||||||
|
|
||||||
|
@ -7,11 +7,11 @@ if exist bin\php\php.exe (
|
|||||||
set PHP_BINARY=php
|
set PHP_BINARY=php
|
||||||
)
|
)
|
||||||
|
|
||||||
if exist src\pocketmine\PocketMine.php (
|
if exist PocketMine-MP.phar (
|
||||||
set POCKETMINE_FILE=src\pocketmine\PocketMine.php
|
set POCKETMINE_FILE=PocketMine-MP.phar
|
||||||
) else (
|
) else (
|
||||||
if exist PocketMine-MP.phar (
|
if exist src\pocketmine\PocketMine.php (
|
||||||
set POCKETMINE_FILE=PocketMine-MP.phar
|
set POCKETMINE_FILE=src\pocketmine\PocketMine.php
|
||||||
) else (
|
) else (
|
||||||
echo "Couldn't find a valid PocketMine-MP installation"
|
echo "Couldn't find a valid PocketMine-MP installation"
|
||||||
pause
|
pause
|
||||||
|
6
start.sh
6
start.sh
@ -34,10 +34,10 @@ if [ "$PHP_BINARY" == "" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$POCKETMINE_FILE" == "" ]; then
|
if [ "$POCKETMINE_FILE" == "" ]; then
|
||||||
if [ -f ./src/PocketMine/PocketMine.php ]; then
|
if [ -f ./PocketMine-MP.phar ]; then
|
||||||
POCKETMINE_FILE="./src/pocketmine/PocketMine.php"
|
|
||||||
elif [ -f ./PocketMine-MP.phar ]; then
|
|
||||||
POCKETMINE_FILE="./PocketMine-MP.phar"
|
POCKETMINE_FILE="./PocketMine-MP.phar"
|
||||||
|
elif [ -f ./src/PocketMine/PocketMine.php ]; then
|
||||||
|
POCKETMINE_FILE="./src/pocketmine/PocketMine.php"
|
||||||
else
|
else
|
||||||
echo "Couldn't find a valid PocketMine-MP installation"
|
echo "Couldn't find a valid PocketMine-MP installation"
|
||||||
exit 1
|
exit 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user