Merge branch 'master' into mcpe-1.2

This commit is contained in:
Dylan K. Taylor 2017-09-09 21:58:30 +01:00
commit 16cb75ef38
8 changed files with 34 additions and 22 deletions

View File

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

View File

@ -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();

View File

@ -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()){

View File

@ -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()){

View File

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

View File

@ -27,6 +27,6 @@ declare(strict_types=1);
namespace pocketmine\level\generator\object;
abstract class Object{
abstract class PopulatorObject{
}

View File

@ -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);
}
}

View File

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