SpongePowered / Sponge

The SpongeAPI implementation targeting vanilla Minecraft and 3rd party platforms.
MIT License
384 stars 211 forks source link

No injected dependency for ConfigurationOptions #1937

Open pie-flavor opened 6 years ago

pie-flavor commented 6 years ago

If you wanted to inject a ConfigurationOptions object for using in your own configs, you cannot. The only way to retrieve it is to inject the default config loader and take its options.

Defman commented 6 years ago

Not quite true, https://github.com/SpongePowered/SpongeCommon/blob/222042d4a04f491315041e9ce0e4d2c3993e03a8/src/main/java/org/spongepowered/common/registry/SpongeGameRegistry.java#L139-L145

This is registering them globaly at ConfigurationOptions.defaults() and you can retrive a ConfigurationOption that uses the default TypeSerializer.

Defman commented 6 years ago

Theres also a TypeSerializer for DataContainers, https://github.com/SpongePowered/SpongeCommon/blob/a4733e52b280a82dcb6921d9e729964e34141165/src/main/java/org/spongepowered/common/data/SpongeDataManager.java#L77-L83

ryantheleach commented 6 years ago

@pie-flavor Can you elaborate? this issue is kinda stuck in limbo currently, with more information someone might be able to fix it, or show you a way forward.

pie-flavor commented 6 years ago

I don't know what exactly needs clarification. Some stuff is in ConfigurationOptions.defaults() but there is also the object mapper factory that gets set per plugin. So a way to just inject a ConfigurationOptions object would be a great thing.