LuckPerms

LuckPerms

41.4k Downloads

Removing a player prefix using null does not work

leelawd opened this issue ยท 4 comments

commented

Attempting to remove a player specific prefix with the following code does not work:

player.getSubjectData().setOption(SubjectData.GLOBAL_CONTEXT, "prefix", null);

This method works on other permissions plugins.

commented

This was a mistake in SpongeAPI which has been corrected (just added the @nullable annotation, but that isn't anything more than a hint to developers, so there aren't breaks) -- please update LuckPerms so this works.

commented

Sure.

Quick question @zml2008 while I'm at it, should those methods perform an exact match, or calculated?

I guess it's Ex 2, just wanted to be sure. All of these methods are very ambiguous regarding the expected effect of the method call.

Example 1

Data
[context: world="nether"] something="idk"
[context: some_context="thing"] something="a thing"
something="value"

subject.setOption(SubjectData.GLOBAL_CONTEXT, "something", null)
Removes all options named "something", even if they apply in a specific context.

Resultant data is empty.

Example 2

Data
[context: world="nether"] something="idk"
[context: some_context="thing"] something="a thing"
something="value"

subject.setOption(SubjectData.GLOBAL_CONTEXT, "something", null)
Removes only the options set in that specific context.

Resultant Data
[context: world="nether"] something="idk"
[context: some_context="thing"] something="a thing"
commented

I assumed example 2. If not, I'll get that fixed too.