diff --git a/.travis.yml b/.travis.yml index fd491e7aa4..3493d03052 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,8 +6,9 @@ php: before_script: # - 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 + - git clone https://github.com/krakjoe/pthreads.git - cd pthreads + - git checkout caca8dc42a5d75ddfb39e6fd15337e87e967517e #master is broken - https://github.com/krakjoe/pthreads/issues/757 - phpize - ./configure - make diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index b76957bb18..55d63bcd42 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -654,7 +654,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $this->loaderId = Level::generateChunkLoaderId($this); $this->chunksPerTick = (int) $this->server->getProperty("chunk-sending.per-tick", 4); $this->spawnThreshold = (int) (($this->server->getProperty("chunk-sending.spawn-radius", 4) ** 2) * M_PI); - $this->spawnPosition = null; $this->gamemode = $this->server->getGamemode(); $this->setLevel($this->server->getDefaultLevel()); $this->boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0); diff --git a/src/pocketmine/network/mcpe/RakLibInterface.php b/src/pocketmine/network/mcpe/RakLibInterface.php index 77d4146ce2..216d8fa60f 100644 --- a/src/pocketmine/network/mcpe/RakLibInterface.php +++ b/src/pocketmine/network/mcpe/RakLibInterface.php @@ -54,7 +54,7 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{ private $players = []; /** @var string[] */ - private $identifiers; + private $identifiers = []; /** @var int[] */ private $identifiersACK = []; @@ -63,9 +63,7 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{ private $interface; public function __construct(Server $server){ - $this->server = $server; - $this->identifiers = []; $this->rakLib = new RakLibServer($this->server->getLogger(), $this->server->getLoader(), $this->server->getPort(), $this->server->getIp() === "" ? "0.0.0.0" : $this->server->getIp(), false); $this->interface = new ServerHandler($this->rakLib, $this); @@ -213,13 +211,10 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{ if($packet instanceof BatchPacket){ if($needACK){ $pk = new EncapsulatedPacket(); + $pk->identifierACK = $this->identifiersACK[$identifier]++; $pk->buffer = $packet->buffer; $pk->reliability = $immediate ? PacketReliability::RELIABLE : PacketReliability::RELIABLE_ORDERED; $pk->orderChannel = 0; - - if($needACK === true){ - $pk->identifierACK = $this->identifiersACK[$identifier]++; - } }else{ if(!isset($packet->__encapsulatedPacket)){ $packet->__encapsulatedPacket = new CachedEncapsulatedPacket; diff --git a/src/pocketmine/utils/Terminal.php b/src/pocketmine/utils/Terminal.php index 3fec7fcb0f..0b53c2ef3e 100644 --- a/src/pocketmine/utils/Terminal.php +++ b/src/pocketmine/utils/Terminal.php @@ -57,7 +57,13 @@ abstract class Terminal{ if(isset($opts["disable-ansi"])){ self::$formattingCodes = false; }else{ - self::$formattingCodes = ((Utils::getOS() !== "win" and getenv("TERM") != "" and (!function_exists("posix_ttyname") or !defined("STDOUT") or posix_ttyname(STDOUT) !== false)) or isset($opts["enable-ansi"])); + self::$formattingCodes = (isset($opts["enable-ansi"]) or ( //user explicitly told us to enable ANSI + stream_isatty(STDOUT) and //STDOUT isn't being piped + ( + getenv('TERM') !== false or //Console says it supports colours + (function_exists('sapi_windows_vt100_support') and sapi_windows_vt100_support(STDOUT)) //we're on windows and have vt100 support + ) + )); } } diff --git a/start.ps1 b/start.ps1 index 9c0cf318f4..b7f1890ab9 100644 --- a/start.ps1 +++ b/start.ps1 @@ -25,7 +25,7 @@ if(Test-Path "PocketMine-MP.phar"){ } function StartServer{ - $command = "powershell " + $binary + " " + $file + " --enable-ansi " + $extraPocketMineArgs + $command = "powershell " + $binary + " " + $file + " " + $extraPocketMineArgs iex $command }