Make valid game version types configurable using an extendable provider interface #27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As described in #15 it is currently not possible to upload bukkit plugins while specifying game versions with this plugin.
This PR fixes that by allowing users to filter which game version types they want to use.
To accomplish that, it introduces the interface
VersionTypeProviderwhich takes a list ofVersionTypes and returns a list of valid type IDs that should be considered when selecting versions. Multiple of these interfaces can be selected at the same time to make reusing them easier (e.g., if CurseForge decides to add java version selection to plugins).Users can either implement this interface themselves for more advanced use cases or possibly different games, or use some of the predefined implementations. By default, the Java Versions, Mod loaders, Minecraft versions (for Mods) and Environments are accepted which matches the existing behavior of the plugin.
Switching to bukkit is as simple as adding the following line to your task:
I changed the constructor of the
GameVersionsclass. Since the doc comment on the constructor for this class mentions that it should not be called manually by users, I think that's fine.If this is considered a breaking change, I could add a constructor compatible with the previous signature, but that would require moving the default provider list outside TaskPublishCurseForge, which would IMO make it harder to find.