aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower-stripped/net/minecraft/server/commands/ListPlayersCommand.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/server/commands/ListPlayersCommand.java.patch')
-rw-r--r--patch-remap/mache-spigotflower-stripped/net/minecraft/server/commands/ListPlayersCommand.java.patch24
1 files changed, 24 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/server/commands/ListPlayersCommand.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/server/commands/ListPlayersCommand.java.patch
new file mode 100644
index 0000000000..da16b8ee43
--- /dev/null
+++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/server/commands/ListPlayersCommand.java.patch
@@ -0,0 +1,24 @@
+--- a/net/minecraft/server/commands/ListPlayersCommand.java
++++ b/net/minecraft/server/commands/ListPlayersCommand.java
+@@ -34,10 +33,17 @@
+ });
+ }
+
+- private static int format(CommandSourceStack commandsourcestack, Function<ServerPlayer, Component> function) {
+- PlayerList playerlist = commandsourcestack.getServer().getPlayerList();
+- List<ServerPlayer> list = playerlist.getPlayers();
+- Component component = ComponentUtils.formatList(list, function);
++ private static int format(CommandSourceStack source, Function<ServerPlayer, Component> nameExtractor) {
++ 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);
+
+ commandsourcestack.sendSuccess(() -> {
+ return Component.translatable("commands.list.players", list.size(), playerlist.getMaxPlayers(), component);