LuckPerms

LuckPerms

41.4k Downloads

Sponge: Custom registered contexts don't change game behavior

whimxiqal opened this issue ยท 7 comments

commented

Description

I want to set up a disallowed permission on a context. I this style command:

/lp user PietElite permission set my.command false my=context

I can see my context my=context listed in the context list with:

/lp user PietElite info

I can see that my context is working correctly (showing false) by running

/lp check PietElite my.command my=context

However, when I turn on /lp verbose and I perform the action that should be denied, it still works and the verbose logging says that the permission is true for me. It seems that the permission is correctly identified by Sponge but something during the actual application of the permission through the Sponge PermissionService loses the context information.

Reproduction steps

  1. Install a plugin that implements its own contexts and permissions
  2. Set a permission (that is default true) to false on the custom context.
  3. Do what you need to do to make that context apply (depends on the plugin. For mine, it was a specific region)
  4. Run /lp check <username> <permission> <context> and observe that the permission is correctly false on that context
  5. Perform the action that should be denied with verbose logging on and observe that the permission is somehow still true.

Expected behaviour

  1. Try to perform the action and observe it is denied because the permission is set to false

Environment details

  • Server type/version: SpongeVanilla running version 1.12.2-7.3.0 stable build
  • LuckPerms version: LuckPerms-Sponge-5.3.21

Any other relevant details

Result of:

  • /lp user PietElite permission set worldedit.navigation.jumpto.command nope.host.spawn=true (not shown)
  • /lp info
  • /lp user PietElite info
  • /lp user PietElite permission check worldedit.navigation.jumpto.command
    https://imgur.com/1aJFGRY

Result of:

(I have never left spawn, so the context nope.host.spawn=true is always applied)

commented

You are in a bit of an old version, I suggest you:

  • First try updating see if that fixes the issue (https://luckperms.net/download)
  • If it doesn't, share screenshots of /lp info, /lp user <user> info, /lp user <user> permission check <permission> and a /lp verbose upload URL too.
commented

You are in a bit of an old version, I suggest you:

  • First try updating see if that fixes the issue (https://luckperms.net/download)
  • If it doesn't, share screenshots of /lp info, /lp user <user> info, /lp user <user> permission check <permission> and a /lp verbose upload URL too.

I've updated the issue with those notes

commented

Hm looks like registered/non-stock contexts are not being considered in the real permission calculation.. at all? That's what verbose suggests compared against the permission check command result.

I vaguely remember noticing this before so it's not new either, thanks for all the info!

commented

Really sorry, I've only just had a chance to look at this.

Unfortunately the verbose upload has now expired, would you be able to generate it again for me?

commented

Ah I see the problem.

In your context calculator, you need to first call subject.getCommandSource() then check to see if the result of that is instanceof Player.

commented

Yes, this works. Thank you Lucko.

commented

Sure! I've also updated it in the issue. It doesn't show much -- just that all permissions are granted with or without explicit denial in the given context (/lp user PietElite info shows that I consistently have the context nope.host.spawn=true)

LP Verbose

Also, if you're interested, these are the files that I use to implement the custom contexts: