func (p *Provider) Settings() world.Settings {
	return world.Settings{
		Name:            p.d.LevelName,
		Spawn:           cube.Pos{int(p.d.SpawnX), int(p.d.SpawnY), int(p.d.SpawnZ)},
		Time:            p.d.Time,
		TimeCycle:       p.d.DoDayLightCycle,
		WeatherCycle:    p.d.DoWeatherCycle,
		RainTime:        int64(p.d.RainTime),
		Raining:         p.d.RainLevel > 0,
		ThunderTime:     int64(p.d.LightningTime),
		Thundering:      p.d.LightningLevel > 0,
		CurrentTick:     p.d.CurrentTick,
		DefaultGameMode: p.LoadDefaultGameMode(),
		Difficulty:      p.LoadDifficulty(),
	}
}
Settings returns the world.Settings of the world loaded by the Provider.
package mcdb
import (
	"bytes"
	"encoding/binary"
	"fmt"
	"github.com/df-mc/dragonfly/server/block/cube"
	"github.com/df-mc/dragonfly/server/world"
	"github.com/df-mc/dragonfly/server/world/chunk"
	"github.com/df-mc/goleveldb/leveldb"
	"github.com/df-mc/goleveldb/leveldb/opt"
	"github.com/sandertv/gophertunnel/minecraft/nbt"
	"github.com/sandertv/gophertunnel/minecraft/protocol"
	"io/ioutil"
	"math"
	"os"
	"path/filepath"
	"time"
)
type Provider struct {
	db  *leveldb.DB
	dir string
	d   data
}
const chunkVersion = 19
func New(dir string) (*Provider, error) {
	_ = os.MkdirAll(filepath.Join(dir, "db"), 0777)
	p := &Provider{dir: dir}
	if _, err := os.Stat(filepath.Join(dir, "level.dat")); os.IsNotExist(err) {
		p.initDefaultLevelDat()
	} else {
		f, err := ioutil.ReadFile(filepath.Join(dir, "level.dat"))
		if err != nil {
			return nil, fmt.Errorf("error opening level.dat file: %w", err)
		}
		if len(f) < 8 {
			return nil, fmt.Errorf("level.dat exists but has no data")
		}
		if err := nbt.UnmarshalEncoding(f[8:], &p.d, nbt.LittleEndian); err != nil {
			return nil, fmt.Errorf("error decoding level.dat NBT: %w", err)
		}
		p.d.WorldStartCount++
	}
	db, err := leveldb.OpenFile(filepath.Join(dir, "db"), &opt.Options{
		Compression: opt.FlateCompression,
		BlockSize:   16 * opt.KiB,
	})
	if err != nil {
		return nil, fmt.Errorf("error opening leveldb database: %w", err)
	}
	p.db = db
	return p, nil
}
func (p *Provider) initDefaultLevelDat() {
	p.d.DoDayLightCycle = true
	p.d.DoWeatherCycle = true
	p.d.BaseGameVersion = protocol.CurrentVersion
	p.d.LevelName = "World"
	p.d.GameType = 1
	p.d.StorageVersion = 8
	p.d.Generator = 1
	p.d.NetworkVersion = protocol.CurrentProtocol
	p.d.Abilities.WalkSpeed = 0.1
	p.d.PVP = true
	p.d.WorldStartCount = 1
	p.d.RandomTickSpeed = 1
	p.d.FallDamage = true
	p.d.FireDamage = true
	p.d.DrowningDamage = true
	p.d.CommandsEnabled = true
	p.d.MultiPlayerGame = true
	p.d.SpawnY = math.MaxInt32
	p.d.Difficulty = 2
	p.d.DoWeatherCycle = true
	p.d.RainLevel = 1.0
	p.d.LightningLevel = 1.0
}