API changes for 2.15
This commit is contained in:
parent
d13eb1a55d
commit
f1606ac51b
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>luckperms</artifactId>
|
<artifactId>luckperms</artifactId>
|
||||||
<groupId>me.lucko.luckperms</groupId>
|
<groupId>me.lucko.luckperms</groupId>
|
||||||
<version>2.14-SNAPSHOT</version>
|
<version>2.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ import java.util.Map;
|
|||||||
* @since 2.11
|
* @since 2.11
|
||||||
*/
|
*/
|
||||||
public class Contexts {
|
public class Contexts {
|
||||||
|
private static final Contexts ALLOW_ALL = new Contexts(ContextSet.empty(), true, true, true, true, true, true);
|
||||||
public static final String SERVER_KEY = "server";
|
public static final String SERVER_KEY = "server";
|
||||||
public static final String WORLD_KEY = "world";
|
public static final String WORLD_KEY = "world";
|
||||||
|
|
||||||
@ -40,7 +41,7 @@ public class Contexts {
|
|||||||
* @return a context that will not apply any filters
|
* @return a context that will not apply any filters
|
||||||
*/
|
*/
|
||||||
public static Contexts allowAll() {
|
public static Contexts allowAll() {
|
||||||
return new Contexts(ContextSet.empty(), true, true, true, true, true, true);
|
return ALLOW_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Contexts of(ContextSet context, boolean includeGlobal, boolean includeGlobalWorld, boolean applyGroups, boolean applyGlobalGroups, boolean applyGlobalWorldGroups, boolean op) {
|
public static Contexts of(ContextSet context, boolean includeGlobal, boolean includeGlobalWorld, boolean applyGroups, boolean applyGlobalGroups, boolean applyGlobalWorldGroups, boolean op) {
|
||||||
|
@ -250,4 +250,12 @@ public interface LuckPermsApi {
|
|||||||
*/
|
*/
|
||||||
void registerContextListener(ContextListener<?> contextListener);
|
void registerContextListener(ContextListener<?> contextListener);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a calculated context instance for the user using the rules of the platform.
|
||||||
|
* These values are calculated using the options in the configuration, and the provided calculators.
|
||||||
|
* @param user the user to get contexts for
|
||||||
|
* @return an optional containing contexts. Will return empty if the user is not online.
|
||||||
|
*/
|
||||||
|
Optional<Contexts> getContextForUser(User user);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@ import java.util.stream.Collectors;
|
|||||||
* @since 2.13
|
* @since 2.13
|
||||||
*/
|
*/
|
||||||
public class ContextSet {
|
public class ContextSet {
|
||||||
|
private static final ContextSet EMPTY = new ContextSet();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a singleton ContextSet from a context pair
|
* Make a singleton ContextSet from a context pair
|
||||||
@ -112,7 +113,7 @@ public class ContextSet {
|
|||||||
* @return a new ContextSet
|
* @return a new ContextSet
|
||||||
*/
|
*/
|
||||||
public static ContextSet empty() {
|
public static ContextSet empty() {
|
||||||
return new ContextSet();
|
return EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Set<Map.Entry<String, String>> contexts;
|
final Set<Map.Entry<String, String>> contexts;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>luckperms</artifactId>
|
<artifactId>luckperms</artifactId>
|
||||||
<groupId>me.lucko.luckperms</groupId>
|
<groupId>me.lucko.luckperms</groupId>
|
||||||
<version>2.14-SNAPSHOT</version>
|
<version>2.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>luckperms</artifactId>
|
<artifactId>luckperms</artifactId>
|
||||||
<groupId>me.lucko.luckperms</groupId>
|
<groupId>me.lucko.luckperms</groupId>
|
||||||
<version>2.14-SNAPSHOT</version>
|
<version>2.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
@ -30,7 +30,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>me.lucko.luckperms</groupId>
|
<groupId>me.lucko.luckperms</groupId>
|
||||||
<artifactId>luckperms-api</artifactId>
|
<artifactId>luckperms-api</artifactId>
|
||||||
<version>2.14-SNAPSHOT</version>
|
<version>${project.version}</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- BukkitAPI -->
|
<!-- BukkitAPI -->
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>luckperms</artifactId>
|
<artifactId>luckperms</artifactId>
|
||||||
<groupId>me.lucko.luckperms</groupId>
|
<groupId>me.lucko.luckperms</groupId>
|
||||||
<version>2.14-SNAPSHOT</version>
|
<version>2.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>luckperms</artifactId>
|
<artifactId>luckperms</artifactId>
|
||||||
<groupId>me.lucko.luckperms</groupId>
|
<groupId>me.lucko.luckperms</groupId>
|
||||||
<version>2.14-SNAPSHOT</version>
|
<version>2.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>luckperms</artifactId>
|
<artifactId>luckperms</artifactId>
|
||||||
<groupId>me.lucko.luckperms</groupId>
|
<groupId>me.lucko.luckperms</groupId>
|
||||||
<version>2.14-SNAPSHOT</version>
|
<version>2.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ public class ApiProvider implements LuckPermsApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getApiVersion() {
|
public double getApiVersion() {
|
||||||
return 2.14;
|
return 2.15;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -159,7 +159,7 @@ public class ApiProvider implements LuckPermsApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void cleanupUser(@NonNull User user) {
|
public void cleanupUser(@NonNull User user) {
|
||||||
me.lucko.luckperms.common.api.internal.Utils.checkUser(user);
|
Utils.checkUser(user);
|
||||||
plugin.getUserManager().cleanup(((UserLink) user).getMaster());
|
plugin.getUserManager().cleanup(((UserLink) user).getMaster());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,4 +221,10 @@ public class ApiProvider implements LuckPermsApi {
|
|||||||
public void registerContextListener(ContextListener<?> contextListener) {
|
public void registerContextListener(ContextListener<?> contextListener) {
|
||||||
plugin.getContextManager().registerListener(contextListener);
|
plugin.getContextManager().registerListener(contextListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<Contexts> getContextForUser(User user) {
|
||||||
|
Utils.checkUser(user);
|
||||||
|
return Optional.ofNullable(plugin.getContextForUser(((UserLink) user).getMaster()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
4
pom.xml
4
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>me.lucko.luckperms</groupId>
|
<groupId>me.lucko.luckperms</groupId>
|
||||||
<artifactId>luckperms</artifactId>
|
<artifactId>luckperms</artifactId>
|
||||||
<version>2.14-SNAPSHOT</version>
|
<version>2.15-SNAPSHOT</version>
|
||||||
<modules>
|
<modules>
|
||||||
<module>common</module>
|
<module>common</module>
|
||||||
<module>api</module>
|
<module>api</module>
|
||||||
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<release.version>2.14</release.version>
|
<release.version>2.15</release.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<distributionManagement>
|
<distributionManagement>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>luckperms</artifactId>
|
<artifactId>luckperms</artifactId>
|
||||||
<groupId>me.lucko.luckperms</groupId>
|
<groupId>me.lucko.luckperms</groupId>
|
||||||
<version>2.14-SNAPSHOT</version>
|
<version>2.15-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user