mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-05 07:57:59 +01:00
fix 1.8 spigot compat
This commit is contained in:
parent
aad0ee5778
commit
a869f09d43
@ -78,18 +78,24 @@ public class ProviderFactory {
|
|||||||
providers.put(providerClass, getProviderInstance(highestProvider));
|
providers.put(providerClass, getProviderInstance(highestProvider));
|
||||||
} else if (!nullable) {
|
} else if (!nullable) {
|
||||||
throw new IllegalStateException("No provider found for " + providerClass.getName());
|
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();
|
registeredProviders.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean testProvider(final Class<?> providerClass) throws InvocationTargetException, IllegalAccessException {
|
private boolean testProvider(final Class<?> providerClass) throws InvocationTargetException, IllegalAccessException {
|
||||||
for (final Method method : providerClass.getMethods()) {
|
try {
|
||||||
if (method.isAnnotationPresent(ProviderTest.class)) {
|
for (final Method method : providerClass.getMethods()) {
|
||||||
return (Boolean) method.invoke(null);
|
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) {
|
private <P extends Provider> P getProviderInstance(final Class<P> provider) {
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package net.ess3.provider;
|
package net.ess3.provider;
|
||||||
|
|
||||||
|
import net.essentialsx.providers.NullableProvider;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
|
@NullableProvider
|
||||||
public interface MaterialTagProvider extends Provider {
|
public interface MaterialTagProvider extends Provider {
|
||||||
boolean tagExists(String tagName);
|
boolean tagExists(String tagName);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user