GameMode is now an enum

This commit is contained in:
Dylan K. Taylor
2019-03-31 16:19:36 +01:00
parent 0017c0087a
commit 42a263a9df
9 changed files with 128 additions and 104 deletions

View File

@ -23,7 +23,6 @@ declare(strict_types=1);
namespace pocketmine\network\mcpe;
use pocketmine\GameMode;
use pocketmine\network\AdvancedNetworkInterface;
use pocketmine\network\BadPacketException;
use pocketmine\network\mcpe\protocol\ProtocolInfo;
@ -210,7 +209,7 @@ class RakLibInterface implements ServerInstance, AdvancedNetworkInterface{
$info->getMaxPlayerCount(),
$this->rakLib->getServerId(),
$this->server->getName(),
GameMode::toString($this->server->getGamemode())
$this->server->getGamemode()->getEnglishName()
]) . ";"
);
}

View File

@ -468,7 +468,7 @@ class SimpleSessionHandler extends SessionHandler{
}
public function handleSetPlayerGameType(SetPlayerGameTypePacket $packet) : bool{
if($packet->gamemode !== $this->player->getGamemode()){
if($packet->gamemode !== $this->player->getGamemode()->getMagicNumber()){
//Set this back to default. TODO: handle this properly
$this->player->sendGamemode();
$this->player->sendSettings();