mirror of
https://github.com/Anime-Game-Servers/AGSLunarCore.git
synced 2024-11-23 04:19:48 +00:00
Fix plugin on enable event not being called
This commit is contained in:
parent
f82fd023a8
commit
dd9646cfc8
@ -65,7 +65,6 @@ public abstract class Plugin {
|
||||
*
|
||||
* @return True if the config is valid, false otherwise.
|
||||
*/
|
||||
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
||||
public boolean validate() {
|
||||
return name != null && description != null && mainClass != null && api != null;
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ public final class PluginManager {
|
||||
* Loads all plugins from the plugins directory.
|
||||
* This can only be called once.
|
||||
*/
|
||||
@SuppressWarnings("resource")
|
||||
public void loadPlugins() throws IOException {
|
||||
if (this.pluginsLoaded)
|
||||
throw new IllegalStateException("Plugins have already been loaded.");
|
||||
@ -143,6 +144,7 @@ public final class PluginManager {
|
||||
));
|
||||
} else try {
|
||||
pluginInstance.onLoad();
|
||||
this.plugins.put(pluginInstance.getName(), pluginInstance);
|
||||
} catch (Throwable exception) {
|
||||
this.getLogger().warn("Failed to load plugin {}.", pluginFile.getName());
|
||||
}
|
||||
@ -179,6 +181,7 @@ public final class PluginManager {
|
||||
|
||||
// Load the plugin.
|
||||
pluginData.instance().onLoad();
|
||||
this.plugins.put(pluginData.instance().getName(), pluginData.instance());
|
||||
} catch (Throwable exception) {
|
||||
this.getLogger().warn("Failed to load plugin {}.", exception.getMessage());
|
||||
depth++;
|
||||
|
Loading…
Reference in New Issue
Block a user