Use ConcurrentHashSet

This commit is contained in:
4drian3d 2021-11-30 11:58:22 -05:00
parent 2303f9b709
commit 2e8d8e1c3b
2 changed files with 7 additions and 5 deletions

View File

@ -4,6 +4,7 @@ import com.glyart.authmevelocity.proxy.config.AuthMeConfig;
import com.glyart.authmevelocity.proxy.listener.FastLoginListener;
import com.glyart.authmevelocity.proxy.listener.PluginMessageListener;
import com.glyart.authmevelocity.proxy.listener.ProxyListener;
import com.google.common.collect.Sets;
import com.google.inject.Inject;
import com.velocitypowered.api.event.Subscribe;
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
@ -15,8 +16,6 @@ import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import java.nio.file.Path;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
@ -26,7 +25,7 @@ public class AuthMeVelocityPlugin {
private final Path pluginDirectory;
private static AuthMeVelocityPlugin plugin;
protected static final Set<UUID> loggedPlayers = Collections.synchronizedSet(new HashSet<UUID>());
protected static final Set<UUID> loggedPlayers = Sets.newConcurrentHashSet();
@Inject
public AuthMeVelocityPlugin(ProxyServer proxy, Logger logger, @DataDirectory Path dataDirectory) {
@ -45,8 +44,10 @@ public class AuthMeVelocityPlugin {
MinecraftChannelIdentifier.create("authmevelocity", "main"));
proxy.getEventManager().register(this, new ProxyListener(config));
proxy.getEventManager().register(this, new PluginMessageListener(proxy, logger, config));
proxy.getPluginManager().getPlugin("fastlogin").ifPresent(fastlogin ->
proxy.getEventManager().register(this, new FastLoginListener(proxy)));
if(proxy.getPluginManager().isLoaded("fastlogin")){
proxy.getEventManager().register(this, new FastLoginListener(proxy));
}
logger.info("-- AuthMeVelocity enabled --");
logger.info("AuthServers: {}", config.getAuthServers());

View File

@ -14,4 +14,5 @@ public class ConfigUtils {
blockedMessage));
}
}
private ConfigUtils(){}
}