if (p.spawnType != SpawnType.PLUGIN)
throw new IllegalStateException("May only hook plugins!");
this.pluginListLock.lock();
try {
Plugin plugin = (Plugin) p.pluggable;
// Only do something if the plugins is not this
if (plugin != this && plugin != this.pluginSupervisor) {
// Wrap plugin inside meta handler, if enabled
if (this.wrapPluginsInMetaProxy) {
final Class<?>[] internalInterfaces = plugin.getClass().getInterfaces();
final Class<?>[] interfaces = new Class[internalInterfaces.length + 1];
System.arraycopy(internalInterfaces, 0, interfaces, 0, internalInterfaces.length);
interfaces[interfaces.length - 1] = PluginWrapper.class;
plugin = (Plugin) Proxy.newProxyInstance(plugin.getClass().getClassLoader(), interfaces, new PluginMetaHandler(this.pluginSupervisor, plugin));
}
}
// 1. Process plugin loaded information
processPluginLoadedAnnotationForThisPlugin(p);