LuckPerms

LuckPerms

41.4k Downloads

commands do not work when used with default target selector variables (@p, @e, etc)

rjohnson98126 opened this issue ยท 10 comments

commented

ENVIRONMENT: running CraftBukkit version git-Spigot-b6ecf3b-9060bfa (MC: 1.12.2) (Implementing API version 1.12.2-R0.1-SNAPSHOT) and running only one plugin, LuckPerms (v.4.1.63) [EDIT: re-verified behavior on latest LP version]

PROBLEM: when a user or group has been given permission to use commands that normally accept default target selector variables, such as @p @e and so on, these commands will not work when that command is used with a target selector variable. the commands return messages such as "Player '@p' not found" or "Entity '@e' not found".

CAVEATS: the same command WILL work if the command does not use a target selector variable, but instead names the player. Commands with target selector variables continue to work as expected when the user has default minecraft Operator privelege, although this defeats the intent of LuckPerms and so is not a workaround

STEPS TO REPRODUCE.

(1) ensure you do not have minecraft "op" privilege set for your [username]

(2) use luckperms to assign your non-op [username] the "minecraft.command.give" permission, or assign the user to a group that has this permission enabled.

(3) type in the user command window "/give @p dirt". the result will be "Player '@p' not found"

(4) type in the user command window "/give [username] dirt". the result will be to give one block of dirt.

other commands, such as 'kill', 'tell', 'teleport', and any other plugin commands that use target selector variables (@p, @a, @e, @r, @s) all behave in this manner.

commented

lol, i should have checked that first. good point.

however, i did just update it, and verified that it still has the same behavior. I will edit my original issue to show that this occurs on 4.1.63.

thanks!

commented

What makes you think this is a LP error?

I don't see how permission checks would interfere with the process of the command "finding" a player??

commented

Hi. First off, thank you for your plugin, it has exceptional design and documentation, and i wish more plugins were like this one.

to be precise, i didnt say it was an LP "error" and i'm not saying it's LP's fault, i'm just saying it's a "problem" that a number of commands don't work as expected. you can make the case that this isn't LP's problem, because it's more fundamental to vanilla minecraft and therefore LP works as designed, and you're probably right

but... these various commands, which are normally only available in vanilla MC (or from other plugins) to those users with "op" permissions, have as part of their definitions to accept target selector variables. LuckPerms greatly expands the resolution of the vanilla MC (or plugin) op-permission commands, but unfortunately the commands do not retain their ability to accept target selector variables. The target selector variables WILL still work, if the user is in "op" mode, but im sure you'll agree that defeats the entire purpose of LP.

I don't know what else to add, I hope that you are able to fix this even if I agree that the root cause of this issue is deeper than LP's permission management, and is not "caused" by LP. I don't necessarily need to /tell @a, or /give @a, that's pretty trivial... but having the ability to /kill @e[type= ... ] among a few others is fairly common use

if not, i suppose the "workaround" will be for the server owner to open up a console and send the commands via server, and we'll continue to use LP anyhow.

commented

Sorry if I came across as defensive, that wasn't my intention - but I can see my message might've come across that way. I was just trying to get to the point :)

I'm quite tired at the moment so can't really give this issue my full thought - I'll try look into this a bit more / work out a reply sometime tomorrow - if that's okay. ๐Ÿ˜„

commented

Ok I just discovered additional details. The Essentials plugin also doesnt handle target selector variables, but even worse: their versions of minecraft commands (renamed in essentials.*) don't allow target selector variables at all, even with "op" permission... completely independent of LuckPerms.

I'm starting to suspect that these target selector variables are peculiar within vanilla minecraft, and may be unusable in multiple plugins. So even if you did fix it in LP, it might not even matter if they dont work in other plugins anyhow.

I probably have to let this go :) but i'm interested if you have any insight.

commented

You should try update your luckperms to the lastest version. Issue could be already fixed.

commented

Yes, you're right, the Essentials commands don't support selectors.

In fact, in general, Bukkit plugin commands will not support selectors, as this isn't exposed in the Bukkit API.

Perhaps that's the problem you're encountering? If the Vanilla commands aren't working with selectors, then this sounds like a Spigot/CraftBukkit bug. You could try reproducing it without any plugins on the server?

It's definitely unrelated to LuckPerms. :)

commented

I'd imagine broken selectors is definitely in scope as a CraftBukkit bug, if that ends up being the case.

commented

thanks for the response, i'll look into it and follow up with Spigot/CraftBukkit when i have time to be told "we're not going to fix that" :-)

commented

i meant to write back on this a long time ago, but forgot. now, since im here, i'll post for anyone who might have this same problem:

Youre right, this has nothing to do with LP. i was falsely suspecting LP only becasue i ceased using OP and started using permissions. The problem is that the basic minecraft:commands were superseded by Essentials that used the same alias.

if I use /minecraft:give or /minecraft:kill, then the behavior is defined by the minecraft:command and target selectors are recognized.

the TLDR version is PEBCAK :D