# Getting Started

## Dependencies
- FirstSpirit installation
- OpenJDK11 (On Windows this gets installed together with FS `C:/Users/<User>/.firstspirit/FSLauncher/jre/11.0.11/jre-win/jdk-11.0.11+9-jre/bin/java.exe`)
- AspectJ https://www.eclipse.org/aspectj/ (already included)
- copy `.firstspirit/FSLauncher/jar/*`, `.firstspirit_<version>/jars/*` (usually located in $HOME) of the FS installation into `lib/`
- Fix some FirstSpirit crap: open `.firstspirit/FSLauncher/jar/fs-isolated-client-<version>.jar` and replace `de/javasoft\plaf\synthetica\SyntheticaIcon.class` with `META-INF\versions\9\de\javasoft\plaf\synthetica\SyntheticaIcon.class`

## Paths
- `<java>` point to your (or FSs) OpenJDK11 installation
- `<aspectjweaver.jar>` can be found in `FSHook/tool` 
- `<classpath>` points to `lib/*` and `tool/*`
 - The seperator is `:` on Linux and `;` on Windows.

## Building
``` java -cp <classpath> org.aspectj.tools.ajc.Main -sourceroots 'src/' -injars lib/fs-isolated-client-*.jar -outjar bin/uploadPlugin.jar -outxml -9 -Xlintfile .vscode/ajc.properties", ```
(Should give a few warnings but no errors)

## What the hell?
AspectJ is a bytecode manipulation framework. In our case the method `Plugins.getPlugins(ServerConnection, Class, BaseContext)` from `de.espirit.firstspirit.client.plugin.Plugins` gets overriden to load the plugins registered in `com.kallendorf.fshook.CustomLoader.pluginsToLoad` in addition to the default ones.
This allows th execution of arbitrary code within the FirstSprit client.