Skip to content

Commit

Permalink
Merge pull request #330 from jonesbusy/feature/IS_FOR_ADOPTION-flag
Browse files Browse the repository at this point in the history
Flag for adoption
  • Loading branch information
jonesbusy authored Oct 14, 2024
2 parents 1336296 + 9283d0f commit 5450572
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ public enum MetadataFlag {
*/
IS_DEPRECATED(null, (plugin, pluginService) -> pluginService.isDeprecated(plugin)),

/**
* If the plugin is for adoption
*/
IS_FOR_ADOPTION(null, (plugin, pluginService) -> pluginService.isForAdoption(plugin)),

/**
* If the plugin has a max score (100 %)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,20 @@ public boolean isDeprecated(Plugin plugin) {
&& updateCenterPlugin.labels().contains("deprecated");
}

/**
* Retgurn if a plugin is for adoption
* @param plugin Plugin
* @return True if for adoption
*/
public boolean isForAdoption(Plugin plugin) {
UpdateCenterData updateCenterData = getUpdateCenterData();
UpdateCenterData.UpdateCenterPlugin updateCenterPlugin =
updateCenterData.getPlugins().get(plugin.getName());
return updateCenterPlugin != null
&& updateCenterPlugin.labels() != null
&& updateCenterPlugin.labels().contains("adopt-this-plugin");
}

/**
* Check if a plugin is an API plugin
* @param plugin Plugin
Expand Down

0 comments on commit 5450572

Please sign in to comment.