加几个方法用来干活

This commit is contained in:
IzzelAliz 2019-07-10 21:51:40 +08:00
parent d9301f7379
commit 10279f34ad

View File

@ -85,15 +85,24 @@ public abstract class PluginLoader {
public void onLoading(Plugin plugin) { public void onLoading(Plugin plugin) {
} }
public void postLoading(Plugin plugin) {
}
public void onStarting(Plugin plugin) { public void onStarting(Plugin plugin) {
} }
public void postStarting(Plugin plugin) {
}
public void onActivated(Plugin plugin) { public void onActivated(Plugin plugin) {
} }
public void onStopping(Plugin plugin) { public void onStopping(Plugin plugin) {
} }
public void postStopping(Plugin plugin) {
}
public static void addPlugin(Plugin plugin) { public static void addPlugin(Plugin plugin) {
plugins.add(plugin.getName()); plugins.add(plugin.getName());
} }
@ -102,10 +111,18 @@ public abstract class PluginLoader {
registerLoader.forEach(loader -> loader.onLoading(plugin)); registerLoader.forEach(loader -> loader.onLoading(plugin));
} }
public static void postLoad(Plugin plugin) {
registerLoader.forEach(loader -> loader.postLoading(plugin));
}
public static void start(Plugin plugin) { public static void start(Plugin plugin) {
registerLoader.forEach(loader -> loader.onStarting(plugin)); registerLoader.forEach(loader -> loader.onStarting(plugin));
} }
public static void postStart(Plugin plugin) {
registerLoader.forEach(loader -> loader.postStarting(plugin));
}
public static void active(Plugin plugin) { public static void active(Plugin plugin) {
registerLoader.forEach(loader -> loader.onActivated(plugin)); registerLoader.forEach(loader -> loader.onActivated(plugin));
} }
@ -114,6 +131,10 @@ public abstract class PluginLoader {
registerLoader.forEach(loader -> loader.onStopping(plugin)); registerLoader.forEach(loader -> loader.onStopping(plugin));
} }
public static void postStop(Plugin plugin) {
registerLoader.forEach(loader -> loader.postStopping(plugin));
}
public static boolean isPlugin(Plugin plugin) { public static boolean isPlugin(Plugin plugin) {
return plugins.contains(plugin.getName()); return plugins.contains(plugin.getName());
} }