Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make CommandSourceStack respect hidden players #11556

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

notTamion
Copy link
Contributor

fixes #11545

@notTamion notTamion requested a review from a team as a code owner November 1, 2024 17:18
@lynxplay
Copy link
Contributor

lynxplay commented Nov 1, 2024

We have this diff already

+ // Paper start - tell clients to ask server for suggestions for EntityArguments
+ final Collection<String> collection;
+ if (icompletionprovider instanceof CommandSourceStack commandSourceStack && commandSourceStack.getEntity() instanceof ServerPlayer sourcePlayer) {
+ collection = new java.util.ArrayList<>();
+ for (final ServerPlayer player : commandSourceStack.getServer().getPlayerList().getPlayers()) {
+ if (sourcePlayer.getBukkitEntity().canSee(player.getBukkitEntity())) {
+ collection.add(player.getGameProfile().getName());
+ }
+ }
+ } else {
+ collection = icompletionprovider.getOnlinePlayerNames();
+ }
+ // Paper end - tell clients to ask server for suggestions for EntityArguments

Either we remove this or duplicate it.
Idk what else calls this method and if that is of interest to maybe not solve as deep.

@notTamion
Copy link
Contributor Author

its only called by argument types so i think fixing this that deep is the correct solution.
image

@lynxplay
Copy link
Contributor

lynxplay commented Nov 1, 2024

Okay, thanks for the quick check 👍

@lynxplay
Copy link
Contributor

While this works, we should probably at least discuss if we want certain commands to obey this visibility.
Banning and deop both sounds like commands where I'd never like this command to not show me the members?

@notTamion
Copy link
Contributor Author

Perhaps we can add an exclusion for operators?

@Leguan16
Copy link
Contributor

I think excluding operators makes sense.

@notTamion
Copy link
Contributor Author

just an idea, if anyone has a solution they find better please leave a comment

@Machine-Maker
Copy link
Member

I don't like making more functionality dependant on ops. The concept of "op" is not a good thing to really encourage more. People should be using proper permissions. I thought about maybe a new permission that could be granted to bypass all visibility hiding, but I'm not sure about that either.

@Leguan16
Copy link
Contributor

I don't know. The paper command for example also works for ops and mixing op and permission requirements sucks.

@notTamion
Copy link
Contributor Author

i agree with machine, considering servers will most likely not give staff operator but instead give them the permissions they need i think it would be smarter to add a permission for this. i don't think comparing this to the paper command is fair as the paper command is more of a debug command rather than something a staff member would actually have to use frequently

@Machine-Maker
Copy link
Member

Ok, I think we want a permission, but just for command suggestions, paper.bypass-visibility.tab-completion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Awaiting final testing
Development

Successfully merging this pull request may close these issues.

Players aren't hidden in the /team command
5 participants