Fire events when locking and unlocking Sones.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 13 Dec 2010 19:17:13 +0000 (20:17 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 13 Dec 2010 19:17:13 +0000 (20:17 +0100)
src/main/java/net/pterodactylus/sone/core/Core.java

index 9eba2b7..2ef2d57 100644 (file)
@@ -710,7 +710,9 @@ public class Core implements IdentityListener {
         */
        public void lockSone(Sone sone) {
                synchronized (lockedSones) {
-                       lockedSones.add(sone);
+                       if (lockedSones.add(sone)) {
+                               coreListenerManager.fireSoneLocked(sone);
+                       }
                }
        }
 
@@ -723,7 +725,9 @@ public class Core implements IdentityListener {
         */
        public void unlockSone(Sone sone) {
                synchronized (lockedSones) {
-                       lockedSones.remove(sone);
+                       if (lockedSones.remove(sone)) {
+                               coreListenerManager.fireSoneUnlocked(sone);
+                       }
                }
        }