Refactor plugin loading: improve error handling and adjust debug logging
This commit is contained in:
1 parent
8919731c63
commit
2bacdcc0f7
1 file changed
+6
-6
@@ -74,10 +74,6 @@ public final class PluginService {
|
||||
|
||||
base = base.replace(".java", "");
|
||||
|
||||
if (Constants.SERVER_DEBUG) {
|
||||
System.out.println(base);
|
||||
}
|
||||
|
||||
if (!file.isDirectory()) {
|
||||
try {
|
||||
Class<?> clazz = null;
|
||||
@@ -94,9 +90,13 @@ public final class PluginService {
|
||||
final EventSubscriber<?> sub = (EventSubscriber<?>) clazz.newInstance();
|
||||
|
||||
plugins.add(sub);
|
||||
|
||||
if (Constants.SERVER_DEBUG) {
|
||||
System.out.println(clazz.getName());
|
||||
}
|
||||
}
|
||||
} catch (InstantiationException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.SEVERE, "Failed to load plugin: " + base, e);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user