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

Complete refactor of permissions/nodes. progress towards 1.6

This commit is contained in:
Luck
2016-08-27 00:32:39 +01:00
parent c4497db06c
commit edaf174ebf
33 changed files with 1477 additions and 800 deletions

View File

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

View File

@@ -43,12 +43,16 @@ public interface LPConfiguration {
/**
* @return the default group, in a node representation
* @deprecated as of 1.6, the default group is always "default"
*/
@Deprecated
String getDefaultGroupNode();
/**
* @return the name of the default group
* @deprecated as of 1.6, the default group is always "default"
*/
@Deprecated
String getDefaultGroupName();
/**

View File

@@ -175,4 +175,12 @@ public interface LuckPermsApi {
*/
boolean isTrackLoaded(String name);
/**
* Returns a permission builder instance
* @param permission the main permission node to build
* @return a {@link Node.Builder} instance
* @throws IllegalArgumentException if the permission is invalid
*/
Node.Builder buildNode(String permission) throws IllegalArgumentException;
}

View File

@@ -0,0 +1,209 @@
/*
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
*
* 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;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Optional;
/**
* Represents an immutable node object
*/
public interface Node extends Map.Entry<String, Boolean> {
/**
* @return the actual permission node
*/
String getPermission();
/**
* Get what value the permission is set to. A negated node would return <code>false</code>.
* @return the permission's value
*/
@Override
Boolean getValue();
/**
* @return true if the node is negated
*/
boolean isNegated();
/**
* Gets the server this node applies on, if the node is server specific
* @return an {@link Optional} containing the server, if one is defined
*/
Optional<String> getServer();
/**
* Gets the world this node applies on, if the node is world specific
* @return an {@link Optional} containing the world, if one is defined
*/
Optional<String> getWorld();
/**
* @return true if this node is server specific
*/
boolean isServerSpecific();
/**
* @return true if this node is server specific
*/
boolean isWorldSpecific();
/**
* If this node should apply on a specific server
* @param server the name of the server
* @param includeGlobal if global permissions should apply
* @param applyRegex if regex should be applied
* @return true if the node should apply
*/
boolean shouldApplyOnServer(String server, boolean includeGlobal, boolean applyRegex);
/**
* If this node should apply on a specific world
* @param world the name of the world
* @param includeGlobal if global permissions should apply
* @param applyRegex if regex should be applied
* @return true if the node should apply
*/
boolean shouldApplyOnWorld(String world, boolean includeGlobal, boolean applyRegex);
/**
* If this node should apply given the specific context
* @param context the context key value pairs
* @return true if the node should apply
*/
boolean shouldApplyWithContext(Map<String, String> context);
/**
* Similar to {@link #shouldApplyOnServer(String, boolean, boolean)}, except this method accepts a List
* @param servers the list of servers
* @param includeGlobal if global permissions should apply
* @return true if the node should apply
*/
boolean shouldApplyOnAnyServers(List<String> servers, boolean includeGlobal);
/**
* Similar to {@link #shouldApplyOnWorld(String, boolean, boolean)}, except this method accepts a List
* @param worlds the list of world
* @param includeGlobal if global permissions should apply
* @return true if the node should apply
*/
boolean shouldApplyOnAnyWorlds(List<String> worlds, boolean includeGlobal);
/**
* Resolves a list of wildcards that match this node
* @param possibleNodes a list of possible permission nodes
* @return a list of permissions that match this wildcard
*/
List<String> resolveWildcard(List<String> possibleNodes);
/**
* Resolves any shorthand parts of this node and returns the full list
* @return a list of full nodes
*/
List<String> resolveShorthand();
/**
* @return true if this node will expire in the future
*/
boolean isTemporary();
/**
* @return true if this node will not expire
*/
boolean isPermanent();
/**
* @return the time in Unix time when this node will expire
*/
long getExpiryUnixTime();
/**
* @return the {@link Date} when this node will expire
*/
Date getExpiry();
/**
* @return the number of seconds until this permission will expire
*/
long getSecondsTilExpiry();
/**
* @return true if this node has expired
*/
boolean hasExpired();
/**
* @return the extra contexts required for this node to apply
*/
Map<String, String> getExtraContexts();
/**
* Converts this node into a serialized form
* @return a serialized node string
*/
String toSerializedNode();
/**
* @return true if this is a group node
*/
boolean isGroupNode();
/**
* @return the name of the group
* @throws IllegalStateException if this is not a group node. See {@link #isGroupNode()}
*/
String getGroupName();
/**
* @return true is this node is a wildcard node
*/
boolean isWildcard();
/**
* Gets the level of this wildcard, higher is more specific
* @return the wildcard level
* @throws IllegalStateException if this is not a wildcard
*/
int getWildcardLevel();
/**
* Similar to {@link #equals(Object)}, except doesn't take note of the expiry time or value
* @param node the other node
* @return true if the two nodes are almost equal
*/
boolean almostEquals(Node node);
interface Builder {
Builder setNegated(boolean negated);
Builder setValue(boolean value);
Builder setExpiry(long expireAt);
Builder setWorld(String world);
Builder setServer(String server) throws IllegalArgumentException;
Builder withExtraContext(String key, String value);
Node build();
}
}

