Merge branch 'master' into mcpe-1.2

This commit is contained in:
Dylan K. Taylor 2017-09-18 10:29:38 +01:00
commit 361b262d3a
5 changed files with 12 additions and 11 deletions

View File

@ -6,8 +6,9 @@ php:
before_script: before_script:
# - pecl install channel://pecl.php.net/pthreads-3.1.6 # - pecl install channel://pecl.php.net/pthreads-3.1.6
- echo | pecl install channel://pecl.php.net/yaml-2.0.2 - 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 - cd pthreads
- git checkout caca8dc42a5d75ddfb39e6fd15337e87e967517e #master is broken - https://github.com/krakjoe/pthreads/issues/757
- phpize - phpize
- ./configure - ./configure
- make - make

View File

@ -654,7 +654,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$this->loaderId = Level::generateChunkLoaderId($this); $this->loaderId = Level::generateChunkLoaderId($this);
$this->chunksPerTick = (int) $this->server->getProperty("chunk-sending.per-tick", 4); $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->spawnThreshold = (int) (($this->server->getProperty("chunk-sending.spawn-radius", 4) ** 2) * M_PI);
$this->spawnPosition = null;
$this->gamemode = $this->server->getGamemode(); $this->gamemode = $this->server->getGamemode();
$this->setLevel($this->server->getDefaultLevel()); $this->setLevel($this->server->getDefaultLevel());
$this->boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0); $this->boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0);

View File

@ -54,7 +54,7 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{
private $players = []; private $players = [];
/** @var string[] */ /** @var string[] */
private $identifiers; private $identifiers = [];
/** @var int[] */ /** @var int[] */
private $identifiersACK = []; private $identifiersACK = [];
@ -63,9 +63,7 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{
private $interface; private $interface;
public function __construct(Server $server){ public function __construct(Server $server){
$this->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->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); $this->interface = new ServerHandler($this->rakLib, $this);
@ -213,13 +211,10 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{
if($packet instanceof BatchPacket){ if($packet instanceof BatchPacket){
if($needACK){ if($needACK){
$pk = new EncapsulatedPacket(); $pk = new EncapsulatedPacket();
$pk->identifierACK = $this->identifiersACK[$identifier]++;
$pk->buffer = $packet->buffer; $pk->buffer = $packet->buffer;
$pk->reliability = $immediate ? PacketReliability::RELIABLE : PacketReliability::RELIABLE_ORDERED; $pk->reliability = $immediate ? PacketReliability::RELIABLE : PacketReliability::RELIABLE_ORDERED;
$pk->orderChannel = 0; $pk->orderChannel = 0;
if($needACK === true){
$pk->identifierACK = $this->identifiersACK[$identifier]++;
}
}else{ }else{
if(!isset($packet->__encapsulatedPacket)){ if(!isset($packet->__encapsulatedPacket)){
$packet->__encapsulatedPacket = new CachedEncapsulatedPacket; $packet->__encapsulatedPacket = new CachedEncapsulatedPacket;

View File

@ -57,7 +57,13 @@ abstract class Terminal{
if(isset($opts["disable-ansi"])){ if(isset($opts["disable-ansi"])){
self::$formattingCodes = false; self::$formattingCodes = false;
}else{ }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
)
));
} }
} }

View File

@ -25,7 +25,7 @@ if(Test-Path "PocketMine-MP.phar"){
} }
function StartServer{ function StartServer{
$command = "powershell " + $binary + " " + $file + " --enable-ansi " + $extraPocketMineArgs $command = "powershell " + $binary + " " + $file + " " + $extraPocketMineArgs
iex $command iex $command
} }