From: David ‘Bombe’ Roden Date: Wed, 11 Dec 2019 17:32:47 +0000 (+0100) Subject: ♻️ Get event bus only once X-Git-Tag: v81^2~5^2~47 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=2fe8f266f44029bf87b6343c115a3ae173809eea;p=Sone.git ♻️ Get event bus only once --- diff --git a/src/main/java/net/pterodactylus/sone/main/SonePlugin.java b/src/main/java/net/pterodactylus/sone/main/SonePlugin.java index a6ade6b..ca32537 100644 --- a/src/main/java/net/pterodactylus/sone/main/SonePlugin.java +++ b/src/main/java/net/pterodactylus/sone/main/SonePlugin.java @@ -209,13 +209,16 @@ public class SonePlugin implements FredPlugin, FredPluginFCP, FredPluginL10n, Fr /* start the web interface! */ webInterface.start(); + /* send some events on startup */ + EventBus eventBus = injector.getInstance(EventBus.class); + /* first start? */ if (injector.getInstance(Key.get(Boolean.class, Names.named("FirstStart")))) { - injector.getInstance(EventBus.class).post(new FirstStart()); + eventBus.post(new FirstStart()); } else { /* new config? */ if (injector.getInstance(Key.get(Boolean.class, Names.named("NewConfig")))) { - injector.getInstance(EventBus.class).post(new ConfigNotRead()); + eventBus.post(new ConfigNotRead()); } } }