
Removing a player prefix using null does not work
leelawd opened this issue ยท 4 comments
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.
The value field is annotated with NonNull.
https://github.com/SpongePowered/SpongeAPI/blob/bleeding/src/main/java/org/spongepowered/api/service/permission/package-info.java#L25
https://github.com/SpongePowered/SpongeAPI/blob/bleeding/src/main/java/org/spongepowered/api/service/permission/SubjectData.java#L176
Sponge API issue, report there.
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.
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"