Improve n/bukkit SenderFactory getPermissionValue impls

This commit is contained in:
Luck 2020-01-04 22:00:53 +00:00
parent a33f326cfc
commit 3ceb53aa4f
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
2 changed files with 14 additions and 8 deletions

View File

@ -88,10 +88,13 @@ public class BukkitSenderFactory extends SenderFactory<CommandSender> {
@Override
protected Tristate getPermissionValue(CommandSender sender, String node) {
boolean isSet = sender.isPermissionSet(node);
boolean val = sender.hasPermission(node);
return !isSet ? val ? Tristate.TRUE : Tristate.UNDEFINED : Tristate.of(val);
if (sender.hasPermission(node)) {
return Tristate.TRUE;
} else if (sender.isPermissionSet(node)) {
return Tristate.FALSE;
} else {
return Tristate.UNDEFINED;
}
}
@Override

View File

@ -80,10 +80,13 @@ public class NukkitSenderFactory extends SenderFactory<CommandSender> {
@Override
protected Tristate getPermissionValue(CommandSender sender, String node) {
boolean isSet = sender.isPermissionSet(node);
boolean val = sender.hasPermission(node);
return !isSet ? val ? Tristate.TRUE : Tristate.UNDEFINED : Tristate.of(val);
if (sender.hasPermission(node)) {
return Tristate.TRUE;
} else if (sender.isPermissionSet(node)) {
return Tristate.FALSE;
} else {
return Tristate.UNDEFINED;
}
}
@Override