X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FPreferences.java;h=c413f891f764c6b5c0605c590789ab9ca39d93f1;hb=61e6c72dbbc5b698ce3a5e6d6c474356a5c0c9f6;hp=16d945363afc08eccc4ea1168a2a5159dd082bf8;hpb=2402f55b1ae1000a4decbd2833883bebb91952f8;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/core/Preferences.java b/src/main/java/net/pterodactylus/sone/core/Preferences.java index 16d9453..c413f89 100644 --- a/src/main/java/net/pterodactylus/sone/core/Preferences.java +++ b/src/main/java/net/pterodactylus/sone/core/Preferences.java @@ -17,9 +17,12 @@ package net.pterodactylus.sone.core; +import net.pterodactylus.sone.core.event.InsertionDelayChangedEvent; import net.pterodactylus.sone.fcp.FcpInterface; import net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired; +import com.google.common.eventbus.EventBus; + /** * Convenience interface for external classes that want to access the core’s * configuration. @@ -28,16 +31,11 @@ import net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired; */ public class Preferences { - /** The wrapped options. */ + private final EventBus eventBus; private final Options options; - /** - * Creates a new preferences object wrapped around the given options. - * - * @param options - * The options to wrap - */ - public Preferences(Options options) { + public Preferences(EventBus eventBus, Options options) { + this.eventBus = eventBus; this.options = options; } @@ -72,6 +70,7 @@ public class Preferences { */ public Preferences setInsertionDelay(Integer insertionDelay) { options.getIntegerOption("InsertionDelay").set(insertionDelay); + eventBus.post(new InsertionDelayChangedEvent(getInsertionDelay())); return this; }