Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration API - Exposing internal values #3494

Open
3 of 4 tasks
IllusionTheDev opened this issue Jul 29, 2023 · 4 comments
Open
3 of 4 tasks

Configuration API - Exposing internal values #3494

IllusionTheDev opened this issue Jul 29, 2023 · 4 comments

Comments

@IllusionTheDev
Copy link

Feature description

I am requesting a getValues method in the Configuration class. This method would return a defensive copy of the internal map.

Goal of the feature

This method exists in Spigot's ConfigurationSection class, and is beneficial for multi-platform code, as well as configuration parsing in some cases.

Unfitting alternatives

The only other alternative is to get all the keys, iterate through them and call Configuration#get, which is more computationally expensive.

Checking

  • This is not a question or plugin creation help request.
  • This is a feature or improvement request.
  • I have not read these checkboxes and therefore I just ticked them all.
  • I did not use this form to report a bug.
@md-5
Copy link
Member

md-5 commented Jul 29, 2023

From memory the bungee API is lazy compared to the spigot one so the internal map isn't quite comparable.

What specifically are you trying to achieve?

@IllusionTheDev
Copy link
Author

IllusionTheDev commented Jul 29, 2023

My end goal is to have a map-based configuration API similar to bungee's, that works across all platforms.

My current implementation looks like this, with an adapter for Bukkit and an adapter for bungee

Looking at the code, I believe the implementation should return a mix of the self map and the defaults.

@Janmm14
Copy link
Contributor

Janmm14 commented Jul 29, 2023

I would not suggest to use this coding style. You mix configuration details (like path strings and default values) into every other part of your plugin.

@IllusionTheDev
Copy link
Author

I would not suggest to use this coding style. You mix configuration details (like path strings and default values) into every other part of your plugin.

The objective of this system is to provide a consistent configuration experience in certain aspects across all platforms (Think of database configs). Platform-specific configs have their own unique paths and files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants