diff --git a/pom.xml b/pom.xml
index 98a8bb48..986d2949 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,6 +14,9 @@
bukkit
bukkit-legacy
bungee
+ sponge/sponge-service
+ sponge/sponge-service-api6
+ sponge/sponge-service-api7
sponge
diff --git a/sponge/pom.xml b/sponge/pom.xml
index 9327e07c..7bfca345 100644
--- a/sponge/pom.xml
+++ b/sponge/pom.xml
@@ -95,6 +95,27 @@
+
+
+ me.lucko.luckperms
+ luckperms-sponge-service
+ ${project.version}
+ compile
+
+
+
+ me.lucko.luckperms
+ luckperms-sponge-service-api6
+ ${project.version}
+ compile
+
+
+
+ me.lucko.luckperms
+ luckperms-sponge-service-api7
+ ${project.version}
+ compile
+
org.spongepowered
diff --git a/sponge/sponge-service-api6/pom.xml b/sponge/sponge-service-api6/pom.xml
new file mode 100644
index 00000000..e4d5e310
--- /dev/null
+++ b/sponge/sponge-service-api6/pom.xml
@@ -0,0 +1,69 @@
+
+
+
+ luckperms
+ me.lucko.luckperms
+ 3.2-SNAPSHOT
+ ../../pom.xml
+
+ 4.0.0
+
+ luckperms-sponge-service-api6
+ jar
+
+
+ clean package
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ ${compiler.version}
+
+
+ 1.8
+
+
+
+
+
+
+
+
+ me.lucko.luckperms
+ luckperms-sponge-service
+ ${project.version}
+ provided
+
+
+
+ me.lucko.luckperms
+ luckperms-common
+ ${project.version}
+ provided
+
+
+
+ me.lucko.luckperms
+ luckperms-api
+ ${project.version}
+ provided
+
+
+
+ org.spongepowered
+ spongeapi
+ 6.0.0
+ provided
+
+
+
+ org.projectlombok
+ lombok
+ ${lombok.version}
+ provided
+
+
+
+
diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/service/description/SimpleDescription.java b/sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/PermissionDescription6Proxy.java
similarity index 58%
rename from sponge/src/main/java/me/lucko/luckperms/sponge/service/description/SimpleDescription.java
rename to sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/PermissionDescription6Proxy.java
index 8851eefb..b6b77fb5 100644
--- a/sponge/src/main/java/me/lucko/luckperms/sponge/service/description/SimpleDescription.java
+++ b/sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/PermissionDescription6Proxy.java
@@ -23,19 +23,15 @@
* SOFTWARE.
*/
-package me.lucko.luckperms.sponge.service.description;
+package me.lucko.luckperms.sponge.service.proxy.api6;
-import lombok.AccessLevel;
-import lombok.AllArgsConstructor;
-import lombok.EqualsAndHashCode;
-import lombok.Getter;
-import lombok.ToString;
+import lombok.RequiredArgsConstructor;
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.proxy.SubjectProxy;
+import org.spongepowered.api.Sponge;
import org.spongepowered.api.plugin.PluginContainer;
import org.spongepowered.api.service.permission.PermissionDescription;
import org.spongepowered.api.service.permission.Subject;
@@ -43,28 +39,32 @@ import org.spongepowered.api.text.Text;
import java.util.Map;
-@SuppressWarnings("unchecked")
-@Getter
-@AllArgsConstructor
-@EqualsAndHashCode(of = {"owner", "id", "description"})
-@ToString(of = {"owner", "id", "description"})
-public final class SimpleDescription implements PermissionDescription {
-
- @Getter(AccessLevel.NONE)
+@RequiredArgsConstructor
+public class PermissionDescription6Proxy implements PermissionDescription {
private final LPPermissionService service;
- private final PluginContainer owner;
- private final String id;
- private final Text description;
+ private final LPPermissionDescription handle;
@Override
- public Map getAssignedSubjects(String id) {
- LPSubjectCollection subjects = service.getCollection(id);
- return (Map) subjects.getAllWithPermission(this.id)
- .thenApply(map -> map.entrySet().stream()
- .collect(ImmutableCollectors.toImmutableMap(
- e -> new SubjectProxy(service, e.getKey()),
- Map.Entry::getValue)
- )
- ).join();
+ public String getId() {
+ return handle.getId();
+ }
+
+ @Override
+ public Text getDescription() {
+ return handle.getDescription().orElse(Text.EMPTY);
+ }
+
+ @Override
+ public PluginContainer getOwner() {
+ return handle.getOwner().orElseGet(() -> Sponge.getGame().getPluginManager().fromInstance(service.getPlugin()).orElseThrow(() -> new RuntimeException("Unable to get LuckPerms instance.")));
+ }
+
+ @Override
+ public Map getAssignedSubjects(String s) {
+ return handle.getAssignedSubjects(s).entrySet().stream()
+ .collect(ImmutableCollectors.toImmutableMap(
+ e -> new Subject6Proxy(service, e.getKey().toReference()),
+ Map.Entry::getValue
+ ));
}
}
diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/service/proxy/PermissionServiceProxy.java b/sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/PermissionService6Proxy.java
similarity index 77%
rename from sponge/src/main/java/me/lucko/luckperms/sponge/service/proxy/PermissionServiceProxy.java
rename to sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/PermissionService6Proxy.java
index e8b07bf1..f764d7e1 100644
--- a/sponge/src/main/java/me/lucko/luckperms/sponge/service/proxy/PermissionServiceProxy.java
+++ b/sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/PermissionService6Proxy.java
@@ -23,14 +23,16 @@
* SOFTWARE.
*/
-package me.lucko.luckperms.sponge.service.proxy;
+package me.lucko.luckperms.sponge.service.proxy.api6;
import lombok.RequiredArgsConstructor;
import me.lucko.luckperms.common.utils.ImmutableCollectors;
-import me.lucko.luckperms.sponge.contexts.SpongeCalculatorLink;
+import me.lucko.luckperms.sponge.service.model.LPPermissionDescription;
import me.lucko.luckperms.sponge.service.model.LPPermissionService;
+import org.spongepowered.api.Sponge;
+import org.spongepowered.api.plugin.PluginContainer;
import org.spongepowered.api.service.context.ContextCalculator;
import org.spongepowered.api.service.permission.PermissionDescription;
import org.spongepowered.api.service.permission.PermissionService;
@@ -42,7 +44,7 @@ import java.util.Map;
import java.util.Optional;
@RequiredArgsConstructor
-public class PermissionServiceProxy implements PermissionService {
+public class PermissionService6Proxy implements PermissionService {
private final LPPermissionService handle;
@Override
@@ -76,21 +78,26 @@ public class PermissionServiceProxy implements PermissionService {
@Override
public Optional newDescriptionBuilder(Object o) {
- return Optional.of(handle.newDescriptionBuilder(o));
+ Optional container = Sponge.getGame().getPluginManager().fromInstance(o);
+ if (!container.isPresent()) {
+ throw new IllegalArgumentException("Couldn't find a plugin container for " + o.getClass().getSimpleName());
+ }
+
+ return Optional.of(new SimpleDescription6Builder(handle, container.get()));
}
@Override
public Optional getDescription(String s) {
- return handle.getDescription(s);
+ return handle.getDescription(s).map(LPPermissionDescription::sponge);
}
@Override
public Collection getDescriptions() {
- return handle.getDescriptions();
+ return handle.getDescriptions().stream().map(LPPermissionDescription::sponge).collect(ImmutableCollectors.toImmutableSet());
}
@Override
public void registerContextCalculator(ContextCalculator contextCalculator) {
- handle.registerContextCalculator(new SpongeCalculatorLink(contextCalculator));
+ handle.registerContextCalculator(contextCalculator);
}
}
diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/service/description/SimpleDescriptionBuilder.java b/sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/SimpleDescription6Builder.java
similarity index 84%
rename from sponge/src/main/java/me/lucko/luckperms/sponge/service/description/SimpleDescriptionBuilder.java
rename to sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/SimpleDescription6Builder.java
index 80d336d3..7f31e49c 100644
--- a/sponge/src/main/java/me/lucko/luckperms/sponge/service/description/SimpleDescriptionBuilder.java
+++ b/sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/SimpleDescription6Builder.java
@@ -23,7 +23,7 @@
* SOFTWARE.
*/
-package me.lucko.luckperms.sponge.service.description;
+package me.lucko.luckperms.sponge.service.proxy.api6;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
@@ -32,7 +32,8 @@ import lombok.ToString;
import me.lucko.luckperms.api.Tristate;
import me.lucko.luckperms.api.context.ContextSet;
-import me.lucko.luckperms.sponge.service.LuckPermsService;
+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;
@@ -47,8 +48,8 @@ import java.util.Map;
@ToString(of = {"container", "roles", "id", "description"})
@EqualsAndHashCode(of = {"container", "roles", "id", "description"})
@RequiredArgsConstructor
-public final class SimpleDescriptionBuilder implements PermissionDescription.Builder {
- private final LuckPermsService service;
+public final class SimpleDescription6Builder implements PermissionDescription.Builder {
+ private final LPPermissionService service;
private final PluginContainer container;
private final Map roles = new HashMap<>();
private String id = null;
@@ -61,7 +62,7 @@ public final class SimpleDescriptionBuilder implements PermissionDescription.Bui
}
@Override
- public PermissionDescription.Builder description(@NonNull Text text) {
+ public PermissionDescription.Builder description(Text text) {
description = text;
return this;
}
@@ -77,12 +78,8 @@ public final class SimpleDescriptionBuilder implements PermissionDescription.Bui
if (id == null) {
throw new IllegalStateException("id cannot be null");
}
- if (description == null) {
- throw new IllegalStateException("description cannot be null");
- }
- SimpleDescription d = new SimpleDescription(service, container, id, description);
- service.getDescriptionSet().add(d);
+ LPPermissionDescription d = service.registerPermissionDescription(id, description, container);
// Set role-templates
LPSubjectCollection subjects = service.getCollection(PermissionService.SUBJECTS_ROLE_TEMPLATE);
@@ -98,6 +95,6 @@ public final class SimpleDescriptionBuilder implements PermissionDescription.Bui
id = null;
description = null;
- return d;
+ return d.sponge();
}
}
diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/service/proxy/SubjectProxy.java b/sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/Subject6Proxy.java
similarity index 91%
rename from sponge/src/main/java/me/lucko/luckperms/sponge/service/proxy/SubjectProxy.java
rename to sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/Subject6Proxy.java
index 0259dea8..04f22846 100644
--- a/sponge/src/main/java/me/lucko/luckperms/sponge/service/proxy/SubjectProxy.java
+++ b/sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/Subject6Proxy.java
@@ -23,7 +23,7 @@
* SOFTWARE.
*/
-package me.lucko.luckperms.sponge.service.proxy;
+package me.lucko.luckperms.sponge.service.proxy.api6;
import lombok.RequiredArgsConstructor;
@@ -32,7 +32,7 @@ import me.lucko.luckperms.common.utils.ImmutableCollectors;
import me.lucko.luckperms.sponge.service.model.CompatibilityUtil;
import me.lucko.luckperms.sponge.service.model.LPPermissionService;
import me.lucko.luckperms.sponge.service.model.LPSubject;
-import me.lucko.luckperms.sponge.service.references.SubjectReference;
+import me.lucko.luckperms.sponge.service.model.SubjectReference;
import org.spongepowered.api.command.CommandSource;
import org.spongepowered.api.service.context.Context;
@@ -48,12 +48,12 @@ import java.util.concurrent.CompletableFuture;
@SuppressWarnings("unchecked")
@RequiredArgsConstructor
-public class SubjectProxy implements Subject {
+public class Subject6Proxy implements Subject {
private final LPPermissionService service;
private final SubjectReference ref;
private CompletableFuture getHandle() {
- return ref.resolve();
+ return ref.resolveLp();
}
@Override
@@ -63,17 +63,17 @@ public class SubjectProxy implements Subject {
@Override
public SubjectCollection getContainingCollection() {
- return service.getCollection(ref.getCollection()).sponge();
+ return service.getCollection(ref.getCollectionIdentifier()).sponge();
}
@Override
public SubjectData getSubjectData() {
- return new SubjectDataProxy(service, ref, true);
+ return new SubjectData6Proxy(service, ref, true);
}
@Override
public SubjectData getTransientSubjectData() {
- return new SubjectDataProxy(service, ref, false);
+ return new SubjectData6Proxy(service, ref, false);
}
@Override
@@ -127,7 +127,7 @@ public class SubjectProxy implements Subject {
public List getParents() {
return (List) getHandle().thenApply(handle -> {
return handle.getParents(ImmutableContextSet.empty()).stream()
- .map(s -> new SubjectProxy(service, s))
+ .map(s -> new Subject6Proxy(service, s))
.collect(ImmutableCollectors.toImmutableList());
}).join();
}
@@ -136,7 +136,7 @@ public class SubjectProxy implements Subject {
public List getParents(Set contexts) {
return (List) getHandle().thenApply(handle -> {
return handle.getParents(CompatibilityUtil.convertContexts(contexts)).stream()
- .map(s -> new SubjectProxy(service, s))
+ .map(s -> new Subject6Proxy(service, s))
.collect(ImmutableCollectors.toImmutableList());
}).join();
}
@@ -157,7 +157,7 @@ public class SubjectProxy implements Subject {
@Override
public String getIdentifier() {
- return ref.getIdentifier();
+ return ref.getSubjectIdentifier();
}
@Override
diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/service/proxy/SubjectCollectionProxy.java b/sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/SubjectCollection6Proxy.java
similarity index 91%
rename from sponge/src/main/java/me/lucko/luckperms/sponge/service/proxy/SubjectCollectionProxy.java
rename to sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/SubjectCollection6Proxy.java
index dd0949a6..de0a976a 100644
--- a/sponge/src/main/java/me/lucko/luckperms/sponge/service/proxy/SubjectCollectionProxy.java
+++ b/sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/SubjectCollection6Proxy.java
@@ -23,7 +23,7 @@
* SOFTWARE.
*/
-package me.lucko.luckperms.sponge.service.proxy;
+package me.lucko.luckperms.sponge.service.proxy.api6;
import lombok.RequiredArgsConstructor;
@@ -43,7 +43,7 @@ import java.util.Set;
@SuppressWarnings("unchecked")
@RequiredArgsConstructor
-public class SubjectCollectionProxy implements SubjectCollection {
+public class SubjectCollection6Proxy implements SubjectCollection {
private final LPPermissionService service;
private final LPSubjectCollection handle;
@@ -71,7 +71,7 @@ public 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 Subject6Proxy(service, service.newSubjectReference(getIdentifier(), s)))
.collect(ImmutableCollectors.toImmutableList())
).join();
}
@@ -82,7 +82,7 @@ public class SubjectCollectionProxy implements SubjectCollection {
return (Map) handle.getAllWithPermission(s).thenApply(map -> {
return map.entrySet().stream()
.collect(ImmutableCollectors.toImmutableMap(
- e -> new SubjectProxy(service, e.getKey()),
+ e -> new Subject6Proxy(service, e.getKey()),
Map.Entry::getValue
));
}).join();
@@ -93,7 +93,7 @@ public class SubjectCollectionProxy implements SubjectCollection {
return (Map) handle.getAllWithPermission(CompatibilityUtil.convertContexts(set), s)
.thenApply(map -> map.entrySet().stream()
.collect(ImmutableCollectors.toImmutableMap(
- e -> new SubjectProxy(service, e.getKey()),
+ e -> new Subject6Proxy(service, e.getKey()),
Map.Entry::getValue
))
).join();
diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/service/proxy/SubjectDataProxy.java b/sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/SubjectData6Proxy.java
similarity index 90%
rename from sponge/src/main/java/me/lucko/luckperms/sponge/service/proxy/SubjectDataProxy.java
rename to sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/SubjectData6Proxy.java
index cdc414cc..4ce9ee18 100644
--- a/sponge/src/main/java/me/lucko/luckperms/sponge/service/proxy/SubjectDataProxy.java
+++ b/sponge/sponge-service-api6/src/main/java/me/lucko/luckperms/sponge/service/proxy/api6/SubjectData6Proxy.java
@@ -23,7 +23,7 @@
* SOFTWARE.
*/
-package me.lucko.luckperms.sponge.service.proxy;
+package me.lucko.luckperms.sponge.service.proxy.api6;
import lombok.RequiredArgsConstructor;
@@ -32,7 +32,7 @@ import me.lucko.luckperms.sponge.service.model.CompatibilityUtil;
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.references.SubjectReference;
+import me.lucko.luckperms.sponge.service.model.SubjectReference;
import org.spongepowered.api.service.context.Context;
import org.spongepowered.api.service.permission.Subject;
@@ -46,19 +46,16 @@ import java.util.concurrent.CompletableFuture;
/**
* Proxies a LuckPerms Subject to implement {@link SubjectData}.
- *
- * All methods which return "boolean" will return instantly, and the change will be applied in the background.
- * This will be changed as soon as Sponge implements futures into its API.
*/
@SuppressWarnings("unchecked")
@RequiredArgsConstructor
-public class SubjectDataProxy implements SubjectData {
+public class SubjectData6Proxy implements SubjectData {
private final LPPermissionService service;
private final SubjectReference ref;
private final boolean enduring;
private CompletableFuture getHandle() {
- return enduring ? ref.resolve().thenApply(LPSubject::getSubjectData) : ref.resolve().thenApply(LPSubject::getTransientSubjectData);
+ return enduring ? ref.resolveLp().thenApply(LPSubject::getSubjectData) : ref.resolveLp().thenApply(LPSubject::getTransientSubjectData);
}
@Override
@@ -108,7 +105,7 @@ public class SubjectDataProxy implements SubjectData {
.collect(ImmutableCollectors.toImmutableMap(
e -> CompatibilityUtil.convertContexts(e.getKey()),
e -> e.getValue().stream()
- .map(s -> new SubjectProxy(service, s))
+ .map(s -> new Subject6Proxy(service, s))
.collect(ImmutableCollectors.toImmutableList())
)
);
@@ -119,7 +116,7 @@ public class SubjectDataProxy implements SubjectData {
public List getParents(Set contexts) {
return (List) getHandle().thenApply(handle -> {
return handle.getParents(CompatibilityUtil.convertContexts(contexts)).stream()
- .map(s -> new SubjectProxy(service, s))
+ .map(s -> new Subject6Proxy(service, s))
.collect(ImmutableCollectors.toImmutableList());
}).join();
}
@@ -160,7 +157,7 @@ public class SubjectDataProxy implements SubjectData {
@Override
public boolean clearParents(Set contexts) {
- getHandle().thenCompose(handle -> handle.clearParents(CompatibilityUtil.convertContexts(contexts)));
+ ;
return true;
}
diff --git a/sponge/sponge-service-api6/src/main/java/org/spongepowered/api/service/permission/SubjectReference.java b/sponge/sponge-service-api6/src/main/java/org/spongepowered/api/service/permission/SubjectReference.java
new file mode 100644
index 00000000..c3e8026a
--- /dev/null
+++ b/sponge/sponge-service-api6/src/main/java/org/spongepowered/api/service/permission/SubjectReference.java
@@ -0,0 +1,41 @@
+/*
+ * 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 org.spongepowered.api.service.permission;
+
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * This is included, as the interface didn't exist in API6.
+ * We just shade it into the LP jar so we can still implement it. :)
+ */
+public interface SubjectReference {
+
+ String getCollectionIdentifier();
+
+ String getSubjectIdentifier();
+
+ CompletableFuture resolve();
+
+}
\ No newline at end of file
diff --git a/sponge/sponge-service-api7/pom.xml b/sponge/sponge-service-api7/pom.xml
new file mode 100644
index 00000000..a7b8d6d5
--- /dev/null
+++ b/sponge/sponge-service-api7/pom.xml
@@ -0,0 +1,69 @@
+
+
+
+ luckperms
+ me.lucko.luckperms
+ 3.2-SNAPSHOT
+ ../../pom.xml
+
+ 4.0.0
+
+ luckperms-sponge-service-api7
+ jar
+
+
+ clean package
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ ${compiler.version}
+
+
+ 1.8
+
+
+
+
+
+
+
+
+ me.lucko.luckperms
+ luckperms-sponge-service
+ ${project.version}
+ provided
+
+
+
+ me.lucko.luckperms
+ luckperms-common
+ ${project.version}
+ provided
+
+
+
+ me.lucko.luckperms
+ luckperms-api
+ ${project.version}
+ provided
+
+
+
+ org.spongepowered
+ spongeapi
+ 7.0.0-SNAPSHOT
+ provided
+
+
+
+ org.projectlombok
+ lombok
+ ${lombok.version}
+ provided
+
+
+
+
diff --git a/sponge/sponge-service-api7/src/main/java/me/lucko/luckperms/sponge/service/proxy/api7/PermissionDescription7Proxy.java b/sponge/sponge-service-api7/src/main/java/me/lucko/luckperms/sponge/service/proxy/api7/PermissionDescription7Proxy.java
new file mode 100644
index 00000000..75ed2fa9
--- /dev/null
+++ b/sponge/sponge-service-api7/src/main/java/me/lucko/luckperms/sponge/service/proxy/api7/PermissionDescription7Proxy.java
@@ -0,0 +1,78 @@
+/*
+ * 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.proxy.api7;
+
+import lombok.RequiredArgsConstructor;
+
+import me.lucko.luckperms.common.utils.ImmutableCollectors;
+import me.lucko.luckperms.sponge.service.model.LPPermissionDescription;
+import me.lucko.luckperms.sponge.service.model.LPPermissionService;
+
+import org.spongepowered.api.plugin.PluginContainer;
+import org.spongepowered.api.service.permission.PermissionDescription;
+import org.spongepowered.api.service.permission.Subject;
+import org.spongepowered.api.service.permission.SubjectReference;
+import org.spongepowered.api.text.Text;
+
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.CompletableFuture;
+
+@RequiredArgsConstructor
+public class PermissionDescription7Proxy implements PermissionDescription {
+ private final LPPermissionService service;
+ private final LPPermissionDescription handle;
+
+ @Override
+ public String getId() {
+ return handle.getId();
+ }
+
+ @Override
+ public Optional getDescription() {
+ return handle.getDescription();
+ }
+
+ @Override
+ public Optional getOwner() {
+ return handle.getOwner();
+ }
+
+ @Override
+ public Map getAssignedSubjects(String s) {
+ return handle.getAssignedSubjects(s).entrySet().stream()
+ .collect(ImmutableCollectors.toImmutableMap(
+ e -> new Subject7Proxy(service, e.getKey().toReference()),
+ Map.Entry::getValue
+ ));
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public CompletableFuture