fix 1.8 spigot compat

This commit is contained in:
JRoy 2024-12-30 09:15:26 -05:00
parent aad0ee5778
commit a869f09d43
No known key found for this signature in database
GPG Key ID: FAD510B503869E7D
2 changed files with 12 additions and 4 deletions

View File

@ -78,18 +78,24 @@ public class ProviderFactory {
providers.put(providerClass, getProviderInstance(highestProvider));
} else if (!nullable) {
throw new IllegalStateException("No provider found for " + providerClass.getName());
} else {
essentials.getLogger().info("No provider found for " + providerClass.getSimpleName() + ", but it is nullable");
}
}
registeredProviders.clear();
}
private boolean testProvider(final Class<?> providerClass) throws InvocationTargetException, IllegalAccessException {
for (final Method method : providerClass.getMethods()) {
if (method.isAnnotationPresent(ProviderTest.class)) {
return (Boolean) method.invoke(null);
try {
for (final Method method : providerClass.getMethods()) {
if (method.isAnnotationPresent(ProviderTest.class)) {
return (Boolean) method.invoke(null);
}
}
return true;
} catch (final NoClassDefFoundError ignored) {
return false;
}
return true;
}
private <P extends Provider> P getProviderInstance(final Class<P> provider) {

View File

@ -1,7 +1,9 @@
package net.ess3.provider;
import net.essentialsx.providers.NullableProvider;
import org.bukkit.Material;
@NullableProvider
public interface MaterialTagProvider extends Provider {
boolean tagExists(String tagName);