X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2FSone.java;h=f83ab821fc238013f4400af3e7903bccf14d1b36;hb=68e6a4ba77a6f9fcea28ad73e12cf78817c5f42c;hp=a387545a6b305dc39b8e8a4b63065b3be4c1e2e7;hpb=874506cede6f3cba7fc99da420fc1d79e2433358;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/data/Sone.java b/src/main/java/net/pterodactylus/sone/data/Sone.java index a387545..f83ab82 100644 --- a/src/main/java/net/pterodactylus/sone/data/Sone.java +++ b/src/main/java/net/pterodactylus/sone/data/Sone.java @@ -72,6 +72,9 @@ public class Sone { /** All replies. */ private final Set replies = new HashSet(); + /** The IDs of all blocked Sones. */ + private final Set blockedSoneIds = new HashSet(); + /** Modification count. */ private volatile long modificationCounter = 0; @@ -377,6 +380,48 @@ public class Sone { } /** + * Returns the IDs of all blocked Sones. These Sones will not propagated + * using the “known Sones” mechanism. + * + * @return The IDs of all blocked Sones + */ + public Set getBlockedSoneIds() { + return Collections.unmodifiableSet(blockedSoneIds); + } + + /** + * Returns whether the given Sone ID is blocked. + * + * @param soneId + * The Sone ID to check + * @return {@code true} if the given Sone ID is blocked, {@code false} + * otherwise + */ + public boolean isSoneBlocked(String soneId) { + return blockedSoneIds.contains(soneId); + } + + /** + * Adds the given ID to the list of blocked IDs. + * + * @param soneId + * The Sone ID to block + */ + public void addBlockedSoneId(String soneId) { + blockedSoneIds.add(soneId); + } + + /** + * Removes the given ID from the list of blocked IDs. + * + * @param soneId + * The Sone ID to unblock + */ + public void removeBlockedSoneIds(String soneId) { + blockedSoneIds.remove(soneId); + } + + /** * Returns the modification counter. * * @return The modification counter