From 764665cf158ad8441d114ef5617e25b5a041fab6 Mon Sep 17 00:00:00 2001 From: Luck Date: Sat, 30 Dec 2017 15:23:31 +0000 Subject: [PATCH] Populate Subject cache when obtaining SubjectReferences for instances which already exist --- .../dependencies/DependencyManager.java | 2 +- .../proxy/api6/SubjectCollectionProxy.java | 3 +- .../service/proxy/api6/SubjectDataProxy.java | 11 ++---- .../service/proxy/api6/SubjectProxy.java | 19 +++++----- .../proxy/api7/PermissionServiceProxy.java | 3 +- .../proxy/api7/SubjectCollectionProxy.java | 3 +- .../service/proxy/api7/SubjectProxy.java | 8 ++++- .../service/model/LPPermissionService.java | 2 -- .../sponge/service/model/LPSubject.java | 2 +- .../service/model/LPSubjectCollection.java | 4 --- .../sponge/service/model/ProxiedSubject.java | 35 +++++++++++++++++++ .../service/model/SubjectReference.java | 17 +++++++-- .../model/SubjectReferenceFactory.java | 10 ++++++ .../sponge/managers/SpongeGroupManager.java | 5 +-- .../sponge/managers/SpongeUserManager.java | 5 +-- .../sponge/service/LuckPermsService.java | 6 ---- .../service/storage/SubjectStorageModel.java | 2 +- 17 files changed, 95 insertions(+), 42 deletions(-) create mode 100644 sponge/sponge-service/src/main/java/me/lucko/luckperms/sponge/service/model/ProxiedSubject.java diff --git a/common/src/main/java/me/lucko/luckperms/common/dependencies/DependencyManager.java b/common/src/main/java/me/lucko/luckperms/common/dependencies/DependencyManager.java index 42bca9783..5a0a735b8 100644 --- a/common/src/main/java/me/lucko/luckperms/common/dependencies/DependencyManager.java +++ b/common/src/main/java/me/lucko/luckperms/common/dependencies/DependencyManager.java @@ -186,7 +186,7 @@ public class DependencyManager { } } - private void loadJar(File file) { + private void loadJar(File file) { // get the classloader to load into ClassLoader classLoader = plugin.getClass().getClassLoader(); diff --git a/sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/SubjectCollectionProxy.java b/sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/SubjectCollectionProxy.java index 639dce9e7..5e6fa9acb 100644 --- a/sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/SubjectCollectionProxy.java +++ b/sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/SubjectCollectionProxy.java @@ -32,6 +32,7 @@ import me.lucko.luckperms.sponge.service.CompatibilityUtil; 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.model.SubjectReferenceFactory; import org.spongepowered.api.service.context.Context; import org.spongepowered.api.service.permission.Subject; @@ -71,7 +72,7 @@ public final class SubjectCollectionProxy implements SubjectCollection { // this behaviour should be replaced when CompletableFutures are added to Sponge return (List) handle.getAllIdentifiers() .thenApply(ids -> ids.stream() - .map(s -> new SubjectProxy(service, service.newSubjectReference(getIdentifier(), s))) + .map(s -> new SubjectProxy(service, SubjectReferenceFactory.obtain(service, getIdentifier(), s))) .collect(ImmutableCollectors.toList()) ).join(); } diff --git a/sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/SubjectDataProxy.java b/sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/SubjectDataProxy.java index 8a7e7ac60..d745f10bb 100644 --- a/sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/SubjectDataProxy.java +++ b/sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/SubjectDataProxy.java @@ -33,6 +33,7 @@ import me.lucko.luckperms.sponge.service.model.LPPermissionService; import me.lucko.luckperms.sponge.service.model.LPSubject; import me.lucko.luckperms.sponge.service.model.LPSubjectData; import me.lucko.luckperms.sponge.service.model.SubjectReference; +import me.lucko.luckperms.sponge.service.model.SubjectReferenceFactory; import org.spongepowered.api.service.context.Context; import org.spongepowered.api.service.permission.Subject; @@ -114,10 +115,7 @@ public final class SubjectDataProxy implements SubjectData { public boolean addParent(Set contexts, Subject parent) { handle().thenCompose(handle -> handle.addParent( CompatibilityUtil.convertContexts(contexts), - service.newSubjectReference( - parent.getContainingCollection().getIdentifier(), - parent.getIdentifier() - ) + SubjectReferenceFactory.obtain(service, parent) )); return true; } @@ -126,10 +124,7 @@ public final class SubjectDataProxy implements SubjectData { public boolean removeParent(Set contexts, Subject parent) { handle().thenCompose(handle -> handle.removeParent( CompatibilityUtil.convertContexts(contexts), - service.newSubjectReference( - parent.getContainingCollection().getIdentifier(), - parent.getIdentifier() - ) + SubjectReferenceFactory.obtain(service, parent) )); return true; } diff --git a/sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/SubjectProxy.java b/sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/SubjectProxy.java index 62cbb3da3..579b03f12 100644 --- a/sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/SubjectProxy.java +++ b/sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/SubjectProxy.java @@ -32,7 +32,9 @@ import me.lucko.luckperms.common.utils.ImmutableCollectors; import me.lucko.luckperms.sponge.service.CompatibilityUtil; import me.lucko.luckperms.sponge.service.model.LPPermissionService; import me.lucko.luckperms.sponge.service.model.LPSubject; +import me.lucko.luckperms.sponge.service.model.ProxiedSubject; import me.lucko.luckperms.sponge.service.model.SubjectReference; +import me.lucko.luckperms.sponge.service.model.SubjectReferenceFactory; import org.spongepowered.api.command.CommandSource; import org.spongepowered.api.service.context.Context; @@ -48,7 +50,7 @@ import java.util.concurrent.CompletableFuture; @SuppressWarnings("unchecked") @RequiredArgsConstructor -public final class SubjectProxy implements Subject { +public final class SubjectProxy implements Subject, ProxiedSubject { private final LPPermissionService service; private final SubjectReference ref; @@ -56,6 +58,11 @@ public final class SubjectProxy implements Subject { return ref.resolveLp(); } + @Override + public SubjectReference getReference() { + return ref; + } + @Override public Optional getCommandSource() { return handle().thenApply(LPSubject::getCommandSource).join(); @@ -95,10 +102,7 @@ public final class SubjectProxy implements Subject { public boolean isChildOf(Subject parent) { return handle().thenApply(handle -> handle.isChildOf( ImmutableContextSet.empty(), - service.newSubjectReference( - parent.getContainingCollection().getIdentifier(), - parent.getIdentifier() - ) + SubjectReferenceFactory.obtain(service, parent) )).join(); } @@ -106,10 +110,7 @@ public final class SubjectProxy implements Subject { public boolean isChildOf(Set contexts, Subject parent) { return handle().thenApply(handle -> handle.isChildOf( CompatibilityUtil.convertContexts(contexts), - service.newSubjectReference( - parent.getContainingCollection().getIdentifier(), - parent.getIdentifier() - ) + SubjectReferenceFactory.obtain(service, parent) )).join(); } diff --git a/sponge/sponge-service-api7/src/main/java/me/lucko/luckperms/sponge/service/proxy/api7/PermissionServiceProxy.java b/sponge/sponge-service-api7/src/main/java/me/lucko/luckperms/sponge/service/proxy/api7/PermissionServiceProxy.java index a94181b76..064dea28b 100644 --- a/sponge/sponge-service-api7/src/main/java/me/lucko/luckperms/sponge/service/proxy/api7/PermissionServiceProxy.java +++ b/sponge/sponge-service-api7/src/main/java/me/lucko/luckperms/sponge/service/proxy/api7/PermissionServiceProxy.java @@ -33,6 +33,7 @@ import me.lucko.luckperms.common.utils.ImmutableCollectors; import me.lucko.luckperms.sponge.service.model.LPPermissionDescription; import me.lucko.luckperms.sponge.service.model.LPPermissionService; import me.lucko.luckperms.sponge.service.model.LPSubjectCollection; +import me.lucko.luckperms.sponge.service.model.SubjectReferenceFactory; import org.spongepowered.api.Sponge; import org.spongepowered.api.plugin.PluginContainer; @@ -105,7 +106,7 @@ public final class PermissionServiceProxy implements PermissionService { @Override public SubjectReference newSubjectReference(String s, String s1) { - return handle.newSubjectReference(s, s1); + return SubjectReferenceFactory.obtain(handle, s, s1); } @Override diff --git a/sponge/sponge-service-api7/src/main/java/me/lucko/luckperms/sponge/service/proxy/api7/SubjectCollectionProxy.java b/sponge/sponge-service-api7/src/main/java/me/lucko/luckperms/sponge/service/proxy/api7/SubjectCollectionProxy.java index 874ea9cd8..2c14660dc 100644 --- a/sponge/sponge-service-api7/src/main/java/me/lucko/luckperms/sponge/service/proxy/api7/SubjectCollectionProxy.java +++ b/sponge/sponge-service-api7/src/main/java/me/lucko/luckperms/sponge/service/proxy/api7/SubjectCollectionProxy.java @@ -31,6 +31,7 @@ import me.lucko.luckperms.common.utils.ImmutableCollectors; import me.lucko.luckperms.sponge.service.CompatibilityUtil; import me.lucko.luckperms.sponge.service.model.LPSubject; import me.lucko.luckperms.sponge.service.model.LPSubjectCollection; +import me.lucko.luckperms.sponge.service.model.SubjectReferenceFactory; import org.spongepowered.api.service.context.Context; import org.spongepowered.api.service.permission.Subject; @@ -91,7 +92,7 @@ public final class SubjectCollectionProxy implements SubjectCollection { @Override public SubjectReference newSubjectReference(String s) { - return handle.newSubjectReference(s); + return SubjectReferenceFactory.obtain(handle.getService(), getIdentifier(), s); } @Override diff --git a/sponge/sponge-service-api7/src/main/java/me/lucko/luckperms/sponge/service/proxy/api7/SubjectProxy.java b/sponge/sponge-service-api7/src/main/java/me/lucko/luckperms/sponge/service/proxy/api7/SubjectProxy.java index 2b9256913..814643a17 100644 --- a/sponge/sponge-service-api7/src/main/java/me/lucko/luckperms/sponge/service/proxy/api7/SubjectProxy.java +++ b/sponge/sponge-service-api7/src/main/java/me/lucko/luckperms/sponge/service/proxy/api7/SubjectProxy.java @@ -31,6 +31,7 @@ import me.lucko.luckperms.api.context.ImmutableContextSet; import me.lucko.luckperms.sponge.service.CompatibilityUtil; import me.lucko.luckperms.sponge.service.model.LPPermissionService; import me.lucko.luckperms.sponge.service.model.LPSubject; +import me.lucko.luckperms.sponge.service.model.ProxiedSubject; import me.lucko.luckperms.sponge.service.model.SubjectReference; import me.lucko.luckperms.sponge.service.model.SubjectReferenceFactory; @@ -48,7 +49,7 @@ import java.util.concurrent.CompletableFuture; @SuppressWarnings("unchecked") @RequiredArgsConstructor -public final class SubjectProxy implements Subject { +public final class SubjectProxy implements Subject, ProxiedSubject { private final LPPermissionService service; private final SubjectReference ref; @@ -56,6 +57,11 @@ public final class SubjectProxy implements Subject { return ref.resolveLp(); } + @Override + public SubjectReference getReference() { + return ref; + } + @Override public Optional getCommandSource() { return getHandle().thenApply(LPSubject::getCommandSource).join(); diff --git a/sponge/sponge-service/src/main/java/me/lucko/luckperms/sponge/service/model/LPPermissionService.java b/sponge/sponge-service/src/main/java/me/lucko/luckperms/sponge/service/model/LPPermissionService.java index e39a52afd..59f7a24fb 100644 --- a/sponge/sponge-service/src/main/java/me/lucko/luckperms/sponge/service/model/LPPermissionService.java +++ b/sponge/sponge-service/src/main/java/me/lucko/luckperms/sponge/service/model/LPPermissionService.java @@ -64,8 +64,6 @@ public interface LPPermissionService { ImmutableMap getLoadedCollections(); - SubjectReference newSubjectReference(String collectionIdentifier, String subjectIdentifier); - LPPermissionDescription registerPermissionDescription(String id, Text description, PluginContainer owner); Optional getDescription(String permission); diff --git a/sponge/sponge-service/src/main/java/me/lucko/luckperms/sponge/service/model/LPSubject.java b/sponge/sponge-service/src/main/java/me/lucko/luckperms/sponge/service/model/LPSubject.java index 1101f5f14..c8d40525c 100644 --- a/sponge/sponge-service/src/main/java/me/lucko/luckperms/sponge/service/model/LPSubject.java +++ b/sponge/sponge-service/src/main/java/me/lucko/luckperms/sponge/service/model/LPSubject.java @@ -47,7 +47,7 @@ public interface LPSubject { String getIdentifier(); default SubjectReference toReference() { - return getService().newSubjectReference(getParentCollection().getIdentifier(), getIdentifier()); + return SubjectReferenceFactory.obtain(getService(), this); } default LPSubject getDefaults() { diff --git a/sponge/sponge-service/src/main/java/me/lucko/luckperms/sponge/service/model/LPSubjectCollection.java b/sponge/sponge-service/src/main/java/me/lucko/luckperms/sponge/service/model/LPSubjectCollection.java index 251d3a68a..08f01edf9 100644 --- a/sponge/sponge-service/src/main/java/me/lucko/luckperms/sponge/service/model/LPSubjectCollection.java +++ b/sponge/sponge-service/src/main/java/me/lucko/luckperms/sponge/service/model/LPSubjectCollection.java @@ -49,10 +49,6 @@ public interface LPSubjectCollection { String getIdentifier(); - default SubjectReference newSubjectReference(String identifier) { - return getService().newSubjectReference(getIdentifier(), identifier); - } - Predicate getIdentifierValidityPredicate(); CompletableFuture loadSubject(String identifier); diff --git a/sponge/sponge-service/src/main/java/me/lucko/luckperms/sponge/service/model/ProxiedSubject.java b/sponge/sponge-service/src/main/java/me/lucko/luckperms/sponge/service/model/ProxiedSubject.java new file mode 100644 index 000000000..36c8665a9 --- /dev/null +++ b/sponge/sponge-service/src/main/java/me/lucko/luckperms/sponge/service/model/ProxiedSubject.java @@ -0,0 +1,35 @@ +/* + * This file is part of LuckPerms, licensed under the MIT License. + * + * Copyright (c) lucko (Luck) + * Copyright (c) contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package me.lucko.luckperms.sponge.service.model; + +/** + * Marks that an object is a proxied representation of a {@link org.spongepowered.api.service.permission.Subject}. + */ +public interface ProxiedSubject { + + SubjectReference getReference(); + +} diff --git a/sponge/sponge-service/src/main/java/me/lucko/luckperms/sponge/service/model/SubjectReference.java b/sponge/sponge-service/src/main/java/me/lucko/luckperms/sponge/service/model/SubjectReference.java index 3c87d3ac2..7aef25a95 100644 --- a/sponge/sponge-service/src/main/java/me/lucko/luckperms/sponge/service/model/SubjectReference.java +++ b/sponge/sponge-service/src/main/java/me/lucko/luckperms/sponge/service/model/SubjectReference.java @@ -48,7 +48,7 @@ public final class SubjectReference implements org.spongepowered.api.service.per /** * The time a subject instance should be cached in this reference */ - private static final long CACHE_TIME = TimeUnit.SECONDS.toMillis(60); + private static final long CACHE_TIME = TimeUnit.MINUTES.toMillis(5); /** * Reference to the permission service @@ -79,6 +79,19 @@ public final class SubjectReference implements org.spongepowered.api.service.per this.subjectIdentifier = Preconditions.checkNotNull(subjectIdentifier); } + void fillCache(LPSubject subject) { + LPSubject sub = tryCache(); + + if (sub == null) { + // if no value is currently cached, populate with the passed value + lastLookup = System.currentTimeMillis(); + cache = new WeakReference<>(subject); + } else if (sub == subject) { + // if equal, reset the cache timeout + lastLookup = System.currentTimeMillis(); + } + } + private LPSubject tryCache() { if ((System.currentTimeMillis() - lastLookup) < CACHE_TIME) { if (cache != null) { @@ -152,7 +165,7 @@ public final class SubjectReference implements org.spongepowered.api.service.per @Override public String toString() { - return "SubjectReference(" + + return "luckperms.SubjectReference(" + "collection=" + this.collectionIdentifier + ", " + "subject=" + this.subjectIdentifier + ")"; } diff --git a/sponge/sponge-service/src/main/java/me/lucko/luckperms/sponge/service/model/SubjectReferenceFactory.java b/sponge/sponge-service/src/main/java/me/lucko/luckperms/sponge/service/model/SubjectReferenceFactory.java index 619bee07d..644863245 100644 --- a/sponge/sponge-service/src/main/java/me/lucko/luckperms/sponge/service/model/SubjectReferenceFactory.java +++ b/sponge/sponge-service/src/main/java/me/lucko/luckperms/sponge/service/model/SubjectReferenceFactory.java @@ -63,7 +63,17 @@ public final class SubjectReferenceFactory { return obtain(service, parts.get(0), parts.get(1)); } + public static SubjectReference obtain(@NonNull LPPermissionService service, @NonNull LPSubject subject) { + SubjectReference ret = obtain(service, subject.getParentCollection().getIdentifier(), subject.getIdentifier()); + ret.fillCache(subject); + return ret; + } + public static SubjectReference obtain(@NonNull LPPermissionService service, @NonNull Subject subject) { + if (subject instanceof ProxiedSubject) { + return ((ProxiedSubject) subject).getReference(); + } + return obtain(service, subject.getContainingCollection().getIdentifier(), subject.getIdentifier()); } diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/managers/SpongeGroupManager.java b/sponge/src/main/java/me/lucko/luckperms/sponge/managers/SpongeGroupManager.java index 4be19363f..a48eaf8f4 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/managers/SpongeGroupManager.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/managers/SpongeGroupManager.java @@ -50,6 +50,7 @@ import me.lucko.luckperms.sponge.service.ProxyFactory; import me.lucko.luckperms.sponge.service.model.LPSubject; import me.lucko.luckperms.sponge.service.model.LPSubjectCollection; import me.lucko.luckperms.sponge.service.model.SubjectReference; +import me.lucko.luckperms.sponge.service.model.SubjectReferenceFactory; import org.spongepowered.api.service.permission.PermissionService; import org.spongepowered.api.service.permission.SubjectCollection; @@ -237,7 +238,7 @@ public class SpongeGroupManager implements GroupManager, LPSubjectCollection { List> lookup = plugin.getStorage().getGroupsWithPermission(permission).join(); for (HeldPermission holder : lookup) { if (holder.asNode().getFullContexts().equals(ImmutableContextSet.empty())) { - ret.put(getService().newSubjectReference(getIdentifier(), holder.getHolder()), holder.getValue()); + ret.put(SubjectReferenceFactory.obtain(getService(), getIdentifier(), holder.getHolder()), holder.getValue()); } } @@ -253,7 +254,7 @@ public class SpongeGroupManager implements GroupManager, LPSubjectCollection { List> lookup = plugin.getStorage().getGroupsWithPermission(permission).join(); for (HeldPermission holder : lookup) { if (holder.asNode().getFullContexts().equals(contexts)) { - ret.put(getService().newSubjectReference(getIdentifier(), holder.getHolder()), holder.getValue()); + ret.put(SubjectReferenceFactory.obtain(getService(), getIdentifier(), holder.getHolder()), holder.getValue()); } } diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/managers/SpongeUserManager.java b/sponge/src/main/java/me/lucko/luckperms/sponge/managers/SpongeUserManager.java index 4dec9322f..f9735f5e8 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/managers/SpongeUserManager.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/managers/SpongeUserManager.java @@ -50,6 +50,7 @@ import me.lucko.luckperms.sponge.service.ProxyFactory; import me.lucko.luckperms.sponge.service.model.LPSubject; import me.lucko.luckperms.sponge.service.model.LPSubjectCollection; import me.lucko.luckperms.sponge.service.model.SubjectReference; +import me.lucko.luckperms.sponge.service.model.SubjectReferenceFactory; import org.spongepowered.api.service.permission.PermissionService; import org.spongepowered.api.service.permission.SubjectCollection; @@ -334,7 +335,7 @@ public class SpongeUserManager implements UserManager, LPSubjectCollection { List> lookup = plugin.getStorage().getUsersWithPermission(permission).join(); for (HeldPermission holder : lookup) { if (holder.asNode().getFullContexts().equals(ImmutableContextSet.empty())) { - ret.put(getService().newSubjectReference(getIdentifier(), holder.getHolder().toString()), holder.getValue()); + ret.put(SubjectReferenceFactory.obtain(getService(), getIdentifier(), holder.getHolder().toString()), holder.getValue()); } } @@ -350,7 +351,7 @@ public class SpongeUserManager implements UserManager, LPSubjectCollection { List> lookup = plugin.getStorage().getUsersWithPermission(permission).join(); for (HeldPermission holder : lookup) { if (holder.asNode().getFullContexts().equals(contexts)) { - ret.put(getService().newSubjectReference(getIdentifier(), holder.getHolder().toString()), holder.getValue()); + ret.put(SubjectReferenceFactory.obtain(getService(), getIdentifier(), holder.getHolder().toString()), holder.getValue()); } } diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/service/LuckPermsService.java b/sponge/src/main/java/me/lucko/luckperms/sponge/service/LuckPermsService.java index e42c27688..3c72be9b6 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/service/LuckPermsService.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/service/LuckPermsService.java @@ -47,7 +47,6 @@ 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.model.SubjectReference; -import me.lucko.luckperms.sponge.service.model.SubjectReferenceFactory; import me.lucko.luckperms.sponge.service.persisted.PersistedCollection; import me.lucko.luckperms.sponge.service.storage.SubjectStorage; @@ -142,11 +141,6 @@ public class LuckPermsService implements LPPermissionService { return ImmutableMap.copyOf(collections.asMap()); } - @Override - public SubjectReference newSubjectReference(String collectionIdentifier, String subjectIdentifier) { - return SubjectReferenceFactory.obtain(this, collectionIdentifier, subjectIdentifier); - } - @Override public LPPermissionDescription registerPermissionDescription(String id, Text description, PluginContainer owner) { LuckPermsPermissionDescription desc = new LuckPermsPermissionDescription(this, id, description, owner); diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/service/storage/SubjectStorageModel.java b/sponge/src/main/java/me/lucko/luckperms/sponge/service/storage/SubjectStorageModel.java index fd5fd99ea..bbed38767 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/service/storage/SubjectStorageModel.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/service/storage/SubjectStorageModel.java @@ -58,7 +58,7 @@ public class SubjectStorageModel { private final Map> parents; public SubjectStorageModel(LPPermissionService service, Map> permissions, Map> options, Map> parents) { - this.service = service; + this.service = service; ImmutableMap.Builder> permissionsBuilder = ImmutableMap.builder(); for (Map.Entry> e : permissions.entrySet()) {