Convert “Sone is being inserted” into EventBus-based event.
[Sone.git] / src / main / java / net / pterodactylus / sone / web / WebInterface.java
index 9e5e0eb..886383c 100644 (file)
@@ -45,8 +45,10 @@ import net.pterodactylus.sone.core.event.NewPostReplyFoundEvent;
 import net.pterodactylus.sone.core.event.NewSoneFoundEvent;
 import net.pterodactylus.sone.core.event.PostRemovedEvent;
 import net.pterodactylus.sone.core.event.PostReplyRemovedEvent;
+import net.pterodactylus.sone.core.event.SoneInsertingEvent;
 import net.pterodactylus.sone.core.event.SoneLockedEvent;
 import net.pterodactylus.sone.core.event.SoneRemovedEvent;
+import net.pterodactylus.sone.core.event.SoneUnlockedEvent;
 import net.pterodactylus.sone.data.Album;
 import net.pterodactylus.sone.data.Image;
 import net.pterodactylus.sone.data.Post;
@@ -959,31 +961,37 @@ public class WebInterface implements CoreListener {
                lockedSonesTickerObjects.put(sone, tickerObject);
        }
 
-       //
-       // CORELISTENER METHODS
-       //
-
        /**
-        * {@inheritDoc}
+        * Notifies the web interface that a Sone was unlocked.
+        *
+        * @param soneUnlockedEvent
+        *            The event
         */
-       @Override
-       public void soneUnlocked(Sone sone) {
-               lockedSonesNotification.remove(sone);
-               Ticker.getInstance().deregisterEvent(lockedSonesTickerObjects.remove(sone));
+       @Subscribe
+       public void soneUnlocked(SoneUnlockedEvent soneUnlockedEvent) {
+               lockedSonesNotification.remove(soneUnlockedEvent.sone());
+               Ticker.getInstance().deregisterEvent(lockedSonesTickerObjects.remove(soneUnlockedEvent.sone()));
        }
 
        /**
-        * {@inheritDoc}
+        * Notifies the web interface that a {@link Sone} is being inserted.
+        *
+        * @param soneInsertingEvent
+        *            The event
         */
-       @Override
-       public void soneInserting(Sone sone) {
-               TemplateNotification soneInsertNotification = getSoneInsertNotification(sone);
+       @Subscribe
+       public void soneInserting(SoneInsertingEvent soneInsertingEvent) {
+               TemplateNotification soneInsertNotification = getSoneInsertNotification(soneInsertingEvent.sone());
                soneInsertNotification.set("soneStatus", "inserting");
-               if (sone.getOptions().getBooleanOption("EnableSoneInsertNotifications").get()) {
+               if (soneInsertingEvent.sone().getOptions().getBooleanOption("EnableSoneInsertNotifications").get()) {
                        notificationManager.addNotification(soneInsertNotification);
                }
        }
 
+       //
+       // CORELISTENER METHODS
+       //
+
        /**
         * {@inheritDoc}
         */