diff --git a/.travis.yml b/.travis.yml index adb6125b71..bdf5e55e5d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,19 @@ language: php php: - - 7.0 + - 7.2 before_script: - - pecl install channel://pecl.php.net/pthreads-3.1.6 - - echo | pecl install channel://pecl.php.net/yaml-2.0.0 +# - pecl install channel://pecl.php.net/pthreads-3.1.6 + - echo | pecl install channel://pecl.php.net/yaml-2.0.2 + - git clone https://github.com/krakjoe/pthreads.git --depth=1 + - cd pthreads + - phpize + - ./configure + - make + - make install + - cd .. + - echo "extension=pthreads.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini script: - ./tests/travis.sh diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index b039ef2d43..865147692a 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -78,9 +78,9 @@ namespace pocketmine { use pocketmine\wizard\SetupWizard; use raklib\RakLib; - const VERSION = "1.6.2dev"; + const VERSION = "1.7dev"; const API_VERSION = "3.0.0-ALPHA7"; - const CODENAME = "Unleashed"; + const CODENAME = "[REDACTED]"; /* * Startup code. Do not look at it, it may harm you. @@ -89,8 +89,8 @@ namespace pocketmine { * Enjoy it as much as I did writing it. I don't want to do it again. */ - if(version_compare("7.0", PHP_VERSION) > 0 or version_compare("7.1", PHP_VERSION) <= 0){ - echo "[CRITICAL] You must use PHP 7.0" . PHP_EOL; + if(version_compare("7.2", PHP_VERSION) > 0){ + echo "[CRITICAL] You must use PHP >= 7.2" . PHP_EOL; echo "[CRITICAL] Please use the installer provided on the homepage." . PHP_EOL; exit(1); } @@ -448,8 +448,8 @@ namespace pocketmine { if(substr_count($pthreads_version, ".") < 2){ $pthreads_version = "0.$pthreads_version"; } - if(version_compare($pthreads_version, "3.1.5") < 0){ - $logger->critical("pthreads >= 3.1.5 is required, while you have $pthreads_version."); + if(version_compare($pthreads_version, "3.1.7-dev") < 0){ + $logger->critical("pthreads >= 3.1.7-dev is required, while you have $pthreads_version."); ++$errors; } @@ -534,7 +534,7 @@ namespace pocketmine { if(\Phar::running(true) === ""){ - $logger->warning("Non-packaged PocketMine-MP installation detected, do not use on production."); + $logger->warning("Non-packaged PocketMine-MP installation detected. Consider using a phar in production for better performance."); } ThreadManager::init(); diff --git a/src/pocketmine/Thread.php b/src/pocketmine/Thread.php index 1f1be497cf..b6a4d2b62b 100644 --- a/src/pocketmine/Thread.php +++ b/src/pocketmine/Thread.php @@ -60,7 +60,7 @@ abstract class Thread extends \Thread{ } } - public function start(int $options = PTHREADS_INHERIT_ALL){ + public function start(?int $options = \PTHREADS_INHERIT_ALL){ ThreadManager::getInstance()->add($this); if(!$this->isRunning() and !$this->isJoined() and !$this->isTerminated()){ diff --git a/src/pocketmine/Worker.php b/src/pocketmine/Worker.php index 85e3dedf9a..f9ade50716 100644 --- a/src/pocketmine/Worker.php +++ b/src/pocketmine/Worker.php @@ -61,7 +61,7 @@ abstract class Worker extends \Worker{ } } - public function start(int $options = PTHREADS_INHERIT_ALL){ + public function start(?int $options = \PTHREADS_INHERIT_ALL){ ThreadManager::getInstance()->add($this); if(!$this->isRunning() and !$this->isJoined() and !$this->isTerminated()){ diff --git a/src/pocketmine/item/ItemFactory.php b/src/pocketmine/item/ItemFactory.php index efe0327092..f08561ff28 100644 --- a/src/pocketmine/item/ItemFactory.php +++ b/src/pocketmine/item/ItemFactory.php @@ -338,11 +338,13 @@ class ItemFactory{ if(defined(Item::class . "::" . strtoupper($b[0]))){ $item = self::get(constant(Item::class . "::" . strtoupper($b[0])), $meta); - if($item->getId() === Item::AIR and strtoupper($b[0]) !== "AIR"){ - $item = self::get($b[0] & 0xFFFF, $meta); + if($item->getId() === Item::AIR and strtoupper($b[0]) !== "AIR" and is_numeric($b[0])){ + $item = self::get(((int) $b[0]) & 0xFFFF, $meta); } + }elseif(is_numeric($b[0])){ + $item = self::get(((int) $b[0]) & 0xFFFF, $meta); }else{ - $item = self::get($b[0] & 0xFFFF, $meta); + $item = self::get(Item::AIR, 0, 0); } return $item; diff --git a/src/pocketmine/level/generator/object/Object.php b/src/pocketmine/level/generator/object/PopulatorObject.php similarity index 96% rename from src/pocketmine/level/generator/object/Object.php rename to src/pocketmine/level/generator/object/PopulatorObject.php index 0abf2a3554..8714c0d89d 100644 --- a/src/pocketmine/level/generator/object/Object.php +++ b/src/pocketmine/level/generator/object/PopulatorObject.php @@ -27,6 +27,6 @@ declare(strict_types=1); namespace pocketmine\level\generator\object; -abstract class Object{ +abstract class PopulatorObject{ } \ No newline at end of file diff --git a/src/pocketmine/utils/MainLogger.php b/src/pocketmine/utils/MainLogger.php index 686f68344d..8e97d61041 100644 --- a/src/pocketmine/utils/MainLogger.php +++ b/src/pocketmine/utils/MainLogger.php @@ -105,8 +105,8 @@ class MainLogger extends \AttachableThreadedLogger{ $this->send($message, \LogLevel::INFO, "INFO", TextFormat::WHITE); } - public function debug($message){ - if($this->logDebug === false){ + public function debug($message, bool $force = false){ + if($this->logDebug === false and !$force){ return; } $this->send($message, \LogLevel::DEBUG, "DEBUG", TextFormat::GRAY); @@ -156,7 +156,7 @@ class MainLogger extends \AttachableThreadedLogger{ $errfile = \pocketmine\cleanPath($errfile); $this->log($type, get_class($e) . ": \"$errstr\" ($errno) in \"$errfile\" at line $errline"); foreach(\pocketmine\getTrace(0, $trace) as $i => $line){ - $this->debug($line); + $this->debug($line, true); } } diff --git a/start.ps1 b/start.ps1 index ef3c1221f5..9c0cf318f4 100644 --- a/start.ps1 +++ b/start.ps1 @@ -1,6 +1,8 @@ -param ( +[CmdletBinding(PositionalBinding=$false)] +param ( [string]$php = "", - [switch]$Loop = $false + [switch]$Loop = $false, + [string][Parameter(ValueFromRemainingArguments)]$extraPocketMineArgs ) if($php -ne ""){ @@ -23,7 +25,7 @@ if(Test-Path "PocketMine-MP.phar"){ } function StartServer{ - $command = "powershell " + $binary + " " + $file + " --enable-ansi" + $command = "powershell " + $binary + " " + $file + " --enable-ansi " + $extraPocketMineArgs iex $command }