Skip to content

Allow for the preventing of non player sources from running luckperms commands#2633

Closed
Moose1301 wants to merge 1 commit into
LuckPerms:masterfrom
Moose1301:master
Closed

Allow for the preventing of non player sources from running luckperms commands#2633
Moose1301 wants to merge 1 commit into
LuckPerms:masterfrom
Moose1301:master

Conversation

@Moose1301
Copy link
Copy Markdown

Adds #2551

Copy link
Copy Markdown
Member

@lucko lucko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I really appreciate the PR.

However, there are lots of codestyle issues, random added/deleted lines in files unaffected by the change, and a concern about behaviour relating to Sender#isValid.

In future, please try to review the "files changed" tab to make sure your changes are correct, and nothing extra has creeped it's way in. I appreciate that we don't have a codestyle guide for contributions, but it should be easy enough to just match the format found in the file being edited!

return;
}

if(this.plugin.getConfiguration().get(ConfigKeys.BLOCK_NON_PLAYER_SOURCES)) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codestyle:

Suggested change
if(this.plugin.getConfiguration().get(ConfigKeys.BLOCK_NON_PLAYER_SOURCES)) {
if (this.plugin.getConfiguration().get(ConfigKeys.BLOCK_NON_PLAYER_SOURCES)) {


#Stops Luckperms Commands from being run from non player sources.
#eg: Stops a mod from running /lp user Example permission set *
block-non-player-sources: false
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again - please match the style found in the rest of the file.

# Stops LuckPerms commands from being.... - space after the #, proper capitalisation.....

Should also be a new-line between the setting and the start of the next comment.

applyConvenienceAliases(arguments, true);

if(this.plugin.getConfiguration().get(ConfigKeys.BLOCK_NON_PLAYER_SOURCES)) {
if(sender.isConsole() || sender.isValid()) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codestyle - should be a space after if.

Also, sender.isValid() will return true in most cases - it returns false if the player has since logged out and their player instance has been GCed.

@Moose1301
Copy link
Copy Markdown
Author

Ok, I fixed the issues you said

@Moose1301 Moose1301 requested a review from lucko October 3, 2020 15:15
@lucko
Copy link
Copy Markdown
Member

lucko commented Oct 16, 2020

There are still a number of codestyle issues which have not been resolved.

In future, please try to review the "files changed" tab to make sure your changes are correct, and nothing extra has creeped it's way in.

I had a go at rebasing your PR and fixing up the issues myself. After having a closer look and think about what's going on here, I'm concerned that we're implementing a "kind of" security measure, which I am not sure can necessarily be trusted. It's possible for mods to run commands as another player, or use a custom command source, which would entirely bypass these checks.

I draw your attention to the discussion / my commands on this issue: #2219

I think on this basis, it would be best to not merge these changes.

Sorry to not be clear from the start, my bad. Thank you for your contribution nonetheless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants