Merge branch '3.5'

This commit is contained in:
Dylan K. Taylor 2019-01-29 14:05:00 +00:00
commit c5f0665853
4 changed files with 28 additions and 19 deletions

View File

@ -158,6 +158,7 @@ use function min;
use function preg_match;
use function round;
use function spl_object_id;
use function sqrt;
use function strlen;
use function strpos;
use function strtolower;
@ -411,8 +412,11 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
}
public function setFlying(bool $value){
$this->flying = $value;
$this->sendSettings();
if($this->flying !== $value){
$this->flying = $value;
$this->resetFallDistance();
$this->sendSettings();
}
}
public function isFlying() : bool{
@ -1332,20 +1336,18 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$this->allowFlight = $this->isCreative();
if($this->isSpectator()){
$this->flying = true;
$this->setFlying(true);
$this->keepMovement = true;
$this->despawnFromAll();
}else{
$this->keepMovement = $this->allowMovementCheats;
if($this->isSurvival()){
$this->flying = false;
$this->setFlying(false);
}
$this->spawnToAll();
}
$this->resetFallDistance();
if(!$client){ //GameMode changed by server, do not send for client changes
if(!$client){ //Gamemode changed by server, do not send for client changes
$this->sendGamemode();
}else{
Command::broadcastCommandMessage($this, new TranslationContainer("commands.gamemode.success.self", [GameMode::toTranslation($gm)]));
@ -1564,7 +1566,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
}else{
$this->broadcastMovement();
$distance = $from->distance($to);
$distance = sqrt((($from->x - $to->x) ** 2) + (($from->z - $to->z) ** 2));
//TODO: check swimming (adds 0.015 exhaustion in MCPE)
if($this->isSprinting()){
$this->exhaust(0.1 * $distance, PlayerExhaustEvent::CAUSE_SPRINTING);
@ -1589,6 +1591,12 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$this->newPosition = null;
}
public function fall(float $fallDistance) : void{
if(!$this->flying){
parent::fall($fallDistance);
}
}
public function jump() : void{
(new PlayerJumpEvent($this))->call();
parent::jump();
@ -2398,8 +2406,9 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$ev->call();
if($ev->isCancelled()){
$this->sendSettings();
}else{
$this->setFlying($fly);
}else{ //don't use setFlying() here, to avoid feedback loops
$this->flying = $fly;
$this->resetFallDistance();
}
}

View File

@ -61,7 +61,7 @@ abstract class Crops extends Flowable{
public function onActivate(Item $item, Player $player = null) : bool{
if($item->getId() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal
if($this->age < 7 and $item->getId() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal
$block = clone $this;
$block->age += mt_rand(2, 5);
if($block->age > 7){

View File

@ -220,11 +220,10 @@ class Explosion{
$t = $this->level->getTileAt($block->x, $block->y, $block->z);
if($t instanceof Tile){
if($t instanceof Chest){
$t->unpair();
}
if($yieldDrops and $t instanceof Container){
if($t instanceof Chest){
$t->unpair();
}
$t->getInventory()->dropContents($this->level, $t->add(0.5, 0.5, 0.5));
}

View File

@ -75,10 +75,6 @@ class SetupWizard{
}
}while($lang === null);
$config = new Config(\pocketmine\DATA . "server.properties", Config::PROPERTIES);
$config->set("language", $lang);
$config->save();
$this->lang = new Language($lang);
$this->message($this->lang->get("language_has_been_selected"));
@ -87,6 +83,11 @@ class SetupWizard{
return false;
}
//this has to happen here to prevent user avoiding agreeing to license
$config = new Config(\pocketmine\DATA . "server.properties", Config::PROPERTIES);
$config->set("language", $lang);
$config->save();
if(strtolower($this->getInput($this->lang->get("skip_installer"), "n", "y/N")) === "y"){
return true;
}