Skip to content

Commit

Permalink
added check for required facets in WorldBuilder (MovingBlocks#4924)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrGizmo123 committed Sep 2, 2022
1 parent 76eb3f5 commit f881063
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,16 @@ private ListMultimap<Class<? extends WorldFacet>, FacetProvider> determineProvid
return result;
}


/**
* Checks if all @Require facets have been provided by others
*
* @param availableFacets - the list of facets that are provided by others
*/
private void checkProviderRequirements(Set<Class<? extends WorldFacet>> availableFacets) {
for(FacetProvider provider : providersList) {
for (FacetProvider provider : providersList) {
Requires providerRequirement = provider.getClass().getAnnotation(Requires.class);
for(Facet facet : providerRequirement.value()) {
if(!availableFacets.contains(facet)) {
for (Facet facet : providerRequirement.value()) {
if (!availableFacets.contains(facet.value())) {
logger.error("Facet " + facet.getClass().getCanonicalName() + " is not provided");
}
}
Expand Down

0 comments on commit f881063

Please sign in to comment.