diff --git a/api/pom.xml b/api/pom.xml
index 12f6c336a..9d076b2dc 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -5,7 +5,7 @@
luckperms
me.lucko.luckperms
- 2.16-SNAPSHOT
+ 2.17-SNAPSHOT
4.0.0
diff --git a/api/src/main/java/me/lucko/luckperms/LuckPerms.java b/api/src/main/java/me/lucko/luckperms/LuckPerms.java
index 75080202c..2a835116e 100644
--- a/api/src/main/java/me/lucko/luckperms/LuckPerms.java
+++ b/api/src/main/java/me/lucko/luckperms/LuckPerms.java
@@ -27,13 +27,16 @@ import me.lucko.luckperms.api.LuckPermsApi;
import java.util.Optional;
/**
- * Static access to LuckPerms
+ * Singleton for the {@link LuckPermsApi}.
+ *
+ *
Ideally, the ServiceManager for the platform should be used to obtain and cache an instance, however, this can be
+ * used if you need static access.
*/
public final class LuckPerms {
private static LuckPermsApi api = null;
/**
- * Gets an instance of {@link LuckPermsApi}
+ * Gets an instance of {@link LuckPermsApi}, throwing {@link IllegalStateException} if the API is not loaded.
*
* @return an api instance
* @throws IllegalStateException if the api is not loaded
@@ -46,8 +49,10 @@ public final class LuckPerms {
}
/**
- * Gets an instance of {@link LuckPermsApi} safely. Unlike {@link LuckPerms#getApi}, this method will not throw an
- * {@link IllegalStateException} if the api is not loaded, rather return an empty {@link Optional}.
+ * Gets an instance of {@link LuckPermsApi} safely.
+ *
+ *
Unlike {@link LuckPerms#getApi}, this method will not throw an {@link IllegalStateException} if the API is
+ * not loaded, rather return an empty {@link Optional}.
*
* @return an optional api instance
*/
diff --git a/api/src/main/java/me/lucko/luckperms/api/Contexts.java b/api/src/main/java/me/lucko/luckperms/api/Contexts.java
index 5638ec840..5fffa0a03 100644
--- a/api/src/main/java/me/lucko/luckperms/api/Contexts.java
+++ b/api/src/main/java/me/lucko/luckperms/api/Contexts.java
@@ -27,8 +27,9 @@ import me.lucko.luckperms.api.context.ContextSet;
import java.util.Map;
/**
- * Represents the context and options for a permission lookup.
- * All values are immutable.
+ * Context and options for a permission lookup.
+ *
+ *
All values are immutable.
*
* @since 2.11
*/
@@ -67,28 +68,34 @@ public class Contexts {
* The keys for servers and worlds are defined as static values.
*/
private final ContextSet context;
+
/**
* The mode to parse defaults on Bukkit
*
* @since 2.12
*/
private final boolean op;
+
/**
* If global or non server specific nodes should be applied
*/
private final boolean includeGlobal;
+
/**
* If global or non world specific nodes should be applied
*/
private final boolean includeGlobalWorld;
+
/**
* If parent groups should be applied
*/
private final boolean applyGroups;
+
/**
* If global or non server specific group memberships should be applied
*/
private final boolean applyGlobalGroups;
+
/**
* If global or non world specific group memberships should be applied
*/
diff --git a/api/src/main/java/me/lucko/luckperms/api/Datastore.java b/api/src/main/java/me/lucko/luckperms/api/Datastore.java
index 2d10880c6..621dfd052 100644
--- a/api/src/main/java/me/lucko/luckperms/api/Datastore.java
+++ b/api/src/main/java/me/lucko/luckperms/api/Datastore.java
@@ -28,7 +28,7 @@ import java.util.Set;
import java.util.UUID;
/**
- * Interface for the internal Datastore instance
+ * Deprecated Storage interface. Use {@link Storage} instead.
*
* @deprecated as of version 2.14 in favour of {@link Storage}.
*/
diff --git a/api/src/main/java/me/lucko/luckperms/api/Group.java b/api/src/main/java/me/lucko/luckperms/api/Group.java
index f1d27a70f..bad6ed0da 100644
--- a/api/src/main/java/me/lucko/luckperms/api/Group.java
+++ b/api/src/main/java/me/lucko/luckperms/api/Group.java
@@ -26,14 +26,16 @@ import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
import me.lucko.luckperms.exceptions.ObjectLacksException;
import java.util.List;
+import java.util.OptionalInt;
/**
- * Interface for internal Group instances
+ * A group which holds permission data.
*/
-@SuppressWarnings("unused")
public interface Group extends PermissionHolder {
/**
+ * Get the name of the group
+ *
* @return the name of the group
*/
String getName();
@@ -220,11 +222,6 @@ public interface Group extends PermissionHolder {
*/
void unsetInheritGroup(Group group, String server, String world, boolean temporary) throws ObjectLacksException;
- /**
- * Clear all of the groups permission nodes
- */
- void clearNodes();
-
/**
* Get a {@link List} of all of the groups the group inherits, on all servers
*
@@ -236,6 +233,17 @@ public interface Group extends PermissionHolder {
* Get a {@link List} of the groups the group inherits on a specific server
*
* @param server the server to check
+ * @return a {@link List} of group names
+ * @throws NullPointerException if the server is null
+ * @throws IllegalArgumentException if the server is invalid
+ */
+ List getLocalGroups(String server);
+
+
+ /**
+ * Get a {@link List} of the groups the group inherits on a specific server and world
+ *
+ * @param server the server to check
* @param world the world to check
* @return a {@link List} of group names
* @throws NullPointerException if the server or world is null
@@ -244,12 +252,11 @@ public interface Group extends PermissionHolder {
List getLocalGroups(String server, String world);
/**
- * Get a {@link List} of the groups the group inherits on a specific server
+ * Gets the weight of this group, is present.
*
- * @param server the server to check
- * @return a {@link List} of group names
- * @throws NullPointerException if the server is null
- * @throws IllegalArgumentException if the server is invalid
+ * @return the group weight
+ * @since 2.17
*/
- List getLocalGroups(String server);
+ OptionalInt getWeight();
+
}
diff --git a/common/src/main/java/me/lucko/luckperms/common/storage/holder/HeldPermission.java b/api/src/main/java/me/lucko/luckperms/api/HeldPermission.java
similarity index 61%
rename from common/src/main/java/me/lucko/luckperms/common/storage/holder/HeldPermission.java
rename to api/src/main/java/me/lucko/luckperms/api/HeldPermission.java
index afc0108cf..c6322edd1 100644
--- a/common/src/main/java/me/lucko/luckperms/common/storage/holder/HeldPermission.java
+++ b/api/src/main/java/me/lucko/luckperms/api/HeldPermission.java
@@ -20,24 +20,75 @@
* SOFTWARE.
*/
-package me.lucko.luckperms.common.storage.holder;
+package me.lucko.luckperms.api;
import com.google.common.collect.Multimap;
-import me.lucko.luckperms.api.Node;
-
import java.util.Optional;
import java.util.OptionalLong;
+/**
+ * A relationship between a Holder and a permission
+ *
+ * @param the identifier type of the holder
+ * @since 2.17
+ */
public interface HeldPermission {
+ /**
+ * Gets the holder of the permission
+ *
+ * @return the holder
+ */
T getHolder();
+
+ /**
+ * Gets the permission being held
+ *
+ * @return the permission
+ */
String getPermission();
+
+ /**
+ * Gets the value of the permission
+ *
+ * @return the value
+ */
boolean getValue();
+
+ /**
+ * Gets the server where the permission is held
+ *
+ * @return the server
+ */
Optional getServer();
+
+ /**
+ * Gets the world where the permission is held
+ *
+ * @return the world
+ */
Optional getWorld();
+
+ /**
+ * Gets the time in unix time when the permission will expire
+ *
+ * @return the expiry time
+ */
OptionalLong getExpiry();
+
+ /**
+ * Gets the context for the permission.
+ *
+ * @return the context
+ */
Multimap getContext();
+
+ /**
+ * Converts this permission into a Node
+ *
+ * @return a Node copy of this permission
+ */
Node asNode();
}
diff --git a/api/src/main/java/me/lucko/luckperms/api/LPConfiguration.java b/api/src/main/java/me/lucko/luckperms/api/LPConfiguration.java
index 84f5d5f80..9bd4a4718 100644
--- a/api/src/main/java/me/lucko/luckperms/api/LPConfiguration.java
+++ b/api/src/main/java/me/lucko/luckperms/api/LPConfiguration.java
@@ -28,22 +28,24 @@ import me.lucko.luckperms.api.data.MySQLConfiguration;
import java.util.Map;
/**
- * A wrapper interface for the internal LuckPerms configuration, providing read only access.
+ * Read-only access to the LuckPerms configuration settings
*/
-@SuppressWarnings("unused")
public interface LPConfiguration {
/**
+ * Returns the name of this server
* @return the name of this server
*/
String getServer();
/**
+ * Returns how often a sync task will run in minutes
* @return how often a sync task will run in minutes
*/
int getSyncTime();
/**
+ * Returns the default group, in a node representation
* @return the default group, in a node representation
* @deprecated as of 2.6, the default group is always "default"
*/
@@ -51,6 +53,7 @@ public interface LPConfiguration {
String getDefaultGroupNode();
/**
+ * Returns the name of the default group
* @return the name of the default group
* @deprecated as of 2.6, the default group is always "default"
*/
@@ -58,55 +61,65 @@ public interface LPConfiguration {
String getDefaultGroupName();
/**
+ * Returns if the users on this server will have their global permissions applied
* @return if the users on this server will have their global permissions applied
*/
boolean getIncludeGlobalPerms();
/**
+ * Returns if the users on this server will have their global world permissions applied
* @return if the users on this server will have their global world permissions applied
* @since 2.9
*/
boolean getIncludeGlobalWorldPerms();
/**
+ * Returns true if the platform is applying global groups
* @return true if the platform is applying global groups
* @since 2.9
*/
boolean getApplyGlobalGroups();
/**
+ * Returns true if the platform is applying global world groups
* @return true if the platform is applying global world groups
* @since 2.9
*/
boolean getApplyGlobalWorldGroups();
/**
- * @return the online mode setting in the config
+ * Returns the online mode setting
+ * @return the online mode setting
*/
boolean getOnlineMode();
/**
+ * Returns if LuckPerms is applying wildcard permissions
* @return if LuckPerms is applying wildcard permissions
*/
boolean getApplyWildcards();
/**
+ * Returns if LuckPerms is resolving and applying regex permissions
* @return if LuckPerms is resolving and applying regex permissions
*/
boolean getApplyRegex();
/**
+ * Returns if LuckPerms is expanding shorthand permissions
* @return if LuckPerms is expanding shorthand permissions
*/
boolean getApplyShorthand();
/**
+ * Returns if LuckPerms will send notifications to users when permissions are modified
* @return if LuckPerms will send notifications to users when permissions are modified
* @since 2.7
*/
boolean getLogNotify();
/**
+ * Returns true if permission checks are being recorded / debugged
* @return true if permission checks are being recorded / debugged
* @since 2.9
* @deprecated as this value is now always false. Functionality was replaced by the verbose command.
@@ -115,36 +128,42 @@ public interface LPConfiguration {
boolean getDebugPermissionChecks();
/**
+ * Returns true if the vanilla op system is enabled
* @return true if the vanilla op system is enabled
* @since 2.8
*/
boolean getEnableOps();
/**
+ * Returns true if opped players are allowed to use LuckPerms commands
* @return true if opped players are allowed to use LuckPerms commands
* @since 2.8
*/
boolean getCommandsAllowOp();
/**
+ * Returns true if auto op is enabled
* @return true if auto op is enabled
* @since 2.9
*/
boolean getAutoOp();
/**
+ * Returns the name of the server used within Vault operations
* @return the name of the server used within Vault operations
* @since 2.7
*/
String getVaultServer();
/**
+ * Returns true if global permissions should be considered when retrieving meta or player groups
* @return true if global permissions should be considered when retrieving meta or player groups
* @since 2.7
*/
boolean getVaultIncludeGlobal();
/**
+ * Returns the database values set in the configuration
* @return the database values set in the configuration
* @deprecated use {@link #getDatastoreConfig()}
*/
@@ -153,22 +172,26 @@ public interface LPConfiguration {
MySQLConfiguration getDatabaseValues();
/**
+ * Returns the values set for data storage in the configuration
* @return the values set for data storage in the configuration
*/
DatastoreConfiguration getDatastoreConfig();
/**
+ * Returns the storage method string from the configuration
* @return the storage method string from the configuration
*/
String getStorageMethod();
/**
+ * Returns true if split storage is enabled
* @return true if split storage is enabled
* @since 2.7
*/
boolean getSplitStorage();
/**
+ * Returns a map of split storage options
* @return a map of split storage options, where the key is the storage section, and the value is the storage
* method. For example: key = user, value = json
* @since 2.7
diff --git a/api/src/main/java/me/lucko/luckperms/api/LocalizedNode.java b/api/src/main/java/me/lucko/luckperms/api/LocalizedNode.java
index ada9fbdfa..a27cf00e9 100644
--- a/api/src/main/java/me/lucko/luckperms/api/LocalizedNode.java
+++ b/api/src/main/java/me/lucko/luckperms/api/LocalizedNode.java
@@ -23,14 +23,14 @@
package me.lucko.luckperms.api;
/**
- * Represents a Node and where it was inherited from.
+ * A node with a traceable origin
*
* @since 2.11
*/
public interface LocalizedNode extends Node {
/**
- * Gets the node
+ * Gets the delegate node
*
* @return the node this instance is representing
*/
diff --git a/api/src/main/java/me/lucko/luckperms/api/Log.java b/api/src/main/java/me/lucko/luckperms/api/Log.java
index fd8086cf3..b66964d0a 100644
--- a/api/src/main/java/me/lucko/luckperms/api/Log.java
+++ b/api/src/main/java/me/lucko/luckperms/api/Log.java
@@ -27,10 +27,11 @@ import java.util.SortedSet;
import java.util.UUID;
/**
- * Represents the internal LuckPerms log. All content internally is immutable. You can add to the log using the {@link
- * Datastore}, and then request an updated copy.
+ * Represents the internal LuckPerms log.
+ *
+ * The returned instance provides a copy of the data at the time of retrieval. Any changes made to log entries will
+ * only apply to this instance of the log. You can add to the log using the {@link Storage}, and then request an updated copy.
*/
-@SuppressWarnings("unused")
public interface Log {
/**
@@ -48,6 +49,8 @@ public interface Log {
*
* @param pageNo the page number
* @return the page content
+ * @throws IllegalArgumentException if the pageNo is less than 1
+ * @throws IllegalStateException if the log doesn't contain enough entries to populate the page. See {@link #getRecentMaxPages()}}
*/
SortedMap getRecent(int pageNo);
@@ -69,6 +72,8 @@ public interface Log {
* @param pageNo the page number
* @param actor the uuid of the actor to filter by
* @return the page content
+ * @throws IllegalArgumentException if the pageNo is less than 1
+ * @throws IllegalStateException if the log doesn't contain enough entries to populate the page. See {@link #getRecentMaxPages(UUID)}}
*/
SortedMap getRecent(int pageNo, UUID actor);
@@ -91,6 +96,8 @@ public interface Log {
* @param pageNo the page number
* @param uuid the uuid of the acted user to filter by
* @return the page content
+ * @throws IllegalArgumentException if the pageNo is less than 1
+ * @throws IllegalStateException if the log doesn't contain enough entries to populate the page. See {@link #getUserHistoryMaxPages(UUID)}}
*/
SortedMap getUserHistory(int pageNo, UUID uuid);
@@ -113,6 +120,8 @@ public interface Log {
* @param pageNo the page number
* @param name the name of the acted group to filter by
* @return the page content
+ * @throws IllegalArgumentException if the pageNo is less than 1
+ * @throws IllegalStateException if the log doesn't contain enough entries to populate the page. See {@link #getGroupHistoryMaxPages(String)}}
*/
SortedMap getGroupHistory(int pageNo, String name);
@@ -141,9 +150,12 @@ public interface Log {
/**
* @param name the name to filter by
* @return the max page number allowed in the {@link #getTrackHistory(int, String)} method
+ * @throws IllegalArgumentException if the pageNo is less than 1
+ * @throws IllegalStateException if the log doesn't contain enough entries to populate the page. See {@link #getTrackHistoryMaxPages(String)}}
*/
int getTrackHistoryMaxPages(String name);
+
/**
* @param query the query to filter by
* @return all content in this log where the content matches query
@@ -156,6 +168,8 @@ public interface Log {
* @param pageNo the page number
* @param query the query to filter by
* @return the page content
+ * @throws IllegalArgumentException if the pageNo is less than 1
+ * @throws IllegalStateException if the log doesn't contain enough entries to populate the page. See {@link #getSearchMaxPages(String)}}
*/
SortedMap getSearch(int pageNo, String query);
diff --git a/api/src/main/java/me/lucko/luckperms/api/LogEntry.java b/api/src/main/java/me/lucko/luckperms/api/LogEntry.java
index 2e35e1aaf..97145d537 100644
--- a/api/src/main/java/me/lucko/luckperms/api/LogEntry.java
+++ b/api/src/main/java/me/lucko/luckperms/api/LogEntry.java
@@ -25,9 +25,10 @@ package me.lucko.luckperms.api;
import java.util.UUID;
/**
- * Represents a single entry in a log
+ * A single entry in the log
+ *
+ * Implements {@link Comparable} ordering based upon the timestamp of the entry.
*/
-@SuppressWarnings({"unused", "WeakerAccess"})
public class LogEntry implements Comparable {
private static final String FORMAT = "&8(&e%s&8) [&a%s&8] (&b%s&8) &7--> &f%s";
@@ -154,9 +155,15 @@ public class LogEntry implements Comparable {
@Override
public String toString() {
- return "LogEntry(timestamp=" + this.getTimestamp() + ", actor=" + this.getActor() + ", actorName=" +
- this.getActorName() + ", type=" + this.getType() + ", acted=" + this.getActed() + ", actedName=" +
- this.getActedName() + ", action=" + this.getAction() + ")";
+ return "LogEntry(" +
+ "timestamp=" + this.getTimestamp() + ", " +
+ "actor=" + this.getActor() + ", " +
+ "actorName=" + this.getActorName() + ", " +
+ "type=" + this.getType() + ", " +
+ "acted=" + this.getActed() + ", " +
+ "actedName=" + this.getActedName() + ", " +
+ "action=" + this.getAction() +
+ ")";
}
@Override
@@ -165,41 +172,25 @@ public class LogEntry implements Comparable {
if (!(o instanceof LogEntry)) return false;
final LogEntry other = (LogEntry) o;
if (this.getTimestamp() != other.getTimestamp()) return false;
- final Object this$actor = this.getActor();
- final Object other$actor = other.getActor();
- if (this$actor == null ? other$actor != null : !this$actor.equals(other$actor)) return false;
- final Object this$actorName = this.getActorName();
- final Object other$actorName = other.getActorName();
- if (this$actorName == null ? other$actorName != null : !this$actorName.equals(other$actorName)) return false;
+ if (this.getActor() == null ? other.getActor() != null : !this.getActor().equals(other.getActor())) return false;
+ if (this.getActorName() == null ? other.getActorName() != null : !this.getActorName().equals(other.getActorName())) return false;
if (this.getType() != other.getType()) return false;
- final Object this$acted = this.getActed();
- final Object other$acted = other.getActed();
- if (this$acted == null ? other$acted != null : !this$acted.equals(other$acted)) return false;
- final Object this$actedName = this.getActedName();
- final Object other$actedName = other.getActedName();
- if (this$actedName == null ? other$actedName != null : !this$actedName.equals(other$actedName)) return false;
- final Object this$action = this.getAction();
- final Object other$action = other.getAction();
- return this$action == null ? other$action == null : this$action.equals(other$action);
+ if (this.getActed() == null ? other.getActed() != null : !this.getActed().equals(other.getActed())) return false;
+ if (this.getActedName() == null ? other.getActedName() != null : !this.getActedName().equals(other.getActedName())) return false;
+ return this.getAction() == null ? other.getAction() == null : this.getAction().equals(other.getAction());
}
@Override
public int hashCode() {
final int PRIME = 59;
int result = 1;
- final long $timestamp = this.getTimestamp();
- result = result * PRIME + (int) ($timestamp >>> 32 ^ $timestamp);
- final Object $actor = this.getActor();
- result = result * PRIME + ($actor == null ? 43 : $actor.hashCode());
- final Object $actorName = this.getActorName();
- result = result * PRIME + ($actorName == null ? 43 : $actorName.hashCode());
+ result = result * PRIME + (int) (this.getTimestamp() >>> 32 ^ this.getTimestamp());
+ result = result * PRIME + (this.getActor() == null ? 43 : this.getActor().hashCode());
+ result = result * PRIME + (this.getActorName() == null ? 43 : this.getActorName().hashCode());
result = result * PRIME + this.getType();
- final Object $acted = this.getActed();
- result = result * PRIME + ($acted == null ? 43 : $acted.hashCode());
- final Object $actedName = this.getActedName();
- result = result * PRIME + ($actedName == null ? 43 : $actedName.hashCode());
- final Object $action = this.getAction();
- result = result * PRIME + ($action == null ? 43 : $action.hashCode());
+ result = result * PRIME + (this.getActed() == null ? 43 : this.getActed().hashCode());
+ result = result * PRIME + (this.getActedName() == null ? 43 : this.getActedName().hashCode());
+ result = result * PRIME + (this.getAction() == null ? 43 : this.getAction().hashCode());
return result;
}
@@ -214,6 +205,7 @@ public class LogEntry implements Comparable {
protected LogEntryBuilder getThis() {
return this;
}
+
}
public static abstract class AbstractLogEntryBuilder> {
@@ -311,9 +303,15 @@ public class LogEntry implements Comparable {
@Override
public String toString() {
- return "LogEntry.LogEntryBuilder(timestamp=" + getTimestamp() + ", actor=" + getActor() + ", actorName=" +
- getActorName() + ", type=" + getType() + ", acted=" + getActed() + ", actedName=" + getActedName() +
- ", action=" + getAction() + ")";
+ return "LogEntry.LogEntryBuilder(" +
+ "timestamp=" + this.getTimestamp() + ", " +
+ "actor=" + this.getActor() + ", " +
+ "actorName=" + this.getActorName() + ", " +
+ "type=" + this.getType() + ", " +
+ "acted=" + this.getActed() + ", " +
+ "actedName=" + this.getActedName() + ", " +
+ "action=" + this.getAction() +
+ ")";
}
}
diff --git a/api/src/main/java/me/lucko/luckperms/api/Logger.java b/api/src/main/java/me/lucko/luckperms/api/Logger.java
index 16289269d..a4d7bd9c6 100644
--- a/api/src/main/java/me/lucko/luckperms/api/Logger.java
+++ b/api/src/main/java/me/lucko/luckperms/api/Logger.java
@@ -23,7 +23,7 @@
package me.lucko.luckperms.api;
/**
- * A wrapper interface for platform logger instances.
+ * A wrapper interface for platform logger instances
*
* Bukkit/Bungee both use java.util.logging, and Sponge uses org.slf4j. This class wraps those classes so the
* commons module can access a logger.
diff --git a/api/src/main/java/me/lucko/luckperms/api/LuckPermsApi.java b/api/src/main/java/me/lucko/luckperms/api/LuckPermsApi.java
index 75b435d03..8aa14ed02 100644
--- a/api/src/main/java/me/lucko/luckperms/api/LuckPermsApi.java
+++ b/api/src/main/java/me/lucko/luckperms/api/LuckPermsApi.java
@@ -23,6 +23,7 @@
package me.lucko.luckperms.api;
import me.lucko.luckperms.api.context.ContextListener;
+import me.lucko.luckperms.api.context.ContextSet;
import me.lucko.luckperms.api.context.IContextCalculator;
import me.lucko.luckperms.api.event.LPListener;
@@ -31,9 +32,8 @@ import java.util.Set;
import java.util.UUID;
/**
- * The root API interface in LuckPerms
+ * The root API interface for LuckPerms
*/
-@SuppressWarnings("unused")
public interface LuckPermsApi {
/**
@@ -250,6 +250,13 @@ public interface LuckPermsApi {
*/
boolean isTrackLoaded(String name);
+ /**
+ * Gets the node factory instance for the platform
+ *
+ * @return the node factory
+ */
+ NodeFactory getNodeFactory();
+
/**
* Returns a permission builder instance
*
@@ -279,11 +286,21 @@ public interface LuckPermsApi {
/**
* 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.
+ *
+ *
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 getContextForUser(User user);
+ /**
+ * Gets set of contexts applicable to a player using the platforms {@link IContextCalculator}s.
+ *
+ * @param player the player to calculate for. Must be the player instance for the platform.
+ * @return a set of contexts.
+ * @since 2.17
+ */
+ ContextSet getContextForPlayer(Object player);
+
}
diff --git a/api/src/main/java/me/lucko/luckperms/api/MessagingService.java b/api/src/main/java/me/lucko/luckperms/api/MessagingService.java
index 7cf51aacb..99e5c4e67 100644
--- a/api/src/main/java/me/lucko/luckperms/api/MessagingService.java
+++ b/api/src/main/java/me/lucko/luckperms/api/MessagingService.java
@@ -23,7 +23,7 @@
package me.lucko.luckperms.api;
/**
- * Exposes any networking provider being used on the platform. e.g. Redis
+ * A means to push changes to other servers using the platforms networking
*
* @since 2.14
*/
@@ -31,7 +31,9 @@ public interface MessagingService {
/**
* Uses the messaging service to inform other servers about changes.
- * This will push the update asynchronously, and this method will return almost immediately.
+ *
+ * This will push the update asynchronously, and this method will return immediately. Calling this method is
+ * equivalent to running "/lp networksync", except will not sync this server.
*/
void pushUpdate();
diff --git a/api/src/main/java/me/lucko/luckperms/api/Node.java b/api/src/main/java/me/lucko/luckperms/api/Node.java
index 3023dea07..4e202e595 100644
--- a/api/src/main/java/me/lucko/luckperms/api/Node.java
+++ b/api/src/main/java/me/lucko/luckperms/api/Node.java
@@ -31,12 +31,12 @@ import java.util.Optional;
import java.util.Set;
/**
- * Represents an immutable node object
+ * An immutable permission node
+ *
*
Use {@link LuckPermsApi#buildNode(String)} to get an instance.
*
* @since 2.6
*/
-@SuppressWarnings("unused")
public interface Node extends Map.Entry {
/**
diff --git a/api/src/main/java/me/lucko/luckperms/api/NodeFactory.java b/api/src/main/java/me/lucko/luckperms/api/NodeFactory.java
new file mode 100644
index 000000000..11bf81fd6
--- /dev/null
+++ b/api/src/main/java/me/lucko/luckperms/api/NodeFactory.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2016 Lucko (Luck)
+ *
+ * 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.api;
+
+/**
+ * Builds {@link Node} instances
+ *
+ * @since 2.17
+ */
+public interface NodeFactory {
+
+ /**
+ * Creates a node from a serialised node string
+ *
+ * @param serialisedPermission the serialised permission string
+ * @param value the value of the node
+ * @return a node instance
+ * @throws NullPointerException if the permission is null
+ */
+ Node fromSerialisedNode(String serialisedPermission, boolean value);
+
+
+ /**
+ * Creates a new node builder from a given base permission string
+ *
+ * @param permission the permission
+ * @return a node builder instance
+ * @throws NullPointerException if the permission is null
+ */
+ Node.Builder newBuilder(String permission);
+
+ /**
+ * Creates a node builder instance from an existing node
+ *
+ * @param other the other node
+ * @return a node builder instance
+ * @throws NullPointerException if the other node is null
+ */
+ Node.Builder newBuilderFromExisting(Node other);
+
+ /**
+ * Creates a node builder from a serialised node string
+ * @param serialisedPermission the serialised permission string
+ * @param value the value of the node
+ * @return a node builder instance
+ * @throws NullPointerException if the permission is null
+ */
+ Node.Builder newBuilderFromSerialisedNode(String serialisedPermission, boolean value);
+
+
+ /**
+ * Creates a node builder from a key value pair
+ *
+ * @param key the key
+ * @param value the value
+ * @return a node builder instance
+ * @throws NullPointerException if the key or value is null
+ */
+ Node.Builder makeMetaNode(String key, String value);
+
+ /**
+ * Creates a node builder from a prefix string and priority
+ *
+ * @param priority the priority
+ * @param prefix the prefix string
+ * @return a node builder instance
+ * @throws NullPointerException if the prefix is null
+ */
+ Node.Builder makePrefixNode(int priority, String prefix);
+
+ /**
+ * Creates a node builder from a prefix string and priority
+ *
+ * @param priority the priority
+ * @param suffix the suffix string
+ * @return a node builder instance
+ * @throws NullPointerException if the suffix is null
+ */
+ Node.Builder makeSuffixNode(int priority, String suffix);
+
+}
diff --git a/api/src/main/java/me/lucko/luckperms/api/PermissionHolder.java b/api/src/main/java/me/lucko/luckperms/api/PermissionHolder.java
index 0f38d19d2..ef907d78f 100644
--- a/api/src/main/java/me/lucko/luckperms/api/PermissionHolder.java
+++ b/api/src/main/java/me/lucko/luckperms/api/PermissionHolder.java
@@ -31,19 +31,24 @@ import java.util.Set;
import java.util.SortedSet;
/**
- * Interface for internal PermissionHolder (user/group) instances
+ * An object capable of holding permissions
+ *
+ * Any changes made will be lost unless the instance is saved back to the {@link Storage}.
*/
-@SuppressWarnings("unused")
public interface PermissionHolder {
/**
- * @return the identifier for this object. either a uuid string or name However, you should really just use {@link
- * User#getUuid()}, {@link User#getName()} or {@link Group#getName()}
+ * Gets the objects name
+ *
+ *
{@link User#getUuid()}, {@link User#getName()} or {@link Group#getName()} should normally be used instead of
+ * this method.
+ *
+ * @return the identifier for this object. Either a uuid string or name.
*/
String getObjectName();
/**
- * Gets an immutable Set of the objects permission nodes
+ * Gets a sorted set of all held permissions.
*
* @return an immutable set of permissions in priority order
* @since 2.6
@@ -51,20 +56,22 @@ public interface PermissionHolder {
SortedSet extends Node> getPermissions();
/**
- * Similar to {@link #getPermissions()}, except excluding transient permissions
+ * Similar to {@link #getPermissions()}, except without transient permissions
*
* @return a set of nodes
* @since 2.6
*/
- Set getEnduringPermissions();
+ Set extends Node> getEnduringPermissions();
/**
- * Similar to {@link #getPermissions()}, except excluding non-transient permissions
+ * Gets an immutable set of all transiently held permissions.
+ *
+ * Transient permissions only exist for the duration of the session.
*
* @return a set of nodes
* @since 2.6
*/
- Set getTransientPermissions();
+ Set extends Node> getTransientPermissions();
/**
@@ -91,7 +98,7 @@ public interface PermissionHolder {
SortedSet getAllNodes(Contexts contexts);
/**
- * Gets a mutable set of the nodes that is objects has and inherits, filtered by context.
+ * Gets a mutable set of the nodes that this object has and inherits, filtered by context.
* Unlike {@link #getAllNodes(Contexts)}, this method WILL filter individual nodes, and only return ones that fully
* meet the context provided.
*
@@ -102,6 +109,14 @@ public interface PermissionHolder {
*/
Set getAllNodesFiltered(Contexts contexts);
+ /**
+ * Converts the output of {@link #getAllNodesFiltered(Contexts)}, and expands shorthand permissions.
+ * @param contexts the context for the lookup
+ * @param lowerCase if the keys should be made lowercase whilst being exported
+ * @return a mutable map of permissions
+ */
+ Map exportNodes(Contexts contexts, boolean lowerCase);
+
/**
* Gets an immutable Map of the objects permission nodes
*
@@ -111,6 +126,11 @@ public interface PermissionHolder {
@Deprecated
Map getNodes();
+ /**
+ * Removes temporary permissions that have expired
+ */
+ void auditTemporaryPermissions();
+
/**
* Checks to see if the object has a certain permission
*
@@ -508,6 +528,109 @@ public interface PermissionHolder {
@Deprecated
void unsetPermission(String node, String server, String world, boolean temporary) throws ObjectLacksException;
+ /**
+ * Clears all nodes held by the object
+ *
+ * @since 2.17
+ */
+ void clearNodes();
+
+ /**
+ * Clears all nodes held by the object on a specific server
+ *
+ * @param server the server to filter by, can be null
+ * @since 2.17
+ */
+ void clearNodes(String server);
+
+ /**
+ * Clears all nodes held by the object on a specific server and world
+ *
+ * @param server the server to filter by, can be null
+ * @param world the world to filter by, can be null
+ * @since 2.17
+ */
+ void clearNodes(String server, String world);
+
+ /**
+ * Clears all parent groups
+ *
+ * @since 2.17
+ */
+ void clearParents();
+
+ /**
+ * Clears all parents on a specific server
+ *
+ * @param server the server to filter by, can be null
+ * @since 2.17
+ */
+ void clearParents(String server);
+
+ /**
+ * Clears all parents on a specific server and world
+ *
+ * @param server the server to filter by, can be null
+ * @param world the world to filter by, can be null
+ * @since 2.17
+ */
+ void clearParents(String server, String world);
+
+ /**
+ * Clears all meta held by the object
+ *
+ * @since 2.17
+ */
+ void clearMeta();
+
+ /**
+ * Clears all meta held by the object on a specific server
+ *
+ * @param server the server to filter by, can be null
+ * @since 2.17
+ */
+ void clearMeta(String server);
+
+ /**
+ * Clears all meta held by the object on a specific server and world
+ *
+ * @param server the server to filter by, can be null
+ * @param world the world to filter by, can be null
+ * @since 2.17
+ */
+ void clearMeta(String server, String world);
+
+ /**
+ * Clears all meta for a given key.
+ *
+ * @param key the meta key
+ * @param server the server to filter by, can be null
+ * @param world the world to filter by, can be null
+ * @param temporary whether the query is for temporary nodes or not.
+ */
+ void clearMetaKeys(String key, String server, String world, boolean temporary);
+
+ /**
+ * Clears all transient permissions the holder has.
+ */
+ void clearTransientNodes();
+
+ /**
+ * Processes the nodes and returns the non-temporary ones.
+ *
+ * @return a set of permanent nodes
+ * @since 2.6
+ */
+ Set getPermanentPermissionNodes();
+
+ /**
+ * Processes the nodes and returns the temporary ones.
+ *
+ * @return a set of temporary nodes
+ * @since 2.6
+ */
+ Set getTemporaryPermissionNodes();
+
/**
* Gets the permissions and inherited permissions that apply to a specific server and world
*
@@ -581,14 +704,6 @@ public interface PermissionHolder {
@Deprecated
Map, Long> getTemporaryNodes();
- /**
- * Processes the nodes and returns the temporary ones.
- *
- * @return a set of temporary nodes
- * @since 2.6
- */
- Set getTemporaryPermissionNodes();
-
/**
* Processes the nodes and returns the non-temporary ones.
*
@@ -598,17 +713,4 @@ public interface PermissionHolder {
@Deprecated
Map getPermanentNodes();
- /**
- * Processes the nodes and returns the non-temporary ones.
- *
- * @return a set of permanent nodes
- * @since 2.6
- */
- Set getPermanentPermissionNodes();
-
- /**
- * Removes temporary permissions that have expired
- */
- void auditTemporaryPermissions();
-
}
diff --git a/api/src/main/java/me/lucko/luckperms/api/PlatformType.java b/api/src/main/java/me/lucko/luckperms/api/PlatformType.java
index 18ace418c..e99644076 100644
--- a/api/src/main/java/me/lucko/luckperms/api/PlatformType.java
+++ b/api/src/main/java/me/lucko/luckperms/api/PlatformType.java
@@ -23,7 +23,7 @@
package me.lucko.luckperms.api;
/**
- * Represents the platform type that LuckPerms is running on
+ * The platforms which LuckPerms can run on
*
* @since 2.7
*/
diff --git a/api/src/main/java/me/lucko/luckperms/api/Storage.java b/api/src/main/java/me/lucko/luckperms/api/Storage.java
index fd2e66e9d..e7341ae87 100644
--- a/api/src/main/java/me/lucko/luckperms/api/Storage.java
+++ b/api/src/main/java/me/lucko/luckperms/api/Storage.java
@@ -22,6 +22,7 @@
package me.lucko.luckperms.api;
+import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@@ -29,7 +30,7 @@ import java.util.concurrent.Executor;
import java.util.function.Consumer;
/**
- * Interface for the internal Storage instance
+ * A means of loading and saving data to/from the Storage provider.
*
* All methods return {@link CompletableFuture}s, which will be populated with the result once the data has been
* loaded asynchronously. Care should be taken when using the methods to ensure that the main server thread is not
@@ -124,6 +125,16 @@ public interface Storage {
*/
CompletableFuture> getUniqueUsers();
+ /**
+ * Searches for a list of users with a given permission.
+ *
+ * @param permission the permission to search for
+ * @return a list of held permissions, or null if the operation failed
+ * @throws NullPointerException if the permission is null
+ * @since 2.17
+ */
+ CompletableFuture>> getUsersWithPermission(String permission);
+
/**
* Creates and loads a group into the plugins local storage
*
@@ -171,6 +182,16 @@ public interface Storage {
*/
CompletableFuture deleteGroup(Group group);
+ /**
+ * Searches for a list of groups with a given permission.
+ *
+ * @param permission the permission to search for
+ * @return a list of held permissions, or null if the operation failed
+ * @throws NullPointerException if the permission is null
+ * @since 2.17
+ */
+ CompletableFuture>> getGroupsWithPermission(String permission);
+
/**
* Creates and loads a track into the plugins local storage
*
@@ -239,4 +260,14 @@ public interface Storage {
*/
CompletableFuture getUUID(String username);
+ /**
+ * Gets a username from a UUID
+ *
+ * @param uuid the corresponding uuid
+ * @return a name string, could be null
+ * @throws NullPointerException if either parameters are null
+ * @since 2.17
+ */
+ CompletableFuture getName(UUID uuid);
+
}
diff --git a/api/src/main/java/me/lucko/luckperms/api/Track.java b/api/src/main/java/me/lucko/luckperms/api/Track.java
index 4318af803..1a1918788 100644
--- a/api/src/main/java/me/lucko/luckperms/api/Track.java
+++ b/api/src/main/java/me/lucko/luckperms/api/Track.java
@@ -28,19 +28,20 @@ import me.lucko.luckperms.exceptions.ObjectLacksException;
import java.util.List;
/**
- * Interface for internal Track instances
+ * An ordered collection of groups for easy promotions and demotions
*/
-@SuppressWarnings("unused")
public interface Track {
/**
+ * Gets the name of this track
* @return the name of this track
*/
String getName();
/**
* Gets an ordered list of the groups on this track
- * Index 0 is the first/lowest group in (or start of) the track
+ *
+ * Index 0 is the first/lowest group in (or start of) the track
*
* @return an ordered {@link List} of the groups on this track
*/
@@ -136,7 +137,7 @@ public interface Track {
boolean containsGroup(String group);
/**
- * Clear all of the groups within this track
+ * Clear all of the groups from this track
*/
void clearGroups();
diff --git a/api/src/main/java/me/lucko/luckperms/api/Tristate.java b/api/src/main/java/me/lucko/luckperms/api/Tristate.java
index 3a0bf33db..bcc17e082 100644
--- a/api/src/main/java/me/lucko/luckperms/api/Tristate.java
+++ b/api/src/main/java/me/lucko/luckperms/api/Tristate.java
@@ -23,14 +23,34 @@
package me.lucko.luckperms.api;
/**
- * Represents a permission value
+ * Represents a permission setting.
+ *
+ *
Consider a value of {@link #FALSE} to be a "negated" setting, and a value of {@link #UNDEFINED} to be a
+ * non-existent value.
*/
public enum Tristate {
+ /**
+ * A value indicating a holder has a permission set.
+ */
TRUE(true),
+
+ /**
+ * A value indicating a holder has a negated value for a permission.
+ */
FALSE(false),
+
+ /**
+ * A value indicating a holder doesn't have a value for a permission set.
+ */
UNDEFINED(false);
+ /**
+ * Converts from {@link Boolean} a boolean
+ *
+ * @param b the boolean
+ * @return {@link #TRUE} or {@link #FALSE}, depending on the value of the boolean.
+ */
public static Tristate fromBoolean(boolean b) {
return b ? TRUE : FALSE;
}
@@ -41,6 +61,12 @@ public enum Tristate {
this.booleanValue = booleanValue;
}
+ /**
+ * Returns the value of the Tristate as a boolean.
+ *
A value of {@link #UNDEFINED} converts to false.
+ *
+ * @return a boolean representation of the Tristate.
+ */
public boolean asBoolean() {
return booleanValue;
}
diff --git a/api/src/main/java/me/lucko/luckperms/api/User.java b/api/src/main/java/me/lucko/luckperms/api/User.java
index 84c93f7fa..c6d0a2af4 100644
--- a/api/src/main/java/me/lucko/luckperms/api/User.java
+++ b/api/src/main/java/me/lucko/luckperms/api/User.java
@@ -31,17 +31,20 @@ import java.util.Optional;
import java.util.UUID;
/**
- * Interface for internal User instances
+ * A player holding permission data
*/
-@SuppressWarnings("unused")
public interface User extends PermissionHolder {
/**
+ * Gets the users unique ID
+ *
* @return the users Mojang assigned unique id
*/
UUID getUuid();
/**
+ * Gets the users username
+ *
* @return the Users Username
*/
String getName();
@@ -64,7 +67,10 @@ public interface User extends PermissionHolder {
void setPrimaryGroup(String group) throws ObjectAlreadyHasException;
/**
- * Refresh and re-assign the users permissions
+ * Refresh and re-assign the users permissions.
+ *
+ *
This request is not buffered, and the refresh call will be ran directly. This should ideally be called on
+ * an asynchronous thread.
*/
void refreshPermissions();
@@ -76,6 +82,13 @@ public interface User extends PermissionHolder {
*/
Optional getUserDataCache();
+ /**
+ * Sets up the users data cache, if the don't have one setup already.
+ *
+ * @since 2.17
+ */
+ void setupDataCache();
+
/**
* Check to see if the user is a member of a group
*
@@ -255,11 +268,6 @@ public interface User extends PermissionHolder {
*/
void removeGroup(Group group, String server, String world, boolean temporary) throws ObjectLacksException;
- /**
- * Clear all of the users permission nodes
- */
- void clearNodes();
-
/**
* Get a {@link List} of all of the groups the user is a member of, on all servers
*
diff --git a/api/src/main/java/me/lucko/luckperms/api/UuidCache.java b/api/src/main/java/me/lucko/luckperms/api/UuidCache.java
index cc75f0ec4..545051069 100644
--- a/api/src/main/java/me/lucko/luckperms/api/UuidCache.java
+++ b/api/src/main/java/me/lucko/luckperms/api/UuidCache.java
@@ -28,16 +28,15 @@ import java.util.UUID;
* A UUID cache for online users, between external Mojang UUIDs, and internal LuckPerms UUIDs.
*
* This UuidCache is a means of allowing users to have the same internal UUID across a network of offline mode
- * servers or mixed offline mode and online mode servers. Platforms running in offline mode generate a random UUID for a
+ * servers or mixed offline mode and online mode servers. Platforms running in offline mode generate a UUID for a
* user when they first join the server, but this UUID will then not be consistent across the network. LuckPerms will
* instead check the datastore cache, to get a UUID for a user that is consistent across an entire network.
*
*
If you want to get a user object from the Storage using the api on a server in offline mode, you will need to use
* this cache, OR use Storage#getUUID, for users that are not online.
*
- *
WARNING: THIS IS ONLY EFFECTIVE FOR ONLINE PLAYERS. USE THE DATASTORE METHODS FOR OFFLINE PLAYERS.
+ *
THIS IS ONLY EFFECTIVE FOR ONLINE PLAYERS. USE THE DATASTORE METHODS FOR OFFLINE PLAYERS.
*/
-@SuppressWarnings("unused")
public interface UuidCache {
/**
diff --git a/api/src/main/java/me/lucko/luckperms/api/caching/PermissionData.java b/api/src/main/java/me/lucko/luckperms/api/caching/PermissionData.java
index ce10e57d3..082686534 100644
--- a/api/src/main/java/me/lucko/luckperms/api/caching/PermissionData.java
+++ b/api/src/main/java/me/lucko/luckperms/api/caching/PermissionData.java
@@ -44,7 +44,8 @@ public interface PermissionData {
/**
* Invalidates the underlying permission calculator cache.
- * Can be called to allow for an update in defaults.
+ *
+ *
Can be called to allow for an update in defaults.
*/
void invalidateCache();
diff --git a/api/src/main/java/me/lucko/luckperms/api/caching/UserData.java b/api/src/main/java/me/lucko/luckperms/api/caching/UserData.java
index 4a4e84d8d..e752f71d1 100644
--- a/api/src/main/java/me/lucko/luckperms/api/caching/UserData.java
+++ b/api/src/main/java/me/lucko/luckperms/api/caching/UserData.java
@@ -38,7 +38,8 @@ public interface UserData {
/**
* Gets PermissionData from the cache, given a specified context.
- * If the data is not cached, it is calculated. Therefore, this call could be costly.
+ *
+ *
If the data is not cached, it is calculated. Therefore, this call could be costly.
*
* @param contexts the contexts to get the permission data in
* @return a permission data instance
@@ -48,7 +49,8 @@ public interface UserData {
/**
* Gets MetaData from the cache, given a specified context.
- * If the data is not cached, it is calculated. Therefore, this call could be costly.
+ *
+ *
If the data is not cached, it is calculated. Therefore, this call could be costly.
*
* @param contexts the contexts to get the permission data in
* @return a meta data instance
@@ -75,8 +77,10 @@ public interface UserData {
MetaData calculateMeta(Contexts contexts);
/**
- * Calculates permission data and stores it in the cache. If there is already data cached for the given contexts,
- * and if the resultant output is different, the cached value is updated.
+ * Calculates permission data and stores it in the cache.
+ *
+ *
If there is already data cached for the given contexts, and if the resultant output is different,
+ * the cached value is updated.
*
* @param contexts the contexts to recalculate in.
* @throws NullPointerException if contexts is null
@@ -84,8 +88,10 @@ public interface UserData {
void recalculatePermissions(Contexts contexts);
/**
- * Calculates meta data and stores it in the cache. If there is already data cached for the given contexts,
- * and if the resultant output is different, the cached value is updated.
+ * Calculates meta data and stores it in the cache.
+ *
+ *
If there is already data cached for the given contexts, and if the resultant output is different,
+ * the cached value is updated.
*
* @param contexts the contexts to recalculate in.
* @throws NullPointerException if contexts is null
@@ -111,8 +117,9 @@ public interface UserData {
void preCalculate(Set contexts);
/**
- * Ensures that PermissionData and MetaData is cached for a context. If the cache does not contain any data for the
- * context, it will be calculated and saved.
+ * Ensures that PermissionData and MetaData is cached for a context.
+ *
+ * If the cache does not contain any data for the context, it will be calculated and saved.
*
* @param contexts the contexts to pre-calculate for
* @throws NullPointerException if contexts is null
diff --git a/bukkit-legacy/pom.xml b/bukkit-legacy/pom.xml
index dca315330..c3373e2a3 100644
--- a/bukkit-legacy/pom.xml
+++ b/bukkit-legacy/pom.xml
@@ -5,7 +5,7 @@
luckperms
me.lucko.luckperms
- 2.16-SNAPSHOT
+ 2.17-SNAPSHOT
4.0.0
diff --git a/bukkit-placeholders/pom.xml b/bukkit-placeholders/pom.xml
index cd0dd1f8f..e81e432ae 100644
--- a/bukkit-placeholders/pom.xml
+++ b/bukkit-placeholders/pom.xml
@@ -5,7 +5,7 @@
luckperms
me.lucko.luckperms
- 2.16-SNAPSHOT
+ 2.17-SNAPSHOT
4.0.0
diff --git a/bukkit/pom.xml b/bukkit/pom.xml
index 9507eab11..0941283c9 100644
--- a/bukkit/pom.xml
+++ b/bukkit/pom.xml
@@ -5,7 +5,7 @@
luckperms
me.lucko.luckperms
- 2.16-SNAPSHOT
+ 2.17-SNAPSHOT
4.0.0
diff --git a/bungee/pom.xml b/bungee/pom.xml
index 51e901ec9..eba3bd358 100644
--- a/bungee/pom.xml
+++ b/bungee/pom.xml
@@ -5,7 +5,7 @@
luckperms
me.lucko.luckperms
- 2.16-SNAPSHOT
+ 2.17-SNAPSHOT
4.0.0
diff --git a/common/pom.xml b/common/pom.xml
index 564e1b755..a02790028 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -5,7 +5,7 @@
luckperms
me.lucko.luckperms
- 2.16-SNAPSHOT
+ 2.17-SNAPSHOT
4.0.0
diff --git a/common/src/main/java/me/lucko/luckperms/common/api/ApiProvider.java b/common/src/main/java/me/lucko/luckperms/common/api/ApiProvider.java
index 821fa1d6f..201a893a1 100644
--- a/common/src/main/java/me/lucko/luckperms/common/api/ApiProvider.java
+++ b/common/src/main/java/me/lucko/luckperms/common/api/ApiProvider.java
@@ -35,24 +35,26 @@ import me.lucko.luckperms.api.Logger;
import me.lucko.luckperms.api.LuckPermsApi;
import me.lucko.luckperms.api.MessagingService;
import me.lucko.luckperms.api.Node;
+import me.lucko.luckperms.api.NodeFactory;
import me.lucko.luckperms.api.PlatformType;
import me.lucko.luckperms.api.Storage;
import me.lucko.luckperms.api.Track;
import me.lucko.luckperms.api.User;
import me.lucko.luckperms.api.UuidCache;
import me.lucko.luckperms.api.context.ContextListener;
+import me.lucko.luckperms.api.context.ContextSet;
import me.lucko.luckperms.api.context.IContextCalculator;
import me.lucko.luckperms.api.event.LPEvent;
import me.lucko.luckperms.api.event.LPListener;
import me.lucko.luckperms.common.LuckPermsPlugin;
-import me.lucko.luckperms.common.api.internal.DatastoreLink;
-import me.lucko.luckperms.common.api.internal.GroupLink;
-import me.lucko.luckperms.common.api.internal.LPConfigurationLink;
-import me.lucko.luckperms.common.api.internal.StorageLink;
-import me.lucko.luckperms.common.api.internal.TrackLink;
-import me.lucko.luckperms.common.api.internal.UserLink;
-import me.lucko.luckperms.common.api.internal.Utils;
-import me.lucko.luckperms.common.api.internal.UuidCacheLink;
+import me.lucko.luckperms.common.api.delegate.DatastoreDelegate;
+import me.lucko.luckperms.common.api.delegate.GroupDelegate;
+import me.lucko.luckperms.common.api.delegate.LPConfigurationDelegate;
+import me.lucko.luckperms.common.api.delegate.NodeFactoryDelegate;
+import me.lucko.luckperms.common.api.delegate.StorageDelegate;
+import me.lucko.luckperms.common.api.delegate.TrackDelegate;
+import me.lucko.luckperms.common.api.delegate.UserDelegate;
+import me.lucko.luckperms.common.api.delegate.UuidCacheDelegate;
import me.lucko.luckperms.common.core.NodeBuilder;
import me.lucko.luckperms.common.core.UserIdentifier;
@@ -61,7 +63,7 @@ import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
-import static me.lucko.luckperms.common.api.internal.Utils.checkNode;
+import static me.lucko.luckperms.common.api.ApiUtils.checkNode;
/**
* Implements the LuckPerms API using the plugin instance
@@ -92,7 +94,7 @@ public class ApiProvider implements LuckPermsApi {
@Override
public double getApiVersion() {
- return 2.16;
+ return 2.17;
}
@Override
@@ -117,18 +119,18 @@ public class ApiProvider implements LuckPermsApi {
@Override
public LPConfiguration getConfiguration() {
- return new LPConfigurationLink(plugin.getConfiguration());
+ return new LPConfigurationDelegate(plugin.getConfiguration());
}
@Override
public Storage getStorage() {
- return new StorageLink(plugin, plugin.getStorage());
+ return new StorageDelegate(plugin, plugin.getStorage());
}
@SuppressWarnings("deprecation")
@Override
public Datastore getDatastore() {
- return new DatastoreLink(plugin, plugin.getStorage());
+ return new DatastoreDelegate(plugin, plugin.getStorage());
}
@Override
@@ -138,7 +140,7 @@ public class ApiProvider implements LuckPermsApi {
@Override
public UuidCache getUuidCache() {
- return new UuidCacheLink(plugin.getUuidCache());
+ return new UuidCacheDelegate(plugin.getUuidCache());
}
@Override
@@ -149,7 +151,7 @@ public class ApiProvider implements LuckPermsApi {
@Override
public User getUser(@NonNull UUID uuid) {
final me.lucko.luckperms.common.core.model.User user = plugin.getUserManager().get(uuid);
- return user == null ? null : new UserLink(user);
+ return user == null ? null : new UserDelegate(user);
}
@Override
@@ -160,7 +162,7 @@ public class ApiProvider implements LuckPermsApi {
@Override
public User getUser(@NonNull String name) {
final me.lucko.luckperms.common.core.model.User user = plugin.getUserManager().getByUsername(name);
- return user == null ? null : new UserLink(user);
+ return user == null ? null : new UserDelegate(user);
}
@Override
@@ -170,7 +172,7 @@ public class ApiProvider implements LuckPermsApi {
@Override
public Set getUsers() {
- return plugin.getUserManager().getAll().values().stream().map(UserLink::new).collect(Collectors.toSet());
+ return plugin.getUserManager().getAll().values().stream().map(UserDelegate::new).collect(Collectors.toSet());
}
@Override
@@ -180,14 +182,14 @@ public class ApiProvider implements LuckPermsApi {
@Override
public void cleanupUser(@NonNull User user) {
- Utils.checkUser(user);
- plugin.getUserManager().cleanup(((UserLink) user).getMaster());
+ ApiUtils.checkUser(user);
+ plugin.getUserManager().cleanup(((UserDelegate) user).getMaster());
}
@Override
public Group getGroup(@NonNull String name) {
final me.lucko.luckperms.common.core.model.Group group = plugin.getGroupManager().getIfLoaded(name);
- return group == null ? null : new GroupLink(group);
+ return group == null ? null : new GroupDelegate(group);
}
@Override
@@ -197,7 +199,7 @@ public class ApiProvider implements LuckPermsApi {
@Override
public Set getGroups() {
- return plugin.getGroupManager().getAll().values().stream().map(GroupLink::new).collect(Collectors.toSet());
+ return plugin.getGroupManager().getAll().values().stream().map(GroupDelegate::new).collect(Collectors.toSet());
}
@Override
@@ -208,7 +210,7 @@ public class ApiProvider implements LuckPermsApi {
@Override
public Track getTrack(@NonNull String name) {
final me.lucko.luckperms.common.core.model.Track track = plugin.getTrackManager().getIfLoaded(name);
- return track == null ? null : new TrackLink(track);
+ return track == null ? null : new TrackDelegate(track);
}
@Override
@@ -218,7 +220,7 @@ public class ApiProvider implements LuckPermsApi {
@Override
public Set