public static <P> Set<P> services(final Class<? extends P> clazz) {
    final ServiceLoader<? extends P> loader = Services0.loader(clazz);
    final Set<P> providers = new HashSet<>();
    for (final Iterator<? extends P> it = loader.iterator(); it.hasNext();) {
      final P instance;
      try {
        instance = it.next();
      } catch (final ServiceConfigurationError ex) {
        if (SERVICE_LOAD_FAILURES_ARE_FATAL) {
          throw new IllegalStateException("Encountered an exception loading a provider for " + clazz + ": ", ex);
        } else {
          continue;
        }
      }
      providers.add(instance);
    }
    return Collections.unmodifiableSet(providers);
  }
Locates all providers for a certain service and initializes them.

@param clazz the service interface
@param <P> the service interface type
@return an unmodifiable set of all known providers of the service
@since 4.17.0
api/src/main/java/net/kyori/adventure/util/Services.java