Merge commit '3ec2994d7f05f30e2519430379ae0f3106be5074'

# Conflicts:
#	resources/vanilla
#	src/pocketmine/Player.php
This commit is contained in:
Dylan K. Taylor
2020-05-20 19:52:03 +01:00
4 changed files with 65 additions and 17 deletions

View File

@@ -682,7 +682,7 @@ class NetworkSession{
}
public function syncGameMode(GameMode $mode, bool $isRollback = false) : void{
$this->sendDataPacket(SetPlayerGameTypePacket::create(self::getClientFriendlyGamemode($mode)));
$this->sendDataPacket(SetPlayerGameTypePacket::create(TypeConverter::getInstance()->getClientFriendlyGamemode($mode)));
$this->syncAdventureSettings($this->player);
if(!$isRollback){
$this->invManager->syncCreative();
@@ -943,18 +943,4 @@ class NetworkSession{
return false;
}
/**
* Returns a client-friendly gamemode of the specified real gamemode
* This function takes care of handling gamemodes known to MCPE (as of 1.1.0.3, that includes Survival, Creative and Adventure)
*
* @internal
*/
public static function getClientFriendlyGamemode(GameMode $gamemode) : int{
if($gamemode->equals(GameMode::SPECTATOR())){
return GameMode::CREATIVE()->getMagicNumber();
}
return $gamemode->getMagicNumber();
}
}