diff --git a/paper-server/patches/features/0009-Fix-entity-type-tags-suggestions-in-selectors.patch b/paper-server/patches/features/0009-Fix-entity-type-tags-suggestions-in-selectors.patch index b587b90ed..2d6d532ce 100644 --- a/paper-server/patches/features/0009-Fix-entity-type-tags-suggestions-in-selectors.patch +++ b/paper-server/patches/features/0009-Fix-entity-type-tags-suggestions-in-selectors.patch @@ -60,7 +60,7 @@ index fa8c5ba4e0efd0c36613aaa8eaafba0cb70ceb87..19ccf3abf14c67f72a1ca065e4a304f5 } diff --git a/net/minecraft/commands/arguments/EntityArgument.java b/net/minecraft/commands/arguments/EntityArgument.java -index 0a01df6ebd14afe79bc76364cb1df5e0c5c08074..7a06ad9940d25e163178370bfa9ccc3bbd3d1189 100644 +index 0a01df6ebd14afe79bc76364cb1df5e0c5c08074..77a68052c7653aee54c60f4bded9fa5337e3e4db 100644 --- a/net/minecraft/commands/arguments/EntityArgument.java +++ b/net/minecraft/commands/arguments/EntityArgument.java @@ -138,7 +138,7 @@ public class EntityArgument implements ArgumentType { @@ -72,27 +72,6 @@ index 0a01df6ebd14afe79bc76364cb1df5e0c5c08074..7a06ad9940d25e163178370bfa9ccc3b // Paper end - Fix EntityArgument permissions try { -@@ -149,7 +149,19 @@ public class EntityArgument implements ArgumentType { - return entitySelectorParser.fillSuggestions( - builder, - offsetBuilder -> { -- Collection onlinePlayerNames = sharedSuggestionProvider.getOnlinePlayerNames(); -+ // Paper start - tell clients to ask server for suggestions for EntityArguments -+ final Collection onlinePlayerNames; -+ if (sharedSuggestionProvider instanceof CommandSourceStack commandSourceStack && commandSourceStack.getEntity() instanceof ServerPlayer sourcePlayer) { -+ onlinePlayerNames = new java.util.ArrayList<>(); -+ for (final ServerPlayer player : commandSourceStack.getServer().getPlayerList().getPlayers()) { -+ if (sourcePlayer.getBukkitEntity().canSee(player.getBukkitEntity())) { -+ onlinePlayerNames.add(player.getGameProfile().getName()); -+ } -+ } -+ } else { -+ onlinePlayerNames = sharedSuggestionProvider.getOnlinePlayerNames(); -+ } -+ // Paper end - tell clients to ask server for suggestions for EntityArguments - Iterable iterable = (Iterable)(this.playersOnly - ? onlinePlayerNames - : Iterables.concat(onlinePlayerNames, sharedSuggestionProvider.getSelectedEntities())); diff --git a/net/minecraft/commands/arguments/selector/EntitySelectorParser.java b/net/minecraft/commands/arguments/selector/EntitySelectorParser.java index a6f232747df631f6afe440606bea94c588f1a0dd..fb42630741674c6cbd20b7d45d78dea1dc73a78f 100644 --- a/net/minecraft/commands/arguments/selector/EntitySelectorParser.java diff --git a/paper-server/patches/sources/net/minecraft/commands/CommandSourceStack.java.patch b/paper-server/patches/sources/net/minecraft/commands/CommandSourceStack.java.patch index bac6f4b64..488821280 100644 --- a/paper-server/patches/sources/net/minecraft/commands/CommandSourceStack.java.patch +++ b/paper-server/patches/sources/net/minecraft/commands/CommandSourceStack.java.patch @@ -123,6 +123,15 @@ } } +@@ -523,7 +_,7 @@ + + @Override + public Collection getOnlinePlayerNames() { +- return Lists.newArrayList(this.server.getPlayerNames()); ++ return this.entity instanceof ServerPlayer sourcePlayer && !sourcePlayer.getBukkitEntity().hasPermission("paper.bypass-visibility.tab-completion") ? this.getServer().getPlayerList().getPlayers().stream().filter(serverPlayer -> sourcePlayer.getBukkitEntity().canSee(serverPlayer.getBukkitEntity())).map(serverPlayer -> serverPlayer.getGameProfile().getName()).toList() : Lists.newArrayList(this.server.getPlayerNames()); // Paper - Make CommandSourceStack respect hidden players + } + + @Override @@ -598,4 +_,16 @@ public boolean isSilent() { return this.silent;