mirror of
https://github.com/BG-Software-LLC/WildLoaders.git
synced 2024-11-21 11:46:46 +01:00
Fixed errors when not having SWM installed (#97)
This commit is contained in:
parent
f301d02544
commit
b1b9d1639d
@ -85,13 +85,13 @@ public final class ProvidersHandler implements ProvidersManager {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
Class.forName("com.infernalsuite.aswm.api.SlimePlugin");
|
Class.forName("com.infernalsuite.aswm.api.SlimePlugin");
|
||||||
worldsProvider = createInstance("WorldsProvider_AdvancedSlimePaper");
|
worldsProvider = createInstanceSilently("WorldsProvider_AdvancedSlimePaper");
|
||||||
} catch (Throwable ignored) {
|
} catch (ClassNotFoundException ignored) {
|
||||||
try {
|
try {
|
||||||
Class.forName("com.grinderwolf.swm.nms.world.AbstractSlimeNMSWorld");
|
Class.forName("com.grinderwolf.swm.nms.world.AbstractSlimeNMSWorld");
|
||||||
worldsProvider = createInstance("WorldsProvider_AdvancedSlimeWorldManager");
|
worldsProvider = createInstanceSilently("WorldsProvider_AdvancedSlimeWorldManager");
|
||||||
} catch (Throwable error) {
|
} catch (Throwable error) {
|
||||||
worldsProvider = createInstance("WorldsProvider_SlimeWorldManager");
|
worldsProvider = createInstanceSilently("WorldsProvider_SlimeWorldManager");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,6 +140,14 @@ public final class ProvidersHandler implements ProvidersManager {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private <T> Optional<T> createInstanceSilently(String className) {
|
||||||
|
try {
|
||||||
|
return createInstance(className);
|
||||||
|
} catch (Throwable error) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private <T> Optional<T> createInstance(String className) {
|
private <T> Optional<T> createInstance(String className) {
|
||||||
try {
|
try {
|
||||||
Class<?> clazz = Class.forName("com.bgsoftware.wildloaders.hooks." + className);
|
Class<?> clazz = Class.forName("com.bgsoftware.wildloaders.hooks." + className);
|
||||||
|
Loading…
Reference in New Issue
Block a user