diff --git a/javacord-core/src/main/java/org/javacord/core/entity/channel/ServerThreadChannelImpl.java b/javacord-core/src/main/java/org/javacord/core/entity/channel/ServerThreadChannelImpl.java index 7752b99c8..37efe6dc7 100644 --- a/javacord-core/src/main/java/org/javacord/core/entity/channel/ServerThreadChannelImpl.java +++ b/javacord-core/src/main/java/org/javacord/core/entity/channel/ServerThreadChannelImpl.java @@ -20,6 +20,7 @@ import java.util.HashSet; import java.util.Set; import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ConcurrentHashMap; /** * The implementation of {@link ServerThreadChannel}. @@ -94,7 +95,7 @@ public ServerThreadChannelImpl(final DiscordApiImpl api, final ServerImpl server lastMessageId = data.hasNonNull("last_message_id") ? data.get("last_message_id").asLong() : 0; rateLimitPerUser = data.get("rate_limit_per_user").asInt(0); - members = new HashSet<>(); + members = ConcurrentHashMap.newKeySet(); if (data.hasNonNull("member")) { // If userId is not included, that means this came from a GUILD_CREATE event // This means the userId is the bot's and the thread id is from this thread diff --git a/javacord-core/src/main/java/org/javacord/core/entity/channel/ServerVoiceChannelImpl.java b/javacord-core/src/main/java/org/javacord/core/entity/channel/ServerVoiceChannelImpl.java index 4cb3788e8..ccf46fa8a 100644 --- a/javacord-core/src/main/java/org/javacord/core/entity/channel/ServerVoiceChannelImpl.java +++ b/javacord-core/src/main/java/org/javacord/core/entity/channel/ServerVoiceChannelImpl.java @@ -11,11 +11,11 @@ import org.javacord.core.listener.channel.server.voice.InternalServerVoiceChannelAttachableListenerManager; import java.util.Collections; -import java.util.HashSet; import java.util.Objects; import java.util.Optional; import java.util.Set; import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; /** @@ -37,7 +37,7 @@ public class ServerVoiceChannelImpl extends TextableRegularServerChannelImpl /** * The ids of the connected users of this server voice channel. */ - private final Set connectedUsers = new HashSet<>(); + private final Set connectedUsers = ConcurrentHashMap.newKeySet(); /** * Creates a new server voice channel object.