/help showing commands that players do not have permission for (Brigadier) #11891
Labels
status: accepted
Disputed bug is accepted as valid or Feature accepted as desired to be added.
version: 1.21.4
Expected behavior
When declaring a requirement (mainly a permission requirement) using an
ArgumentBuilder
from Brigadier using.requires(source -> source.getSender().hasPermission("plugin.permission"))
, it is expected that such a command, as it is not visible to the client, showing the red text saying that this command does not exist, should also not be visible using /help.Observed/Actual behavior
Instead, when running /help, anybody can still see the command. This isn't necessarily a big problem, but it feels like unintended behavior.
Steps/models to reproduce
Defining a command like this:
We can view in-game, if not opped, that we do not have access to
/testcmd
, yet running/help testcmd
runs fine, printing the expected help block.Plugin and Datapack List
Paper version
Latest, up-to-date (dev) version, as I am currently running the actual Paper project using
./gradlew runDevServer
. This behavior also occurs on production builds.Other
If I understood it correctly, the current logic goes through the
HelpMap
. There are three possible ways I can see this fixed:HelpMap
is modified in order to account for requirements on command nodesCommands#register
, we append new overloads for a permission value, which acts like a second "requirement", which is also tracked by theHelpMap
in order to not show commands the user has no access to. This does not account for nodes with permission inside a command tree.ArgumentBuilder
gets appended with a.withPermission(String)
method, which acts not only as a second requirement predicate, but also a value that theHelpMap
can use.The text was updated successfully, but these errors were encountered: