mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2026-11-27 20:13:07 +00:00
Remove usage of the now-redundant ExtractedContexts class, other misc cleanup
This commit is contained in:
56 files changed
+443
-487
No files matched your search
+20
-28
@@ -59,13 +59,11 @@ public class SubjectDataProxy implements SubjectData {
|
||||
|
||||
@Override
|
||||
public Map<Set<Context>, Map<String, Boolean>> getAllPermissions() {
|
||||
return (Map) getHandle().thenApply(handle -> {
|
||||
return handle.getAllPermissions().entrySet().stream()
|
||||
.collect(ImmutableCollectors.toImmutableMap(
|
||||
e -> CompatibilityUtil.convertContexts(e.getKey()),
|
||||
Map.Entry::getValue
|
||||
));
|
||||
}).join();
|
||||
return (Map) getHandle().thenApply(handle -> handle.getAllPermissions().entrySet().stream()
|
||||
.collect(ImmutableCollectors.toImmutableMap(
|
||||
e -> CompatibilityUtil.convertContexts(e.getKey()),
|
||||
Map.Entry::getValue
|
||||
))).join();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -75,13 +73,11 @@ public class SubjectDataProxy implements SubjectData {
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Boolean> setPermission(Set<Context> contexts, String permission, Tristate value) {
|
||||
return getHandle().thenCompose(handle -> {
|
||||
return handle.setPermission(
|
||||
CompatibilityUtil.convertContexts(contexts),
|
||||
permission,
|
||||
CompatibilityUtil.convertTristate(value)
|
||||
);
|
||||
});
|
||||
return getHandle().thenCompose(handle -> handle.setPermission(
|
||||
CompatibilityUtil.convertContexts(contexts),
|
||||
permission,
|
||||
CompatibilityUtil.convertTristate(value)
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -96,13 +92,11 @@ public class SubjectDataProxy implements SubjectData {
|
||||
|
||||
@Override
|
||||
public Map<Set<Context>, List<org.spongepowered.api.service.permission.SubjectReference>> getAllParents() {
|
||||
return (Map) getHandle().thenApply(handle -> {
|
||||
return handle.getAllParents().entrySet().stream()
|
||||
.collect(ImmutableCollectors.toImmutableMap(
|
||||
e -> CompatibilityUtil.convertContexts(e.getKey()),
|
||||
Map.Entry::getValue
|
||||
));
|
||||
}).join();
|
||||
return (Map) getHandle().thenApply(handle -> handle.getAllParents().entrySet().stream()
|
||||
.collect(ImmutableCollectors.toImmutableMap(
|
||||
e -> CompatibilityUtil.convertContexts(e.getKey()),
|
||||
Map.Entry::getValue
|
||||
))).join();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -132,13 +126,11 @@ public class SubjectDataProxy implements SubjectData {
|
||||
|
||||
@Override
|
||||
public Map<Set<Context>, Map<String, String>> getAllOptions() {
|
||||
return (Map) getHandle().thenApply(handle -> {
|
||||
return handle.getAllOptions().entrySet().stream()
|
||||
.collect(ImmutableCollectors.toImmutableMap(
|
||||
e -> CompatibilityUtil.convertContexts(e.getKey()),
|
||||
Map.Entry::getValue
|
||||
));
|
||||
}).join();
|
||||
return (Map) getHandle().thenApply(handle -> handle.getAllOptions().entrySet().stream()
|
||||
.collect(ImmutableCollectors.toImmutableMap(
|
||||
e -> CompatibilityUtil.convertContexts(e.getKey()),
|
||||
Map.Entry::getValue
|
||||
))).join();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+9
-27
@@ -88,65 +88,47 @@ public class SubjectProxy implements Subject {
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(Set<Context> contexts, String permission) {
|
||||
return getHandle().thenApply(handle -> {
|
||||
return handle.getPermissionValue(CompatibilityUtil.convertContexts(contexts), permission).asBoolean();
|
||||
}).join();
|
||||
return getHandle().thenApply(handle -> handle.getPermissionValue(CompatibilityUtil.convertContexts(contexts), permission).asBoolean()).join();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(String permission) {
|
||||
return getHandle().thenApply(handle -> {
|
||||
return handle.getPermissionValue(ImmutableContextSet.empty(), permission).asBoolean();
|
||||
}).join();
|
||||
return getHandle().thenApply(handle -> handle.getPermissionValue(ImmutableContextSet.empty(), permission).asBoolean()).join();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tristate getPermissionValue(Set<Context> contexts, String permission) {
|
||||
return getHandle().thenApply(handle -> {
|
||||
return CompatibilityUtil.convertTristate(handle.getPermissionValue(CompatibilityUtil.convertContexts(contexts), permission));
|
||||
}).join();
|
||||
return getHandle().thenApply(handle -> CompatibilityUtil.convertTristate(handle.getPermissionValue(CompatibilityUtil.convertContexts(contexts), permission))).join();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChildOf(org.spongepowered.api.service.permission.SubjectReference parent) {
|
||||
return getHandle().thenApply(handle -> {
|
||||
return handle.isChildOf(ImmutableContextSet.empty(), SubjectReferenceFactory.obtain(service, parent));
|
||||
}).join();
|
||||
return getHandle().thenApply(handle -> handle.isChildOf(ImmutableContextSet.empty(), SubjectReferenceFactory.obtain(service, parent))).join();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChildOf(Set<Context> contexts, org.spongepowered.api.service.permission.SubjectReference parent) {
|
||||
return getHandle().thenApply(handle -> {
|
||||
return handle.isChildOf(CompatibilityUtil.convertContexts(contexts), SubjectReferenceFactory.obtain(service, parent));
|
||||
}).join();
|
||||
return getHandle().thenApply(handle -> handle.isChildOf(CompatibilityUtil.convertContexts(contexts), SubjectReferenceFactory.obtain(service, parent))).join();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<org.spongepowered.api.service.permission.SubjectReference> getParents() {
|
||||
return (List) getHandle().thenApply(handle -> {
|
||||
return handle.getParents(ImmutableContextSet.empty());
|
||||
}).join();
|
||||
return (List) getHandle().thenApply(handle -> handle.getParents(ImmutableContextSet.empty())).join();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<org.spongepowered.api.service.permission.SubjectReference> getParents(Set<Context> contexts) {
|
||||
return (List) getHandle().thenApply(handle -> {
|
||||
return handle.getParents(CompatibilityUtil.convertContexts(contexts));
|
||||
}).join();
|
||||
return (List) getHandle().thenApply(handle -> handle.getParents(CompatibilityUtil.convertContexts(contexts))).join();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<String> getOption(Set<Context> contexts, String key) {
|
||||
return getHandle().thenApply(handle -> {
|
||||
return handle.getOption(CompatibilityUtil.convertContexts(contexts), key);
|
||||
}).join();
|
||||
return getHandle().thenApply(handle -> handle.getOption(CompatibilityUtil.convertContexts(contexts), key)).join();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<String> getOption(String key) {
|
||||
return getHandle().thenApply(handle -> {
|
||||
return handle.getOption(ImmutableContextSet.empty(), key);
|
||||
}).join();
|
||||
return getHandle().thenApply(handle -> handle.getOption(ImmutableContextSet.empty(), key)).join();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user