From a6601fb1de49f42c26eccb9dff5c07a17feceafc Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 14 Nov 2010 17:10:36 +0100 Subject: [PATCH] =?utf8?q?Fire=20a=20=E2=80=9Cnew=20Sone=20found=E2=80=9D?= =?utf8?q?=20event=20when=20a=20new=20Sone=20is=20found.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/main/java/net/pterodactylus/sone/core/Core.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 2f69bee..2894945 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -679,7 +679,13 @@ public class Core implements IdentityListener { sone.setLatestEdition(Numbers.safeParseLong(identity.getProperty("Sone.LatestEdition"), (long) 0)); if (newSone) { synchronized (newSones) { - newSones.add(sone.getId()); + newSone = !knownSones.contains(sone.getId()); + if (newSone) { + newSones.add(sone.getId()); + } + } + if (newSone) { + coreListenerManager.fireNewSoneFound(sone); } } remoteSones.put(identity.getId(), sone); -- 2.7.4