LuckPerms

LuckPerms

41.4k Downloads

LP returning undefined when using extra contexts

bloodmc opened this issue ยท 4 comments

commented

Using LP 4.2.20

I'm testing the following permission

    {
      "context": {
        "gp_claim": "cbb95907-9fa7-4adc-96c0-ed4b45e0edef",
        "item_used": "minecraft:wool.5"
      },
      "data": {
        "griefprevention.flag.block-break.minecraft.grass": true
      }
    }
  1. First GP checks the user subject's permission by calling the following method
Tristate value = user.getPermissionValue(contexts, permission);

The contexts passed are the following

contexts = [world=world, localport=25565, remoteip=192.168.1.14, used_item=minecraft:wool.5, localhost=192.168.1.14, gp_claim=cbb95907-9fa7-4adc-96c0-ed4b45e0edef, Source=minecraft:player, localip=192.168.1.14, dimension=minecraft.overworld]

The permission checked was griefprevention.flag.block-break.minecraft.grass.0

This ends up returning a result of UNDEFINED

  1. The second GP check is against the default user by calling
Tristate value = GriefPreventionPlugin.GLOBAL_SUBJECT.getPermissionValue(contexts, permission);

The contexts passed are the following

contexts [used_item=minecraft:wool.5, gp_claim=cbb95907-9fa7-4adc-96c0-ed4b45e0edef, Source=minecraft:player]

The permission checked was griefprevention.flag.block-break.minecraft.grass.0

This also returns a result of UNDEFINED.

Is there any reason why LP is not finding a match?

I assume that whatever contexts would only match if a permission contains all of them. So if I pass contexts A/B/C and have a permission with A/B/C/D then this would match but it would not match A/B. If this is so then I understand =) Just want to make sure.

UPDATE

Just tested another

  1. I did another check against default user by calling the following
Tristate value = GriefPreventionPlugin.GLOBAL_SUBJECT.getPermissionValue(contexts, permission);

The contexts passed this time were exactly what I had in LP

contexts [used_item=minecraft:wool.5, gp_claim=cbb95907-9fa7-4adc-96c0-ed4b45e0edef]

The permission checked was griefprevention.flag.block-break.minecraft.grass.0

The result is still UNDEFINED so I'm at a loss here.

commented
GriefPreventionPlugin.GLOBAL_SUBJECT.getSubjectData().getPermissions(contexts);

Passing contexts

contexts [used_item=minecraft:wool.5, gp_claim=cbb95907-9fa7-4adc-96c0-ed4b45e0edef]

This returns nothing as well.

commented

In the data, the context is item_used, but the context you're passing is used_item?

commented

Lol woops. I'll test when I get home but you are absolutely right :)

commented

works now. Twas user error =) thanks!