From 9111166484dc15d0570990e753bb10bb0b90d126 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Thu, 20 May 2021 08:31:32 +1000 Subject: [PATCH] Make Vanilla /list respect Vanish API By: md_5 --- .../minecraft/server/commands/CommandList.patch | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 paper-server/nms-patches/net/minecraft/server/commands/CommandList.patch diff --git a/paper-server/nms-patches/net/minecraft/server/commands/CommandList.patch b/paper-server/nms-patches/net/minecraft/server/commands/CommandList.patch new file mode 100644 index 0000000000..e69728edf4 --- /dev/null +++ b/paper-server/nms-patches/net/minecraft/server/commands/CommandList.patch @@ -0,0 +1,15 @@ +--- a/net/minecraft/server/commands/CommandList.java ++++ b/net/minecraft/server/commands/CommandList.java +@@ -36,6 +36,12 @@ + private static int a(CommandListenerWrapper commandlistenerwrapper, Function function) { + PlayerList playerlist = commandlistenerwrapper.getServer().getPlayerList(); + List list = playerlist.getPlayers(); ++ // CraftBukkit start ++ if (commandlistenerwrapper.getBukkitSender() instanceof org.bukkit.entity.Player) { ++ org.bukkit.entity.Player sender = (org.bukkit.entity.Player) commandlistenerwrapper.getBukkitSender(); ++ list = list.stream().filter((ep) -> sender.canSee(ep.getBukkitEntity())).collect(java.util.stream.Collectors.toList()); ++ } ++ // CraftBukkit end + IChatMutableComponent ichatmutablecomponent = ChatComponentUtils.b(list, function); + + commandlistenerwrapper.sendMessage(new ChatMessage("commands.list.players", new Object[]{list.size(), playerlist.getMaxPlayers(), ichatmutablecomponent}), false);