diff --git a/Essentials/src/main/java/com/earth2me/essentials/ProviderFactory.java b/Essentials/src/main/java/com/earth2me/essentials/ProviderFactory.java index 21a974c4b..1521ba697 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/ProviderFactory.java +++ b/Essentials/src/main/java/com/earth2me/essentials/ProviderFactory.java @@ -24,6 +24,11 @@ public class ProviderFactory { this.essentials = essentials; } + /** + * Gets the provider which has been selected for the given type. + * @param providerClass The provider type. + * @return the provider or null if no provider could be selected for that type. + */ public
P get(final Class
providerClass) { final Provider provider = providers.get(providerClass); if (provider == null) { @@ -93,6 +98,11 @@ public class ProviderFactory { } final Object[] args = new Object[constructor.getParameterTypes().length]; + /* + Providers can have constructors with any of the following types, and this code will automatically supply them; + - Plugin - The Essentials instance will be passed + - boolean - True will be passed if this server is running Paper, otherwise false. + */ for (int i = 0; i < args.length; i++) { final Class> paramType = constructor.getParameterTypes()[i]; if (paramType.isAssignableFrom(Plugin.class)) { diff --git a/providers/BaseProviders/src/main/java/net/essentialsx/providers/ProviderData.java b/providers/BaseProviders/src/main/java/net/essentialsx/providers/ProviderData.java index fc54309ee..3f0508472 100644 --- a/providers/BaseProviders/src/main/java/net/essentialsx/providers/ProviderData.java +++ b/providers/BaseProviders/src/main/java/net/essentialsx/providers/ProviderData.java @@ -8,7 +8,14 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface ProviderData { + /** + * A brief description of when this specific provider is used (MC Version, Server Software) and its name. + */ String description(); + /** + * If there is multiple providers for a given type that pass their {@link ProviderTest}, the one with the highest weight will be used. + * @return the weight of the provider. + */ int weight() default 0; }