X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FPreferences.java;h=bd3c056013dab2caefc651b4205ce084176d0d85;hp=456e7f2fae994b6c0ad06fadb4117f3dad4a760f;hb=2bacfa78f3191fd9847574a6c8b218a4882844a4;hpb=3d6cffe82270a1faacf1f0d39c34b11ab316e0db
diff --git a/src/main/java/net/pterodactylus/sone/core/Preferences.java b/src/main/java/net/pterodactylus/sone/core/Preferences.java
index 456e7f2..bd3c056 100644
--- a/src/main/java/net/pterodactylus/sone/core/Preferences.java
+++ b/src/main/java/net/pterodactylus/sone/core/Preferences.java
@@ -39,35 +39,33 @@ import com.google.common.eventbus.EventBus;
/**
* Convenience interface for external classes that want to access the coreâs
* configuration.
- *
- * @author David âBombeâ Roden
*/
public class Preferences {
private final EventBus eventBus;
private final Option insertionDelay =
- new DefaultOption(60, range(0, MAX_VALUE));
+ new DefaultOption<>(60, range(0, MAX_VALUE));
private final Option postsPerPage =
- new DefaultOption(10, range(1, MAX_VALUE));
+ new DefaultOption<>(10, range(1, MAX_VALUE));
private final Option imagesPerPage =
- new DefaultOption(9, range(1, MAX_VALUE));
+ new DefaultOption<>(9, range(1, MAX_VALUE));
private final Option charactersPerPost =
- new DefaultOption(400, Predicates.or(
+ new DefaultOption<>(400, Predicates.or(
range(50, MAX_VALUE), equalTo(-1)));
private final Option postCutOffLength =
- new DefaultOption(200, range(50, MAX_VALUE));
+ new DefaultOption<>(200, range(50, MAX_VALUE));
private final Option requireFullAccess =
- new DefaultOption(false);
+ new DefaultOption<>(false);
private final Option positiveTrust =
- new DefaultOption(75, range(0, 100));
+ new DefaultOption<>(75, range(0, 100));
private final Option negativeTrust =
- new DefaultOption(-25, range(-100, 100));
+ new DefaultOption<>(-25, range(-100, 100));
private final Option trustComment =
- new DefaultOption("Set from Sone Web Interface");
+ new DefaultOption<>("Set from Sone Web Interface");
private final Option activateFcpInterface =
- new DefaultOption(false);
+ new DefaultOption<>(false);
private final Option fcpFullAccessRequired =
- new DefaultOption(ALWAYS);
+ new DefaultOption<>(ALWAYS);
public Preferences(EventBus eventBus) {
this.eventBus = eventBus;
@@ -105,6 +103,7 @@ public class Preferences {
public Preferences setInsertionDelay(Integer insertionDelay) {
this.insertionDelay.set(insertionDelay);
eventBus.post(new InsertionDelayChangedEvent(getInsertionDelay()));
+ eventBus.post(new PreferenceChangedEvent("InsertionDelay", getInsertionDelay()));
return this;
}
@@ -138,6 +137,7 @@ public class Preferences {
*/
public Preferences setPostsPerPage(Integer postsPerPage) {
this.postsPerPage.set(postsPerPage);
+ eventBus.post(new PreferenceChangedEvent("PostsPerPage", getPostsPerPage()));
return this;
}