aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/server/commands/ListPlayersCommand.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/server/commands/ListPlayersCommand.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/server/commands/ListPlayersCommand.java.patch28
1 files changed, 28 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/server/commands/ListPlayersCommand.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/server/commands/ListPlayersCommand.java.patch
new file mode 100644
index 0000000000..6bf629b9b6
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/server/commands/ListPlayersCommand.java.patch
@@ -0,0 +1,28 @@
+--- a/net/minecraft/server/commands/ListPlayersCommand.java
++++ b/net/minecraft/server/commands/ListPlayersCommand.java
+@@ -32,10 +34,20 @@
+ }
+
+ private static int format(CommandSourceStack source, Function<ServerPlayer, Component> nameExtractor) {
+- PlayerList playerList = source.getServer().getPlayerList();
+- List<ServerPlayer> players = playerList.getPlayers();
+- Component component = ComponentUtils.formatList(players, nameExtractor);
+- source.sendSuccess(() -> Component.translatable("commands.list.players", players.size(), playerList.getMaxPlayers(), component), false);
+- return players.size();
++ PlayerList playerlist = source.getServer().getPlayerList();
++ // CraftBukkit start
++ List<ServerPlayer> players = playerlist.getPlayers();
++ if (source.getBukkitSender() instanceof org.bukkit.entity.Player) {
++ org.bukkit.entity.Player sender = (org.bukkit.entity.Player) source.getBukkitSender();
++ players = players.stream().filter((ep) -> sender.canSee(ep.getBukkitEntity())).collect(java.util.stream.Collectors.toList());
++ }
++ List<ServerPlayer> list = players;
++ // CraftBukkit end
++ Component ichatbasecomponent = ComponentUtils.formatList(list, nameExtractor);
++
++ source.sendSuccess(() -> {
++ return Component.translatable("commands.list.players", list.size(), playerlist.getMaxPlayers(), ichatbasecomponent);
++ }, false);
++ return list.size();
+ }
+ }