From 2fe8f266f44029bf87b6343c115a3ae173809eea Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 11 Dec 2019 18:32:47 +0100 Subject: [PATCH] =?utf8?q?=E2=99=BB=EF=B8=8F=20Get=20event=20bus=20only=20?= =?utf8?q?once?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/main/java/net/pterodactylus/sone/main/SonePlugin.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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()); } } } -- 2.7.4