use of me.lucko.luckperms.api.LocalizedNode in project LuckPerms by lucko.
the class PermissionHolder method getAllEntries.
private List<LocalizedNode> getAllEntries(Contexts context) {
List<LocalizedNode> entries = new LinkedList<>();
if (context.hasSetting(LookupSetting.RESOLVE_INHERITANCE)) {
accumulateInheritancesTo(entries, context);
} else {
for (Node n : getOwnNodes(context.getContexts())) {
ImmutableLocalizedNode localizedNode = ImmutableLocalizedNode.of(n, getObjectName());
entries.add(localizedNode);
}
}
if (!context.hasSetting(LookupSetting.INCLUDE_NODES_SET_WITHOUT_SERVER)) {
entries.removeIf(n -> !n.isGroupNode() && !n.isServerSpecific());
}
if (!context.hasSetting(LookupSetting.INCLUDE_NODES_SET_WITHOUT_WORLD)) {
entries.removeIf(n -> !n.isGroupNode() && !n.isWorldSpecific());
}
return entries;
}
use of me.lucko.luckperms.api.LocalizedNode in project LuckPerms by lucko.
the class PermissionHolder method exportNodesAndShorthand.
public Map<String, Boolean> exportNodesAndShorthand(boolean lowerCase) {
List<LocalizedNode> entries = resolveInheritances();
Map<String, Boolean> perms = new HashMap<>();
boolean applyShorthand = this.plugin.getConfiguration().get(ConfigKeys.APPLYING_SHORTHAND);
for (Node node : entries) {
String perm = lowerCase ? node.getPermission().toLowerCase().intern() : node.getPermission();
if (perms.putIfAbsent(perm, node.getValuePrimitive()) == null && applyShorthand) {
List<String> shorthand = node.resolveShorthand();
if (!shorthand.isEmpty()) {
for (String s : shorthand) {
perms.putIfAbsent((lowerCase ? s.toLowerCase() : s).intern(), node.getValuePrimitive());
}
}
}
}
return ImmutableMap.copyOf(perms);
}
Aggregations