More progress towards 1.6: implement PermissionService

This commit is contained in:
Luck
2016-08-28 14:57:03 +01:00
Unverified
parent 2a305b1c55
commit a3ebf86f6b
14 changed files with 1091 additions and 583 deletions
@@ -180,6 +180,7 @@ public interface LuckPermsApi {
* @param permission the main permission node to build
* @return a {@link Node.Builder} instance
* @throws IllegalArgumentException if the permission is invalid
* @since 1.6
*/
Node.Builder buildNode(String permission) throws IllegalArgumentException;
@@ -29,6 +29,8 @@ import java.util.Optional;
/**
* Represents an immutable node object
* <p> Use {@link LuckPermsApi#buildNode(String)} to get an instance.
* @since 1.6
*/
public interface Node extends Map.Entry<String, Boolean> {
@@ -201,6 +203,42 @@ public interface Node extends Map.Entry<String, Boolean> {
*/
int getWildcardLevel();
/**
* @return true if this node is a meta node
*/
boolean isMeta();
/**
* Gets the meta value from this node
* @return the meta value
* @throws IllegalStateException if this node is not a meta node
*/
Map.Entry<String, String> getMeta();
/**
* @return true if this node is a prefix node
*/
boolean isPrefix();
/**
* Gets the prefix value from this node
* @return the prefix value
* @throws IllegalStateException if this node is a not a prefix node
*/
Map.Entry<Integer, String> getPrefix();
/**
* @return true if this node is a suffix node
*/
boolean isSuffix();
/**
* Gets the suffix value from this node
* @return the suffix value
* @throws IllegalStateException if this node is a not a suffix node
*/
Map.Entry<Integer, String> getSuffix();
/**
* Similar to {@link #equals(Object)}, except doesn't take note of the value
* @param node the other node
@@ -229,6 +267,8 @@ public interface Node extends Map.Entry<String, Boolean> {
Builder setWorld(String world);
Builder setServer(String server) throws IllegalArgumentException;
Builder withExtraContext(String key, String value);
Builder withExtraContext(Map<String, String> map);
Builder withExtraContext(Map.Entry<String, String> entry);
Node build();
}
@@ -31,7 +31,7 @@ import java.util.Set;
import java.util.SortedSet;
/**
* Wrapper interface for internal PermissionHolder (object/group) instances
* Wrapper interface for internal PermissionHolder (user/group) instances
*/
@SuppressWarnings("unused")
public interface PermissionHolder {
@@ -260,11 +260,10 @@ public interface PermissionHolder {
* Whenever a user logs out of the server, or the server restarts, this permission will disappear.
* It is never saved to the datastore, and therefore will not apply on other servers.
*
* This is useful if you want to temporarily set a permission for a user while they're online, but don't
* <p> This is useful if you want to temporarily set a permission for a user while they're online, but don't
* want it to persist, and have to worry about removing it when they log out.
*
* For unsetting a transient permission, see {@link #unsetTransientPermission(Node)}
*
* <p> For unsetting a transient permission, see {@link #unsetTransientPermission(Node)}
* @param node The node to be set
* @throws ObjectAlreadyHasException if the object already has the permission
* @throws NullPointerException if the node is null
@@ -26,7 +26,7 @@ import java.util.function.Consumer;
/**
* A callback used to wait for the completion of asynchronous operations.
* All callbacks are ran on the main Bukkit server thread.
* All callbacks are ran on the main server thread.
* @param <T> the return type
*/
public interface Callback<T> {