Make getPlayers a little safer. Should probably use a CopyOnWrite collection though.
This commit is contained in:
parent
608eaace1c
commit
d0d0f4ec9f
@ -399,7 +399,7 @@ public class BungeeCord extends ProxyServer
|
|||||||
connectionLock.readLock().lock();
|
connectionLock.readLock().lock();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return (Collection) new HashSet<>( connections.values() );
|
return Collections.unmodifiableCollection( new HashSet( connections.values() ) );
|
||||||
} finally
|
} finally
|
||||||
{
|
{
|
||||||
connectionLock.readLock().unlock();
|
connectionLock.readLock().unlock();
|
||||||
|
@ -10,6 +10,7 @@ import java.net.InetSocketAddress;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
@ -60,7 +61,7 @@ public class BungeeServerInfo implements ServerInfo
|
|||||||
@Override
|
@Override
|
||||||
public Collection<ProxiedPlayer> getPlayers()
|
public Collection<ProxiedPlayer> getPlayers()
|
||||||
{
|
{
|
||||||
return Collections.unmodifiableCollection( players );
|
return Collections.unmodifiableCollection( new HashSet( players ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user