X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fmain%2FSonePlugin.java;h=ef9f05aac575f216948fd64db16c70e7dfbf17c9;hb=1ce940852c7e96a83233bcb706d0f87a1c655c54;hp=4957d30abcf92bc0b111e0473320fe11402e78b9;hpb=85c942c0a3b86afe5a82493e45c449dfd9e53687;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/main/SonePlugin.java b/src/main/java/net/pterodactylus/sone/main/SonePlugin.java index 4957d30..ef9f05a 100644 --- a/src/main/java/net/pterodactylus/sone/main/SonePlugin.java +++ b/src/main/java/net/pterodactylus/sone/main/SonePlugin.java @@ -22,6 +22,8 @@ import static java.util.logging.Logger.*; import java.util.logging.Logger; import java.util.logging.*; +import javax.annotation.Nonnull; + import net.pterodactylus.sone.core.*; import net.pterodactylus.sone.core.event.*; import net.pterodactylus.sone.fcp.*; @@ -60,7 +62,7 @@ public class SonePlugin implements FredPlugin, FredPluginFCP, FredPluginL10n, Fr private final LoadingCache> classCache = CacheBuilder.newBuilder() .build(new CacheLoader>() { @Override - public Class load(String key) throws Exception { + public Class load(@Nonnull String key) throws Exception { return SonePlugin.class.getClassLoader().loadClass(key); } }); @@ -108,6 +110,9 @@ public class SonePlugin implements FredPlugin, FredPluginFCP, FredPluginL10n, Fr /** The core. */ private Core core; + /** The event bus. */ + private EventBus eventBus; + /** The web interface. */ private WebInterface webInterface; @@ -210,7 +215,7 @@ public class SonePlugin implements FredPlugin, FredPluginFCP, FredPluginL10n, Fr webInterface.start(); /* send some events on startup */ - EventBus eventBus = injector.getInstance(EventBus.class); + eventBus = injector.getInstance(EventBus.class); /* first start? */ if (injector.getInstance(Key.get(Boolean.class, Names.named("FirstStart")))) { @@ -245,6 +250,9 @@ public class SonePlugin implements FredPlugin, FredPluginFCP, FredPluginL10n, Fr */ @Override public void terminate() { + /* send shutdown event. */ + eventBus.post(new Shutdown()); + try { /* stop the web interface. */ webInterface.stop();