dragonfly icon indicating copy to clipboard operation
dragonfly copied to clipboard

potentailly add a new field to the server config

Open RestartFU opened this issue 1 year ago • 1 comments

hey, recently, while working on my custom provider for dragonfly, I realized that when players get spawned in, they are always going to get spawned in using the server worlds (overworld, nether, end).

This is great but this means that we'd have to merge our dimensions into a single world. Not everybody wants to do that.

As you can see here: https://github.com/bedrock-gophers/provider/blob/master/provider/settings.go#L16-L19 I've made it so you can give a custom world "resolver", which you can use if you are using my custom player provider

here's how we use it on moyai:

func wrld(dim world.Dimension) *world.World {
	switch dim {
	case world.Overworld:
		return Overworld()
	case world.Nether:
		return Nether()
	case world.End:
		fmt.Println("end")
		return End()
	}
	return nil
}

func NewServer(config server.Config) *server.Server {
	providerSettings := provider.DefaultSettings()
	providerSettings.UseServerWorld = false
	providerSettings.World = wrld
	providerSettings.FlushRate = time.Minute * 10
	providerSettings.SaveEffects = false

	playerProvider = provider.NewProvider(&config, providerSettings)
	srv = config.New()
	return srv
}

I was wondering if the main developers would be OK with adding such a field to the server config (only the world function I mean)

if so, please suggest field names so I can start working on a PR

RestartFU avatar Jul 17 '24 00:07 RestartFU

This can already be done by providing a world using this field in the player's data.

T14Raptor avatar Jul 17 '24 02:07 T14Raptor

Player's data is not readily accessible to the user so there does need to be some other solution

Sandertv avatar Nov 25 '24 16:11 Sandertv