1
0
mirror of https://github.com/lucko/LuckPerms.git synced 2025-09-02 19:02:33 +02:00

API changes for 2.15

This commit is contained in:
Luck
2016-11-22 18:27:40 +00:00
parent d13eb1a55d
commit f1606ac51b
12 changed files with 30 additions and 14 deletions

View File

@@ -5,7 +5,7 @@
<parent>
<artifactId>luckperms</artifactId>
<groupId>me.lucko.luckperms</groupId>
<version>2.14-SNAPSHOT</version>
<version>2.15-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -32,6 +32,7 @@ import java.util.Map;
* @since 2.11
*/
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 WORLD_KEY = "world";
@@ -40,7 +41,7 @@ public class Contexts {
* @return a context that will not apply any filters
*/
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) {

View File

@@ -250,4 +250,12 @@ public interface LuckPermsApi {
*/
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);
}

View File

@@ -37,6 +37,7 @@ import java.util.stream.Collectors;
* @since 2.13
*/
public class ContextSet {
private static final ContextSet EMPTY = new ContextSet();
/**
* Make a singleton ContextSet from a context pair
@@ -112,7 +113,7 @@ public class ContextSet {
* @return a new ContextSet
*/
public static ContextSet empty() {
return new ContextSet();
return EMPTY;
}
final Set<Map.Entry<String, String>> contexts;