gm switch requires kick, rails are enabled by default

This commit is contained in:
GameHerobrine 2023-12-15 07:57:48 +03:00
parent d2884aef8d
commit 2d623c9122
2 changed files with 6 additions and 19 deletions

View file

@ -989,23 +989,10 @@ class Player{
foreach($this->inventory as $slot => $item){ foreach($this->inventory as $slot => $item){
$inv[$slot] = BlockAPI::getItem(AIR, 0, 0); $inv[$slot] = BlockAPI::getItem(AIR, 0, 0);
} }
$this->blocked = true;
$this->gamemode = $gm; $this->gamemode = $gm;
$this->sendChat("Your gamemode has been changed to " . $this->getGamemode() . ", you've to do a forced reconnect.\n");
$spwnPos = $this->getSpawn(); $this->server->schedule(30, [$this, "close"], "gamemode change", false, true); //Forces a kick
$pk = new StartGamePacket();
$pk->seed = $this->level->getSeed();
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;
$pk->spawnX = $spwnPos->x;
$pk->spawnY = $spwnPos->y;
$pk->spawnZ = $spwnPos->z;
$pk->generator = $this->level->generatorType;
$pk->gamemode = $this->gamemode & 0x01;
$pk->eid = 0;
$this->dataPacket($pk);
$this->sendSettings();
} }
if($this->gamemode === SPECTATOR){ if($this->gamemode === SPECTATOR){

View file

@ -78,7 +78,7 @@ class PocketMinecraftServer{
"enable-mob-ai" => false, "enable-mob-ai" => false,
"enable-nether-reactor" => true, "enable-nether-reactor" => true,
"enable-explosions" => true, "enable-explosions" => true,
"enable-rail-connection" => false, "enable-rail-connection" => true,
"save-player-data" => true, "save-player-data" => true,
"save-console-data" => true, "save-console-data" => true,
"query-plugins" => false, "query-plugins" => false,