mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
Move MOTD game mode stringifying to RakLibInterface
since this is contextless (there's no way to know the version of the client requesting the MOTD), we can safely assume that this is not going to vary between protocol versions.
This commit is contained in:
parent
6beb80b8fe
commit
5e462db0f8
@ -79,14 +79,6 @@ class TypeConverter{
|
||||
}
|
||||
}
|
||||
|
||||
public function protocolGameModeName(GameMode $gameMode) : string{
|
||||
switch($gameMode->id()){
|
||||
case GameMode::SURVIVAL()->id(): return "Survival";
|
||||
case GameMode::ADVENTURE()->id(): return "Adventure";
|
||||
default: return "Creative";
|
||||
}
|
||||
}
|
||||
|
||||
public function protocolGameModeToCore(int $gameMode) : ?GameMode{
|
||||
switch($gameMode){
|
||||
case ProtocolGameMode::SURVIVAL:
|
||||
|
@ -26,7 +26,6 @@ namespace pocketmine\network\mcpe\raklib;
|
||||
use pocketmine\lang\KnownTranslationFactory;
|
||||
use pocketmine\network\AdvancedNetworkInterface;
|
||||
use pocketmine\network\mcpe\compression\ZlibCompressor;
|
||||
use pocketmine\network\mcpe\convert\TypeConverter;
|
||||
use pocketmine\network\mcpe\EntityEventBroadcaster;
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
use pocketmine\network\mcpe\PacketBroadcaster;
|
||||
@ -36,6 +35,7 @@ use pocketmine\network\mcpe\protocol\serializer\PacketSerializerContext;
|
||||
use pocketmine\network\Network;
|
||||
use pocketmine\network\NetworkInterfaceStartException;
|
||||
use pocketmine\network\PacketHandlingException;
|
||||
use pocketmine\player\GameMode;
|
||||
use pocketmine\Server;
|
||||
use pocketmine\snooze\SleeperNotifier;
|
||||
use pocketmine\timings\Timings;
|
||||
@ -255,7 +255,11 @@ class RakLibInterface implements ServerEventListener, AdvancedNetworkInterface{
|
||||
$info->getMaxPlayerCount(),
|
||||
$this->rakServerId,
|
||||
$this->server->getName(),
|
||||
TypeConverter::getInstance()->protocolGameModeName($this->server->getGamemode())
|
||||
match($this->server->getGamemode()){
|
||||
GameMode::SURVIVAL() => "Survival",
|
||||
GameMode::ADVENTURE() => "Adventure",
|
||||
default => "Creative"
|
||||
}
|
||||
]) . ";"
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user