-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Added default permission "console" #6501
Conversation
…s only console to run that specific command.
|
||
public const DEFAULT_CONSOLE = "console"; | ||
|
||
public const DEFAULT_NOT_CONSOLE = "notconsole"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't bother with this. You haven't implemented support for it and no one will use it. (Trust me, no one understands what notop
is supposed to be used for either.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "notconsole" may be useful for commands that are not supported to run in cli mode. For example, a command that opens a form for the sender
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inverted permissions aren't well-defined.
I also don't think denying permission is the right way to address that, since it'll give confusing messages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'd also still end up needing to check instanceof of command sender within the execute() anyway to ensure that you're not letting in other types of command senders, or console senders which have had this permission overridden to true.
@@ -41,13 +45,17 @@ class PermissionParser{ | |||
"isoperator" => self::DEFAULT_OP, | |||
"admin" => self::DEFAULT_OP, | |||
"isadmin" => self::DEFAULT_OP, | |||
"console" => self::DEFAULT_CONSOLE, | |||
"isconsole" => self::DEFAULT_CONSOLE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't add stuff that doesn't exist.
I don't see the real purpose of the PR apart from adding an extra permission that may never be used and that won't solve the problem of having to check the CommandSender instance. |
It's actually used internally already for |
Added a new default permissions value
console
to make sensitive commands restricted to console only.Related to this #6499
Related issues & PRs
Fixes #6499
Changes
Behavioural changes
Any command with
default: console
permission added in itsplugin.yml
will only work and show in console.