Either World is null for some reason (calling in wrong place) or cast is invalid (gamemode is actully diffrent), also check the logs there might be hint too
Either World is null for some reason (calling in wrong place) or cast is invalid (gamemode is actully diffrent), also check the logs there might be hint too