NonNull annotations should be on the same line in interfaces

This commit is contained in:
Luck
2018-09-19 21:12:54 +01:00
Unverified
parent 3941c77826
commit 75f0f40d70
84 changed files with 404 additions and 781 deletions
@@ -49,8 +49,7 @@ public interface ActionLogger {
* @return a log instance
* @see Storage#getLog()
*/
@NonNull
CompletableFuture<Log> getLog();
@NonNull CompletableFuture<Log> getLog();
/**
* Submits a log entry to the plugin to be handled.
@@ -68,8 +67,7 @@ public interface ActionLogger {
* @param entry the entry to submit
* @return a future which will complete when the action is done
*/
@NonNull
CompletableFuture<Void> submit(@NonNull LogEntry entry);
@NonNull CompletableFuture<Void> submit(@NonNull LogEntry entry);
/**
* Submits a log entry to the plugins storage handler.
@@ -79,8 +77,7 @@ public interface ActionLogger {
* @param entry the entry to submit
* @return a future which will complete when the action is done
*/
@NonNull
CompletableFuture<Void> submitToStorage(@NonNull LogEntry entry);
@NonNull CompletableFuture<Void> submitToStorage(@NonNull LogEntry entry);
/**
* Submits a log entry to the plugins log broadcasting handler.
@@ -91,7 +88,6 @@ public interface ActionLogger {
* @param entry the entry to submit
* @return a future which will complete when the action is done
*/
@NonNull
CompletableFuture<Void> broadcastAction(@NonNull LogEntry entry);
@NonNull CompletableFuture<Void> broadcastAction(@NonNull LogEntry entry);
}
@@ -41,8 +41,7 @@ public interface DemotionResult extends MutateResult {
*
* @return the status
*/
@NonNull
Status getStatus();
@NonNull Status getStatus();
@Override
default boolean wasSuccess() {
@@ -60,8 +59,7 @@ public interface DemotionResult extends MutateResult {
*
* @return the group the user was demoted from.
*/
@NonNull
Optional<String> getGroupFrom();
@NonNull Optional<String> getGroupFrom();
/**
* Gets the name of the group the user was demoted from, if applicable.
@@ -71,8 +69,7 @@ public interface DemotionResult extends MutateResult {
*
* @return the group the user was demoted to.
*/
@NonNull
Optional<String> getGroupTo();
@NonNull Optional<String> getGroupTo();
/**
* The result status
@@ -49,24 +49,21 @@ public interface Entity {
*
* @return the uuid of the object, if available
*/
@Nullable
UUID getUniqueId();
@Nullable UUID getUniqueId();
/**
* Gets the name of the object
*
* @return the object name
*/
@NonNull
String getName();
@NonNull String getName();
/**
* Gets the entities type.
*
* @return the type
*/
@NonNull
Type getType();
@NonNull Type getType();
/**
* The different types of {@link Entity}
@@ -43,8 +43,7 @@ public interface Group extends PermissionHolder {
*
* @return the name of the group
*/
@NonNull
String getName();
@NonNull String getName();
/**
* Gets the groups "display name", if it has one that differs from it's actual name.
@@ -57,8 +56,7 @@ public interface Group extends PermissionHolder {
* @return the display name
* @since 4.3
*/
@Nullable
String getDisplayName();
@Nullable String getDisplayName();
/**
* Gets the groups "display name", if it has one that differs from it's actual name.
@@ -70,8 +68,7 @@ public interface Group extends PermissionHolder {
* @return the display name
* @since 4.3
*/
@Nullable
String getDisplayName(@NonNull ContextSet contextSet);
@Nullable String getDisplayName(@NonNull ContextSet contextSet);
/**
* Gets the weight of this group, if present.
@@ -79,8 +76,7 @@ public interface Group extends PermissionHolder {
* @return the group weight
* @since 2.17
*/
@NonNull
OptionalInt getWeight();
@NonNull OptionalInt getWeight();
/**
* Gets the groups's {@link GroupData} cache.
@@ -88,8 +84,7 @@ public interface Group extends PermissionHolder {
* @return the groups cached data.
* @since 4.0
*/
@NonNull
@Override
GroupData getCachedData();
@NonNull GroupData getCachedData();
}
@@ -45,16 +45,14 @@ public interface HeldPermission<T> {
*
* @return the holder
*/
@NonNull
T getHolder();
@NonNull T getHolder();
/**
* Gets the permission being held
*
* @return the permission
*/
@NonNull
String getPermission();
@NonNull String getPermission();
/**
* Gets the value of the permission
@@ -68,16 +66,14 @@ public interface HeldPermission<T> {
*
* @return the server
*/
@NonNull
Optional<String> getServer();
@NonNull Optional<String> getServer();
/**
* Gets the world where the permission is held
*
* @return the world
*/
@NonNull
Optional<String> getWorld();
@NonNull Optional<String> getWorld();
/**
* Gets the time in unix time when the permission will expire
@@ -98,7 +94,6 @@ public interface HeldPermission<T> {
*
* @return a Node copy of this permission
*/
@NonNull
Node asNode();
@NonNull Node asNode();
}
@@ -39,8 +39,7 @@ public interface LPConfiguration {
*
* @return the name of this server
*/
@NonNull
String getServer();
@NonNull String getServer();
/**
* Gets if the users on this server will have their global permissions applied
@@ -78,8 +77,7 @@ public interface LPConfiguration {
*
* @return the storage method string from the configuration
*/
@NonNull
String getStorageMethod();
@NonNull String getStorageMethod();
/**
* Gets true if split storage is enabled
@@ -96,11 +94,9 @@ public interface LPConfiguration {
* method. For example: key = user, value = json
* @since 2.7
*/
@NonNull
Map<String, String> getSplitStorageOptions();
@NonNull Map<String, String> getSplitStorageOptions();
@NonNull
Unsafe unsafe();
@NonNull Unsafe unsafe();
interface Unsafe {
@@ -115,8 +111,7 @@ public interface LPConfiguration {
* @return the corresponding object, if one is present
* @throws IllegalArgumentException if the key isn't known
*/
@NonNull
Object getObject(String key);
@NonNull Object getObject(String key);
}
}
@@ -42,8 +42,7 @@ public interface LocalizedNode extends Node {
*
* @return the node this instance is representing
*/
@NonNull
Node getNode();
@NonNull Node getNode();
/**
* Gets the location where the {@link Node} is inherited from.
@@ -56,7 +55,6 @@ public interface LocalizedNode extends Node {
*
* @return where the node was inherited from.
*/
@NonNull
String getLocation();
@NonNull String getLocation();
}
@@ -47,8 +47,7 @@ public interface Log {
*
* @return the content
*/
@NonNull
SortedSet<LogEntry> getContent();
@NonNull SortedSet<LogEntry> getContent();
/**
* Gets the entries in the log performed by the given actor.
@@ -56,8 +55,7 @@ public interface Log {
* @param actor the uuid of the actor to filter by
* @return the content for the given actor
*/
@NonNull
SortedSet<LogEntry> getContent(@NonNull UUID actor);
@NonNull SortedSet<LogEntry> getContent(@NonNull UUID actor);
/**
* Gets the log content for a given user
@@ -65,8 +63,7 @@ public interface Log {
* @param uuid the uuid to filter by
* @return all content in this log where the user = uuid
*/
@NonNull
SortedSet<LogEntry> getUserHistory(@NonNull UUID uuid);
@NonNull SortedSet<LogEntry> getUserHistory(@NonNull UUID uuid);
/**
* Gets the log content for a given group
@@ -74,8 +71,7 @@ public interface Log {
* @param name the name to filter by
* @return all content in this log where the group = name
*/
@NonNull
SortedSet<LogEntry> getGroupHistory(@NonNull String name);
@NonNull SortedSet<LogEntry> getGroupHistory(@NonNull String name);
/**
* Gets the log content for a given track
@@ -83,7 +79,6 @@ public interface Log {
* @param name the name to filter by
* @return all content in this log where the track = name
*/
@NonNull
SortedSet<LogEntry> getTrackHistory(@NonNull String name);
@NonNull SortedSet<LogEntry> getTrackHistory(@NonNull String name);
}
@@ -52,24 +52,21 @@ public interface LogEntry extends Comparable<LogEntry> {
*
* @return the actor id
*/
@NonNull
UUID getActor();
@NonNull UUID getActor();
/**
* Gets the name describing the actor.
*
* @return the name of the actor
*/
@NonNull
String getActorName();
@NonNull String getActorName();
/**
* Gets the type of action.
*
* @return the action type
*/
@NonNull
Type getType();
@NonNull Type getType();
/**
* Gets the uuid of the object which was acted upon.
@@ -78,16 +75,14 @@ public interface LogEntry extends Comparable<LogEntry> {
*
* @return the uuid of acted object
*/
@NonNull
Optional<UUID> getActed();
@NonNull Optional<UUID> getActed();
/**
* Gets the name describing the object which was acted upon
*
* @return the name of the acted object
*/
@NonNull
String getActedName();
@NonNull String getActedName();
/**
* Returns a string describing the action which took place.
@@ -97,8 +92,7 @@ public interface LogEntry extends Comparable<LogEntry> {
*
* @return the action
*/
@NonNull
String getAction();
@NonNull String getAction();
/**
* Represents the type of a {@link LogEntry}.
@@ -106,19 +100,7 @@ public interface LogEntry extends Comparable<LogEntry> {
* @since 3.3
*/
enum Type {
USER('U'),
GROUP('G'),
TRACK('T');
private final char code;
Type(char code) {
this.code = code;
}
public char getCode() {
return this.code;
}
USER('U'), GROUP('G'), TRACK('T');
public static @NonNull Type valueOf(char code) {
switch (code) {
@@ -135,6 +117,16 @@ public interface LogEntry extends Comparable<LogEntry> {
throw new IllegalArgumentException("Unknown code: " + code);
}
}
private final char code;
Type(char code) {
this.code = code;
}
public char getCode() {
return this.code;
}
}
/**
@@ -149,8 +141,7 @@ public interface LogEntry extends Comparable<LogEntry> {
* @return the builder
* @see LogEntry#getTimestamp()
*/
@NonNull
Builder setTimestamp(long timestamp);
@NonNull Builder setTimestamp(long timestamp);
/**
* Sets the actor of the entry.
@@ -159,8 +150,7 @@ public interface LogEntry extends Comparable<LogEntry> {
* @return the builder
* @see LogEntry#getActor()
*/
@NonNull
Builder setActor(@NonNull UUID actor);
@NonNull Builder setActor(@NonNull UUID actor);
/**
* Sets the actor name of the entry.
@@ -169,8 +159,7 @@ public interface LogEntry extends Comparable<LogEntry> {
* @return the builder
* @see LogEntry#getActorName()
*/
@NonNull
Builder setActorName(@NonNull String actorName);
@NonNull Builder setActorName(@NonNull String actorName);
/**
* Sets the type of the entry.
@@ -179,8 +168,7 @@ public interface LogEntry extends Comparable<LogEntry> {
* @return the builder
* @see LogEntry#getType()
*/
@NonNull
Builder setType(@NonNull Type type);
@NonNull Builder setType(@NonNull Type type);
/**
* Sets the acted object for the entry.
@@ -189,8 +177,7 @@ public interface LogEntry extends Comparable<LogEntry> {
* @return the builder
* @see LogEntry#getActed()
*/
@NonNull
Builder setActed(@Nullable UUID acted);
@NonNull Builder setActed(@Nullable UUID acted);
/**
* Sets the acted name for the entry.
@@ -199,8 +186,7 @@ public interface LogEntry extends Comparable<LogEntry> {
* @return the builder
* @see LogEntry#getActedName()
*/
@NonNull
Builder setActedName(@NonNull String actedName);
@NonNull Builder setActedName(@NonNull String actedName);
/**
* Sets the action of the entry.
@@ -209,16 +195,14 @@ public interface LogEntry extends Comparable<LogEntry> {
* @return the builder
* @see LogEntry#getAction()
*/
@NonNull
Builder setAction(@NonNull String action);
@NonNull Builder setAction(@NonNull String action);
/**
* Creates a {@link LogEntry} instance from the builder.
*
* @return a new log entry instance
*/
@NonNull
LogEntry build();
@NonNull LogEntry build();
}
@@ -62,8 +62,7 @@ public interface LuckPermsApi {
* @return the platform info
* @since 4.0
*/
@NonNull
PlatformInfo getPlatformInfo();
@NonNull PlatformInfo getPlatformInfo();
/**
* Gets the {@link UserManager}, responsible for managing
@@ -78,8 +77,7 @@ public interface LuckPermsApi {
* @return the user manager
* @since 4.0
*/
@NonNull
UserManager getUserManager();
@NonNull UserManager getUserManager();
/**
* Gets the {@link GroupManager}, responsible for managing
@@ -94,8 +92,7 @@ public interface LuckPermsApi {
* @return the group manager
* @since 4.0
*/
@NonNull
GroupManager getGroupManager();
@NonNull GroupManager getGroupManager();
/**
* Gets the {@link TrackManager}, responsible for managing
@@ -110,8 +107,7 @@ public interface LuckPermsApi {
* @return the track manager
* @since 4.0
*/
@NonNull
TrackManager getTrackManager();
@NonNull TrackManager getTrackManager();
/**
* Schedules the execution of an update task, and returns an encapsulation
@@ -125,8 +121,7 @@ public interface LuckPermsApi {
* @return a future
* @since 4.0
*/
@NonNull
CompletableFuture<Void> runUpdateTask();
@NonNull CompletableFuture<Void> runUpdateTask();
/**
* Gets the {@link EventBus}, used for subscribing to internal LuckPerms
@@ -135,16 +130,14 @@ public interface LuckPermsApi {
* @return the event bus
* @since 3.0
*/
@NonNull
EventBus getEventBus();
@NonNull EventBus getEventBus();
/**
* Gets a representation of the plugins configuration
*
* @return the configuration
*/
@NonNull
LPConfiguration getConfiguration();
@NonNull LPConfiguration getConfiguration();
/**
* Gets an object representing the plugins primary {@link Storage} backend.
@@ -155,8 +148,7 @@ public interface LuckPermsApi {
* @return a storage instance
* @since 2.14
*/
@NonNull
Storage getStorage();
@NonNull Storage getStorage();
/**
* Gets the {@link MessagingService}, if present.
@@ -170,8 +162,7 @@ public interface LuckPermsApi {
*
* @return the messaging service instance, if present.
*/
@NonNull
Optional<MessagingService> getMessagingService();
@NonNull Optional<MessagingService> getMessagingService();
/**
* Registers a {@link MessengerProvider} for use by the platform.
@@ -193,8 +184,7 @@ public interface LuckPermsApi {
* @return the action logger
* @since 4.1
*/
@NonNull
ActionLogger getActionLogger();
@NonNull ActionLogger getActionLogger();
/**
* Gets a {@link UuidCache}.
@@ -204,11 +194,10 @@ public interface LuckPermsApi {
*
* @return the uuid cache
* @deprecated this feature is now handled internally - and the API returns a
* No-op implementation of this class.
* No-op implementation of this class.
*/
@NonNull
@Deprecated
UuidCache getUuidCache();
@NonNull UuidCache getUuidCache();
/**
* Gets the {@link ContextManager}.
@@ -219,8 +208,7 @@ public interface LuckPermsApi {
* @return the context manager
* @since 4.0
*/
@NonNull
ContextManager getContextManager();
@NonNull ContextManager getContextManager();
/**
* Gets the {@link NodeFactory}.
@@ -229,8 +217,7 @@ public interface LuckPermsApi {
*
* @return the node factory
*/
@NonNull
NodeFactory getNodeFactory();
@NonNull NodeFactory getNodeFactory();
/**
* Gets the {@link MetaStackFactory}.
@@ -242,8 +229,7 @@ public interface LuckPermsApi {
* @return the meta stack factory
* @since 3.2
*/
@NonNull
MetaStackFactory getMetaStackFactory();
@NonNull MetaStackFactory getMetaStackFactory();
@@ -70,13 +70,13 @@ import java.util.stream.Stream;
* <p>Nodes have the following attributes:</p>
* <p></p>
* <ul>
* <li>{@link #getPermission() permission} - the actual permission string</li>
* <li>{@link #getValue() value} - the value of the node (false for negated)</li>
* <li>{@link #isOverride() override} - if the node is marked as having special priority over other nodes</li>
* <li>{@link #getServer() server} - the specific server where this node should apply</li>
* <li>{@link #getWorld() world} - the specific world where this node should apply</li>
* <li>{@link #getContexts() context} - the additional contexts required for this node to apply </li>
* <li>{@link #getExpiry() expiry} - the time when this node should expire</li>
* <li>{@link #getPermission() permission} - the actual permission string</li>
* <li>{@link #getValue() value} - the value of the node (false for negated)</li>
* <li>{@link #isOverride() override} - if the node is marked as having special priority over other nodes</li>
* <li>{@link #getServer() server} - the specific server where this node should apply</li>
* <li>{@link #getWorld() world} - the specific world where this node should apply</li>
* <li>{@link #getContexts() context} - the additional contexts required for this node to apply </li>
* <li>{@link #getExpiry() expiry} - the time when this node should expire</li>
* </ul>
*
* <p>The 'permission' property of a {@link Node} is also used in some cases to represent state
@@ -89,13 +89,13 @@ import java.util.stream.Stream;
* <p>The current types are:</p>
* <p></p>
* <ul>
* <li>normal - just a regular permission</li>
* <li>{@link InheritanceType} - an "inheritance node" marks that the holder should inherit data from another group</li>
* <li>{@link PrefixType} - represents an assigned prefix</li>
* <li>{@link SuffixType} - represents an assigned suffix</li>
* <li>{@link MetaType} - represents an assigned meta option</li>
* <li>{@link WeightType} - marks the weight of the object holding this node</li>
* <li>{@link DisplayNameType} - marks the display name of the object holding this node</li>
* <li>normal - just a regular permission</li>
* <li>{@link InheritanceType} - an "inheritance node" marks that the holder should inherit data from another group</li>
* <li>{@link PrefixType} - represents an assigned prefix</li>
* <li>{@link SuffixType} - represents an assigned suffix</li>
* <li>{@link MetaType} - represents an assigned meta option</li>
* <li>{@link WeightType} - marks the weight of the object holding this node</li>
* <li>{@link DisplayNameType} - marks the display name of the object holding this node</li>
* </ul>
*
* <p>The core node state must be immutable in all implementations.</p>
@@ -113,8 +113,7 @@ public interface Node {
*
* @return the actual permission node
*/
@NonNull
String getPermission();
@NonNull String getPermission();
/**
* Gets the value of the node.
@@ -160,16 +159,14 @@ public interface Node {
*
* @return an {@link Optional} containing the server, if one is defined
*/
@NonNull
Optional<String> getServer();
@NonNull 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
*/
@NonNull
Optional<String> getWorld();
@NonNull Optional<String> getWorld();
/**
* Gets if this node is server specific.
@@ -218,8 +215,7 @@ public interface Node {
*
* @return a list of full nodes
*/
@NonNull
List<String> resolveShorthand();
@NonNull List<String> resolveShorthand();
/**
* Gets if this node is assigned temporarily.
@@ -251,8 +247,7 @@ public interface Node {
* @return the {@link Date} when this node will expire
* @throws IllegalStateException if the node is not temporary
*/
@NonNull
Date getExpiry() throws IllegalStateException;
@NonNull Date getExpiry() throws IllegalStateException;
/**
* Gets the number of seconds until this permission will expire.
@@ -279,20 +274,18 @@ public interface Node {
* @return the extra contexts required for this node to apply
* @since 2.13
*/
@NonNull
ContextSet getContexts();
@NonNull ContextSet getContexts();
/**
* The same as {@link #getContexts()}, but also includes context pairs for
* "server" and "world" keys if present.
*
* @return the full contexts required for this node to apply
* @since 3.1
* @see Contexts#SERVER_KEY
* @see Contexts#WORLD_KEY
* @since 3.1
*/
@NonNull
ContextSet getFullContexts();
@NonNull ContextSet getFullContexts();
/**
* Gets if this node is a wildcard permission.
@@ -344,10 +337,7 @@ public interface Node {
* @since 4.2
*/
default <T extends NodeType> T typeData(NodeTypeKey<T> key) throws IllegalStateException {
return getTypeData(key)
.orElseThrow(() ->
new IllegalStateException("Node '" + getPermission() + "' does not have the '" + key.getTypeName() + "' type.")
);
return getTypeData(key).orElseThrow(() -> new IllegalStateException("Node '" + getPermission() + "' does not have the '" + key.getTypeName() + "' type."));
}
/**
@@ -444,7 +434,7 @@ public interface Node {
* Gets if this Node is equal to another node as defined by the given
* {@link StandardNodeEquality} predicate.
*
* @param other the other node
* @param other the other node
* @param equalityPredicate the predicate
* @return true if this node is considered equal
* @since 4.1
@@ -455,7 +445,7 @@ public interface Node {
* Gets if this Node is equal to another node as defined by the given
* {@link NodeEqualityPredicate}.
*
* @param other the other node
* @param other the other node
* @param equalityPredicate the predicate
* @return true if this node is considered equal
* @since 4.1
@@ -470,8 +460,8 @@ public interface Node {
*
* @param other the other node
* @return true if the two nodes are almost equal
* @deprecated in favour of {@link #equals(Node, NodeEqualityPredicate)}
* @see StandardNodeEquality#IGNORE_VALUE
* @deprecated in favour of {@link #equals(Node, NodeEqualityPredicate)}
*/
@Deprecated
default boolean equalsIgnoringValue(@NonNull Node other) {
@@ -484,8 +474,8 @@ public interface Node {
*
* @param other the other node
* @return true if the two nodes are almost equal
* @deprecated in favour of {@link #equals(Node, NodeEqualityPredicate)}
* @see StandardNodeEquality#IGNORE_EXPIRY_TIME_AND_VALUE
* @deprecated in favour of {@link #equals(Node, NodeEqualityPredicate)}
*/
@Deprecated
default boolean almostEquals(@NonNull Node other) {
@@ -498,9 +488,9 @@ public interface Node {
*
* @param other the other node
* @return true if the two nodes are almost equal
* @see StandardNodeEquality#IGNORE_VALUE_OR_IF_TEMPORARY
* @since 2.8
* @deprecated in favour of {@link #equals(Node, NodeEqualityPredicate)}
* @see StandardNodeEquality#IGNORE_VALUE_OR_IF_TEMPORARY
*/
@Deprecated
default boolean equalsIgnoringValueOrTemp(@NonNull Node other) {
@@ -541,8 +531,7 @@ public interface Node {
* @return the builder
* @see Node#isNegated()
*/
@NonNull
Builder setNegated(boolean negated);
@NonNull Builder setNegated(boolean negated);
/**
* Sets the value of the node.
@@ -551,8 +540,7 @@ public interface Node {
* @return the builder
* @see Node#getValue()
*/
@NonNull
Builder setValue(boolean value);
@NonNull Builder setValue(boolean value);
/**
* Sets the override property for the node.
@@ -564,8 +552,7 @@ public interface Node {
* @return the builder
* @see Node#isOverride()
*/
@NonNull
Builder setOverride(boolean override);
@NonNull Builder setOverride(boolean override);
/**
* Sets the time when the node should expire.
@@ -577,8 +564,7 @@ public interface Node {
* @return the builder
* @see Node#getExpiryUnixTime()
*/
@NonNull
Builder setExpiry(long expiryUnixTimestamp);
@NonNull Builder setExpiry(long expiryUnixTimestamp);
/**
* Sets the time when the node should expire.
@@ -587,7 +573,7 @@ public interface Node {
* system time.</p>
*
* @param duration how long the node should be added for
* @param unit the unit <code>duration</code> is measured in
* @param unit the unit <code>duration</code> is measured in
* @return the builder
* @since 4.2
*/
@@ -604,8 +590,7 @@ public interface Node {
* @return the builder
* @since 4.2
*/
@NonNull
Builder clearExpiry();
@NonNull Builder clearExpiry();
/**
* Sets the world value for the node.
@@ -614,8 +599,7 @@ public interface Node {
* @return the builder
* @see Node#getWorld()
*/
@NonNull
Builder setWorld(@Nullable String world);
@NonNull Builder setWorld(@Nullable String world);
/**
* Sets the server value for the node.
@@ -624,20 +608,18 @@ public interface Node {
* @return the builder
* @see Node#getServer()
*/
@NonNull
Builder setServer(@Nullable String server);
@NonNull Builder setServer(@Nullable String server);
/**
* Appends an extra context onto the node.
*
* @param key the context key
* @param key the context key
* @param value the context value
* @return the builder
* @see ContextSet
* @see Node#getContexts()
*/
@NonNull
Builder withExtraContext(@NonNull String key, @NonNull String value);
@NonNull Builder withExtraContext(@NonNull String key, @NonNull String value);
/**
* Appends extra contexts onto the node.
@@ -647,8 +629,7 @@ public interface Node {
* @see ContextSet
* @see Node#getContexts()
*/
@NonNull
Builder withExtraContext(@NonNull Map<String, String> map);
@NonNull Builder withExtraContext(@NonNull Map<String, String> map);
/**
* Appends extra contexts onto the node.
@@ -658,8 +639,7 @@ public interface Node {
* @see ContextSet
* @see Node#getContexts()
*/
@NonNull
Builder withExtraContext(@NonNull Set<Map.Entry<String, String>> context);
@NonNull Builder withExtraContext(@NonNull Set<Map.Entry<String, String>> context);
/**
* Appends an extra context onto the node.
@@ -669,8 +649,7 @@ public interface Node {
* @see ContextSet
* @see Node#getContexts()
*/
@NonNull
Builder withExtraContext(Map.@NonNull Entry<String, String> entry);
@NonNull Builder withExtraContext(Map.@NonNull Entry<String, String> entry);
/**
* Appends extra contexts onto the node.
@@ -680,8 +659,7 @@ public interface Node {
* @see ContextSet
* @see Node#getContexts()
*/
@NonNull
Builder withExtraContext(@NonNull ContextSet contextSet);
@NonNull Builder withExtraContext(@NonNull ContextSet contextSet);
/**
* Sets the extra contexts for the node.
@@ -692,16 +670,14 @@ public interface Node {
* @see Node#getContexts()
* @since 4.2
*/
@NonNull
Builder setExtraContext(@NonNull ContextSet contextSet);
@NonNull Builder setExtraContext(@NonNull ContextSet contextSet);
/**
* Creates a {@link Node} instance from the builder.
*
* @return a new node instance
*/
@NonNull
Node build();
@NonNull Node build();
}
}
@@ -69,7 +69,7 @@ public interface NodeFactory {
*
* @param groupName the name of the group
* @return a node builder instance
* @throws NullPointerException if the groupName is null
* @throws NullPointerException if the groupName is null
* @since 4.0
*/
Node.@NonNull Builder makeGroupNode(@NonNull String groupName);
@@ -87,9 +87,9 @@ public interface NodeFactory {
/**
* Creates a node builder for the given chat meta type
*
* @param type the type
* @param type the type
* @param priority the priority
* @param value the value for the prefix/suffix
* @param value the value for the prefix/suffix
* @return a node builder instance
* @throws NullPointerException if the type or value is null
* @since 3.2
@@ -68,8 +68,7 @@ public interface PermissionHolder {
*
* @return the identifier for this object. Either a uuid string or name.
*/
@NonNull
String getObjectName();
@NonNull String getObjectName();
/**
* Gets a friendly name for this holder, to be displayed in command output, etc.
@@ -86,8 +85,7 @@ public interface PermissionHolder {
* @return a friendly identifier for this holder
* @since 3.2
*/
@NonNull
String getFriendlyName();
@NonNull String getFriendlyName();
/**
* Gets the holders {@link CachedData} cache.
@@ -95,8 +93,7 @@ public interface PermissionHolder {
* @return the holders cached data.
* @since 3.2
*/
@NonNull
CachedData getCachedData();
@NonNull CachedData getCachedData();
/**
* Refreshes and applies any changes to the cached holder data.
@@ -107,8 +104,7 @@ public interface PermissionHolder {
* @return the task future
* @since 4.0
*/
@NonNull
CompletableFuture<Void> refreshCachedData();
@NonNull CompletableFuture<Void> refreshCachedData();
/**
* Gets the backing multimap containing every permission this holder has.
@@ -119,8 +115,7 @@ public interface PermissionHolder {
* @return the holders own permissions
* @since 3.3
*/
@NonNull
ImmutableSetMultimap<ImmutableContextSet, Node> getNodes();
@NonNull ImmutableSetMultimap<ImmutableContextSet, Node> getNodes();
/**
* Gets the backing multimap containing every transient permission this holder has.
@@ -132,8 +127,7 @@ public interface PermissionHolder {
* @return the holders own permissions
* @since 3.3
*/
@NonNull
ImmutableSetMultimap<ImmutableContextSet, Node> getTransientNodes();
@NonNull ImmutableSetMultimap<ImmutableContextSet, Node> getTransientNodes();
/**
* Gets a flattened/squashed view of the holders permissions.
@@ -150,8 +144,7 @@ public interface PermissionHolder {
* @return a list of the holders own nodes.
* @since 3.3
*/
@NonNull
List<Node> getOwnNodes();
@NonNull List<Node> getOwnNodes();
/**
* Gets a sorted set of all held permissions.
@@ -166,8 +159,7 @@ public interface PermissionHolder {
* @return an immutable set of permissions in priority order
* @since 2.6
*/
@NonNull
SortedSet<? extends Node> getPermissions();
@NonNull SortedSet<? extends Node> getPermissions();
/**
* Similar to {@link #getPermissions()}, except only including permissions from the enduring
@@ -184,8 +176,7 @@ public interface PermissionHolder {
* @return a set of nodes
* @since 2.6
*/
@NonNull
Set<? extends Node> getEnduringPermissions();
@NonNull Set<? extends Node> getEnduringPermissions();
/**
* Similar to {@link #getPermissions()}, except only including permissions from the enduring
@@ -201,8 +192,7 @@ public interface PermissionHolder {
* @return a set of nodes
* @since 2.6
*/
@NonNull
Set<? extends Node> getTransientPermissions();
@NonNull Set<? extends Node> getTransientPermissions();
/**
* A filtered view of this holders nodes, only including permanent entries.
@@ -217,8 +207,7 @@ public interface PermissionHolder {
* @return a set of permanent nodes
* @since 2.6
*/
@NonNull
Set<Node> getPermanentPermissionNodes();
@NonNull Set<Node> getPermanentPermissionNodes();
/**
* A filtered view of this holders nodes, only including temporary entries.
@@ -233,8 +222,7 @@ public interface PermissionHolder {
* @return a set of temporary nodes
* @since 2.6
*/
@NonNull
Set<Node> getTemporaryPermissionNodes();
@NonNull Set<Node> getTemporaryPermissionNodes();
/**
* Recursively resolves this holders permissions.
@@ -252,8 +240,7 @@ public interface PermissionHolder {
* @return a list of nodes
* @since 3.3
*/
@NonNull
List<LocalizedNode> resolveInheritances(@NonNull Contexts contexts);
@NonNull List<LocalizedNode> resolveInheritances(@NonNull Contexts contexts);
/**
* Recursively resolves this holders permissions.
@@ -273,8 +260,7 @@ public interface PermissionHolder {
* @return a list of nodes
* @since 3.3
*/
@NonNull
List<LocalizedNode> resolveInheritances();
@NonNull List<LocalizedNode> resolveInheritances();
/**
* Gets a mutable sorted set of the nodes that this object has and inherits, filtered by context
@@ -290,8 +276,7 @@ public interface PermissionHolder {
* @throws NullPointerException if the context is null
* @since 2.11
*/
@NonNull
SortedSet<LocalizedNode> getAllNodes(@NonNull Contexts contexts);
@NonNull SortedSet<LocalizedNode> getAllNodes(@NonNull Contexts contexts);
/**
* Gets a mutable sorted set of the nodes that this object has and inherits.
@@ -305,8 +290,7 @@ public interface PermissionHolder {
* @throws NullPointerException if the context is null
* @since 3.3
*/
@NonNull
SortedSet<LocalizedNode> getAllNodes();
@NonNull SortedSet<LocalizedNode> getAllNodes();
/**
* Gets a mutable set of the nodes that this object has and inherits, filtered by context.
@@ -319,19 +303,17 @@ public interface PermissionHolder {
* @throws NullPointerException if the context is null
* @since 2.11
*/
@NonNull
Set<LocalizedNode> getAllNodesFiltered(@NonNull Contexts contexts);
@NonNull Set<LocalizedNode> getAllNodesFiltered(@NonNull Contexts contexts);
/**
* Converts the output of {@link #getAllNodesFiltered(Contexts)} into string and boolean form,
* and expands shorthand permissions.
*
* @param contexts the context for the lookup
* @param contexts the context for the lookup
* @param convertToLowercase if the keys should be made lowercase whilst being exported
* @return a mutable map of permissions
*/
@NonNull
Map<String, Boolean> exportNodes(@NonNull Contexts contexts, boolean convertToLowercase);
@NonNull Map<String, Boolean> exportNodes(@NonNull Contexts contexts, boolean convertToLowercase);
/**
* Removes any temporary permissions that have expired.
@@ -346,42 +328,39 @@ public interface PermissionHolder {
*
* <p>Although this method is named hasPermission, it can be used for all node types.</p>
*
* @param node the node to check for
* @param node the node to check for
* @param equalityPredicate how to determine if a node matches
* @return a Tristate for the holders permission status for the node
* @throws NullPointerException if the node is null
* @since 4.1
*/
@NonNull
Tristate hasPermission(@NonNull Node node, @NonNull NodeEqualityPredicate equalityPredicate);
@NonNull Tristate hasPermission(@NonNull Node node, @NonNull NodeEqualityPredicate equalityPredicate);
/**
* Checks to see if the object has a certain permission.
*
* <p>Although this method is named hasTransientPermission, it can be used for all node types.</p>
*
* @param node the node to check for
* @param node the node to check for
* @param equalityPredicate how to determine if a node matches
* @return a Tristate for the holders permission status for the node
* @throws NullPointerException if the node is null
* @since 4.1
*/
@NonNull
Tristate hasTransientPermission(@NonNull Node node, @NonNull NodeEqualityPredicate equalityPredicate);
@NonNull Tristate hasTransientPermission(@NonNull Node node, @NonNull NodeEqualityPredicate equalityPredicate);
/**
* Checks to see if the object inherits a certain permission.
*
* <p>Although this method is named inheritsPermission, it can be used for all node types.</p>
*
* @param node the node to check for
* @param node the node to check for
* @param equalityPredicate how to determine if a node matches
* @return a Tristate for the holders inheritance status for the node
* @throws NullPointerException if the node is null
* @since 4.1
*/
@NonNull
Tristate inheritsPermission(@NonNull Node node, @NonNull NodeEqualityPredicate equalityPredicate);
@NonNull Tristate inheritsPermission(@NonNull Node node, @NonNull NodeEqualityPredicate equalityPredicate);
/**
* Checks to see if the object has a certain permission.
@@ -393,8 +372,7 @@ public interface PermissionHolder {
* @throws NullPointerException if the node is null
* @since 2.6
*/
@NonNull
Tristate hasPermission(@NonNull Node node);
@NonNull Tristate hasPermission(@NonNull Node node);
/**
* Checks to see if the object has a certain permission.
@@ -406,8 +384,7 @@ public interface PermissionHolder {
* @throws NullPointerException if the node is null
* @since 2.6
*/
@NonNull
Tristate hasTransientPermission(@NonNull Node node);
@NonNull Tristate hasTransientPermission(@NonNull Node node);
/**
* Checks to see if the object inherits a certain permission.
@@ -419,8 +396,7 @@ public interface PermissionHolder {
* @throws NullPointerException if the node is null
* @since 2.6
*/
@NonNull
Tristate inheritsPermission(@NonNull Node node);
@NonNull Tristate inheritsPermission(@NonNull Node node);
/**
* Check to see if this holder inherits another group in the global context.
@@ -442,7 +418,7 @@ public interface PermissionHolder {
*
* <p>This method only checks for direct inheritance - one hop up the inheritance tree.</p>
*
* @param group The group to check membership of
* @param group The group to check membership of
* @param contextSet the context set to filter by
* @return true if the group inherits the other group
* @throws NullPointerException if the group is null
@@ -472,8 +448,7 @@ public interface PermissionHolder {
* @throws NullPointerException if the node is null
* @since 4.0
*/
@NonNull
DataMutateResult setPermission(@NonNull Node node);
@NonNull DataMutateResult setPermission(@NonNull Node node);
/**
* Sets a permission node for the permission holder.
@@ -491,14 +466,13 @@ public interface PermissionHolder {
* made already. This can be done via {@link UserManager#loadUser(UUID)} or
* {@link GroupManager#loadGroup(String)} respectively.</p>
*
* @param node The node to be set
* @param node The node to be set
* @param temporaryMergeBehaviour The behaviour used to merge temporary permission entries
* @return the result of the operation
* @throws NullPointerException if the node is null
* @since 4.3
*/
@NonNull
TemporaryDataMutateResult setPermission(@NonNull Node node, @NonNull TemporaryMergeBehaviour temporaryMergeBehaviour);
@NonNull TemporaryDataMutateResult setPermission(@NonNull Node node, @NonNull TemporaryMergeBehaviour temporaryMergeBehaviour);
/**
* Sets a transient permission for the permission holder.
@@ -521,8 +495,7 @@ public interface PermissionHolder {
* @throws NullPointerException if the node is null
* @since 4.0
*/
@NonNull
DataMutateResult setTransientPermission(@NonNull Node node);
@NonNull DataMutateResult setTransientPermission(@NonNull Node node);
/**
* Sets a transient permission for the permission holder.
@@ -540,14 +513,13 @@ public interface PermissionHolder {
*
* <p>Although this method is named setTransientPermission, it can be used for all node types.</p>
*
* @param node The node to be se
* @param node The node to be se
* @param temporaryMergeBehaviour The behaviour used to merge temporary permission entries
* @return the result of the operation
* @throws NullPointerException if the node is null
* @since 4.3
*/
@NonNull
TemporaryDataMutateResult setTransientPermission(@NonNull Node node, @NonNull TemporaryMergeBehaviour temporaryMergeBehaviour);
@NonNull TemporaryDataMutateResult setTransientPermission(@NonNull Node node, @NonNull TemporaryMergeBehaviour temporaryMergeBehaviour);
/**
* Unsets a permission for the permission holder.
@@ -570,8 +542,7 @@ public interface PermissionHolder {
* @throws NullPointerException if the node is null
* @since 4.0
*/
@NonNull
DataMutateResult unsetPermission(@NonNull Node node);
@NonNull DataMutateResult unsetPermission(@NonNull Node node);
/**
* Unsets a transient permission for the permission holder.
@@ -583,8 +554,7 @@ public interface PermissionHolder {
* @throws NullPointerException if the node is null
* @since 4.0
*/
@NonNull
DataMutateResult unsetTransientPermission(@NonNull Node node);
@NonNull DataMutateResult unsetTransientPermission(@NonNull Node node);
/**
* Clears any nodes from the holder which pass the predicate.
@@ -780,8 +750,8 @@ public interface PermissionHolder {
* Unsets a permission for the permission holder.
*
* @param node The node to be unset
* @throws NullPointerException if the node is null
* @return the result of the operation
* @throws NullPointerException if the node is null
* @since 3.1
* @deprecated now forwards to {@link #unsetPermission(Node)}
*/
@@ -794,8 +764,8 @@ public interface PermissionHolder {
* Unsets a transient permission for the permission holder.
*
* @param node The node to be unset
* @throws NullPointerException if the node is null
* @return the result of the operation
* @throws NullPointerException if the node is null
* @since 3.1
* @deprecated now forwards to {@link #unsetTransientPermission(Node)}
*/
@@ -48,8 +48,7 @@ public interface PlayerSaveResult {
*
* @return the status
*/
@NonNull
Set<Status> getStatus();
@NonNull Set<Status> getStatus();
/**
* Gets if the result includes a certain status code.
@@ -65,8 +64,7 @@ public interface PlayerSaveResult {
* @return the old username
* @see Status#USERNAME_UPDATED
*/
@Nullable
String getOldUsername();
@Nullable String getOldUsername();
/**
* Gets the other uuids involved in the result
@@ -74,8 +72,7 @@ public interface PlayerSaveResult {
* @return the other uuids
* @see Status#OTHER_UUIDS_PRESENT_FOR_USERNAME
*/
@Nullable
Set<UUID> getOtherUuids();
@Nullable Set<UUID> getOtherUuids();
/**
* The various states the result can take
@@ -41,8 +41,7 @@ public interface PromotionResult extends MutateResult {
*
* @return the status
*/
@NonNull
Status getStatus();
@NonNull Status getStatus();
@Override
default boolean wasSuccess() {
@@ -57,8 +56,7 @@ public interface PromotionResult extends MutateResult {
*
* @return the group the user was promoted from.
*/
@NonNull
Optional<String> getGroupFrom();
@NonNull Optional<String> getGroupFrom();
/**
* Gets the name of the group the user was promoted from, if applicable.
@@ -71,8 +69,7 @@ public interface PromotionResult extends MutateResult {
*
* @return the group the user was promoted to.
*/
@NonNull
Optional<String> getGroupTo();
@NonNull Optional<String> getGroupTo();
/**
* The result status
@@ -50,8 +50,7 @@ public interface Storage {
*
* @return the name of the implementation
*/
@NonNull
String getName();
@NonNull String getName();
/**
* Gets whether the storage instance is allowing logins on the platform.
@@ -70,9 +69,8 @@ public interface Storage {
* @throws NullPointerException if entry is null
* @deprecated in favour of {@link ActionLogger#submit(LogEntry)}.
*/
@NonNull
@Deprecated
CompletableFuture<Boolean> logAction(@NonNull LogEntry entry);
@NonNull CompletableFuture<Boolean> logAction(@NonNull LogEntry entry);
/**
* Loads and returns the entire log from storage
@@ -80,9 +78,8 @@ public interface Storage {
* @return a log instance, could be null if loading failed
* @deprecated in favour of {@link ActionLogger#getLog()}
*/
@NonNull
@Deprecated
CompletableFuture<Log> getLog();
@NonNull CompletableFuture<Log> getLog();
/**
* Loads a user's data from the main storage into the plugins local storage.
@@ -93,9 +90,8 @@ public interface Storage {
* @throws NullPointerException if uuid is null
* @deprecated in favour of {@link UserManager#loadUser(UUID, String)}
*/
@NonNull
@Deprecated
CompletableFuture<Boolean> loadUser(@NonNull UUID uuid, @Nullable String username);
@NonNull CompletableFuture<Boolean> loadUser(@NonNull UUID uuid, @Nullable String username);
/**
* Loads a user's data from the main storage into the plugins local storage.
@@ -121,9 +117,8 @@ public interface Storage {
* @throws IllegalStateException if the user instance was not obtained from LuckPerms.
* @deprecated in favour of {@link UserManager#saveUser(User)}
*/
@NonNull
@Deprecated
CompletableFuture<Boolean> saveUser(@NonNull User user);
@NonNull CompletableFuture<Boolean> saveUser(@NonNull User user);
/**
* Gets a set all "unique" user UUIDs.
@@ -133,9 +128,8 @@ public interface Storage {
* @return a set of uuids, or null if the operation failed.
* @deprecated in favour of {@link UserManager#getUniqueUsers()}
*/
@NonNull
@Deprecated
CompletableFuture<Set<UUID>> getUniqueUsers();
@NonNull CompletableFuture<Set<UUID>> getUniqueUsers();
/**
* Searches for a list of users with a given permission.
@@ -146,9 +140,8 @@ public interface Storage {
* @since 2.17
* @deprecated in favour of {@link UserManager#getWithPermission(String)}
*/
@NonNull
@Deprecated
CompletableFuture<List<HeldPermission<UUID>>> getUsersWithPermission(@NonNull String permission);
@NonNull CompletableFuture<List<HeldPermission<UUID>>> getUsersWithPermission(@NonNull String permission);
/**
* Creates and loads a group into the plugins local storage
@@ -159,9 +152,8 @@ public interface Storage {
* @throws IllegalArgumentException if the name is invalid
* @deprecated in favour of {@link GroupManager#createAndLoadGroup(String)}
*/
@NonNull
@Deprecated
CompletableFuture<Boolean> createAndLoadGroup(@NonNull String name);
@NonNull CompletableFuture<Boolean> createAndLoadGroup(@NonNull String name);
/**
* Loads a group into the plugins local storage.
@@ -172,9 +164,8 @@ public interface Storage {
* @throws IllegalArgumentException if the name is invalid
* @deprecated in favour of {@link GroupManager#loadGroup(String)}
*/
@NonNull
@Deprecated
CompletableFuture<Boolean> loadGroup(@NonNull String name);
@NonNull CompletableFuture<Boolean> loadGroup(@NonNull String name);
/**
* Loads all groups from the storage into memory
@@ -182,9 +173,8 @@ public interface Storage {
* @return true if the operation completed successfully.
* @deprecated in favour of {@link GroupManager#loadAllGroups()}
*/
@NonNull
@Deprecated
CompletableFuture<Boolean> loadAllGroups();
@NonNull CompletableFuture<Boolean> loadAllGroups();
/**
* Saves a group back to storage.
@@ -197,9 +187,8 @@ public interface Storage {
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
* @deprecated in favour of {@link GroupManager#saveGroup(Group)}
*/
@NonNull
@Deprecated
CompletableFuture<Boolean> saveGroup(@NonNull Group group);
@NonNull CompletableFuture<Boolean> saveGroup(@NonNull Group group);
/**
* Permanently deletes a group from storage.
@@ -210,9 +199,8 @@ public interface Storage {
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
* @deprecated in favour of {@link GroupManager#deleteGroup(Group)}
*/
@NonNull
@Deprecated
CompletableFuture<Boolean> deleteGroup(@NonNull Group group);
@NonNull CompletableFuture<Boolean> deleteGroup(@NonNull Group group);
/**
* Searches for a list of groups with a given permission.
@@ -223,9 +211,8 @@ public interface Storage {
* @since 2.17
* @deprecated in favour of {@link GroupManager#getWithPermission(String)}
*/
@NonNull
@Deprecated
CompletableFuture<List<HeldPermission<String>>> getGroupsWithPermission(@NonNull String permission);
@NonNull CompletableFuture<List<HeldPermission<String>>> getGroupsWithPermission(@NonNull String permission);
/**
* Creates and loads a track into the plugins local storage
@@ -236,9 +223,8 @@ public interface Storage {
* @throws IllegalArgumentException if the name is invalid
* @deprecated in favour of {@link TrackManager#createAndLoadTrack(String)}
*/
@NonNull
@Deprecated
CompletableFuture<Boolean> createAndLoadTrack(@NonNull String name);
@NonNull CompletableFuture<Boolean> createAndLoadTrack(@NonNull String name);
/**
* Loads a track into the plugins local storage.
@@ -249,9 +235,8 @@ public interface Storage {
* @throws IllegalArgumentException if the name is invalid
* @deprecated in favour of {@link TrackManager#loadTrack(String)}
*/
@NonNull
@Deprecated
CompletableFuture<Boolean> loadTrack(@NonNull String name);
@NonNull CompletableFuture<Boolean> loadTrack(@NonNull String name);
/**
* Loads all tracks from the storage into memory
@@ -259,9 +244,8 @@ public interface Storage {
* @return true if the operation completed successfully.
* @deprecated in favour of {@link TrackManager#loadAllTracks()}
*/
@NonNull
@Deprecated
CompletableFuture<Boolean> loadAllTracks();
@NonNull CompletableFuture<Boolean> loadAllTracks();
/**
* Saves a track back to storage. You should call this after you make any changes to a track.
@@ -272,9 +256,8 @@ public interface Storage {
* @throws IllegalStateException if the track instance was not obtained from LuckPerms.
* @deprecated in favour of {@link TrackManager#saveTrack(Track)}
*/
@NonNull
@Deprecated
CompletableFuture<Boolean> saveTrack(@NonNull Track track);
@NonNull CompletableFuture<Boolean> saveTrack(@NonNull Track track);
/**
* Permanently deletes a track from storage
@@ -285,9 +268,8 @@ public interface Storage {
* @throws IllegalStateException if the track instance was not obtained from LuckPerms.
* @deprecated in favour of {@link TrackManager#deleteTrack(Track)}
*/
@NonNull
@Deprecated
CompletableFuture<Boolean> deleteTrack(@NonNull Track track);
@NonNull CompletableFuture<Boolean> deleteTrack(@NonNull Track track);
/**
* Saves UUID caching data to the global cache
@@ -299,8 +281,7 @@ public interface Storage {
* @throws IllegalArgumentException if the username is invalid
* @deprecated in favour of {@link UserManager#savePlayerData(UUID, String)}
*/
@NonNull
CompletableFuture<Boolean> saveUUIDData(@NonNull String username, @NonNull UUID uuid);
@NonNull CompletableFuture<Boolean> saveUUIDData(@NonNull String username, @NonNull UUID uuid);
/**
* Gets a UUID from a username
@@ -311,8 +292,7 @@ public interface Storage {
* @throws IllegalArgumentException if the username is invalid
* @deprecated in favour of {@link UserManager#lookupUuid(String)}
*/
@NonNull
CompletableFuture<UUID> getUUID(@NonNull String username);
@NonNull CompletableFuture<UUID> getUUID(@NonNull String username);
/**
* Gets a username from a UUID
@@ -323,9 +303,7 @@ public interface Storage {
* @since 2.17
* @deprecated in favour of {@link UserManager#lookupUsername(UUID)}
*/
@NonNull
@Deprecated
CompletableFuture<String> getName(@NonNull UUID uuid);
@NonNull @Deprecated CompletableFuture<String> getName(@NonNull UUID uuid);
/**
* Returns an executor which will run all passed runnables on the
@@ -337,9 +315,7 @@ public interface Storage {
* @return an executor instance
* @deprecated as plugins should create their own executors
*/
@NonNull
@Deprecated
Executor getSyncExecutor();
@NonNull @Deprecated Executor getSyncExecutor();
/**
* Returns an executor which will run all passed runnables asynchronously
@@ -351,8 +327,6 @@ public interface Storage {
* @return an executor instance
* @deprecated as plugins should create their own executors
*/
@NonNull
@Deprecated
Executor getAsyncExecutor();
@NonNull @Deprecated Executor getAsyncExecutor();
}
@@ -39,8 +39,7 @@ public interface TemporaryDataMutateResult {
*
* @return the result
*/
@NonNull
DataMutateResult getResult();
@NonNull DataMutateResult getResult();
/**
* Gets the node that resulted from any {@link TemporaryMergeBehaviour}
@@ -51,7 +50,6 @@ public interface TemporaryDataMutateResult {
*
* @return the resultant node
*/
@NonNull
Node getMergedNode();
@NonNull Node getMergedNode();
}
@@ -42,8 +42,7 @@ public interface Track {
*
* @return the name of this track
*/
@NonNull
String getName();
@NonNull String getName();
/**
* Gets a list of the groups on this track
@@ -54,8 +53,7 @@ public interface Track {
*
* @return an ordered {@link List} of the groups on this track
*/
@NonNull
List<String> getGroups();
@NonNull List<String> getGroups();
/**
* Gets the number of groups on this track
@@ -74,8 +72,7 @@ public interface Track {
* @throws NullPointerException if the group is null
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
*/
@Nullable
String getNext(@NonNull Group current);
@Nullable String getNext(@NonNull Group current);
/**
* Gets the previous group on the track, before the one provided
@@ -87,41 +84,37 @@ public interface Track {
* @throws NullPointerException if the group is null
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
*/
@Nullable
String getPrevious(@NonNull Group current);
@Nullable String getPrevious(@NonNull Group current);
/**
* Promotes the given user along this track.
*
* @param user the user to promote
* @param user the user to promote
* @param contextSet the contexts to promote the user in
* @return the result of the action
* @since 4.2
*/
@NonNull
PromotionResult promote(@NonNull User user, @NonNull ContextSet contextSet);
@NonNull PromotionResult promote(@NonNull User user, @NonNull ContextSet contextSet);
/**
* Demotes the given user along this track.
*
* @param user the user to demote
* @param user the user to demote
* @param contextSet the contexts to demote the user in
* @return the result of the action
* @since 4.2
*/
@NonNull
DemotionResult demote(@NonNull User user, @NonNull ContextSet contextSet);
@NonNull DemotionResult demote(@NonNull User user, @NonNull ContextSet contextSet);
/**
* Appends a group to the end of this track
*
* @param group the group to append
* @return the result of the operation
* @throws NullPointerException if the group is null
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
* @throws NullPointerException if the group is null
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
*/
@NonNull
DataMutateResult appendGroup(@NonNull Group group);
@NonNull DataMutateResult appendGroup(@NonNull Group group);
/**
* Inserts a group at a certain position on this track
@@ -133,8 +126,7 @@ public interface Track {
* @throws NullPointerException if the group is null
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
*/
@NonNull
DataMutateResult insertGroup(@NonNull Group group, int position) throws IndexOutOfBoundsException;
@NonNull DataMutateResult insertGroup(@NonNull Group group, int position) throws IndexOutOfBoundsException;
/**
* Removes a group from this track
@@ -144,8 +136,7 @@ public interface Track {
* @throws NullPointerException if the group is null
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
*/
@NonNull
DataMutateResult removeGroup(@NonNull Group group);
@NonNull DataMutateResult removeGroup(@NonNull Group group);
/**
* Removes a group from this track
@@ -154,8 +145,7 @@ public interface Track {
* @return the result of the operation
* @throws NullPointerException if the group is null
*/
@NonNull
DataMutateResult removeGroup(@NonNull String group);
@NonNull DataMutateResult removeGroup(@NonNull String group);
/**
* Checks if a group features on this track
@@ -42,8 +42,7 @@ public interface User extends PermissionHolder {
*
* @return the users Mojang assigned unique id
*/
@NonNull
UUID getUuid();
@NonNull UUID getUuid();
/**
* Gets the users username
@@ -52,8 +51,7 @@ public interface User extends PermissionHolder {
*
* @return the users username
*/
@Nullable
String getName();
@Nullable String getName();
/**
* Gets the users current primary group.
@@ -64,8 +62,7 @@ public interface User extends PermissionHolder {
*
* @return the users primary group
*/
@NonNull
String getPrimaryGroup();
@NonNull String getPrimaryGroup();
/**
* Sets a users primary group.
@@ -75,11 +72,10 @@ public interface User extends PermissionHolder {
*
* @param group the new primary group
* @return if the change was applied successfully
* @throws IllegalStateException if the user is not a member of that group
* @throws NullPointerException if the group is null
* @throws IllegalStateException if the user is not a member of that group
* @throws NullPointerException if the group is null
*/
@NonNull
DataMutateResult setPrimaryGroup(@NonNull String group);
@NonNull DataMutateResult setPrimaryGroup(@NonNull String group);
/**
* Gets the user's {@link UserData} cache.
@@ -87,16 +83,15 @@ public interface User extends PermissionHolder {
* @return the users cached data.
* @since 3.2
*/
@NonNull
@Override
UserData getCachedData();
@NonNull UserData getCachedData();
/**
* Refresh and re-assign the users permissions.
*
* @deprecated Calling this method is no longer necessary. Permissions data is now refreshed on
* demand, as changes are made. Consider use of {@link #refreshCachedData()}
* instead. This method is now implemented as a no-op.
* demand, as changes are made. Consider use of {@link #refreshCachedData()}
* instead. This method is now implemented as a no-op.
*/
@Deprecated
void refreshPermissions();
@@ -34,7 +34,7 @@ import java.util.UUID;
* LuckPerms UUIDs.
*
* @deprecated this feature is now handled internally - and the API returns a
* No-op implementation of this class.
* No-op implementation of this class.
*/
@Deprecated
public interface UuidCache {
@@ -50,9 +50,8 @@ public interface UuidCache {
* <code>ProxiedPlayer#getUniqueId</code>
* @return the corresponding internal UUID
*/
@NonNull
@Deprecated
UUID getUUID(@NonNull UUID mojangUuid);
@NonNull UUID getUUID(@NonNull UUID mojangUuid);
/**
* Gets a users "external", server assigned unique id, from the internal
@@ -62,8 +61,7 @@ public interface UuidCache {
* <code>User#getUuid</code>
* @return the corresponding external UUID
*/
@NonNull
@Deprecated
UUID getExternalUUID(@NonNull UUID internalUuid);
@NonNull UUID getExternalUUID(@NonNull UUID internalUuid);
}
@@ -57,8 +57,7 @@ public interface CachedData {
* @return a permission data instance
* @throws NullPointerException if contexts is null
*/
@NonNull
PermissionData getPermissionData(@NonNull Contexts contexts);
@NonNull PermissionData getPermissionData(@NonNull Contexts contexts);
/**
* Gets MetaData from the cache, given a specified context.
@@ -68,8 +67,7 @@ public interface CachedData {
* @throws NullPointerException if contexts is null
* @since 3.2
*/
@NonNull
MetaData getMetaData(@NonNull MetaContexts contexts);
@NonNull MetaData getMetaData(@NonNull MetaContexts contexts);
/**
* Gets MetaData from the cache, given a specified context.
@@ -78,8 +76,7 @@ public interface CachedData {
* @return a meta data instance
* @throws NullPointerException if contexts is null
*/
@NonNull
MetaData getMetaData(@NonNull Contexts contexts);
@NonNull MetaData getMetaData(@NonNull Contexts contexts);
/**
* Calculates permission data, bypassing the cache.
@@ -96,8 +93,7 @@ public interface CachedData {
* @return a permission data instance
* @throws NullPointerException if contexts is null
*/
@NonNull
PermissionData calculatePermissions(@NonNull Contexts contexts);
@NonNull PermissionData calculatePermissions(@NonNull Contexts contexts);
/**
* Calculates meta data, bypassing the cache.
@@ -115,8 +111,7 @@ public interface CachedData {
* @throws NullPointerException if contexts is null
* @since 3.2
*/
@NonNull
MetaData calculateMeta(@NonNull MetaContexts contexts);
@NonNull MetaData calculateMeta(@NonNull MetaContexts contexts);
/**
* Calculates meta data, bypassing the cache.
@@ -133,8 +128,7 @@ public interface CachedData {
* @return a meta data instance
* @throws NullPointerException if contexts is null
*/
@NonNull
MetaData calculateMeta(@NonNull Contexts contexts);
@NonNull MetaData calculateMeta(@NonNull Contexts contexts);
/**
* (Re)calculates permission data for a given context.
@@ -212,12 +206,11 @@ public interface CachedData {
* until the recalculation has been performed.</p>
*
* @param contexts the contexts to reload in.
* @throws NullPointerException if contexts is null
* @return a future
* @throws NullPointerException if contexts is null
* @since 4.0
*/
@NonNull
CompletableFuture<? extends PermissionData> reloadPermissions(@NonNull Contexts contexts);
@NonNull CompletableFuture<? extends PermissionData> reloadPermissions(@NonNull Contexts contexts);
/**
* (Re)loads meta data for a given context.
@@ -240,12 +233,11 @@ public interface CachedData {
* until the recalculation has been performed.</p>
*
* @param contexts the contexts to reload in.
* @throws NullPointerException if contexts is null
* @return a future
* @throws NullPointerException if contexts is null
* @since 4.0
*/
@NonNull
CompletableFuture<? extends MetaData> reloadMeta(@NonNull MetaContexts contexts);
@NonNull CompletableFuture<? extends MetaData> reloadMeta(@NonNull MetaContexts contexts);
/**
* (Re)loads meta data for a given context.
@@ -268,12 +260,11 @@ public interface CachedData {
* until the recalculation has been performed.</p>
*
* @param contexts the contexts to reload in.
* @throws NullPointerException if contexts is null
* @return a future
* @throws NullPointerException if contexts is null
* @since 4.0
*/
@NonNull
CompletableFuture<? extends MetaData> reloadMeta(@NonNull Contexts contexts);
@NonNull CompletableFuture<? extends MetaData> reloadMeta(@NonNull Contexts contexts);
/**
* Recalculates permission data for all known contexts.
@@ -318,8 +309,7 @@ public interface CachedData {
* @return a future
* @since 4.0
*/
@NonNull
CompletableFuture<Void> reloadPermissions();
@NonNull CompletableFuture<Void> reloadPermissions();
/**
* Reloads meta data for all known contexts.
@@ -342,8 +332,7 @@ public interface CachedData {
* @return a future
* @since 4.0
*/
@NonNull
CompletableFuture<Void> reloadMeta();
@NonNull CompletableFuture<Void> reloadMeta();
/**
* Pre-calculates and caches {@link PermissionData} and {@link MetaData}
@@ -41,7 +41,6 @@ public interface CachedDataContainer {
*
* @return the contexts this container is caching
*/
@NonNull
Contexts getContexts();
@NonNull Contexts getContexts();
}
@@ -45,7 +45,7 @@ public final class MetaContexts {
/**
* Creates a new meta contexts instance
*
* @param contexts the standard contexts for the query
* @param contexts the standard contexts for the query
* @param prefixStackDefinition the prefix stack definition to be used
* @param suffixStackDefinition the suffix stack definition to be used
* @return the new instance
@@ -64,7 +64,7 @@ public final class MetaContexts {
/**
* Creates a new meta contexts instance
*
* @param contexts the standard contexts for the query
* @param contexts the standard contexts for the query
* @param prefixStackDefinition the prefix stack definition to be used
* @param suffixStackDefinition the suffix stack definition to be used
*/
@@ -47,8 +47,7 @@ public interface MetaData extends CachedDataContainer {
*
* @return the contexts this container is caching
*/
@NonNull
MetaContexts getMetaContexts();
@NonNull MetaContexts getMetaContexts();
/**
* Gets an immutable copy of the meta this user has.
@@ -62,8 +61,7 @@ public interface MetaData extends CachedDataContainer {
* @return an immutable multimap of meta
* @since 3.3
*/
@NonNull
ListMultimap<String, String> getMetaMultimap();
@NonNull ListMultimap<String, String> getMetaMultimap();
/**
* Gets an immutable copy of the meta this user has.
@@ -73,8 +71,7 @@ public interface MetaData extends CachedDataContainer {
*
* @return an immutable map of meta
*/
@NonNull
Map<String, String> getMeta();
@NonNull Map<String, String> getMeta();
/**
* Gets an immutable sorted map of all of the prefixes the user has, whereby the first value is the highest priority
@@ -82,8 +79,7 @@ public interface MetaData extends CachedDataContainer {
*
* @return a sorted map of prefixes
*/
@NonNull
SortedMap<Integer, String> getPrefixes();
@NonNull SortedMap<Integer, String> getPrefixes();
/**
* Gets an immutable sorted map of all of the suffixes the user has, whereby the first value is the highest priority
@@ -91,24 +87,21 @@ public interface MetaData extends CachedDataContainer {
*
* @return a sorted map of suffixes
*/
@NonNull
SortedMap<Integer, String> getSuffixes();
@NonNull SortedMap<Integer, String> getSuffixes();
/**
* Gets the user's highest priority prefix, or null if the user has no prefixes
*
* @return a prefix string, or null
*/
@Nullable
String getPrefix();
@Nullable String getPrefix();
/**
* Gets the user's highest priority suffix, or null if the user has no suffixes
*
* @return a suffix string, or null
*/
@Nullable
String getSuffix();
@Nullable String getSuffix();
/**
* Gets the definition used for the prefix stack
@@ -116,8 +109,7 @@ public interface MetaData extends CachedDataContainer {
* @return the definition used for the prefix stack
* @since 3.2
*/
@NonNull
MetaStackDefinition getPrefixStackDefinition();
@NonNull MetaStackDefinition getPrefixStackDefinition();
/**
* Gets the definition used for the suffix stack
@@ -125,7 +117,6 @@ public interface MetaData extends CachedDataContainer {
* @return the definition used for the suffix stack
* @since 3.2
*/
@NonNull
MetaStackDefinition getSuffixStackDefinition();
@NonNull MetaStackDefinition getSuffixStackDefinition();
}
@@ -45,8 +45,7 @@ public interface PermissionData extends CachedDataContainer {
* @return a tristate result
* @throws NullPointerException if permission is null
*/
@NonNull
Tristate getPermissionValue(@NonNull String permission);
@NonNull Tristate getPermissionValue(@NonNull String permission);
/**
* Invalidates the underlying permission calculator cache.
@@ -60,7 +59,6 @@ public interface PermissionData extends CachedDataContainer {
*
* @return an immutable set of permissions
*/
@NonNull
Map<String, Boolean> getImmutableBacking();
@NonNull Map<String, Boolean> getImmutableBacking();
}
@@ -44,7 +44,6 @@ public interface ContextCalculator<T> {
* @return the map
* @since 2.13
*/
@NonNull
MutableContextSet giveApplicableContext(@NonNull T subject, @NonNull MutableContextSet accumulator);
@NonNull MutableContextSet giveApplicableContext(@NonNull T subject, @NonNull MutableContextSet accumulator);
}
@@ -44,9 +44,9 @@ import java.util.Optional;
*
* <p></p>
* <ul>
* <li>{@code org.bukkit.entity.Player}</li>
* <li>{@code net.md_5.bungee.api.connection.ProxiedPlayer}</li>
* <li>{@code org.spongepowered.api.service.permission.Subject}</li>
* <li>{@code org.bukkit.entity.Player}</li>
* <li>{@code net.md_5.bungee.api.connection.ProxiedPlayer}</li>
* <li>{@code org.spongepowered.api.service.permission.Subject}</li>
* </ul>
*
* @since 4.0
@@ -59,8 +59,7 @@ public interface ContextManager {
* @param subject the subject
* @return the applicable context for the subject
*/
@NonNull
ImmutableContextSet getApplicableContext(@NonNull Object subject);
@NonNull ImmutableContextSet getApplicableContext(@NonNull Object subject);
/**
* Queries the ContextManager for current context values for the subject.
@@ -68,8 +67,7 @@ public interface ContextManager {
* @param subject the subject
* @return the applicable context for the subject
*/
@NonNull
Contexts getApplicableContexts(@NonNull Object subject);
@NonNull Contexts getApplicableContexts(@NonNull Object subject);
/**
* Queries the ContextManager for current context values for the given User.
@@ -83,8 +81,7 @@ public interface ContextManager {
* @param user the user
* @return the applicable context for the subject
*/
@NonNull
Optional<ImmutableContextSet> lookupApplicableContext(@NonNull User user);
@NonNull Optional<ImmutableContextSet> lookupApplicableContext(@NonNull User user);
/**
* Queries the ContextManager for current context values for the given User.
@@ -98,8 +95,7 @@ public interface ContextManager {
* @param user the user
* @return the applicable context for the subject
*/
@NonNull
Optional<Contexts> lookupApplicableContexts(@NonNull User user);
@NonNull Optional<Contexts> lookupApplicableContexts(@NonNull User user);
/**
* Gets the contexts from the static calculators in this manager.
@@ -109,8 +105,7 @@ public interface ContextManager {
*
* @return the current active static contexts
*/
@NonNull
ImmutableContextSet getStaticContext();
@NonNull ImmutableContextSet getStaticContext();
/**
* Gets the contexts from the static calculators in this manager.
@@ -120,8 +115,7 @@ public interface ContextManager {
*
* @return the current active static contexts
*/
@NonNull
Contexts getStaticContexts();
@NonNull Contexts getStaticContexts();
/**
* Forms a {@link Contexts} instance from an {@link ImmutableContextSet}.
@@ -129,12 +123,11 @@ public interface ContextManager {
* <p>This method relies on the plugins configuration to form the
* {@link Contexts} instance.</p>
*
* @param subject the reference subject
* @param subject the reference subject
* @param contextSet the context set
* @return a contexts instance
*/
@NonNull
Contexts formContexts(@NonNull Object subject, @NonNull ImmutableContextSet contextSet);
@NonNull Contexts formContexts(@NonNull Object subject, @NonNull ImmutableContextSet contextSet);
/**
* Forms a {@link Contexts} instance from an {@link ImmutableContextSet}.
@@ -145,8 +138,7 @@ public interface ContextManager {
* @param contextSet the context set
* @return a contexts instance
*/
@NonNull
Contexts formContexts(@NonNull ImmutableContextSet contextSet);
@NonNull Contexts formContexts(@NonNull ImmutableContextSet contextSet);
/**
* Registers a context calculator with the manager.
@@ -78,9 +78,9 @@ public interface ContextSet extends Iterable<Map.Entry<String, String>> {
/**
* Creates an {@link ImmutableContextSet} from two context pairs.
*
* @param key1 the first key
* @param key1 the first key
* @param value1 the first value
* @param key2 the second key
* @param key2 the second key
* @param value2 the second value
* @return a new ImmutableContextSet containing the two pairs
* @throws NullPointerException if any of the keys or values are null
@@ -163,8 +163,7 @@ public interface ContextSet extends Iterable<Map.Entry<String, String>> {
*
* @return an immutable representation of this set
*/
@NonNull
ImmutableContextSet makeImmutable();
@NonNull ImmutableContextSet makeImmutable();
/**
* Creates a mutable copy of this {@link ContextSet}.
@@ -175,8 +174,7 @@ public interface ContextSet extends Iterable<Map.Entry<String, String>> {
* @return a mutable ContextSet
* @since 2.16
*/
@NonNull
MutableContextSet mutableCopy();
@NonNull MutableContextSet mutableCopy();
/**
* Returns a {@link Set} of {@link Map.Entry}s representing the current
@@ -187,8 +185,7 @@ public interface ContextSet extends Iterable<Map.Entry<String, String>> {
*
* @return an immutable set
*/
@NonNull
Set<Map.Entry<String, String>> toSet();
@NonNull Set<Map.Entry<String, String>> toSet();
/**
* Returns a {@link Map} <b>loosely</b> representing the current state of
@@ -207,9 +204,8 @@ public interface ContextSet extends Iterable<Map.Entry<String, String>> {
* @return an immutable map
* @deprecated because the resultant map may not contain all data in the ContextSet
*/
@NonNull
@Deprecated
Map<String, String> toMap();
@NonNull Map<String, String> toMap();
/**
* Returns a {@link Multimap} representing the current state of this
@@ -221,8 +217,7 @@ public interface ContextSet extends Iterable<Map.Entry<String, String>> {
* @return a multimap
* @since 2.16
*/
@NonNull
Multimap<String, String> toMultimap();
@NonNull Multimap<String, String> toMultimap();
/**
* Returns an {@link Iterator} over each of the context pairs in this set.
@@ -234,9 +229,8 @@ public interface ContextSet extends Iterable<Map.Entry<String, String>> {
*
* @return an iterator
*/
@NonNull
@Override
Iterator<Map.Entry<String, String>> iterator();
@NonNull Iterator<Map.Entry<String, String>> iterator();
/**
* Returns if the {@link ContextSet} contains at least one value for the
@@ -258,8 +252,7 @@ public interface ContextSet extends Iterable<Map.Entry<String, String>> {
* @return a set of values
* @throws NullPointerException if the key is null
*/
@NonNull
Set<String> getValues(@NonNull String key);
@NonNull Set<String> getValues(@NonNull String key);
/**
* Returns any value from this {@link ContextSet} matching the key, if present.
@@ -43,13 +43,12 @@ public interface StaticContextCalculator extends ContextCalculator<Object> {
* @param accumulator a map of contexts to add to
* @return the map
*/
@NonNull
MutableContextSet giveApplicableContext(@NonNull MutableContextSet accumulator);
@NonNull MutableContextSet giveApplicableContext(@NonNull MutableContextSet accumulator);
/**
* Gives the subject all of the applicable contexts they meet
*
* @param subject the subject to add contexts to
* @param subject the subject to add contexts to
* @param accumulator a map of contexts to add to
* @return the map
*/
@@ -39,9 +39,7 @@ public interface Cancellable {
*
* @return the cancellation
*/
@NonNull
@Param(-1)
AtomicBoolean getCancellationState();
@NonNull @Param(-1) AtomicBoolean getCancellationState();
/**
* Returns true if the event is currently cancelled.
@@ -51,8 +51,7 @@ public interface EventBus {
* @param <T> the event class
* @return an event handler instance representing this subscription
*/
@NonNull
<T extends LuckPermsEvent> EventHandler<T> subscribe(@NonNull Class<T> eventClass, @NonNull Consumer<? super T> handler);
@NonNull <T extends LuckPermsEvent> EventHandler<T> subscribe(@NonNull Class<T> eventClass, @NonNull Consumer<? super T> handler);
/**
* Registers a new subscription to the given event.
@@ -72,8 +71,7 @@ public interface EventBus {
* @param handler the event handler
* @return an event handler instance representing this subscription
*/
@NonNull
<T extends LuckPermsEvent> EventHandler<T> subscribe(Object plugin, @NonNull Class<T> eventClass, @NonNull Consumer<? super T> handler);
@NonNull <T extends LuckPermsEvent> EventHandler<T> subscribe(Object plugin, @NonNull Class<T> eventClass, @NonNull Consumer<? super T> handler);
/**
* Gets a set of all registered handlers for a given event.
@@ -82,7 +80,6 @@ public interface EventBus {
* @param <T> the event class
* @return an immutable set of event handlers
*/
@NonNull
<T extends LuckPermsEvent> Set<EventHandler<T>> getHandlers(@NonNull Class<T> eventClass);
@NonNull <T extends LuckPermsEvent> Set<EventHandler<T>> getHandlers(@NonNull Class<T> eventClass);
}
@@ -41,8 +41,7 @@ public interface EventHandler<T extends LuckPermsEvent> extends AutoCloseable {
*
* @return the event class
*/
@NonNull
Class<T> getEventClass();
@NonNull Class<T> getEventClass();
/**
* Returns true if this handler is active
@@ -63,8 +62,7 @@ public interface EventHandler<T extends LuckPermsEvent> extends AutoCloseable {
*
* @return the event consumer
*/
@NonNull
Consumer<? super T> getConsumer();
@NonNull Consumer<? super T> getConsumer();
/**
* Gets the number of times this handler has been called
@@ -41,7 +41,6 @@ public interface LuckPermsEvent {
*
* @return the api instance
*/
@NonNull
LuckPermsApi getApi();
@NonNull LuckPermsApi getApi();
}
@@ -44,8 +44,6 @@ public interface Sourced {
*
* @return the source
*/
@NonNull
@Param(-1)
Source getSource();
@NonNull @Param(-1) Source getSource();
}
@@ -44,17 +44,13 @@ public interface GroupCacheLoadEvent extends LuckPermsEvent {
*
* @return the group
*/
@NonNull
@Param(0)
Group getGroup();
@NonNull @Param(0) Group getGroup();
/**
* Gets the data that was loaded
*
* @return the loaded data
*/
@NonNull
@Param(1)
GroupData getLoadedData();
@NonNull @Param(1) GroupData getLoadedData();
}
@@ -42,17 +42,13 @@ public interface GroupCreateEvent extends LuckPermsEvent {
*
* @return the new group
*/
@NonNull
@Param(0)
Group getGroup();
@NonNull @Param(0) Group getGroup();
/**
* Gets the cause of the creation
*
* @return the cause of the creation
*/
@NonNull
@Param(1)
CreationCause getCause();
@NonNull @Param(1) CreationCause getCause();
}
@@ -44,17 +44,13 @@ public interface GroupDataRecalculateEvent extends LuckPermsEvent {
*
* @return the group
*/
@NonNull
@Param(0)
Group getGroup();
@NonNull @Param(0) Group getGroup();
/**
* Gets the data that was recalculated
*
* @return the data
*/
@NonNull
@Param(1)
GroupData getData();
@NonNull @Param(1) GroupData getData();
}
@@ -44,26 +44,20 @@ public interface GroupDeleteEvent extends LuckPermsEvent {
*
* @return the name of the deleted group
*/
@NonNull
@Param(0)
String getGroupName();
@NonNull @Param(0) String getGroupName();
/**
* Gets an immutable copy of the groups existing data
*
* @return a copy of the groups existing data
*/
@NonNull
@Param(1)
Set<Node> getExistingData();
@NonNull @Param(1) Set<Node> getExistingData();
/**
* Gets the cause of the deletion
*
* @return the cause of the deletion
*/
@NonNull
@Param(2)
DeletionCause getCause();
@NonNull @Param(2) DeletionCause getCause();
}
@@ -43,8 +43,6 @@ public interface GroupLoadEvent extends LuckPermsEvent {
*
* @return the group that was loaded
*/
@NonNull
@Param(0)
Group getGroup();
@NonNull @Param(0) Group getGroup();
}
@@ -42,9 +42,7 @@ public interface LogBroadcastEvent extends LuckPermsEvent, Cancellable {
*
* @return the log entry to be broadcasted
*/
@NonNull
@Param(0)
LogEntry getEntry();
@NonNull @Param(0) LogEntry getEntry();
/**
* Gets where the log entry originated from.
@@ -52,9 +50,7 @@ public interface LogBroadcastEvent extends LuckPermsEvent, Cancellable {
* @return the origin of the log
* @since 3.3
*/
@NonNull
@Param(1)
Origin getOrigin();
@NonNull @Param(1) Origin getOrigin();
/**
* Represents where a log entry is from
@@ -46,17 +46,13 @@ public interface LogNetworkPublishEvent extends LuckPermsEvent, Cancellable {
*
* @return the id of the log entry being published
*/
@NonNull
@Param(0)
UUID getLogId();
@NonNull @Param(0) UUID getLogId();
/**
* Gets the log entry to be published
*
* @return the log entry to be published
*/
@NonNull
@Param(1)
LogEntry getEntry();
@NonNull @Param(1) LogEntry getEntry();
}
@@ -50,27 +50,21 @@ public interface LogNotifyEvent extends LuckPermsEvent, Cancellable {
*
* @return the log entry to be sent
*/
@NonNull
@Param(0)
LogEntry getEntry();
@NonNull @Param(0) LogEntry getEntry();
/**
* Gets where the log entry originated from.
*
* @return the origin of the log
*/
@NonNull
@Param(1)
Origin getOrigin();
@NonNull @Param(1) Origin getOrigin();
/**
* Gets the object to be notified.
*
* @return the object to notify
*/
@NonNull
@Param(2)
Entity getNotifiable();
@NonNull @Param(2) Entity getNotifiable();
/**
* Represents where a log entry is from
@@ -42,8 +42,6 @@ public interface LogPublishEvent extends LuckPermsEvent, Cancellable {
*
* @return the log entry to be published
*/
@NonNull
@Param(0)
LogEntry getEntry();
@NonNull @Param(0) LogEntry getEntry();
}
@@ -45,17 +45,13 @@ public interface LogReceiveEvent extends LuckPermsEvent {
*
* @return the id of the log entry being received
*/
@NonNull
@Param(0)
UUID getLogId();
@NonNull @Param(0) UUID getLogId();
/**
* Gets the log entry being received
*
* @return the log entry being received
*/
@NonNull
@Param(1)
LogEntry getEntry();
@NonNull @Param(1) LogEntry getEntry();
}
@@ -40,8 +40,6 @@ public interface NodeAddEvent extends NodeMutateEvent {
*
* @return the node that was added
*/
@NonNull
@Param(3)
Node getNode();
@NonNull @Param(3) Node getNode();
}
@@ -46,27 +46,21 @@ public interface NodeMutateEvent extends LuckPermsEvent {
*
* @return the event target
*/
@NonNull
@Param(0)
PermissionHolder getTarget();
@NonNull @Param(0) PermissionHolder getTarget();
/**
* Gets an immutable copy of the holders data before the change
*
* @return the data before the change
*/
@NonNull
@Param(1)
Set<Node> getDataBefore();
@NonNull @Param(1) Set<Node> getDataBefore();
/**
* Gets an immutable copy of the holders data after the change
*
* @return the data after the change
*/
@NonNull
@Param(2)
Set<Node> getDataAfter();
@NonNull @Param(2) Set<Node> getDataAfter();
/**
* Gets whether the target of this event is a {@link me.lucko.luckperms.api.User}
@@ -40,8 +40,6 @@ public interface NodeRemoveEvent extends NodeMutateEvent {
*
* @return the node that was removed
*/
@NonNull
@Param(3)
Node getNode();
@NonNull @Param(3) Node getNode();
}
@@ -48,26 +48,20 @@ public interface PlayerDataSaveEvent extends LuckPermsEvent {
*
* @return the uuid
*/
@NonNull
@Param(0)
UUID getUuid();
@NonNull @Param(0) UUID getUuid();
/**
* Gets the username that was saved.
*
* @return the username
*/
@NonNull
@Param(1)
String getUsername();
@NonNull @Param(1) String getUsername();
/**
* Gets the result of the operation.
*
* @return the result
*/
@NonNull
@Param(2)
PlayerSaveResult getResult();
@NonNull @Param(2) PlayerSaveResult getResult();
}
@@ -41,7 +41,6 @@ public interface EntitySource extends Source {
*
* @return the entity
*/
@NonNull
Entity getEntity();
@NonNull Entity getEntity();
}
@@ -43,8 +43,7 @@ public interface Source {
*
* @return the type
*/
@NonNull
Type getType();
@NonNull Type getType();
/**
* Represents a type of source
@@ -43,8 +43,6 @@ public interface PreNetworkSyncEvent extends LuckPermsEvent, Cancellable {
*
* @return the id of the sync request
*/
@NonNull
@Param(0)
UUID getSyncId();
@NonNull @Param(0) UUID getSyncId();
}
@@ -42,17 +42,13 @@ public interface TrackCreateEvent extends LuckPermsEvent {
*
* @return the new track
*/
@NonNull
@Param(0)
Track getTrack();
@NonNull @Param(0) Track getTrack();
/**
* Gets the cause of the creation
*
* @return the cause of the creation
*/
@NonNull
@Param(1)
CreationCause getCause();
@NonNull @Param(1) CreationCause getCause();
}
@@ -43,26 +43,20 @@ public interface TrackDeleteEvent extends LuckPermsEvent {
*
* @return the name of the deleted track
*/
@NonNull
@Param(0)
String getTrackName();
@NonNull @Param(0) String getTrackName();
/**
* Gets an immutable copy of the tracks existing data
*
* @return a copy of the tracks existing data
*/
@NonNull
@Param(1)
List<String> getExistingData();
@NonNull @Param(1) List<String> getExistingData();
/**
* Gets the cause of the deletion
*
* @return the cause of the deletion
*/
@NonNull
@Param(2)
DeletionCause getCause();
@NonNull @Param(2) DeletionCause getCause();
}
@@ -43,8 +43,6 @@ public interface TrackLoadEvent extends LuckPermsEvent {
*
* @return the track that was loaded
*/
@NonNull
@Param(0)
Track getTrack();
@NonNull @Param(0) Track getTrack();
}
@@ -39,8 +39,6 @@ public interface TrackAddGroupEvent extends TrackMutateEvent {
*
* @return the group that was added
*/
@NonNull
@Param(3)
String getGroup();
@NonNull @Param(3) String getGroup();
}
@@ -43,26 +43,20 @@ public interface TrackMutateEvent extends LuckPermsEvent {
*
* @return the track that was mutated
*/
@NonNull
@Param(0)
Track getTrack();
@NonNull @Param(0) Track getTrack();
/**
* Gets an immutable copy of the tracks data before the change
*
* @return the data before the change
*/
@NonNull
@Param(1)
List<String> getDataBefore();
@NonNull @Param(1) List<String> getDataBefore();
/**
* Gets an immutable copy of the tracks data after the change
*
* @return the data after the change
*/
@NonNull
@Param(2)
List<String> getDataAfter();
@NonNull @Param(2) List<String> getDataAfter();
}
@@ -39,8 +39,6 @@ public interface TrackRemoveGroupEvent extends TrackMutateEvent {
*
* @return the group that was removed
*/
@NonNull
@Param(3)
String getGroup();
@NonNull @Param(3) String getGroup();
}
@@ -42,17 +42,13 @@ public interface UserCacheLoadEvent extends LuckPermsEvent {
*
* @return the user
*/
@NonNull
@Param(0)
User getUser();
@NonNull @Param(0) User getUser();
/**
* Gets the data that was loaded
*
* @return the loaded data
*/
@NonNull
@Param(1)
UserData getLoadedData();
@NonNull @Param(1) UserData getLoadedData();
}
@@ -42,17 +42,13 @@ public interface UserDataRecalculateEvent extends LuckPermsEvent {
*
* @return the user
*/
@NonNull
@Param(0)
User getUser();
@NonNull @Param(0) User getUser();
/**
* Gets the data that was recalculated
*
* @return the data
*/
@NonNull
@Param(1)
UserData getData();
@NonNull @Param(1) UserData getData();
}
@@ -50,17 +50,13 @@ public interface UserFirstLoginEvent extends LuckPermsEvent {
*
* @return the uuid of the user
*/
@NonNull
@Param(0)
UUID getUuid();
@NonNull @Param(0) UUID getUuid();
/**
* Gets the username of the user
*
* @return the username of the user
*/
@NonNull
@Param(1)
String getUsername();
@NonNull @Param(1) String getUsername();
}
@@ -41,8 +41,6 @@ public interface UserLoadEvent extends LuckPermsEvent {
*
* @return the user that was loaded
*/
@NonNull
@Param(0)
User getUser();
@NonNull @Param(0) User getUser();
}
@@ -52,26 +52,20 @@ public interface UserLoginProcessEvent extends LuckPermsEvent {
*
* @return the uuid of the connection which was processed
*/
@NonNull
@Param(0)
UUID getUuid();
@NonNull @Param(0) UUID getUuid();
/**
* Gets the username of the connection which was processed
*
* @return the username of the connection which was processed
*/
@NonNull
@Param(1)
String getUsername();
@NonNull @Param(1) String getUsername();
/**
* Gets the resultant User instance which was loaded.
*
* @return the user instance
*/
@NonNull
@Param(2)
User getUser();
@NonNull @Param(2) User getUser();
}
@@ -45,26 +45,21 @@ public interface UserTrackEvent extends LuckPermsEvent, Sourced {
*
* @return the track involved in the event
*/
@NonNull
@Param(0)
Track getTrack();
@NonNull @Param(0) Track getTrack();
/**
* Gets the user who was promoted or demoted
*
* @return the user involved in the event
*/
@NonNull
@Param(1)
User getUser();
@NonNull @Param(1) User getUser();
/**
* Gets the action performed
*
* @return the action performed
*/
@NonNull
TrackAction getAction();
@NonNull TrackAction getAction();
/**
* Gets the group the user was promoted/demoted from.
@@ -73,17 +68,13 @@ public interface UserTrackEvent extends LuckPermsEvent, Sourced {
*
* @return the group the user was promoted/demoted from
*/
@NonNull
@Param(2)
Optional<String> getGroupFrom();
@NonNull @Param(2) Optional<String> getGroupFrom();
/**
* Gets the group the user was promoted/demoted to
*
* @return the group the user was promoted/demoted to
*/
@NonNull
@Param(3)
Optional<String> getGroupTo();
@NonNull @Param(3) Optional<String> getGroupTo();
}
@@ -74,8 +74,7 @@ public interface GroupManager {
* @throws NullPointerException if the name is null
* @since 4.1
*/
@NonNull
CompletableFuture<Group> createAndLoadGroup(@NonNull String name);
@NonNull CompletableFuture<Group> createAndLoadGroup(@NonNull String name);
/**
* Loads a group from the plugin's storage provider into memory.
@@ -95,8 +94,7 @@ public interface GroupManager {
* @throws NullPointerException if the name is null
* @since 4.1
*/
@NonNull
CompletableFuture<Optional<Group>> loadGroup(@NonNull String name);
@NonNull CompletableFuture<Optional<Group>> loadGroup(@NonNull String name);
/**
* Saves a group's data back to the plugin's storage provider.
@@ -115,8 +113,7 @@ public interface GroupManager {
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
* @since 4.1
*/
@NonNull
CompletableFuture<Void> saveGroup(@NonNull Group group);
@NonNull CompletableFuture<Void> saveGroup(@NonNull Group group);
/**
* Permanently deletes a group from the plugin's storage provider.
@@ -127,15 +124,13 @@ public interface GroupManager {
* <p>Unlike the method in {@link Storage}, when a group cannot be deleted,
* the future will be {@link CompletableFuture completed exceptionally}.</p>
*
*
* @param group the group to delete
* @return a future to encapsulate the operation.
* @throws NullPointerException if group is null
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
* @since 4.1
*/
@NonNull
CompletableFuture<Void> deleteGroup(@NonNull Group group);
@NonNull CompletableFuture<Void> deleteGroup(@NonNull Group group);
/**
* Loads all groups into memory.
@@ -149,8 +144,7 @@ public interface GroupManager {
* @return a future to encapsulate the operation.
* @since 4.1
*/
@NonNull
CompletableFuture<Void> loadAllGroups();
@NonNull CompletableFuture<Void> loadAllGroups();
/**
* Searches for a list of groups with a given permission.
@@ -160,8 +154,7 @@ public interface GroupManager {
* @throws NullPointerException if the permission is null
* @since 4.2
*/
@NonNull
CompletableFuture<List<HeldPermission<String>>> getWithPermission(@NonNull String permission);
@NonNull CompletableFuture<List<HeldPermission<String>>> getWithPermission(@NonNull String permission);
/**
* Gets a loaded group.
@@ -170,8 +163,7 @@ public interface GroupManager {
* @return a {@link Group} object, if one matching the name exists, or null if not
* @throws NullPointerException if the name is null
*/
@Nullable
Group getGroup(@NonNull String name);
@Nullable Group getGroup(@NonNull String name);
/**
* Gets a loaded group.
@@ -191,8 +183,7 @@ public interface GroupManager {
*
* @return a {@link Set} of {@link Group} objects
*/
@NonNull
Set<Group> getLoadedGroups();
@NonNull Set<Group> getLoadedGroups();
/**
* Check if a group is loaded in memory
@@ -72,8 +72,7 @@ public interface TrackManager {
* @throws NullPointerException if the name is null
* @since 4.1
*/
@NonNull
CompletableFuture<Track> createAndLoadTrack(@NonNull String name);
@NonNull CompletableFuture<Track> createAndLoadTrack(@NonNull String name);
/**
* Loads a track from the plugin's storage provider into memory.
@@ -93,8 +92,7 @@ public interface TrackManager {
* @throws NullPointerException if the name is null
* @since 4.1
*/
@NonNull
CompletableFuture<Optional<Track>> loadTrack(@NonNull String name);
@NonNull CompletableFuture<Optional<Track>> loadTrack(@NonNull String name);
/**
* Saves a track's data back to the plugin's storage provider.
@@ -113,8 +111,7 @@ public interface TrackManager {
* @throws IllegalStateException if the track instance was not obtained from LuckPerms.
* @since 4.1
*/
@NonNull
CompletableFuture<Void> saveTrack(@NonNull Track track);
@NonNull CompletableFuture<Void> saveTrack(@NonNull Track track);
/**
* Permanently deletes a track from the plugin's storage provider.
@@ -125,15 +122,13 @@ public interface TrackManager {
* <p>Unlike the method in {@link Storage}, when a track cannot be deleted,
* the future will be {@link CompletableFuture completed exceptionally}.</p>
*
*
* @param track the track to delete
* @return a future to encapsulate the operation.
* @throws NullPointerException if track is null
* @throws IllegalStateException if the track instance was not obtained from LuckPerms.
* @since 4.1
*/
@NonNull
CompletableFuture<Void> deleteTrack(@NonNull Track track);
@NonNull CompletableFuture<Void> deleteTrack(@NonNull Track track);
/**
* Loads all tracks into memory.
@@ -147,8 +142,7 @@ public interface TrackManager {
* @return a future to encapsulate the operation.
* @since 4.1
*/
@NonNull
CompletableFuture<Void> loadAllTracks();
@NonNull CompletableFuture<Void> loadAllTracks();
/**
* Gets a loaded track.
@@ -157,8 +151,7 @@ public interface TrackManager {
* @return a {@link Track} object, if one matching the name exists, or null if not
* @throws NullPointerException if the name is null
*/
@Nullable
Track getTrack(@NonNull String name);
@Nullable Track getTrack(@NonNull String name);
/**
* Gets a loaded track.
@@ -178,8 +171,7 @@ public interface TrackManager {
*
* @return a {@link Set} of {@link Track} objects
*/
@NonNull
Set<Track> getLoadedTracks();
@NonNull Set<Track> getLoadedTracks();
/**
* Check if a track is loaded in memory
@@ -71,14 +71,13 @@ public interface UserManager {
* <p>Unlike the method in {@link Storage}, when a user cannot be loaded,
* the future will be {@link CompletableFuture completed exceptionally}.</p>
*
* @param uuid the uuid of the user
* @param uuid the uuid of the user
* @param username the username, if known
* @return the resultant user
* @throws NullPointerException if the uuid is null
* @since 4.1
*/
@NonNull
CompletableFuture<User> loadUser(@NonNull UUID uuid, @Nullable String username);
@NonNull CompletableFuture<User> loadUser(@NonNull UUID uuid, @Nullable String username);
/**
* Loads a user from the plugin's storage provider into memory.
@@ -110,8 +109,7 @@ public interface UserManager {
* @throws IllegalArgumentException if the username is invalid
* @since 4.2
*/
@NonNull
CompletableFuture<UUID> lookupUuid(@NonNull String username);
@NonNull CompletableFuture<UUID> lookupUuid(@NonNull String username);
/**
* Uses the LuckPerms cache to find a username for the given uuid.
@@ -122,8 +120,7 @@ public interface UserManager {
* @throws IllegalArgumentException if the username is invalid
* @since 4.2
*/
@NonNull
CompletableFuture<String> lookupUsername(@NonNull UUID uuid);
@NonNull CompletableFuture<String> lookupUsername(@NonNull UUID uuid);
/**
* Saves a user's data back to the plugin's storage provider.
@@ -142,8 +139,7 @@ public interface UserManager {
* @throws IllegalStateException if the user instance was not obtained from LuckPerms.
* @since 4.1
*/
@NonNull
CompletableFuture<Void> saveUser(@NonNull User user);
@NonNull CompletableFuture<Void> saveUser(@NonNull User user);
/**
* Saves data about a player to the uuid caching system.
@@ -155,8 +151,7 @@ public interface UserManager {
* @throws IllegalArgumentException if the username is invalid
* @since 4.2
*/
@NonNull
CompletableFuture<PlayerSaveResult> savePlayerData(@NonNull UUID uuid, @NonNull String username);
@NonNull CompletableFuture<PlayerSaveResult> savePlayerData(@NonNull UUID uuid, @NonNull String username);
/**
* Gets a set all "unique" user UUIDs.
@@ -166,8 +161,7 @@ public interface UserManager {
* @return a set of uuids
* @since 4.2
*/
@NonNull
CompletableFuture<Set<UUID>> getUniqueUsers();
@NonNull CompletableFuture<Set<UUID>> getUniqueUsers();
/**
* Searches for a list of users with a given permission.
@@ -177,8 +171,7 @@ public interface UserManager {
* @throws NullPointerException if the permission is null
* @since 4.2
*/
@NonNull
CompletableFuture<List<HeldPermission<UUID>>> getWithPermission(@NonNull String permission);
@NonNull CompletableFuture<List<HeldPermission<UUID>>> getWithPermission(@NonNull String permission);
/**
* Gets a loaded user.
@@ -187,8 +180,7 @@ public interface UserManager {
* @return a {@link User} object, if one matching the uuid is loaded, or null if not
* @throws NullPointerException if the uuid is null
*/
@Nullable
User getUser(@NonNull UUID uuid);
@Nullable User getUser(@NonNull UUID uuid);
/**
* Gets a loaded user.
@@ -208,8 +200,7 @@ public interface UserManager {
* @return a {@link User} object, if one matching the uuid is loaded, or null if not
* @throws NullPointerException if the name is null
*/
@Nullable
User getUser(@NonNull String name);
@Nullable User getUser(@NonNull String name);
/**
* Gets a loaded user.
@@ -227,8 +218,7 @@ public interface UserManager {
*
* @return a {@link Set} of {@link User} objects
*/
@NonNull
Set<User> getLoadedUsers();
@NonNull Set<User> getLoadedUsers();
/**
* Check if a user is loaded in memory
@@ -35,8 +35,8 @@ import org.checkerframework.checker.nullness.qual.NonNull;
* <p>Users wishing to provide their own implementation for the plugins
* "Messaging Service" should implement and register this interface.</p>
*
* @since 4.1
* @see LuckPermsApi#registerMessengerProvider(MessengerProvider)
* @since 4.1
*/
public interface MessengerProvider {
@@ -45,8 +45,7 @@ public interface MessengerProvider {
*
* @return the provider name
*/
@NonNull
String getName();
@NonNull String getName();
/**
* Creates and returns a new {@link Messenger} instance, which passes
@@ -59,7 +58,6 @@ public interface MessengerProvider {
* incoming messages to
* @return a new messenger agent instance
*/
@NonNull
Messenger obtain(@NonNull IncomingMessageConsumer incomingMessageConsumer);
@NonNull Messenger obtain(@NonNull IncomingMessageConsumer incomingMessageConsumer);
}
@@ -46,7 +46,6 @@ public interface Message {
*
* @return the id of the message
*/
@NonNull
UUID getId();
@NonNull UUID getId();
}
@@ -56,7 +56,6 @@ public interface OutgoingMessage extends Message {
*
* @return an encoded string form of the message
*/
@NonNull
String asEncodedString();
@NonNull String asEncodedString();
}
@@ -44,7 +44,6 @@ public interface LogMessage extends Message {
*
* @return the log entry
*/
@NonNull
LogEntry getLogEntry();
@NonNull LogEntry getLogEntry();
}
@@ -45,7 +45,6 @@ public interface UserUpdateMessage extends Message {
*
* @return the user
*/
@NonNull
UUID getUser();
@NonNull UUID getUser();
}
@@ -47,31 +47,27 @@ public interface MetaStackDefinition {
*
* @return the elements in this stack
*/
@NonNull
List<MetaStackElement> getElements();
@NonNull List<MetaStackElement> getElements();
/**
* Gets the spacer string added before any stack elements
*
* @return the start spacer
*/
@NonNull
String getStartSpacer();
@NonNull String getStartSpacer();
/**
* Gets the spacer added between stack elements
*
* @return the middle spacer
*/
@NonNull
String getMiddleSpacer();
@NonNull String getMiddleSpacer();
/**
* Gets the spacer added after any stack elements
*
* @return the end spacer
*/
@NonNull
String getEndSpacer();
@NonNull String getEndSpacer();
}
@@ -48,8 +48,8 @@ public interface MetaStackElement {
*
* <p>The element being considered can be retrieved using {@link ChatMetaType#getEntry(Node)}.</p>
*
* @param node the node being considered
* @param type the type of entry being accumulated
* @param node the node being considered
* @param type the type of entry being accumulated
* @param current the current value being used. If this returns true, the current value will be replaced by this entry
* @return true if the node should be accumulated into this element, replacing the current value
*/
@@ -43,8 +43,7 @@ public interface MetaStackFactory {
* @param definition the definition
* @return the parsed element, if present
*/
@NonNull
Optional<MetaStackElement> fromString(@NonNull String definition);
@NonNull Optional<MetaStackElement> fromString(@NonNull String definition);
/**
* Parses a list of {@link MetaStackElement}s from string, using the pre-defined elements in the plugin.
@@ -54,19 +53,17 @@ public interface MetaStackFactory {
* @param definitions the definition strings
* @return a list of parsed elements
*/
@NonNull
List<MetaStackElement> fromStrings(@NonNull List<String> definitions);
@NonNull List<MetaStackElement> fromStrings(@NonNull List<String> definitions);
/**
* Creates a new {@link MetaStackDefinition} with the given properties.
*
* @param elements the elements to be included in the stack.
* @param startSpacer the spacer to be included at the start of the stacks output
* @param elements the elements to be included in the stack.
* @param startSpacer the spacer to be included at the start of the stacks output
* @param middleSpacer the spacer to be included between stack elements
* @param endSpacer the spacer to be included at the end of the stacks output
* @param endSpacer the spacer to be included at the end of the stacks output
* @return the new stack definition instance
*/
@NonNull
MetaStackDefinition createDefinition(@NonNull List<MetaStackElement> elements, @NonNull String startSpacer, @NonNull String middleSpacer, @NonNull String endSpacer);
@NonNull MetaStackDefinition createDefinition(@NonNull List<MetaStackElement> elements, @NonNull String startSpacer, @NonNull String middleSpacer, @NonNull String endSpacer);
}
@@ -41,14 +41,14 @@ public interface DisplayNameType extends NodeType {
/**
* The key for this type.
*/
NodeTypeKey<DisplayNameType> KEY = new NodeTypeKey<DisplayNameType>(){};
NodeTypeKey<DisplayNameType> KEY = new NodeTypeKey<DisplayNameType>() {
};
/**
* Gets the display name.
*
* @return the display name
*/
@NonNull
String getDisplayName();
@NonNull String getDisplayName();
}
@@ -42,7 +42,8 @@ public interface InheritanceType extends NodeType {
/**
* The key for this type.
*/
NodeTypeKey<InheritanceType> KEY = new NodeTypeKey<InheritanceType>(){};
NodeTypeKey<InheritanceType> KEY = new NodeTypeKey<InheritanceType>() {
};
/**
* Gets the name of the group to be inherited.
@@ -51,7 +52,6 @@ public interface InheritanceType extends NodeType {
*
* @return the name of the group
*/
@NonNull
String getGroupName();
@NonNull String getGroupName();
}
@@ -43,23 +43,22 @@ public interface MetaType extends NodeType, Map.Entry<String, String> {
/**
* The key for this type.
*/
NodeTypeKey<MetaType> KEY = new NodeTypeKey<MetaType>(){};
NodeTypeKey<MetaType> KEY = new NodeTypeKey<MetaType>() {
};
/**
* Gets the meta key.
*
* @return the meta key
*/
@NonNull
String getKey();
@NonNull String getKey();
/**
* Gets the meta value.
*
* @return the meta value
*/
@NonNull
String getValue();
@NonNull String getValue();
@Override
@Deprecated
@@ -43,7 +43,8 @@ public interface PrefixType extends NodeType {
/**
* The key for this type.
*/
NodeTypeKey<PrefixType> KEY = new NodeTypeKey<PrefixType>(){};
NodeTypeKey<PrefixType> KEY = new NodeTypeKey<PrefixType>() {
};
/**
* Gets the priority of the prefix assignment.
@@ -57,8 +58,7 @@ public interface PrefixType extends NodeType {
*
* @return the prefix
*/
@NonNull
String getPrefix();
@NonNull String getPrefix();
/**
* Gets a representation of this instance as a {@link Map.Entry}.
@@ -44,15 +44,15 @@ public interface RegexType extends NodeType {
/**
* The key for this type.
*/
NodeTypeKey<RegexType> KEY = new NodeTypeKey<RegexType>(){};
NodeTypeKey<RegexType> KEY = new NodeTypeKey<RegexType>() {
};
/**
* Gets the non-compiled pattern string.
*
* @return the pattern string
*/
@NonNull
String getPatternString();
@NonNull String getPatternString();
/**
* Gets the pattern for the regex node.
@@ -61,7 +61,6 @@ public interface RegexType extends NodeType {
*
* @return the pattern
*/
@NonNull
Optional<Pattern> getPattern();
@NonNull Optional<Pattern> getPattern();
}
@@ -43,7 +43,8 @@ public interface SuffixType extends NodeType {
/**
* The key for this type.
*/
NodeTypeKey<SuffixType> KEY = new NodeTypeKey<SuffixType>(){};
NodeTypeKey<SuffixType> KEY = new NodeTypeKey<SuffixType>() {
};
/**
* Gets the priority of the suffix assignment.
@@ -57,8 +58,7 @@ public interface SuffixType extends NodeType {
*
* @return the suffix
*/
@NonNull
String getSuffix();
@NonNull String getSuffix();
/**
* Gets a representation of this instance as a {@link Map.Entry}.
@@ -39,7 +39,8 @@ public interface WeightType extends NodeType {
/**
* The key for this type.
*/
NodeTypeKey<WeightType> KEY = new NodeTypeKey<WeightType>(){};
NodeTypeKey<WeightType> KEY = new NodeTypeKey<WeightType>() {
};
/**
* Gets the weight value.
@@ -42,8 +42,7 @@ public interface PlatformInfo {
*
* @return the version of the plugin running on the platform
*/
@NonNull
String getVersion();
@NonNull String getVersion();
/**
* Gets the API version
@@ -57,16 +56,14 @@ public interface PlatformInfo {
*
* @return the type of platform LuckPerms is running on
*/
@NonNull
PlatformType getType();
@NonNull PlatformType getType();
/**
* Gets the unique players which have connected to the server since it started.
*
* @return the unique connections
*/
@NonNull
Set<UUID> getUniqueConnections();
@NonNull Set<UUID> getUniqueConnections();
/**
* Gets the time when the plugin first started in milliseconds.
@@ -34,11 +34,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
*/
public enum PlatformType {
BUKKIT("Bukkit"),
BUNGEE("Bungee"),
SPONGE("Sponge"),
NUKKIT("Nukkit"),
VELOCITY("Velocity");
BUKKIT("Bukkit"), BUNGEE("Bungee"), SPONGE("Sponge"), NUKKIT("Nukkit"), VELOCITY("Velocity");
private final String friendlyName;