View File

@@ -27,33 +27,61 @@ import me.lucko.luckperms.exceptions.ObjectLacksException;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* Wrapper interface for internal PermissionHolder (user/group) instances
* Wrapper interface for internal PermissionHolder (object/group) instances
*/
@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()}
* However, you should really just use {@link User#getUuid()}, {@link User#getName()} or {@link Group#getName()}
*/
String getObjectName();
/**
* Gets an immutable Set of the objects permission nodes
* @return an immutable set of permissions
* @since 1.6
*/
Set<Node> getPermissionNodes();
/**
* Gets an immutable set of the nodes that this object has and inherits
* @return an immutable set of permissions
* @since 1.6
*/
Set<Node> getAllNodes();
/**
* Gets an immutable Map of the objects permission nodes
* @return an immutable map of permissions
* @deprecated in favour of {@link #getPermissionNodes()}
*/
@Deprecated
Map<String, Boolean> getNodes();
/**
* Checks to see if the object has a certain permission
* @param node the node to check for
* @return true if the object has the permission
* @throws NullPointerException if the node is null
* @since 1.6
*/
boolean hasPermission(Node node);
/**
* Checks to see if the object has a certain permission
* @param node The permission node
* @param b If the node is true/false(negated)
* @return true if the user has the permission
* @return true if the object has the permission
* @throws NullPointerException if the node is null
* @throws IllegalArgumentException if the node is invalid
* @deprecated in favour of {@link #hasPermission(Node)}
*/
@Deprecated
boolean hasPermission(String node, boolean b);
/**
@@ -61,10 +89,12 @@ public interface PermissionHolder {
* @param node The permission node
* @param b If the node is true/false(negated)
* @param server The server
* @return true if the user has the permission
* @return true if the object has the permission
* @throws NullPointerException if the node or server is null
* @throws IllegalArgumentException if the node or server is invalid
* @deprecated in favour of {@link #hasPermission(Node)}
*/
@Deprecated
boolean hasPermission(String node, boolean b, String server);
/**
@@ -73,10 +103,12 @@ public interface PermissionHolder {
* @param b If the node is true/false(negated)
* @param server The server
* @param world The world
* @return true if the user has the permission
* @return true if the object has the permission
* @throws NullPointerException if the node, server or world is null
* @throws IllegalArgumentException if the node, server or world is invalid
* @deprecated in favour of {@link #hasPermission(Node)}
*/
@Deprecated
boolean hasPermission(String node, boolean b, String server, String world);
/**
@@ -84,10 +116,12 @@ public interface PermissionHolder {
* @param node The permission node
* @param b If the node is true/false(negated)
* @param temporary if the permission is temporary
* @return true if the user has the permission
* @return true if the object has the permission
* @throws NullPointerException if the node is null
* @throws IllegalArgumentException if the node is invalid
* @deprecated in favour of {@link #hasPermission(Node)}
*/
@Deprecated
boolean hasPermission(String node, boolean b, boolean temporary);
/**
@@ -96,10 +130,12 @@ public interface PermissionHolder {
* @param b If the node is true/false(negated)
* @param server The server to check on
* @param temporary if the permission is temporary
* @return true if the user has the permission
* @return true if the object has the permission
* @throws NullPointerException if the node or server is null
* @throws IllegalArgumentException if the node or server is invalid
* @deprecated in favour of {@link #hasPermission(Node)}
*/
@Deprecated
boolean hasPermission(String node, boolean b, String server, boolean temporary);
/**
@@ -109,20 +145,33 @@ public interface PermissionHolder {
* @param server The server to check on
* @param world The world to check on
* @param temporary if the permission is temporary
* @return true if the user has the permission
* @return true if the object has the permission
* @throws NullPointerException if the node, server or world is null
* @throws IllegalArgumentException if the node, server or world is invalud
* @throws IllegalArgumentException if the node, server or world is invalid
* @deprecated in favour of {@link #hasPermission(Node)}
*/
@Deprecated
boolean hasPermission(String node, boolean b, String server, String world, boolean temporary);
/**
* Cheks to see if the object inherits a certain permission
* @param node the node to check for
* @return true if the object inherits the permission
* @throws NullPointerException if the node is null
* @since 1.6
*/
boolean inheritsPermission(Node node);
/**
* Checks to see if the object inherits a certain permission
* @param node The permission node
* @param b If the node is true/false(negated)
* @return true if the user inherits the permission
* @return true if the object inherits the permission
* @throws NullPointerException if the node is null
* @throws IllegalArgumentException if the node is invalid
* @deprecated in favour of {@link #inheritsPermission(Node)}
*/
@Deprecated
boolean inheritsPermission(String node, boolean b);
/**
@@ -130,10 +179,12 @@ public interface PermissionHolder {
* @param node The permission node
* @param b If the node is true/false(negated)
* @param server The server
* @return true if the user inherits the permission
* @return true if the object inherits the permission
* @throws NullPointerException if the node or server is null
* @throws IllegalArgumentException if the node or server is invalid
* @deprecated in favour of {@link #inheritsPermission(Node)}
*/
@Deprecated
boolean inheritsPermission(String node, boolean b, String server);
/**
@@ -142,10 +193,12 @@ public interface PermissionHolder {
* @param b If the node is true/false(negated)
* @param server The server
* @param world The world
* @return true if the user inherits the permission
* @return true if the object inherits the permission
* @throws NullPointerException if the node, server or world is null
* @throws IllegalArgumentException if the node server or world is invalid
* @deprecated in favour of {@link #inheritsPermission(Node)}
*/
@Deprecated
boolean inheritsPermission(String node, boolean b, String server, String world);
/**
@@ -153,10 +206,12 @@ public interface PermissionHolder {
* @param node The permission node
* @param b If the node is true/false(negated)
* @param temporary if the permission is temporary
* @return true if the user inherits the permission
* @return true if the object inherits the permission
* @throws NullPointerException if the node is null
* @throws IllegalArgumentException if the node is invalid
* @deprecated in favour of {@link #inheritsPermission(Node)}
*/
@Deprecated
boolean inheritsPermission(String node, boolean b, boolean temporary);
/**
@@ -165,10 +220,12 @@ public interface PermissionHolder {
* @param b If the node is true/false(negated)
* @param server The server
* @param temporary if the permission is temporary
* @return true if the user inherits the permission
* @return true if the object inherits the permission
* @throws NullPointerException if the node or server is null
* @throws IllegalArgumentException if the node or server is invalid
* @deprecated in favour of {@link #inheritsPermission(Node)}
*/
@Deprecated
boolean inheritsPermission(String node, boolean b, String server, boolean temporary);
/**
@@ -178,12 +235,23 @@ public interface PermissionHolder {
* @param server The server
* @param world The world
* @param temporary if the permission is temporary
* @return true if the user inherits the permission
* @return true if the object inherits the permission
* @throws NullPointerException if the node, server or world is null
* @throws IllegalArgumentException if the node, server or world if invalid
* @deprecated in favour of {@link #inheritsPermission(Node)}
*/
@Deprecated
boolean inheritsPermission(String node, boolean b, String server, String world, boolean temporary);
/**
* Sets a permission for the object
* @param node The node to be set
* @throws ObjectAlreadyHasException if the object already has the permission
* @throws NullPointerException if the node is null
* @since 1.6
*/
void setPermission(Node node) throws ObjectAlreadyHasException;
/**
* Sets a permission for the object
* @param node The node to be set
@@ -191,7 +259,9 @@ public interface PermissionHolder {
* @throws ObjectAlreadyHasException if the object already has the permission
* @throws NullPointerException if the node is null
* @throws IllegalArgumentException if the node is invalid
* @deprecated in favour of {@link #setPermission(Node)}
*/
@Deprecated
void setPermission(String node, boolean value) throws ObjectAlreadyHasException;
/**
@@ -202,7 +272,9 @@ public interface PermissionHolder {
* @throws ObjectAlreadyHasException if the object already has the permission
* @throws NullPointerException if the node or server is null
* @throws IllegalArgumentException if the node or server is invalid
* @deprecated in favour of {@link #setPermission(Node)}
*/
@Deprecated
void setPermission(String node, boolean value, String server) throws ObjectAlreadyHasException;
/**
@@ -214,7 +286,9 @@ public interface PermissionHolder {
* @throws ObjectAlreadyHasException if the object already has the permission
* @throws NullPointerException if the node, server or world is null
* @throws IllegalArgumentException if the node, server or world is invalid
* @deprecated in favour of {@link #setPermission(Node)}
*/
@Deprecated
void setPermission(String node, boolean value, String server, String world) throws ObjectAlreadyHasException;
/**
@@ -225,7 +299,9 @@ public interface PermissionHolder {
* @throws ObjectAlreadyHasException if the object already has the permission
* @throws NullPointerException if the node is null
* @throws IllegalArgumentException if the node is invalid or if the expiry time is in the past
* @deprecated in favour of {@link #setPermission(Node)}
*/
@Deprecated
void setPermission(String node, boolean value, long expireAt) throws ObjectAlreadyHasException;
/**
@@ -237,7 +313,9 @@ public interface PermissionHolder {
* @throws ObjectAlreadyHasException if the object already has the permission
* @throws NullPointerException if the node or server is null
* @throws IllegalArgumentException if the node/server is invalid or if the expiry time is in the past
* @deprecated in favour of {@link #setPermission(Node)}
*/
@Deprecated
void setPermission(String node, boolean value, String server, long expireAt) throws ObjectAlreadyHasException;
/**
@@ -250,9 +328,20 @@ public interface PermissionHolder {
* @throws ObjectAlreadyHasException if the object already has the permission
* @throws NullPointerException if the node, server or world is null
* @throws IllegalArgumentException if the node/server/world is invalid, or if the expiry time is in the past
* @deprecated in favour of {@link #setPermission(Node)}
*/
@Deprecated
void setPermission(String node, boolean value, String server, String world, long expireAt) throws ObjectAlreadyHasException;
/**
* Unsets a permission for the object
* @param node The node to be unset
* @throws ObjectLacksException if the node wasn't already set
* @throws NullPointerException if the node is null
* @since 1.6
*/
void unsetPermission(Node node) throws ObjectLacksException;
/**
* Unsets a permission for the object
* @param node The node to be unset
@@ -260,7 +349,9 @@ public interface PermissionHolder {
* @throws ObjectLacksException if the node wasn't already set
* @throws NullPointerException if the node is null
* @throws IllegalArgumentException if the node is invalid
* @deprecated in favour of {@link #unsetPermission(Node)}
*/
@Deprecated
void unsetPermission(String node, boolean temporary) throws ObjectLacksException;
/**
@@ -269,7 +360,9 @@ public interface PermissionHolder {
* @throws ObjectLacksException if the node wasn't already set
* @throws NullPointerException if the node is null
* @throws IllegalArgumentException if the node is invalid
* @deprecated in favour of {@link #unsetPermission(Node)}
*/
@Deprecated
void unsetPermission(String node) throws ObjectLacksException;
/**
@@ -279,7 +372,9 @@ public interface PermissionHolder {
* @throws ObjectLacksException if the node wasn't already set
* @throws NullPointerException if the node or server is null
* @throws IllegalArgumentException if the node or server is invalid
* @deprecated in favour of {@link #unsetPermission(Node)}
*/
@Deprecated
void unsetPermission(String node, String server) throws ObjectLacksException;
/**
@@ -290,7 +385,9 @@ public interface PermissionHolder {
* @throws ObjectLacksException if the node wasn't already set
* @throws NullPointerException if the node, server or world is null
* @throws IllegalArgumentException if the node, server or world is invalid
* @deprecated in favour of {@link #unsetPermission(Node)}
*/
@Deprecated
void unsetPermission(String node, String server, String world) throws ObjectLacksException;
/**
@@ -301,7 +398,9 @@ public interface PermissionHolder {
* @throws ObjectLacksException if the node wasn't already set
* @throws NullPointerException if the node or server is null
* @throws IllegalArgumentException if the node or server is invalid
* @deprecated in favour of {@link #unsetPermission(Node)}
*/
@Deprecated
void unsetPermission(String node, String server, boolean temporary) throws ObjectLacksException;
/**
@@ -313,7 +412,9 @@ public interface PermissionHolder {
* @throws ObjectLacksException if the node wasn't already set
* @throws NullPointerException if the node, server or world is null
* @throws IllegalArgumentException if the node, server or world is invalid
* @deprecated in favour of {@link #unsetPermission(Node)}
*/
@Deprecated
void unsetPermission(String node, String server, String world, boolean temporary) throws ObjectLacksException;
/**
@@ -323,7 +424,9 @@ public interface PermissionHolder {
* @param excludedGroups Groups that shouldn't be inherited (to prevent circular inheritance issues)
* @param possibleNodes A list of possible permission nodes for wildcard permission handling
* @return a {@link Map} of the permissions
* @deprecated in favour of {@link #getPermissions(String, String, Map, boolean, List, boolean)}
*/
@Deprecated
Map<String, Boolean> getLocalPermissions(String server, String world, List<String> excludedGroups, List<String> possibleNodes);
/**
@@ -332,7 +435,9 @@ public interface PermissionHolder {
* @param world The world to get nodes for
* @param excludedGroups Groups that shouldn't be inherited (to prevent circular inheritance issues)
* @return a {@link Map} of the permissions
* @deprecated in favour of {@link #getPermissions(String, String, Map, boolean, List, boolean)}
*/
@Deprecated
Map<String, Boolean> getLocalPermissions(String server, String world, List<String> excludedGroups);
/**
@@ -341,7 +446,9 @@ public interface PermissionHolder {
* @param excludedGroups Groups that shouldn't be inherited (to prevent circular inheritance issues)
* @param possibleNodes A list of possible permission nodes for wildcard permission handling
* @return a {@link Map} of the permissions
* @deprecated in favour of {@link #getPermissions(String, String, Map, boolean, List, boolean)}
*/
@Deprecated
Map<String, Boolean> getLocalPermissions(String server, List<String> excludedGroups, List<String> possibleNodes);
/**
@@ -349,21 +456,54 @@ public interface PermissionHolder {
* @param server The server to get nodes for
* @param excludedGroups Groups that shouldn't be inherited (to prevent circular inheritance issues)
* @return a {@link Map} of the permissions
* @deprecated in favour of {@link #getPermissions(String, String, Map, boolean, List, boolean)}
*/
@Deprecated
Map<String, Boolean> getLocalPermissions(String server, List<String> excludedGroups);
/**
* Convert the holders nodes into a Map of permissions to be applied on the platform
* @param server the server
* @param world the world
* @param extraContext any extra context to filter by
* @param includeGlobal whether to include global nodes
* @param possibleNodes a list of possible permissions for resolving wildcards
* @param applyGroups if inherited group permissions should be included
* @return a map of permissions
* @since 1.6
*/
Map<String, Boolean> getPermissions(String server, String world, Map<String, String> extraContext, boolean includeGlobal, List<String> possibleNodes, boolean applyGroups);
/**
* Processes the nodes and returns the temporary ones.
* @return a map of temporary nodes
* @deprecated in favour of {@link #getTemporaryPermissionNodes()}
*/
@Deprecated
Map<Map.Entry<String, Boolean>, Long> getTemporaryNodes();
/**
* Processes the nodes and returns the temporary ones.
* @return a set of temporary nodes
* @since 1.6
*/
Set<Node> getTemporaryPermissionNodes();
/**
* Processes the nodes and returns the non-temporary ones.
* @return a map of permanent nodes
* @deprecated in favour of {@link #getPermanentPermissionNodes()}
*/
@Deprecated
Map<String, Boolean> getPermanentNodes();
/**
* Processes the nodes and returns the non-temporary ones.
* @return a set of permanent nodes
* @since 1.6
*/
Set<Node> getPermanentPermissionNodes();
/**
* Removes temporary permissions that have expired
*/

View File

@@ -0,0 +1,43 @@
/*
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
*
* 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.event;
import me.lucko.luckperms.api.Node;
import me.lucko.luckperms.api.PermissionHolder;
/**
* @since 1.6
*/
public class AbstractPermissionEvent extends TargetedEvent<PermissionHolder> {
private final Node node;
protected AbstractPermissionEvent(String eventName, PermissionHolder target, Node node) {
super(eventName, target);
this.node = node;
}
public Node getNode() {
return node;
}
}

View File

@@ -27,7 +27,9 @@ import me.lucko.luckperms.api.event.TargetedEvent;
/**
* Called when a permission expires for an object.
* @deprecated in favour of {@link PermissionNodeExpireEvent}
*/
@Deprecated
public class PermissionExpireEvent extends TargetedEvent<PermissionHolder> {
private final String node;

View File

@@ -0,0 +1,37 @@
/*
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
*
* 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.event.events;
import me.lucko.luckperms.api.Node;
import me.lucko.luckperms.api.PermissionHolder;
import me.lucko.luckperms.api.event.AbstractPermissionEvent;
/**
* Called when a temporary permission node expires
* @since 1.6
*/
public class PermissionNodeExpireEvent extends AbstractPermissionEvent {
public PermissionNodeExpireEvent(PermissionHolder target, Node node) {
super("Permission Node Expire Event", target, node);
}
}

View File

@@ -0,0 +1,37 @@
/*
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
*
* 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.event.events;
import me.lucko.luckperms.api.Node;
import me.lucko.luckperms.api.PermissionHolder;
import me.lucko.luckperms.api.event.AbstractPermissionEvent;
/**
* Called when a permission node is set on a holder
* @since 1.6
*/
public class PermissionNodeSetEvent extends AbstractPermissionEvent {
public PermissionNodeSetEvent(PermissionHolder target, Node node) {
super("Permission Node Set Event", target, node);
}
}

View File

@@ -0,0 +1,37 @@
/*
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
*
* 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.event.events;
import me.lucko.luckperms.api.Node;
import me.lucko.luckperms.api.PermissionHolder;
import me.lucko.luckperms.api.event.AbstractPermissionEvent;
/**
* Called when a permission node is unset from a holder
* @since 1.6
*/
public class PermissionNodeUnsetEvent extends AbstractPermissionEvent {
public PermissionNodeUnsetEvent(PermissionHolder target, Node node) {
super("Permission Node Unset Event", target, node);
}
}

View File

@@ -30,7 +30,9 @@ import java.util.Map;
/**
* Called whenever a user or group has a permission set.
* @deprecated in favour of {@link PermissionNodeSetEvent}
*/
@Deprecated
public class PermissionSetEvent extends AbstractPermissionAddEvent {
private final String node;

View File

@@ -27,7 +27,9 @@ import me.lucko.luckperms.api.event.AbstractPermissionRemoveEvent;
/**
* Called whenever a user or group has a permission unset.
* @deprecated in favour of {@link PermissionNodeUnsetEvent}
*/
@Deprecated
public class PermissionUnsetEvent extends AbstractPermissionRemoveEvent {
private final String node;