pmmp / PocketMine-MP

A server software for Minecraft: Bedrock Edition in PHP
https://pmmp.io
GNU Lesser General Public License v3.0
3.26k stars 1.55k forks source link

Setting players gamemode on Login crashes if their previous gamemode is Spectator #4323

Closed HashimTheArab closed 3 years ago

HashimTheArab commented 3 years ago

Issue description

Setting the players gamemode to Survival in PlayerLoginEvent crashes the server if their previous gamemode was Spectator

TypeError: "pocketmine\network\mcpe\NetworkSession::syncAdventureSettings(): Argument #1 ($for) must be of type pocketmine\player\Player, null given,

Steps to reproduce the issue

  1. Set the players gamemode to Survival in Login event
  2. Set your gamemode to Spectator and rejoin the server

OS and versions

Plugins

Plugins (1): Core

Crashdump, backtrace or other files

xDidntPot commented 3 years ago

Weird

xxFLORII commented 3 years ago

try to set the gamemode in the PlayerJoinEvent

HashimTheArab commented 3 years ago

try to set the gamemode in the PlayerJoinEvent

I dont need a solution the issue is meant to point out the error.

xxFLORII commented 3 years ago

ah sorry, I misunderstood.

dhdjSYS commented 3 years ago

GameMode::SURVIVAL() ?

pretty sure that's not how you call on a constant.

Tried it with PocketMine-MP version 3.22.1 and there was no issue with the api. I suggest this issue to be closed.*I am dumb

HashimTheArab commented 3 years ago

GameMode::SURVIVAL() ?

pretty sure that's not how you call on a constant.

Tried it with PocketMine-MP version 3.22.1 and there was no issue with the api. I suggest this issue to be closed.

It's not a constant and its PM4

dhdjSYS commented 3 years ago

It's not a constant and its PM4

I'm dumb.