mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-08-31 00:20:34 +02:00
Use saner class naming
This commit is contained in:
parent
b41dea9ee1
commit
cadd7545c5
|
@ -40,7 +40,7 @@ import org.spongepowered.api.text.Text;
|
|||
import java.util.Map;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public class PermissionDescription6Proxy implements PermissionDescription {
|
||||
public class PermissionDescriptionProxy implements PermissionDescription {
|
||||
private final LPPermissionService service;
|
||||
private final LPPermissionDescription handle;
|
||||
|
||||
|
@ -63,7 +63,7 @@ public class PermissionDescription6Proxy implements PermissionDescription {
|
|||
public Map<Subject, Boolean> getAssignedSubjects(String s) {
|
||||
return handle.getAssignedSubjects(s).entrySet().stream()
|
||||
.collect(ImmutableCollectors.toImmutableMap(
|
||||
e -> new Subject6Proxy(service, e.getKey().toReference()),
|
||||
e -> new SubjectProxy(service, e.getKey().toReference()),
|
||||
Map.Entry::getValue
|
||||
));
|
||||
}
|
|
@ -44,7 +44,7 @@ import java.util.Map;
|
|||
import java.util.Optional;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public class PermissionService6Proxy implements PermissionService {
|
||||
public class PermissionServiceProxy implements PermissionService {
|
||||
private final LPPermissionService handle;
|
||||
|
||||
@Override
|
||||
|
@ -83,7 +83,7 @@ public class PermissionService6Proxy implements PermissionService {
|
|||
throw new IllegalArgumentException("Couldn't find a plugin container for " + o.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
return Optional.of(new SimpleDescription6Builder(handle, container.get()));
|
||||
return Optional.of(new SimpleDescriptionBuilder(handle, container.get()));
|
||||
}
|
||||
|
||||
@Override
|
|
@ -48,7 +48,7 @@ import java.util.Map;
|
|||
@ToString(of = {"container", "roles", "id", "description"})
|
||||
@EqualsAndHashCode(of = {"container", "roles", "id", "description"})
|
||||
@RequiredArgsConstructor
|
||||
public final class SimpleDescription6Builder implements PermissionDescription.Builder {
|
||||
public final class SimpleDescriptionBuilder implements PermissionDescription.Builder {
|
||||
private final LPPermissionService service;
|
||||
private final PluginContainer container;
|
||||
private final Map<String, Tristate> roles = new HashMap<>();
|
|
@ -43,7 +43,7 @@ import java.util.Set;
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequiredArgsConstructor
|
||||
public class SubjectCollection6Proxy implements SubjectCollection {
|
||||
public class SubjectCollectionProxy implements SubjectCollection {
|
||||
private final LPPermissionService service;
|
||||
private final LPSubjectCollection handle;
|
||||
|
||||
|
@ -71,7 +71,7 @@ public class SubjectCollection6Proxy implements SubjectCollection {
|
|||
// this behaviour should be replaced when CompletableFutures are added to Sponge
|
||||
return (List) handle.getAllIdentifiers()
|
||||
.thenApply(ids -> ids.stream()
|
||||
.map(s -> new Subject6Proxy(service, service.newSubjectReference(getIdentifier(), s)))
|
||||
.map(s -> new SubjectProxy(service, service.newSubjectReference(getIdentifier(), s)))
|
||||
.collect(ImmutableCollectors.toImmutableList())
|
||||
).join();
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ public class SubjectCollection6Proxy implements SubjectCollection {
|
|||
return (Map) handle.getAllWithPermission(s).thenApply(map -> {
|
||||
return map.entrySet().stream()
|
||||
.collect(ImmutableCollectors.toImmutableMap(
|
||||
e -> new Subject6Proxy(service, e.getKey()),
|
||||
e -> new SubjectProxy(service, e.getKey()),
|
||||
Map.Entry::getValue
|
||||
));
|
||||
}).join();
|
||||
|
@ -93,7 +93,7 @@ public class SubjectCollection6Proxy implements SubjectCollection {
|
|||
return (Map) handle.getAllWithPermission(CompatibilityUtil.convertContexts(set), s)
|
||||
.thenApply(map -> map.entrySet().stream()
|
||||
.collect(ImmutableCollectors.toImmutableMap(
|
||||
e -> new Subject6Proxy(service, e.getKey()),
|
||||
e -> new SubjectProxy(service, e.getKey()),
|
||||
Map.Entry::getValue
|
||||
))
|
||||
).join();
|
|
@ -44,12 +44,9 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
* Proxies a LuckPerms Subject to implement {@link SubjectData}.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequiredArgsConstructor
|
||||
public class SubjectData6Proxy implements SubjectData {
|
||||
public class SubjectDataProxy implements SubjectData {
|
||||
private final LPPermissionService service;
|
||||
private final SubjectReference ref;
|
||||
private final boolean enduring;
|
||||
|
@ -105,7 +102,7 @@ public class SubjectData6Proxy implements SubjectData {
|
|||
.collect(ImmutableCollectors.toImmutableMap(
|
||||
e -> CompatibilityUtil.convertContexts(e.getKey()),
|
||||
e -> e.getValue().stream()
|
||||
.map(s -> new Subject6Proxy(service, s))
|
||||
.map(s -> new SubjectProxy(service, s))
|
||||
.collect(ImmutableCollectors.toImmutableList())
|
||||
)
|
||||
);
|
||||
|
@ -116,7 +113,7 @@ public class SubjectData6Proxy implements SubjectData {
|
|||
public List<Subject> getParents(Set<Context> contexts) {
|
||||
return (List) getHandle().thenApply(handle -> {
|
||||
return handle.getParents(CompatibilityUtil.convertContexts(contexts)).stream()
|
||||
.map(s -> new Subject6Proxy(service, s))
|
||||
.map(s -> new SubjectProxy(service, s))
|
||||
.collect(ImmutableCollectors.toImmutableList());
|
||||
}).join();
|
||||
}
|
|
@ -48,7 +48,7 @@ import java.util.concurrent.CompletableFuture;
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequiredArgsConstructor
|
||||
public class Subject6Proxy implements Subject {
|
||||
public class SubjectProxy implements Subject {
|
||||
private final LPPermissionService service;
|
||||
private final SubjectReference ref;
|
||||
|
||||
|
@ -68,12 +68,12 @@ public class Subject6Proxy implements Subject {
|
|||
|
||||
@Override
|
||||
public SubjectData getSubjectData() {
|
||||
return new SubjectData6Proxy(service, ref, true);
|
||||
return new SubjectDataProxy(service, ref, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SubjectData getTransientSubjectData() {
|
||||
return new SubjectData6Proxy(service, ref, false);
|
||||
return new SubjectDataProxy(service, ref, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -127,7 +127,7 @@ public class Subject6Proxy implements Subject {
|
|||
public List<Subject> getParents() {
|
||||
return (List) getHandle().thenApply(handle -> {
|
||||
return handle.getParents(ImmutableContextSet.empty()).stream()
|
||||
.map(s -> new Subject6Proxy(service, s))
|
||||
.map(s -> new SubjectProxy(service, s))
|
||||
.collect(ImmutableCollectors.toImmutableList());
|
||||
}).join();
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ public class Subject6Proxy implements Subject {
|
|||
public List<Subject> getParents(Set<Context> contexts) {
|
||||
return (List) getHandle().thenApply(handle -> {
|
||||
return handle.getParents(CompatibilityUtil.convertContexts(contexts)).stream()
|
||||
.map(s -> new Subject6Proxy(service, s))
|
||||
.map(s -> new SubjectProxy(service, s))
|
||||
.collect(ImmutableCollectors.toImmutableList());
|
||||
}).join();
|
||||
}
|
|
@ -42,7 +42,7 @@ import java.util.Optional;
|
|||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public class PermissionDescription7Proxy implements PermissionDescription {
|
||||
public class PermissionDescriptionProxy implements PermissionDescription {
|
||||
private final LPPermissionService service;
|
||||
private final LPPermissionDescription handle;
|
||||
|
||||
|
@ -65,7 +65,7 @@ public class PermissionDescription7Proxy implements PermissionDescription {
|
|||
public Map<Subject, Boolean> getAssignedSubjects(String s) {
|
||||
return handle.getAssignedSubjects(s).entrySet().stream()
|
||||
.collect(ImmutableCollectors.toImmutableMap(
|
||||
e -> new Subject7Proxy(service, e.getKey().toReference()),
|
||||
e -> new SubjectProxy(service, e.getKey().toReference()),
|
||||
Map.Entry::getValue
|
||||
));
|
||||
}
|
|
@ -51,7 +51,7 @@ import java.util.concurrent.CompletableFuture;
|
|||
import java.util.function.Predicate;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public class PermissionService7Proxy implements PermissionService {
|
||||
public class PermissionServiceProxy implements PermissionService {
|
||||
private final LPPermissionService handle;
|
||||
|
||||
@Override
|
||||
|
@ -115,7 +115,7 @@ public class PermissionService7Proxy implements PermissionService {
|
|||
throw new IllegalArgumentException("Couldn't find a plugin container for " + o.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
return new SimpleDescription7Builder(handle, container.get());
|
||||
return new SimpleDescriptionBuilder(handle, container.get());
|
||||
}
|
||||
|
||||
@Override
|
|
@ -48,7 +48,7 @@ import java.util.Map;
|
|||
@ToString(of = {"container", "roles", "id", "description"})
|
||||
@EqualsAndHashCode(of = {"container", "roles", "id", "description"})
|
||||
@RequiredArgsConstructor
|
||||
public final class SimpleDescription7Builder implements PermissionDescription.Builder {
|
||||
public final class SimpleDescriptionBuilder implements PermissionDescription.Builder {
|
||||
private final LPPermissionService service;
|
||||
private final PluginContainer container;
|
||||
private final Map<String, Tristate> roles = new HashMap<>();
|
|
@ -46,7 +46,7 @@ import java.util.function.Predicate;
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequiredArgsConstructor
|
||||
public class SubjectCollection7Proxy implements SubjectCollection {
|
||||
public class SubjectCollectionProxy implements SubjectCollection {
|
||||
private final LPSubjectCollection handle;
|
||||
|
||||
@Override
|
|
@ -45,12 +45,9 @@ import java.util.concurrent.CompletableFuture;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Proxies a LuckPerms Subject to implement {@link SubjectData}.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequiredArgsConstructor
|
||||
public class SubjectData7Proxy implements SubjectData {
|
||||
public class SubjectDataProxy implements SubjectData {
|
||||
private final LPPermissionService service;
|
||||
private final SubjectReference ref;
|
||||
private final boolean enduring;
|
|
@ -47,7 +47,7 @@ import java.util.concurrent.CompletableFuture;
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequiredArgsConstructor
|
||||
public class Subject7Proxy implements Subject {
|
||||
public class SubjectProxy implements Subject {
|
||||
private final LPPermissionService service;
|
||||
private final SubjectReference ref;
|
||||
|
||||
|
@ -77,12 +77,12 @@ public class Subject7Proxy implements Subject {
|
|||
|
||||
@Override
|
||||
public SubjectData getSubjectData() {
|
||||
return new SubjectData7Proxy(service, ref, true);
|
||||
return new SubjectDataProxy(service, ref, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SubjectData getTransientSubjectData() {
|
||||
return new SubjectData7Proxy(service, ref, false);
|
||||
return new SubjectDataProxy(service, ref, false);
|
||||
}
|
||||
|
||||
@Override
|
|
@ -33,6 +33,9 @@ import java.util.Map;
|
|||
import java.util.Optional;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
* LuckPerms model for the Sponge {@link PermissionDescription}
|
||||
*/
|
||||
public interface LPPermissionDescription {
|
||||
|
||||
PermissionDescription sponge();
|
||||
|
|
|
@ -44,7 +44,7 @@ import java.util.Optional;
|
|||
import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
* LuckPerms model for the Sponge PermissionService
|
||||
* LuckPerms model for the Sponge {@link PermissionService}
|
||||
*/
|
||||
public interface LPPermissionService {
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.spongepowered.api.service.permission.Subject;
|
|||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* LuckPerms model for the Sponge Subject
|
||||
* LuckPerms model for the Sponge {@link Subject}
|
||||
*/
|
||||
public interface LPSubject {
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ import java.util.concurrent.CompletableFuture;
|
|||
import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
* LuckPerms model for the Sponge SubjectCollection
|
||||
* LuckPerms model for the Sponge {@link SubjectCollection}
|
||||
*/
|
||||
public interface LPSubjectCollection {
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ import me.lucko.luckperms.api.context.ImmutableContextSet;
|
|||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
* LuckPerms model for the Sponge SubjectData
|
||||
* LuckPerms model for the Sponge {@link org.spongepowered.api.service.permission.SubjectData}
|
||||
*/
|
||||
public interface LPSubjectData {
|
||||
|
||||
|
|
|
@ -31,14 +31,6 @@ import me.lucko.luckperms.sponge.service.model.LPPermissionDescription;
|
|||
import me.lucko.luckperms.sponge.service.model.LPPermissionService;
|
||||
import me.lucko.luckperms.sponge.service.model.LPSubject;
|
||||
import me.lucko.luckperms.sponge.service.model.LPSubjectCollection;
|
||||
import me.lucko.luckperms.sponge.service.proxy.api6.PermissionDescription6Proxy;
|
||||
import me.lucko.luckperms.sponge.service.proxy.api6.PermissionService6Proxy;
|
||||
import me.lucko.luckperms.sponge.service.proxy.api6.Subject6Proxy;
|
||||
import me.lucko.luckperms.sponge.service.proxy.api6.SubjectCollection6Proxy;
|
||||
import me.lucko.luckperms.sponge.service.proxy.api7.PermissionDescription7Proxy;
|
||||
import me.lucko.luckperms.sponge.service.proxy.api7.PermissionService7Proxy;
|
||||
import me.lucko.luckperms.sponge.service.proxy.api7.Subject7Proxy;
|
||||
import me.lucko.luckperms.sponge.service.proxy.api7.SubjectCollection7Proxy;
|
||||
|
||||
import org.spongepowered.api.service.permission.PermissionDescription;
|
||||
import org.spongepowered.api.service.permission.PermissionService;
|
||||
|
@ -61,19 +53,27 @@ public class ProxyFactory {
|
|||
}
|
||||
|
||||
public static PermissionService toSponge(LPPermissionService luckPerms) {
|
||||
return IS_API_7 ? new PermissionService7Proxy(luckPerms) : new PermissionService6Proxy(luckPerms);
|
||||
return IS_API_7 ?
|
||||
new me.lucko.luckperms.sponge.service.proxy.api7.PermissionServiceProxy(luckPerms) :
|
||||
new me.lucko.luckperms.sponge.service.proxy.api6.PermissionServiceProxy(luckPerms);
|
||||
}
|
||||
|
||||
public static SubjectCollection toSponge(LPSubjectCollection luckPerms) {
|
||||
return IS_API_7 ? new SubjectCollection7Proxy(luckPerms) : new SubjectCollection6Proxy(luckPerms.getService(), luckPerms);
|
||||
return IS_API_7 ?
|
||||
new me.lucko.luckperms.sponge.service.proxy.api7.SubjectCollectionProxy(luckPerms) :
|
||||
new me.lucko.luckperms.sponge.service.proxy.api6.SubjectCollectionProxy(luckPerms.getService(), luckPerms);
|
||||
}
|
||||
|
||||
public static Subject toSponge(LPSubject luckPerms) {
|
||||
return IS_API_7 ? new Subject7Proxy(luckPerms.getService(), luckPerms.toReference()) : new Subject6Proxy(luckPerms.getService(), luckPerms.toReference());
|
||||
return IS_API_7 ?
|
||||
new me.lucko.luckperms.sponge.service.proxy.api7.SubjectProxy(luckPerms.getService(), luckPerms.toReference()) :
|
||||
new me.lucko.luckperms.sponge.service.proxy.api6.SubjectProxy(luckPerms.getService(), luckPerms.toReference());
|
||||
}
|
||||
|
||||
public static PermissionDescription toSponge(LPPermissionDescription luckPerms) {
|
||||
return IS_API_7 ? new PermissionDescription7Proxy(luckPerms.getService(), luckPerms) : new PermissionDescription6Proxy(luckPerms.getService(), luckPerms);
|
||||
return IS_API_7 ?
|
||||
new me.lucko.luckperms.sponge.service.proxy.api7.PermissionDescriptionProxy(luckPerms.getService(), luckPerms) :
|
||||
new me.lucko.luckperms.sponge.service.proxy.api6.PermissionDescriptionProxy(luckPerms.getService(), luckPerms);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user