|
@@ -130,7 +130,7 @@ public class PluginInfo implements Comparable<PluginInfo> {
|
130
|
130
|
}
|
131
|
131
|
}
|
132
|
132
|
|
133
|
|
- if (isPersistant()) { loadEntirePlugin(); }
|
|
133
|
+ if (isPersistant() && loadAll()) { loadEntirePlugin(); }
|
134
|
134
|
} else {
|
135
|
135
|
// throw new PluginException("Plugin "+filename+" was not loaded, one or more requirements not met ("+requirements+")");
|
136
|
136
|
}
|
|
@@ -492,18 +492,22 @@ public class PluginInfo implements Comparable<PluginInfo> {
|
492
|
492
|
|
493
|
493
|
final Class<?> c = classloader.loadClass(classname);
|
494
|
494
|
final Constructor<?> constructor = c.getConstructor(new Class[] {});
|
495
|
|
-
|
496
|
|
- final Object temp = constructor.newInstance(new Object[] {});
|
497
|
|
-
|
498
|
|
- if (temp instanceof Plugin) {
|
499
|
|
- if (((Plugin) temp).checkPrerequisites()) {
|
500
|
|
- plugin = (Plugin) temp;
|
501
|
|
- if (!tempLoaded) {
|
502
|
|
- plugin.onLoad();
|
503
|
|
- }
|
504
|
|
- } else {
|
505
|
|
- if (!tempLoaded) {
|
506
|
|
- Logger.userError(ErrorLevel.LOW, "Prerequisites for plugin not met. ('"+filename+":"+getMainClass()+"')");
|
|
495
|
+
|
|
496
|
+ // Only try and construct the main class, anything else should be constructed
|
|
497
|
+ // by the plugin itself.
|
|
498
|
+ if (classname.equals(getMainClass())) {
|
|
499
|
+ final Object temp = constructor.newInstance(new Object[] {});
|
|
500
|
+
|
|
501
|
+ if (temp instanceof Plugin) {
|
|
502
|
+ if (((Plugin) temp).checkPrerequisites()) {
|
|
503
|
+ plugin = (Plugin) temp;
|
|
504
|
+ if (!tempLoaded) {
|
|
505
|
+ plugin.onLoad();
|
|
506
|
+ }
|
|
507
|
+ } else {
|
|
508
|
+ if (!tempLoaded) {
|
|
509
|
+ Logger.userError(ErrorLevel.LOW, "Prerequisites for plugin not met. ('"+filename+":"+getMainClass()+"')");
|
|
510
|
+ }
|
507
|
511
|
}
|
508
|
512
|
}
|
509
|
513
|
}
|
|
@@ -753,6 +757,16 @@ public class PluginInfo implements Comparable<PluginInfo> {
|
753
|
757
|
@Override
|
754
|
758
|
public String toString() { return getNiceName()+" - "+filename; }
|
755
|
759
|
|
|
760
|
+ /**
|
|
761
|
+ * Does this plugin want all its classes loaded?
|
|
762
|
+ *
|
|
763
|
+ * @return true/false if loadall=true || loadall=yes
|
|
764
|
+ */
|
|
765
|
+ public boolean loadAll() {
|
|
766
|
+ final String loadAll = metaData.getProperty("loadall","no");
|
|
767
|
+ return loadAll.equalsIgnoreCase("true") || loadAll.equalsIgnoreCase("yes");
|
|
768
|
+ }
|
|
769
|
+
|
756
|
770
|
/**
|
757
|
771
|
* Get misc meta-information.
|
758
|
772
|
*
|