--- a/net/minecraft/server/commands/CommandList.java +++ b/net/minecraft/server/commands/CommandList.java @@ -35,7 +35,14 @@ private static int format(CommandListenerWrapper commandlistenerwrapper, Function function) { PlayerList playerlist = commandlistenerwrapper.getServer().getPlayerList(); - List list = playerlist.getPlayers(); + // CraftBukkit start + List players = playerlist.getPlayers(); + if (commandlistenerwrapper.getBukkitSender() instanceof org.bukkit.entity.Player) { + org.bukkit.entity.Player sender = (org.bukkit.entity.Player) commandlistenerwrapper.getBukkitSender(); + players = players.stream().filter((ep) -> sender.canSee(ep.getBukkitEntity())).collect(java.util.stream.Collectors.toList()); + } + List list = players; + // CraftBukkit end IChatBaseComponent ichatbasecomponent = ChatComponentUtils.formatList(list, function); commandlistenerwrapper.sendSuccess(() -> {