Separate ID handling from GameMode

the aliases of 0,1,2,3 remain for user-interface level compatibility.
This commit is contained in:
Dylan K. Taylor
2021-06-27 20:32:35 +01:00
parent 5cdf0b169f
commit 902ea515f7
7 changed files with 83 additions and 31 deletions

View File

@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\network\query;
use pocketmine\player\GameMode;
use pocketmine\player\Player;
use pocketmine\plugin\Plugin;
use pocketmine\Server;
@@ -81,7 +82,7 @@ final class QueryInfo{
$this->plugins = $server->getPluginManager()->getPlugins();
$this->players = $server->getOnlinePlayers();
$this->gametype = ($server->getGamemode()->getMagicNumber() & 0x01) === 0 ? "SMP" : "CMP";
$this->gametype = ($server->getGamemode()->equals(GameMode::SURVIVAL()) || $server->getGamemode()->equals(GameMode::ADVENTURE())) ? "SMP" : "CMP";
$this->version = $server->getVersion();
$this->server_engine = $server->getName() . " " . $server->getPocketMineVersion();
$world = $server->getWorldManager()->getDefaultWorld();