Initial
This commit is contained in:
commit
b3120b69b0
7 changed files with 75 additions and 0 deletions
17
src/com/kallendorf/fshook/CustomLoader.java
Normal file
17
src/com/kallendorf/fshook/CustomLoader.java
Normal file
|
@ -0,0 +1,17 @@
|
|||
package com.kallendorf.fshook;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import de.espirit.common.bootstrap.Bootstrap;
|
||||
import de.espirit.firstspirit.client.plugin.Plugin;
|
||||
|
||||
public class CustomLoader{
|
||||
|
||||
public static HashSet<Plugin> pluginsToLoad = new HashSet<>();
|
||||
|
||||
public static void launchFS(String[] args, Set<Plugin> pluginsToAdd) {
|
||||
pluginsToLoad.addAll(pluginsToAdd);
|
||||
Bootstrap.main(args);
|
||||
}
|
||||
}
|
36
src/com/kallendorf/fshook/PluginLoadAspect.aj
Normal file
36
src/com/kallendorf/fshook/PluginLoadAspect.aj
Normal file
|
@ -0,0 +1,36 @@
|
|||
package com.kallendorf.fshook;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import de.espirit.common.bootstrap.Bootstrap;
|
||||
|
||||
import de.espirit.firstspirit.access.BaseContext;
|
||||
import de.espirit.firstspirit.client.plugin.JavaClientEditorialToolbarItemsPlugin;
|
||||
import de.espirit.firstspirit.client.plugin.Plugins;
|
||||
import de.espirit.firstspirit.io.ServerConnection;
|
||||
import de.espirit.firstspirit.client.plugin.Plugin;
|
||||
|
||||
public aspect PluginLoadAspect {
|
||||
|
||||
pointcut main(): execution(void Bootstrap.main(String[]));
|
||||
|
||||
before(): main(){
|
||||
System.out.println("Hooked It!");
|
||||
}
|
||||
|
||||
Collection around(ServerConnection con, Class cls, BaseContext context):
|
||||
call(* Plugins.getPlugins(ServerConnection, Class, BaseContext))
|
||||
&& args(con,cls,context)
|
||||
{
|
||||
System.out.println("Hooking Plugins: "+cls);
|
||||
Collection col=proceed(con,cls,context);
|
||||
|
||||
for(Plugin p: CustomLoader.pluginsToLoad){
|
||||
if(cls.isInstance(p)) {
|
||||
System.out.println("Loaded "+p);
|
||||
col.add(p);
|
||||
}
|
||||
}
|
||||
return col;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue