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 84873d66..c45b3d79 100644 --- a/api/src/main/java/me/lucko/luckperms/api/Datastore.java +++ b/api/src/main/java/me/lucko/luckperms/api/Datastore.java @@ -28,9 +28,6 @@ import java.util.UUID; /** * Wrapper interface for the internal Datastore instance - * - *
The implementations of this interface limit access to the datastore and add parameter checks to further prevent
- * errors and ensure all API interactions to not damage the state of the plugin.
*/
@SuppressWarnings("unused")
public interface Datastore {
@@ -38,10 +35,191 @@ public interface Datastore {
String getName();
boolean isAcceptingLogins();
- Async async();
+ /**
+ * Gets the {@link Sync} interface.
+ *
+ * All operations through this interface are called immediately and in the same thread as they are called.
+ * Datastore operations are thread blocking, and Sync operations should not be called on the main server thread.
+ * @return the sync interface
+ */
Sync sync();
+
+ /**
+ * Gets the {@link Async} interface.
+ *
+ * All operations through this interface are called in a new, separate asynchronous thread.
+ * When the operation is complete, the provided callback method is called, in applicable, in the main server thread.
+ * @return the async interface
+ */
+ Async async();
+
+ /**
+ * Gets the {@link Future} interface
+ *
+ * All operations through this interface are called in a new, separate asynchronous thread, similar to {@link Async}.
+ * The only difference is that instead of providing a callback, a {@link java.util.concurrent.Future} is returned.
+ * See the Oracle JavaDocs for usage of the Future class.
+ * @return the future interface
+ */
Future future();
+ /**
+ * All operations through this interface are called immediately and in the same thread as they are called.
+ * Datastore operations are thread blocking, and Sync operations should not be called on the main server thread.
+ */
+ interface Sync {
+
+ /**
+ * Saves an action to the datastore
+ * @param entry the log entry to be saved
+ * @return true if the operation completed successfully.
+ * @throws NullPointerException if entry is null
+ */
+ boolean logAction(LogEntry entry);
+
+ /**
+ * Loads and returns the log from the datastore
+ * @return a log instance, could be null
+ */
+ Log getLog();
+
+ /**
+ * Either loads or creates a user object, and loads it into the plugins internal storage
+ * @param uuid the uuid of the user
+ * @param username the users username. (if you want to specify The implementations of this interface limit access to the Group and add parameter checks to further prevent
- * errors and ensure all API interactions to not damage the state of the group.
*/
@SuppressWarnings("unused")
public interface Group extends PermissionHolder {
@@ -42,26 +39,34 @@ public interface Group extends PermissionHolder {
String getName();
/**
- * check to see if a group inherits a group
+ * Check to see if a group inherits a group
* @param group The group to check membership of
- * @return true if the user is a member of the group
+ * @return true if the group inherits the other group
+ * @throws NullPointerException if the group is null
+ * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
*/
boolean inheritsGroup(Group group);
/**
- * check to see if the group inherits a group on a specific server
+ * Check to see if the group inherits a group on a specific server
* @param group The group to check membership of
* @param server The server to check on
- * @return true if the group inherits the group
+ * @return true if the group inherits the group on the server
+ * @throws NullPointerException if the group or server is null
+ * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
+ * @throws IllegalArgumentException if the server is invalid
*/
boolean inheritsGroup(Group group, String server);
/**
- * check to see if the group inherits a group on a specific server
+ * Check to see if the group inherits a group on a specific server and world
* @param group The group to check membership of
* @param server The server to check on
* @param world The world to check on
- * @return true if the group inherits the group
+ * @return true if the group inherits the group on the server and world
+ * @throws NullPointerException if the group, server or world is null
+ * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
+ * @throws IllegalArgumentException if the server or world is invalid
*/
boolean inheritsGroup(Group group, String server, String world);
@@ -69,101 +74,134 @@ public interface Group extends PermissionHolder {
* Make this group inherit another group
* @param group the group to be inherited
* @throws ObjectAlreadyHasException if the group already inherits the group
+ * @throws NullPointerException if the group is null
+ * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
*/
void setInheritGroup(Group group) throws ObjectAlreadyHasException;
/**
* Make this group inherit another group on a specific server
* @param group the group to be inherited
- * @param server The server to add the group on
+ * @param server The server to inherit the group on
* @throws ObjectAlreadyHasException if the group already inherits the group on that server
+ * @throws NullPointerException if the group or server is null
+ * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
+ * @throws IllegalArgumentException if the server is invalid
*/
void setInheritGroup(Group group, String server) throws ObjectAlreadyHasException;
/**
- * Make this group inherit another group on a specific server
+ * Make this group inherit another group on a specific server and world
* @param group the group to be inherited
- * @param server The server to add the group on
- * @param world The world to add the group on
- * @throws ObjectAlreadyHasException if the group already inherits the group on that server
+ * @param server The server to inherit the group on
+ * @param world The world to inherit the group on
+ * @throws ObjectAlreadyHasException if the group already inherits the group on that server and world
+ * @throws NullPointerException if the group, server or world is null
+ * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
+ * @throws IllegalArgumentException if the server or world is invalid
*/
void setInheritGroup(Group group, String server, String world) throws ObjectAlreadyHasException;
/**
- * Make this group inherit another group on a specific server
+ * Make this group inherit another group temporarily
* @param group the group to be inherited
- * @param expireAt when the group should expire
- * @throws ObjectAlreadyHasException if the group already inherits the group on that server
+ * @param expireAt the unix time when the group should expire
+ * @throws ObjectAlreadyHasException if the group already inherits the group temporarily
+ * @throws NullPointerException if the group is null
+ * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
+ * @throws IllegalArgumentException if the expiry time is in the past
*/
void setInheritGroup(Group group, long expireAt) throws ObjectAlreadyHasException;
/**
- * Make this group inherit another group on a specific server
+ * Make this group inherit another group on a specific server temporarily
* @param group the group to be inherited
- * @param server The server to add the group on
+ * @param server The server inherit add the group on
* @param expireAt when the group should expire
- * @throws ObjectAlreadyHasException if the group already inherits the group on that server
+ * @throws ObjectAlreadyHasException if the group already inherits the group on that server temporarily
+ * @throws NullPointerException if the group or server is null
+ * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
+ * @throws IllegalArgumentException if the expiry time is in the past or the server is invalid
*/
void setInheritGroup(Group group, String server, long expireAt) throws ObjectAlreadyHasException;
/**
- * Make this group inherit another group on a specific server
+ * Make this group inherit another group on a specific server and world temporarily
* @param group the group to be inherited
- * @param server The server to add the group on
- * @param world The world to add the group on
+ * @param server The server to inherit the group on
+ * @param world The world to inherit the group on
* @param expireAt when the group should expire
- * @throws ObjectAlreadyHasException if the group already inherits the group on that server
+ * @throws ObjectAlreadyHasException if the group already inherits the group on that server and world temporarily
+ * @throws NullPointerException if the group, server or world is null
+ * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
+ * @throws IllegalArgumentException if the expiry time is in the past or the server/world is invalid
*/
void setInheritGroup(Group group, String server, String world, long expireAt) throws ObjectAlreadyHasException;
/**
- * Remove a previously set inheritance
+ * Remove a previously set inheritance rule
* @param group the group to uninherit
* @throws ObjectLacksException if the group does not already inherit the group
+ * @throws NullPointerException if the group is null
+ * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
*/
void unsetInheritGroup(Group group) throws ObjectLacksException;
/**
- * Remove a previously set inheritance
+ * Remove a previously set inheritance rule
* @param group the group to uninherit
* @param temporary if the group being removed is temporary
* @throws ObjectLacksException if the group does not already inherit the group
+ * @throws NullPointerException if the group is null
+ * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
*/
void unsetInheritGroup(Group group, boolean temporary) throws ObjectLacksException;
/**
- * Remove a previously set inheritance
+ * Remove a previously set inheritance rule on a specific server
* @param group the group to uninherit
* @param server The server to remove the group on
- * @throws ObjectLacksException if the group does not already inherit the group
+ * @throws ObjectLacksException if the group does not already inherit the group on that server
+ * @throws NullPointerException if the group or server is null
+ * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
+ * @throws IllegalArgumentException if the server is invalid
*/
void unsetInheritGroup(Group group, String server) throws ObjectLacksException;
/**
- * Remove a previously set inheritance
+ * Remove a previously set inheritance rule on a specific server and world
* @param group the group to uninherit
* @param server The server to remove the group on
* @param world The world to remove the group on
* @throws ObjectLacksException if the group does not already inherit the group
+ * @throws NullPointerException if the group, server or world is null
+ * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
+ * @throws IllegalArgumentException if the server or world is invalid
*/
void unsetInheritGroup(Group group, String server, String world) throws ObjectLacksException;
/**
- * Remove a previously set inheritance
+ * Remove a previously set inheritance rule on a specific server
* @param group the group to uninherit
* @param server The server to remove the group on
* @param temporary if the group being removed is temporary
* @throws ObjectLacksException if the group does not already inherit the group
+ * @throws NullPointerException if the group or server is null
+ * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
+ * @throws IllegalArgumentException if the expiry time is in the past or the server is invalid
*/
void unsetInheritGroup(Group group, String server, boolean temporary) throws ObjectLacksException;
/**
- * Remove a previously set inheritance
+ * Remove a previously set inheritance rule on a specific server and world
* @param group the group to uninherit
* @param server The server to remove the group on
* @param world The world to remove the group on
- * @param temporary if the group being removed is temporary
+ * @param temporary if the group being removed was set temporarily
* @throws ObjectLacksException if the group does not already inherit the group
+ * @throws NullPointerException if the group, server or world is null
+ * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
+ * @throws IllegalArgumentException if the expiry time is in the past or the server/world is invalid
*/
void unsetInheritGroup(Group group, String server, String world, boolean temporary) throws ObjectLacksException;
@@ -183,6 +221,8 @@ public interface Group extends PermissionHolder {
* @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
+ * @throws IllegalArgumentException if the server or world is invalid
*/
List The implementations of this interface limit access to the object and add parameter checks to further prevent
- * errors and ensure all API interactions to not damage the state of the object.
*/
@SuppressWarnings("unused")
public interface PermissionHolder {
+ /**
+ * @return the identifier for this object. either a uuid string or name
+ * However, you should really use {@link User#getUuid()}, {@link User#getName()} or {@link Group#getName()}
+ */
String getObjectName();
+ /**
+ * Gets an immutable Map of the objects permission nodes
+ * @return an immutable map of permissions
+ */
Map The implementations of this interface limit access to the Track and add parameter checks to further prevent
- * errors and ensure all API interactions to not damage the state of the track.
*/
@SuppressWarnings("unused")
public interface Track {
+ /**
+ * @return the name of this track
+ */
String getName();
/**
* Gets an ordered list of the groups on this track
- * @return am ordered {@link List} of the groups on this 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
*/
List The implementations of this interface limit access to the User and add parameter checks to further prevent
- * errors and ensure all API interactions to not damage the state of the user.
*/
@SuppressWarnings("unused")
public interface User extends PermissionHolder {
@@ -55,10 +52,12 @@ public interface User extends PermissionHolder {
/**
* Sets a users primary group
- * @param s the new primary group
+ * @param group the new primary group
* @throws ObjectAlreadyHasException if the user already has this set as their primary group
+ * @throws IllegalStateException if the user is not a member of that group
+ * @throws NullPointerException if the group is null
*/
- void setPrimaryGroup(String s) throws ObjectAlreadyHasException;
+ void setPrimaryGroup(String group) throws ObjectAlreadyHasException;
/**
* Refresh and re-assign the users permissions
@@ -69,6 +68,7 @@ public interface User extends PermissionHolder {
* Check to see if the user is a member of a group
* @param group The group to check membership of
* @return true if the user is a member of the group
+ * @throws NullPointerException if the group is null
*/
boolean isInGroup(Group group);
@@ -77,15 +77,19 @@ public interface User extends PermissionHolder {
* @param group The group to check membership of
* @param server The server to check on
* @return true if the user is a member of the group
+ * @throws NullPointerException if the group or server is null
+ * @throws IllegalArgumentException if the server is invalid
*/
boolean isInGroup(Group group, String server);
/**
- * Check to see if a user is a member of a group on a specific server
+ * Check to see if a user is a member of a group on a specific server and world
* @param group The group to check membership of
* @param server The server to check on
* @param world The world to check on
* @return true if the user is a member of the group
+ * @throws NullPointerException if the group, server or world is null
+ * @throws IllegalArgumentException if the server or world is invalid
*/
boolean isInGroup(Group group, String server, String world);
@@ -93,6 +97,8 @@ public interface User extends PermissionHolder {
* Add a user to a group
* @param group The group to add the user to
* @throws ObjectAlreadyHasException if the user is already a member of the group
+ * @throws NullPointerException if the group is null
+ * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
*/
void addGroup(Group group) throws ObjectAlreadyHasException;
@@ -101,42 +107,57 @@ public interface User extends PermissionHolder {
* @param group The group to add the user to
* @param server The server to add the group on
* @throws ObjectAlreadyHasException if the user is already a member of the group on that server
+ * @throws NullPointerException if the group or server is null
+ * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
+ * @throws IllegalArgumentException if the server is invalid
*/
void addGroup(Group group, String server) throws ObjectAlreadyHasException;
/**
- * Add a user to a group on a specific server
+ * Add a user to a group on a specific server and world
* @param group The group to add the user to
* @param server The server to add the group on
* @param world The world to add the group on
* @throws ObjectAlreadyHasException if the user is already a member of the group on that server
+ * @throws NullPointerException if the group, server or world is null
+ * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
+ * @throws IllegalArgumentException if the server or world is invalid
*/
void addGroup(Group group, String server, String world) throws ObjectAlreadyHasException;
/**
- * Add a user to a group on a specific server
+ * Add a user to a group temporarily on a specific server
* @param group The group to add the user to
* @param expireAt when the group should expire
* @throws ObjectAlreadyHasException if the user is already a member of the group on that server
+ * @throws NullPointerException if the group is null
+ * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
+ * @throws IllegalArgumentException if the expiry time is in the past
*/
void addGroup(Group group, long expireAt) throws ObjectAlreadyHasException;
/**
- * Add a user to a group on a specific server
+ * Add a user to a group temporarily on a specific server
* @param group The group to add the user to
* @param server The server to add the group on
* @param expireAt when the group should expire
* @throws ObjectAlreadyHasException if the user is already a member of the group on that server
+ * @throws NullPointerException if the group or server is null
+ * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
+ * @throws IllegalArgumentException if the expiry time is in the past or the server is invalid
*/
void addGroup(Group group, String server, long expireAt) throws ObjectAlreadyHasException;
/**
- * Add a user to a group on a specific server
+ * Add a user to a group temporarily on a specific server and world
* @param group The group to add the user to
* @param server The server to add the group on
* @param world The world to add the group on
* @param expireAt when the group should expire
* @throws ObjectAlreadyHasException if the user is already a member of the group on that server
+ * @throws NullPointerException if the group, server or world is null
+ * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
+ * @throws IllegalArgumentException if the expiry time is in the past or the server/world is invalid
*/
void addGroup(Group group, String server, String world, long expireAt) throws ObjectAlreadyHasException;
@@ -144,6 +165,8 @@ public interface User extends PermissionHolder {
* Remove the user from a group
* @param group the group to remove the user from
* @throws ObjectLacksException if the user isn't a member of the group
+ * @throws NullPointerException if the group is null
+ * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
*/
void removeGroup(Group group) throws ObjectLacksException;
@@ -152,42 +175,56 @@ public interface User extends PermissionHolder {
* @param group the group to remove the user from
* @param temporary if the group being removed is temporary
* @throws ObjectLacksException if the user isn't a member of the group
+ * @throws NullPointerException if the group is null
+ * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
*/
void removeGroup(Group group, boolean temporary) throws ObjectLacksException;
/**
- * Remove the user from a group
+ * Remove the user from a group on a specific server
* @param group The group to remove the user from
* @param server The server to remove the group on
* @throws ObjectLacksException if the user isn't a member of the group
+ * @throws NullPointerException if the group or server is null
+ * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
+ * @throws IllegalArgumentException if the server is invalid
*/
void removeGroup(Group group, String server) throws ObjectLacksException;
/**
- * Remove the user from a group
+ * Remove the user from a group on a specific server and world
* @param group The group to remove the user from
* @param server The server to remove the group on
* @param world The world to remove the group on
* @throws ObjectLacksException if the user isn't a member of the group
+ * @throws NullPointerException if the group, server or world is null
+ * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
+ * @throws IllegalArgumentException if the server or world is invalid
*/
void removeGroup(Group group, String server, String world) throws ObjectLacksException;
/**
- * Remove the user from a group
+ * Remove the user from a group on a specific server
* @param group The group to remove the user from
* @param server The server to remove the group on
* @param temporary if the group being removed is temporary
* @throws ObjectLacksException if the user isn't a member of the group
+ * @throws NullPointerException if the group or server is null
+ * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
+ * @throws IllegalArgumentException if the expiry time is in the past or the server is invalid
*/
void removeGroup(Group group, String server, boolean temporary) throws ObjectLacksException;
/**
- * Remove the user from a group
+ * Remove the user from a group on a specific server and world
* @param group The group to remove the user from
* @param server The server to remove the group on
* @param world The world to remove the group on
* @param temporary if the group being removed is temporary
* @throws ObjectLacksException if the user isn't a member of the group
+ * @throws NullPointerException if the group, server or world is null
+ * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
+ * @throws IllegalArgumentException if the expiry time is in the past or the server/world is invalid
*/
void removeGroup(Group group, String server, String world, boolean temporary) throws ObjectLacksException;
@@ -207,6 +244,8 @@ public interface User extends PermissionHolder {
* @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
+ * @throws IllegalArgumentException if the server or world is invalid
*/
List This event is fired before the player has actually joined the game on the async login / auth event.
* If you want to do something with the user, store the UUID in a set, and then check the set in the PlayerJoinEvent o.e.
*/
public class UserFirstLoginEvent extends LPEvent {
diff --git a/api/src/main/java/me/lucko/luckperms/api/event/events/UserPermissionRefreshEvent.java b/api/src/main/java/me/lucko/luckperms/api/event/events/UserPermissionRefreshEvent.java
index 60bb8cd8..4899aca6 100644
--- a/api/src/main/java/me/lucko/luckperms/api/event/events/UserPermissionRefreshEvent.java
+++ b/api/src/main/java/me/lucko/luckperms/api/event/events/UserPermissionRefreshEvent.java
@@ -25,6 +25,10 @@ package me.lucko.luckperms.api.event.events;
import me.lucko.luckperms.api.User;
import me.lucko.luckperms.api.event.UserEvent;
+/**
+ * Called after a user has their permissions refreshed.
+ * If you cache user permissions within your own plugin, it's a good idea to update said cache whenever this event is called.
+ */
public class UserPermissionRefreshEvent extends UserEvent {
public UserPermissionRefreshEvent(User user) {
diff --git a/api/src/main/java/me/lucko/luckperms/api/event/events/UserPromoteEvent.java b/api/src/main/java/me/lucko/luckperms/api/event/events/UserPromoteEvent.java
index 7bd38156..fa77972b 100644
--- a/api/src/main/java/me/lucko/luckperms/api/event/events/UserPromoteEvent.java
+++ b/api/src/main/java/me/lucko/luckperms/api/event/events/UserPromoteEvent.java
@@ -26,6 +26,9 @@ import me.lucko.luckperms.api.Track;
import me.lucko.luckperms.api.User;
import me.lucko.luckperms.api.event.TrackEvent;
+/**
+ * Called whenever a user is promoted up a track
+ */
public class UserPromoteEvent extends TrackEvent {
public UserPromoteEvent(Track track, User user, String from, String to) {
diff --git a/common/src/main/java/me/lucko/luckperms/api/implementation/internal/UserLink.java b/common/src/main/java/me/lucko/luckperms/api/implementation/internal/UserLink.java
index 313c12de..ec370fd2 100644
--- a/common/src/main/java/me/lucko/luckperms/api/implementation/internal/UserLink.java
+++ b/common/src/main/java/me/lucko/luckperms/api/implementation/internal/UserLink.java
@@ -66,7 +66,7 @@ public class UserLink extends PermissionHolderLink implements User {
}
@Override
- public void setPrimaryGroup(String s) throws ObjectAlreadyHasException {
+ public void setPrimaryGroup(@NonNull String s) throws ObjectAlreadyHasException {
if (getPrimaryGroup().equalsIgnoreCase(s)) {
throw new ObjectAlreadyHasException();
}
diff --git a/common/src/main/java/me/lucko/luckperms/api/implementation/internal/Utils.java b/common/src/main/java/me/lucko/luckperms/api/implementation/internal/Utils.java
index af67f2ff..e43a7c17 100644
--- a/common/src/main/java/me/lucko/luckperms/api/implementation/internal/Utils.java
+++ b/common/src/main/java/me/lucko/luckperms/api/implementation/internal/Utils.java
@@ -33,19 +33,19 @@ class Utils {
static void checkUser(User user) {
if (!(user instanceof UserLink)) {
- throw new IllegalArgumentException("User instance cannot be handled by this implementation.");
+ throw new IllegalStateException("User instance cannot be handled by this implementation.");
}
}
static void checkGroup(Group group) {
if (!(group instanceof GroupLink)) {
- throw new IllegalArgumentException("Group instance cannot be handled by this implementation.");
+ throw new IllegalStateException("Group instance cannot be handled by this implementation.");
}
}
static void checkTrack(Track track) {
if (!(track instanceof TrackLink)) {
- throw new IllegalArgumentException("Track instance cannot be handled by this implementation.");
+ throw new IllegalStateException("Track instance cannot be handled by this implementation.");
}
}
null
here, just input "null" as a string.)
+ * @return true if the operation completed successfully.
+ * @throws NullPointerException if uuid or username is null
+ * @throws IllegalArgumentException if either of the parameters are invalid
+ */
+ boolean loadOrCreateUser(UUID uuid, String username);
+
+ /**
+ * Loads a user from the datastore into the plugins internal storage.
+ * @param uuid the uuid of the user to load
+ * @return true if the user exists, and was loaded correctly.
+ * @throws NullPointerException if uuid is null
+ */
+ boolean loadUser(UUID uuid);
+
+ /**
+ * Saves a user object into the datastore. You should call this after you make any changes to a user.
+ * @param user the user to save
+ * @return true if the operation completed successfully.
+ * @throws NullPointerException if user is null
+ * @throws IllegalStateException if the user instance was not obtained from LuckPerms.
+ */
+ boolean saveUser(User user);
+
+ /**
+ * Creates and loads a group into the plugins internal storage
+ * @param name the name of the group
+ * @return true if the operation completed successfully
+ * @throws NullPointerException if name is null
+ * @throws IllegalArgumentException if the name is invalid
+ */
+ boolean createAndLoadGroup(String name);
+
+ /**
+ * Loads a group into the plugins internal storage.
+ * @param name the name of the group
+ * @return true if the operation completed successfully
+ * @throws NullPointerException if name is null
+ * @throws IllegalArgumentException if the name is invalid
+ */
+ boolean loadGroup(String name);
+
+ /**
+ * Loads all groups from the datastore into the plugins internal storage
+ * @return true if the operation completed successfully.
+ */
+ boolean loadAllGroups();
+
+ /**
+ * Saves a group back to the datastore. You should call this after you make any changes to a group.
+ * @param group the group to save
+ * @return true if the operation completed successfully.
+ * @throws NullPointerException if group is null
+ * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
+ */
+ boolean saveGroup(Group group);
+
+ /**
+ * Permanently deletes a group from the datastore
+ * @param group the group to delete
+ * @return true if the operation completed successfully.
+ * @throws NullPointerException if group is null
+ * @throws IllegalStateException if the group instance was not obtained from LuckPerms.
+ */
+ boolean deleteGroup(Group group);
+
+ /**
+ * Creates and loads a track into the plugins internal storage
+ * @param name the name of the track
+ * @return true if the operation completed successfully
+ * @throws NullPointerException if name is null
+ * @throws IllegalArgumentException if the name is invalid
+ */
+ boolean createAndLoadTrack(String name);
+
+ /**
+ * Loads a track into the plugins internal storage.
+ * @param name the name of the track
+ * @return true if the operation completed successfully
+ * @throws NullPointerException if name is null
+ * @throws IllegalArgumentException if the name is invalid
+ */
+ boolean loadTrack(String name);
+
+ /**
+ * Loads all tracks from the datastore into the plugins internal storage
+ * @return true if the operation completed successfully.
+ */
+ boolean loadAllTracks();
+
+ /**
+ * Saves a track back to the datastore. You should call this after you make any changes to a track.
+ * @param track the track to save
+ * @return true if the operation completed successfully.
+ * @throws NullPointerException if track is null
+ * @throws IllegalStateException if the track instance was not obtained from LuckPerms.
+ */
+ boolean saveTrack(Track track);
+
+ /**
+ * Permanently deletes a track from the datastore
+ * @param track the track to delete
+ * @return true if the operation completed successfully.
+ * @throws NullPointerException if track is null
+ * @throws IllegalStateException if the track instance was not obtained from LuckPerms.
+ */
+ boolean deleteTrack(Track track);
+
+ /**
+ * Saves UUID caching data to the datastore
+ * @param username the users username
+ * @param uuid the users mojang unique id
+ * @return true if the operation completed successfully.
+ * @throws NullPointerException if either parameters are null
+ * @throws IllegalArgumentException if the username is invalid
+ */
+ boolean saveUUIDData(String username, UUID uuid);
+
+ /**
+ * Gets a UUID from a username
+ * @param username the corresponding username
+ * @return a uuid object, could be null
+ * @throws NullPointerException if either parameters are null
+ * @throws IllegalArgumentException if the username is invalid
+ */
+ UUID getUUID(String username);
+ }
+
+ /**
+ * All operations through this interface are called in a new, separate asynchronous thread.
+ * When the operation is complete, the provided callback method is called, in applicable, in the main server thread.
+ *
+ * See {@link Sync} for method documentation.
+ */
interface Async {
void logAction(LogEntry entry, Callback