Fix issue #251 - hidden servers in list command
This commit is contained in:
parent
5592f81e97
commit
0c144c38db
@ -9,6 +9,7 @@ import lombok.AllArgsConstructor;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.Synchronized;
|
import lombok.Synchronized;
|
||||||
import net.md_5.bungee.api.Callback;
|
import net.md_5.bungee.api.Callback;
|
||||||
|
import net.md_5.bungee.api.CommandSender;
|
||||||
import net.md_5.bungee.api.ServerPing;
|
import net.md_5.bungee.api.ServerPing;
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||||
|
|
||||||
@ -92,7 +93,7 @@ public abstract class ServerInfo
|
|||||||
* @param player the player to check access for
|
* @param player the player to check access for
|
||||||
* @return whether access is granted to this server
|
* @return whether access is granted to this server
|
||||||
*/
|
*/
|
||||||
public boolean canAccess(ProxiedPlayer player)
|
public boolean canAccess(CommandSender player)
|
||||||
{
|
{
|
||||||
return !restricted || player.hasPermission( "bungeecord.server." + name );
|
return !restricted || player.hasPermission( "bungeecord.server." + name );
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,11 @@ public class CommandList extends Command
|
|||||||
{
|
{
|
||||||
for ( ServerInfo server : ProxyServer.getInstance().getServers().values() )
|
for ( ServerInfo server : ProxyServer.getInstance().getServers().values() )
|
||||||
{
|
{
|
||||||
|
if ( !server.canAccess( sender ) )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Collection<ProxiedPlayer> serverPlayers = server.getPlayers();
|
Collection<ProxiedPlayer> serverPlayers = server.getPlayers();
|
||||||
|
|
||||||
StringBuilder message = new StringBuilder();
|
StringBuilder message = new StringBuilder();
|
||||||
|
Loading…
Reference in New Issue
Block a user