Move from findbugs jsr305 to checker-qual

This commit is contained in:
Luck 2018-09-19 20:40:18 +01:00
parent 4987ca3ba2
commit 3941c77826
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
236 changed files with 1625 additions and 2231 deletions

View File

@ -2,7 +2,7 @@ project.version = '4.2'
dependencies {
compileOnly 'com.google.guava:guava:19.0'
compileOnly 'com.google.code.findbugs:jsr305:3.0.2'
compileOnly 'org.checkerframework:checker-qual:2.5.5'
}
if (project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePassword')) {

View File

@ -27,9 +27,9 @@ package me.lucko.luckperms;
import me.lucko.luckperms.api.LuckPermsApi;
import java.util.Optional;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnull;
import java.util.Optional;
/**
* Provides static access to the {@link LuckPermsApi}.
@ -49,8 +49,7 @@ public final class LuckPerms {
* @return an api instance
* @throws IllegalStateException if the api is not loaded
*/
@Nonnull
public static LuckPermsApi getApi() {
public static @NonNull LuckPermsApi getApi() {
if (instance == null) {
throw new IllegalStateException("API is not loaded.");
}
@ -66,8 +65,7 @@ public final class LuckPerms {
*
* @return an optional api instance
*/
@Nonnull
public static Optional<LuckPermsApi> getApiSafe() {
public static @NonNull Optional<LuckPermsApi> getApiSafe() {
return Optional.ofNullable(instance);
}

View File

@ -25,9 +25,9 @@
package me.lucko.luckperms.api;
import java.util.concurrent.CompletableFuture;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnull;
import java.util.concurrent.CompletableFuture;
/**
* Represents the object responsible for handling action logging.
@ -41,8 +41,7 @@ public interface ActionLogger {
*
* @return a new builder
*/
@Nonnull
LogEntry.Builder newEntryBuilder();
LogEntry.@NonNull Builder newEntryBuilder();
/**
* Gets a {@link Log} instance from the plugin storage.
@ -50,7 +49,7 @@ public interface ActionLogger {
* @return a log instance
* @see Storage#getLog()
*/
@Nonnull
@NonNull
CompletableFuture<Log> getLog();
/**
@ -69,8 +68,8 @@ 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.
@ -80,8 +79,8 @@ 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.
@ -92,7 +91,7 @@ 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);
}

View File

@ -25,12 +25,12 @@
package me.lucko.luckperms.api;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Nonnull;
/**
* Represents a type of chat meta
*
@ -43,13 +43,12 @@ public enum ChatMetaType {
*/
PREFIX("prefix") {
@Override
public boolean matches(@Nonnull Node node) {
public boolean matches(@NonNull Node node) {
return Objects.requireNonNull(node, "node").isPrefix();
}
@Nonnull
@Override
public Map.Entry<Integer, String> getEntry(@Nonnull Node node) {
public Map.@NonNull Entry<Integer, String> getEntry(@NonNull Node node) {
return Objects.requireNonNull(node, "node").getPrefix();
}
},
@ -59,13 +58,12 @@ public enum ChatMetaType {
*/
SUFFIX("suffix") {
@Override
public boolean matches(@Nonnull Node node) {
public boolean matches(@NonNull Node node) {
return Objects.requireNonNull(node, "node").isSuffix();
}
@Nonnull
@Override
public Map.Entry<Integer, String> getEntry(@Nonnull Node node) {
public Map.@NonNull Entry<Integer, String> getEntry(@NonNull Node node) {
return Objects.requireNonNull(node, "node").getSuffix();
}
};
@ -82,7 +80,7 @@ public enum ChatMetaType {
* @param node the node to test
* @return true if the node has the same type
*/
public abstract boolean matches(@Nonnull Node node);
public abstract boolean matches(@NonNull Node node);
/**
* Returns if the passed node should be ignored when searching for meta of this type
@ -90,7 +88,7 @@ public enum ChatMetaType {
* @param node the node to test
* @return true if the node does not share the same type
*/
public boolean shouldIgnore(@Nonnull Node node) {
public boolean shouldIgnore(@NonNull Node node) {
return !matches(node);
}
@ -101,8 +99,7 @@ public enum ChatMetaType {
* @return the entry
* @throws IllegalStateException if the node does not share the same type
*/
@Nonnull
public abstract Map.Entry<Integer, String> getEntry(@Nonnull Node node);
public abstract Map.@NonNull Entry<Integer, String> getEntry(@NonNull Node node);
@Override
public String toString() {
@ -116,8 +113,7 @@ public enum ChatMetaType {
* @return the parsed chat meta type
* @since 3.4
*/
@Nonnull
public static Optional<ChatMetaType> ofNode(@Nonnull Node node) {
public static @NonNull Optional<ChatMetaType> ofNode(@NonNull Node node) {
if (node.isPrefix()) {
return Optional.of(PREFIX);
} else if (node.isSuffix()) {

View File

@ -30,13 +30,12 @@ import com.google.common.collect.ImmutableSet;
import me.lucko.luckperms.api.context.ContextSet;
import me.lucko.luckperms.api.context.ImmutableContextSet;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.EnumSet;
import java.util.Objects;
import java.util.Set;
import javax.annotation.Nonnull;
import javax.annotation.concurrent.Immutable;
/**
* Encapsulates the {@link ContextSet contexts} and {@link LookupSetting settings} for
* a permission or meta lookup.
@ -45,7 +44,6 @@ import javax.annotation.concurrent.Immutable;
*
* @since 2.11
*/
@Immutable
public class Contexts {
/**
@ -82,8 +80,7 @@ public class Contexts {
*
* @return a context that will satisfy all contextual requirements.
*/
@Nonnull
public static Contexts allowAll() {
public static @NonNull Contexts allowAll() {
return FullySatisfiedContexts.getInstance();
}
@ -96,8 +93,7 @@ public class Contexts {
* @return the global contexts
* @since 3.3
*/
@Nonnull
public static Contexts global() {
public static @NonNull Contexts global() {
return GLOBAL;
}
@ -113,8 +109,7 @@ public class Contexts {
* @param isOp the value of {@link LookupSetting#IS_OP}
* @return a new instance
*/
@Nonnull
public static Contexts of(@Nonnull ContextSet contextSet, boolean includeNodesSetWithoutServer, boolean includeNodesSetWithoutWorld, boolean resolveInheritance, boolean applyParentsWithoutServer, boolean applyParentsWithoutWorld, boolean isOp) {
public static @NonNull Contexts of(@NonNull ContextSet contextSet, boolean includeNodesSetWithoutServer, boolean includeNodesSetWithoutWorld, boolean resolveInheritance, boolean applyParentsWithoutServer, boolean applyParentsWithoutWorld, boolean isOp) {
Objects.requireNonNull(contextSet, "contextSet");
EnumSet<LookupSetting> settings = formSettings(
includeNodesSetWithoutServer,
@ -145,7 +140,7 @@ public class Contexts {
* @param settings the settings
* @return a new instance
*/
public static Contexts of(@Nonnull ContextSet contextSet, @Nonnull Set<LookupSetting> settings) {
public static Contexts of(@NonNull ContextSet contextSet, @NonNull Set<LookupSetting> settings) {
Objects.requireNonNull(contextSet, "contextSet");
Objects.requireNonNull(settings, "settings");
@ -183,7 +178,7 @@ public class Contexts {
* @deprecated in favour of {@link #of(ContextSet, boolean, boolean, boolean, boolean, boolean, boolean)}
*/
@Deprecated
public Contexts(@Nonnull ContextSet contextSet, boolean includeNodesSetWithoutServer, boolean includeNodesSetWithoutWorld, boolean resolveInheritance, boolean applyParentsWithoutServer, boolean applyParentsWithoutWorld, boolean isOp) {
public Contexts(@NonNull ContextSet contextSet, boolean includeNodesSetWithoutServer, boolean includeNodesSetWithoutWorld, boolean resolveInheritance, boolean applyParentsWithoutServer, boolean applyParentsWithoutWorld, boolean isOp) {
this.contextSet = Objects.requireNonNull(contextSet, "contextSet").makeImmutable();
this.settings = ImmutableSet.copyOf(formSettings(
includeNodesSetWithoutServer,
@ -196,7 +191,7 @@ public class Contexts {
this.hashCode = calculateHashCode();
}
protected Contexts(@Nonnull ImmutableContextSet contextSet, @Nonnull ImmutableSet<LookupSetting> settings) {
protected Contexts(@NonNull ImmutableContextSet contextSet, @NonNull ImmutableSet<LookupSetting> settings) {
this.contextSet = contextSet;
this.settings = settings;
this.hashCode = calculateHashCode();
@ -208,8 +203,7 @@ public class Contexts {
* @return an immutable context from this instance
* @since 2.13
*/
@Nonnull
public ContextSet getContexts() {
public @NonNull ContextSet getContexts() {
return this.contextSet;
}
@ -219,8 +213,7 @@ public class Contexts {
* @return the settings
* @since 4.2
*/
@Nonnull
public Set<LookupSetting> getSettings() {
public @NonNull Set<LookupSetting> getSettings() {
return this.settings;
}
@ -231,7 +224,7 @@ public class Contexts {
* @return the value
* @since 4.2
*/
public boolean hasSetting(@Nonnull LookupSetting setting) {
public boolean hasSetting(@NonNull LookupSetting setting) {
return this.settings.contains(setting);
}
@ -307,9 +300,8 @@ public class Contexts {
return hasSetting(LookupSetting.APPLY_PARENTS_SET_WITHOUT_WORLD);
}
@Nonnull
@Override
public String toString() {
public @NonNull String toString() {
return "Contexts(contextSet=" + this.contextSet + ", settings=" + this.settings + ")";
}

View File

@ -25,9 +25,9 @@
package me.lucko.luckperms.api;
import java.util.Optional;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnull;
import java.util.Optional;
/**
* Encapsulates the result of {@link User}s demotion along a {@link Track}.
@ -41,7 +41,7 @@ public interface DemotionResult extends MutateResult {
*
* @return the status
*/
@Nonnull
@NonNull
Status getStatus();
@Override
@ -60,7 +60,7 @@ public interface DemotionResult extends MutateResult {
*
* @return the group the user was demoted from.
*/
@Nonnull
@NonNull
Optional<String> getGroupFrom();
/**
@ -71,7 +71,7 @@ public interface DemotionResult extends MutateResult {
*
* @return the group the user was demoted to.
*/
@Nonnull
@NonNull
Optional<String> getGroupTo();
/**

View File

@ -25,10 +25,10 @@
package me.lucko.luckperms.api;
import java.util.UUID;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.UUID;
/**
* Represents an entity on the server.
@ -57,7 +57,7 @@ public interface Entity {
*
* @return the object name
*/
@Nonnull
@NonNull
String getName();
/**
@ -65,7 +65,7 @@ public interface Entity {
*
* @return the type
*/
@Nonnull
@NonNull
Type getType();
/**

View File

@ -31,7 +31,7 @@ import me.lucko.luckperms.api.caching.CachedData;
import me.lucko.luckperms.api.caching.MetaContexts;
import me.lucko.luckperms.api.context.ImmutableContextSet;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* A special instance of {@link Contexts}, which when passed to:
@ -54,8 +54,7 @@ public final class FullySatisfiedContexts extends Contexts {
// singleton
private static final FullySatisfiedContexts INSTANCE = new FullySatisfiedContexts();
@Nonnull
public static Contexts getInstance() {
public static @NonNull Contexts getInstance() {
return INSTANCE;
}
@ -63,9 +62,8 @@ public final class FullySatisfiedContexts extends Contexts {
super(ImmutableContextSet.empty(), ImmutableSet.copyOf(Contexts.global().getSettings()));
}
@Nonnull
@Override
public String toString() {
public @NonNull String toString() {
return "FullySatisfiedContexts()";
}

View File

@ -28,10 +28,10 @@ package me.lucko.luckperms.api;
import me.lucko.luckperms.api.caching.GroupData;
import me.lucko.luckperms.api.context.ContextSet;
import java.util.OptionalInt;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.OptionalInt;
/**
* An inheritable holder of permission data.
@ -43,7 +43,7 @@ public interface Group extends PermissionHolder {
*
* @return the name of the group
*/
@Nonnull
@NonNull
String getName();
/**
@ -71,7 +71,7 @@ public interface Group extends PermissionHolder {
* @since 4.3
*/
@Nullable
String getDisplayName(@Nonnull ContextSet contextSet);
String getDisplayName(@NonNull ContextSet contextSet);
/**
* Gets the weight of this group, if present.
@ -79,7 +79,7 @@ public interface Group extends PermissionHolder {
* @return the group weight
* @since 2.17
*/
@Nonnull
@NonNull
OptionalInt getWeight();
/**
@ -88,7 +88,7 @@ public interface Group extends PermissionHolder {
* @return the groups cached data.
* @since 4.0
*/
@Nonnull
@NonNull
@Override
GroupData getCachedData();

View File

@ -27,19 +27,17 @@ package me.lucko.luckperms.api;
import me.lucko.luckperms.api.context.ContextSet;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Optional;
import java.util.OptionalLong;
import javax.annotation.Nonnull;
import javax.annotation.concurrent.Immutable;
/**
* A relationship between a {@link PermissionHolder} and a permission.
*
* @param <T> the identifier type of the holder
* @since 2.17
*/
@Immutable
public interface HeldPermission<T> {
/**
@ -47,7 +45,7 @@ public interface HeldPermission<T> {
*
* @return the holder
*/
@Nonnull
@NonNull
T getHolder();
/**
@ -55,7 +53,7 @@ public interface HeldPermission<T> {
*
* @return the permission
*/
@Nonnull
@NonNull
String getPermission();
/**
@ -70,7 +68,7 @@ public interface HeldPermission<T> {
*
* @return the server
*/
@Nonnull
@NonNull
Optional<String> getServer();
/**
@ -78,7 +76,7 @@ public interface HeldPermission<T> {
*
* @return the world
*/
@Nonnull
@NonNull
Optional<String> getWorld();
/**
@ -100,7 +98,7 @@ public interface HeldPermission<T> {
*
* @return a Node copy of this permission
*/
@Nonnull
@NonNull
Node asNode();
}

View File

@ -25,9 +25,9 @@
package me.lucko.luckperms.api;
import java.util.Map;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnull;
import java.util.Map;
/**
* Wrapper around parts of the LuckPerms configuration file
@ -39,7 +39,7 @@ public interface LPConfiguration {
*
* @return the name of this server
*/
@Nonnull
@NonNull
String getServer();
/**
@ -78,7 +78,7 @@ public interface LPConfiguration {
*
* @return the storage method string from the configuration
*/
@Nonnull
@NonNull
String getStorageMethod();
/**
@ -96,10 +96,10 @@ public interface LPConfiguration {
* method. For example: key = user, value = json
* @since 2.7
*/
@Nonnull
@NonNull
Map<String, String> getSplitStorageOptions();
@Nonnull
@NonNull
Unsafe unsafe();
interface Unsafe {
@ -115,7 +115,7 @@ public interface LPConfiguration {
* @return the corresponding object, if one is present
* @throws IllegalArgumentException if the key isn't known
*/
@Nonnull
@NonNull
Object getObject(String key);
}

View File

@ -25,8 +25,7 @@
package me.lucko.luckperms.api;
import javax.annotation.Nonnull;
import javax.annotation.concurrent.Immutable;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* An extension of {@link Node}, providing information about
@ -34,7 +33,6 @@ import javax.annotation.concurrent.Immutable;
*
* @since 2.11
*/
@Immutable
public interface LocalizedNode extends Node {
/**
@ -44,7 +42,7 @@ public interface LocalizedNode extends Node {
*
* @return the node this instance is representing
*/
@Nonnull
@NonNull
Node getNode();
/**
@ -58,7 +56,7 @@ public interface LocalizedNode extends Node {
*
* @return where the node was inherited from.
*/
@Nonnull
@NonNull
String getLocation();
}

View File

@ -25,12 +25,11 @@
package me.lucko.luckperms.api;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.SortedSet;
import java.util.UUID;
import javax.annotation.Nonnull;
import javax.annotation.concurrent.Immutable;
/**
* Represents the internal LuckPerms log.
*
@ -41,7 +40,6 @@ import javax.annotation.concurrent.Immutable;
*
* <p>All methods are thread safe, and return immutable and thread safe collections.</p>
*/
@Immutable
public interface Log {
/**
@ -49,7 +47,7 @@ public interface Log {
*
* @return the content
*/
@Nonnull
@NonNull
SortedSet<LogEntry> getContent();
/**
@ -58,8 +56,8 @@ 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
@ -67,8 +65,8 @@ 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
@ -76,8 +74,8 @@ 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
@ -85,7 +83,7 @@ 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);
}

View File

@ -25,19 +25,17 @@
package me.lucko.luckperms.api;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.Optional;
import java.util.UUID;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
/**
* Represents a logged action.
*
* @see ActionLogger#newEntryBuilder() for creating an instance
*/
@Immutable
public interface LogEntry extends Comparable<LogEntry> {
/**
@ -54,7 +52,7 @@ public interface LogEntry extends Comparable<LogEntry> {
*
* @return the actor id
*/
@Nonnull
@NonNull
UUID getActor();
/**
@ -62,7 +60,7 @@ public interface LogEntry extends Comparable<LogEntry> {
*
* @return the name of the actor
*/
@Nonnull
@NonNull
String getActorName();
/**
@ -70,7 +68,7 @@ public interface LogEntry extends Comparable<LogEntry> {
*
* @return the action type
*/
@Nonnull
@NonNull
Type getType();
/**
@ -80,7 +78,7 @@ public interface LogEntry extends Comparable<LogEntry> {
*
* @return the uuid of acted object
*/
@Nonnull
@NonNull
Optional<UUID> getActed();
/**
@ -88,7 +86,7 @@ public interface LogEntry extends Comparable<LogEntry> {
*
* @return the name of the acted object
*/
@Nonnull
@NonNull
String getActedName();
/**
@ -99,7 +97,7 @@ public interface LogEntry extends Comparable<LogEntry> {
*
* @return the action
*/
@Nonnull
@NonNull
String getAction();
/**
@ -122,8 +120,7 @@ public interface LogEntry extends Comparable<LogEntry> {
return this.code;
}
@Nonnull
public static Type valueOf(char code) {
public static @NonNull Type valueOf(char code) {
switch (code) {
case 'U':
case 'u':
@ -152,7 +149,7 @@ public interface LogEntry extends Comparable<LogEntry> {
* @return the builder
* @see LogEntry#getTimestamp()
*/
@Nonnull
@NonNull
Builder setTimestamp(long timestamp);
/**
@ -162,8 +159,8 @@ 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.
@ -172,8 +169,8 @@ 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.
@ -182,8 +179,8 @@ 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.
@ -192,7 +189,7 @@ public interface LogEntry extends Comparable<LogEntry> {
* @return the builder
* @see LogEntry#getActed()
*/
@Nonnull
@NonNull
Builder setActed(@Nullable UUID acted);
/**
@ -202,8 +199,8 @@ 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.
@ -212,15 +209,15 @@ 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
@NonNull
LogEntry build();
}

View File

@ -37,14 +37,14 @@ import me.lucko.luckperms.api.messenger.MessengerProvider;
import me.lucko.luckperms.api.metastacking.MetaStackFactory;
import me.lucko.luckperms.api.platform.PlatformInfo;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* The LuckPerms API.
*
@ -62,7 +62,7 @@ public interface LuckPermsApi {
* @return the platform info
* @since 4.0
*/
@Nonnull
@NonNull
PlatformInfo getPlatformInfo();
/**
@ -78,7 +78,7 @@ public interface LuckPermsApi {
* @return the user manager
* @since 4.0
*/
@Nonnull
@NonNull
UserManager getUserManager();
/**
@ -94,7 +94,7 @@ public interface LuckPermsApi {
* @return the group manager
* @since 4.0
*/
@Nonnull
@NonNull
GroupManager getGroupManager();
/**
@ -110,7 +110,7 @@ public interface LuckPermsApi {
* @return the track manager
* @since 4.0
*/
@Nonnull
@NonNull
TrackManager getTrackManager();
/**
@ -125,7 +125,7 @@ public interface LuckPermsApi {
* @return a future
* @since 4.0
*/
@Nonnull
@NonNull
CompletableFuture<Void> runUpdateTask();
/**
@ -135,7 +135,7 @@ public interface LuckPermsApi {
* @return the event bus
* @since 3.0
*/
@Nonnull
@NonNull
EventBus getEventBus();
/**
@ -143,7 +143,7 @@ public interface LuckPermsApi {
*
* @return the configuration
*/
@Nonnull
@NonNull
LPConfiguration getConfiguration();
/**
@ -155,7 +155,7 @@ public interface LuckPermsApi {
* @return a storage instance
* @since 2.14
*/
@Nonnull
@NonNull
Storage getStorage();
/**
@ -170,7 +170,7 @@ public interface LuckPermsApi {
*
* @return the messaging service instance, if present.
*/
@Nonnull
@NonNull
Optional<MessagingService> getMessagingService();
/**
@ -182,7 +182,7 @@ public interface LuckPermsApi {
* @param messengerProvider the messenger provider.
* @since 4.1
*/
void registerMessengerProvider(@Nonnull MessengerProvider messengerProvider);
void registerMessengerProvider(@NonNull MessengerProvider messengerProvider);
/**
* Gets the {@link ActionLogger}.
@ -193,7 +193,7 @@ public interface LuckPermsApi {
* @return the action logger
* @since 4.1
*/
@Nonnull
@NonNull
ActionLogger getActionLogger();
/**
@ -206,7 +206,7 @@ public interface LuckPermsApi {
* @deprecated this feature is now handled internally - and the API returns a
* No-op implementation of this class.
*/
@Nonnull
@NonNull
@Deprecated
UuidCache getUuidCache();
@ -219,7 +219,7 @@ public interface LuckPermsApi {
* @return the context manager
* @since 4.0
*/
@Nonnull
@NonNull
ContextManager getContextManager();
/**
@ -229,7 +229,7 @@ public interface LuckPermsApi {
*
* @return the node factory
*/
@Nonnull
@NonNull
NodeFactory getNodeFactory();
/**
@ -242,7 +242,7 @@ public interface LuckPermsApi {
* @return the meta stack factory
* @since 3.2
*/
@Nonnull
@NonNull
MetaStackFactory getMetaStackFactory();
@ -265,8 +265,7 @@ public interface LuckPermsApi {
* @return a {@link User} object, if one matching the uuid is loaded, or null if not
* @throws NullPointerException if the uuid is null
*/
@Nullable
default User getUser(@Nonnull UUID uuid) {
default @Nullable User getUser(@NonNull UUID uuid) {
return getUserManager().getUser(uuid);
}
@ -277,8 +276,7 @@ public interface LuckPermsApi {
* @return an optional {@link User} object
* @throws NullPointerException if the uuid is null
*/
@Nonnull
default Optional<User> getUserSafe(@Nonnull UUID uuid) {
default @NonNull Optional<User> getUserSafe(@NonNull UUID uuid) {
return getUserManager().getUserOpt(uuid);
}
@ -289,8 +287,7 @@ public interface LuckPermsApi {
* @return a {@link User} object, if one matching the uuid is loaded, or null if not
* @throws NullPointerException if the name is null
*/
@Nullable
default User getUser(@Nonnull String name) {
default @Nullable User getUser(@NonNull String name) {
return getUserManager().getUser(name);
}
@ -301,8 +298,7 @@ public interface LuckPermsApi {
* @return an optional {@link User} object
* @throws NullPointerException if the name is null
*/
@Nonnull
default Optional<User> getUserSafe(@Nonnull String name) {
default @NonNull Optional<User> getUserSafe(@NonNull String name) {
return getUserManager().getUserOpt(name);
}
@ -311,8 +307,7 @@ public interface LuckPermsApi {
*
* @return a {@link Set} of {@link User} objects
*/
@Nonnull
default Set<User> getUsers() {
default @NonNull Set<User> getUsers() {
return getUserManager().getLoadedUsers();
}
@ -323,7 +318,7 @@ public interface LuckPermsApi {
* @return true if the user is loaded
* @throws NullPointerException if the uuid is null
*/
default boolean isUserLoaded(@Nonnull UUID uuid) {
default boolean isUserLoaded(@NonNull UUID uuid) {
return getUserManager().isLoaded(uuid);
}
@ -333,7 +328,7 @@ public interface LuckPermsApi {
* @param user the user to unload
* @throws NullPointerException if the user is null
*/
default void cleanupUser(@Nonnull User user) {
default void cleanupUser(@NonNull User user) {
getUserManager().cleanupUser(user);
}
@ -344,8 +339,7 @@ public interface LuckPermsApi {
* @return a {@link Group} object, if one matching the name exists, or null if not
* @throws NullPointerException if the name is null
*/
@Nullable
default Group getGroup(@Nonnull String name) {
default @Nullable Group getGroup(@NonNull String name) {
return getGroupManager().getGroup(name);
}
@ -358,8 +352,7 @@ public interface LuckPermsApi {
* @return an optional {@link Group} object
* @throws NullPointerException if the name is null
*/
@Nonnull
default Optional<Group> getGroupSafe(@Nonnull String name) {
default @NonNull Optional<Group> getGroupSafe(@NonNull String name) {
return getGroupManager().getGroupOpt(name);
}
@ -368,8 +361,7 @@ public interface LuckPermsApi {
*
* @return a {@link Set} of {@link Group} objects
*/
@Nonnull
default Set<Group> getGroups() {
default @NonNull Set<Group> getGroups() {
return getGroupManager().getLoadedGroups();
}
@ -380,7 +372,7 @@ public interface LuckPermsApi {
* @return true if the group is loaded
* @throws NullPointerException if the name is null
*/
default boolean isGroupLoaded(@Nonnull String name) {
default boolean isGroupLoaded(@NonNull String name) {
return getGroupManager().isLoaded(name);
}
@ -392,8 +384,7 @@ public interface LuckPermsApi {
* if not
* @throws NullPointerException if the name is null
*/
@Nullable
default Track getTrack(@Nonnull String name) {
default @Nullable Track getTrack(@NonNull String name) {
return getTrackManager().getTrack(name);
}
@ -406,8 +397,7 @@ public interface LuckPermsApi {
* @return an optional {@link Track} object
* @throws NullPointerException if the name is null
*/
@Nonnull
default Optional<Track> getTrackSafe(@Nonnull String name) {
default @NonNull Optional<Track> getTrackSafe(@NonNull String name) {
return getTrackManager().getTrackOpt(name);
}
@ -416,8 +406,7 @@ public interface LuckPermsApi {
*
* @return a {@link Set} of {@link Track} objects
*/
@Nonnull
default Set<Track> getTracks() {
default @NonNull Set<Track> getTracks() {
return getTrackManager().getLoadedTracks();
}
@ -428,7 +417,7 @@ public interface LuckPermsApi {
* @return true if the track is loaded
* @throws NullPointerException if the name is null
*/
default boolean isTrackLoaded(@Nonnull String name) {
default boolean isTrackLoaded(@NonNull String name) {
return getTrackManager().isLoaded(name);
}
@ -438,8 +427,7 @@ public interface LuckPermsApi {
* @return a new builder
* @since 4.0
*/
@Nonnull
default LogEntry.Builder newLogEntryBuilder() {
default LogEntry.@NonNull Builder newLogEntryBuilder() {
return getActionLogger().newEntryBuilder();
}
@ -452,8 +440,7 @@ public interface LuckPermsApi {
* @throws NullPointerException if the permission is null
* @since 2.6
*/
@Nonnull
default Node.Builder buildNode(@Nonnull String permission) throws IllegalArgumentException {
default Node.@NonNull Builder buildNode(@NonNull String permission) throws IllegalArgumentException {
return getNodeFactory().newBuilder(permission);
}
@ -463,7 +450,7 @@ public interface LuckPermsApi {
* @param calculator the context calculator to register. The type MUST be the player class of the platform.
* @throws ClassCastException if the type is not the player class of the platform.
*/
default void registerContextCalculator(@Nonnull ContextCalculator<?> calculator) {
default void registerContextCalculator(@NonNull ContextCalculator<?> calculator) {
getContextManager().registerCalculator(calculator);
}
@ -475,8 +462,7 @@ public interface LuckPermsApi {
* @param user the user to get contexts for
* @return an optional containing contexts. Will return empty if the user is not online.
*/
@Nonnull
default Optional<Contexts> getContextForUser(@Nonnull User user) {
default @NonNull Optional<Contexts> getContextForUser(@NonNull User user) {
return getContextManager().lookupApplicableContexts(user);
}
@ -487,8 +473,7 @@ public interface LuckPermsApi {
* @return a set of contexts.
* @since 2.17
*/
@Nonnull
default ContextSet getContextForPlayer(@Nonnull Object player) {
default @NonNull ContextSet getContextForPlayer(@NonNull Object player) {
return getContextManager().getApplicableContext(player);
}
@ -499,8 +484,7 @@ public interface LuckPermsApi {
* @return a set of contexts.
* @since 3.3
*/
@Nonnull
default Contexts getContextsForPlayer(@Nonnull Object player) {
default @NonNull Contexts getContextsForPlayer(@NonNull Object player) {
return getContextManager().getApplicableContexts(player);
}

View File

@ -25,7 +25,7 @@
package me.lucko.luckperms.api;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* A means to push changes to other servers using the platforms networking
@ -71,6 +71,6 @@ public interface MessagingService {
* @param user the user to push the update for
* @since 4.1
*/
void pushUserUpdate(@Nonnull User user);
void pushUserUpdate(@NonNull User user);
}

View File

@ -37,6 +37,9 @@ import me.lucko.luckperms.api.nodetype.types.PrefixType;
import me.lucko.luckperms.api.nodetype.types.SuffixType;
import me.lucko.luckperms.api.nodetype.types.WeightType;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -46,10 +49,6 @@ import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.stream.Stream;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
/**
* Represents a LuckPerms "node".
*
@ -104,7 +103,6 @@ import javax.annotation.concurrent.Immutable;
* @see NodeFactory for obtaining and constructing instances.
* @since 2.6
*/
@Immutable
public interface Node {
/**
@ -115,7 +113,7 @@ public interface Node {
*
* @return the actual permission node
*/
@Nonnull
@NonNull
String getPermission();
/**
@ -132,8 +130,7 @@ public interface Node {
*
* @return the value of this node as a Tristate
*/
@Nonnull
default Tristate getTristate() {
default @NonNull Tristate getTristate() {
return Tristate.fromBoolean(getValue());
}
@ -163,7 +160,7 @@ public interface Node {
*
* @return an {@link Optional} containing the server, if one is defined
*/
@Nonnull
@NonNull
Optional<String> getServer();
/**
@ -171,7 +168,7 @@ public interface Node {
*
* @return an {@link Optional} containing the world, if one is defined
*/
@Nonnull
@NonNull
Optional<String> getWorld();
/**
@ -211,7 +208,7 @@ public interface Node {
* @return true if the node should apply
* @since 2.13
*/
boolean shouldApplyWithContext(@Nonnull ContextSet contextSet);
boolean shouldApplyWithContext(@NonNull ContextSet contextSet);
/**
* Resolves any shorthand parts of this node and returns the full list of
@ -221,7 +218,7 @@ public interface Node {
*
* @return a list of full nodes
*/
@Nonnull
@NonNull
List<String> resolveShorthand();
/**
@ -254,7 +251,7 @@ public interface Node {
* @return the {@link Date} when this node will expire
* @throws IllegalStateException if the node is not temporary
*/
@Nonnull
@NonNull
Date getExpiry() throws IllegalStateException;
/**
@ -282,7 +279,7 @@ public interface Node {
* @return the extra contexts required for this node to apply
* @since 2.13
*/
@Nonnull
@NonNull
ContextSet getContexts();
/**
@ -294,7 +291,7 @@ public interface Node {
* @see Contexts#SERVER_KEY
* @see Contexts#WORLD_KEY
*/
@Nonnull
@NonNull
ContextSet getFullContexts();
/**
@ -369,8 +366,7 @@ public interface Node {
* @return the name of the group
* @throws IllegalStateException if this node doesn't have {@link InheritanceType} data
*/
@Nonnull
default String getGroupName() throws IllegalStateException {
default @NonNull String getGroupName() throws IllegalStateException {
return typeData(InheritanceType.KEY).getGroupName();
}
@ -390,8 +386,7 @@ public interface Node {
* @return the meta entry
* @throws IllegalStateException if this node doesn't have {@link MetaType} data
*/
@Nonnull
default Map.Entry<String, String> getMeta() throws IllegalStateException {
default Map.@NonNull Entry<String, String> getMeta() throws IllegalStateException {
return typeData(MetaType.KEY);
}
@ -411,8 +406,7 @@ public interface Node {
* @return the meta entry
* @throws IllegalStateException if this node doesn't have {@link PrefixType} data
*/
@Nonnull
default Map.Entry<Integer, String> getPrefix() throws IllegalStateException {
default Map.@NonNull Entry<Integer, String> getPrefix() throws IllegalStateException {
return typeData(PrefixType.KEY).getAsEntry();
}
@ -432,8 +426,7 @@ public interface Node {
* @return the meta entry
* @throws IllegalStateException if this node doesn't have {@link SuffixType} data
*/
@Nonnull
default Map.Entry<Integer, String> getSuffix() throws IllegalStateException {
default Map.@NonNull Entry<Integer, String> getSuffix() throws IllegalStateException {
return typeData(SuffixType.KEY).getAsEntry();
}
@ -481,7 +474,7 @@ public interface Node {
* @see StandardNodeEquality#IGNORE_VALUE
*/
@Deprecated
default boolean equalsIgnoringValue(@Nonnull Node other) {
default boolean equalsIgnoringValue(@NonNull Node other) {
return equals(other, StandardNodeEquality.IGNORE_VALUE);
}
@ -495,7 +488,7 @@ public interface Node {
* @see StandardNodeEquality#IGNORE_EXPIRY_TIME_AND_VALUE
*/
@Deprecated
default boolean almostEquals(@Nonnull Node other) {
default boolean almostEquals(@NonNull Node other) {
return equals(other, StandardNodeEquality.IGNORE_EXPIRY_TIME_AND_VALUE);
}
@ -510,7 +503,7 @@ public interface Node {
* @see StandardNodeEquality#IGNORE_VALUE_OR_IF_TEMPORARY
*/
@Deprecated
default boolean equalsIgnoringValueOrTemp(@Nonnull Node other) {
default boolean equalsIgnoringValueOrTemp(@NonNull Node other) {
return equals(other, StandardNodeEquality.IGNORE_VALUE_OR_IF_TEMPORARY);
}
@ -539,7 +532,7 @@ public interface Node {
* @return the builder
* @since 4.2
*/
Builder copyFrom(@Nonnull Node node);
Builder copyFrom(@NonNull Node node);
/**
* Sets the value of negated for the node.
@ -548,7 +541,7 @@ public interface Node {
* @return the builder
* @see Node#isNegated()
*/
@Nonnull
@NonNull
Builder setNegated(boolean negated);
/**
@ -558,7 +551,7 @@ public interface Node {
* @return the builder
* @see Node#getValue()
*/
@Nonnull
@NonNull
Builder setValue(boolean value);
/**
@ -571,7 +564,7 @@ public interface Node {
* @return the builder
* @see Node#isOverride()
*/
@Nonnull
@NonNull
Builder setOverride(boolean override);
/**
@ -584,7 +577,7 @@ public interface Node {
* @return the builder
* @see Node#getExpiryUnixTime()
*/
@Nonnull
@NonNull
Builder setExpiry(long expiryUnixTimestamp);
/**
@ -598,8 +591,7 @@ public interface Node {
* @return the builder
* @since 4.2
*/
@Nonnull
default Builder setExpiry(long duration, TimeUnit unit) {
default @NonNull Builder setExpiry(long duration, TimeUnit unit) {
Preconditions.checkArgument(duration > 0, "duration must be positive");
long seconds = Objects.requireNonNull(unit, "unit").toSeconds(duration);
long timeNow = System.currentTimeMillis() / 1000L;
@ -612,7 +604,7 @@ public interface Node {
* @return the builder
* @since 4.2
*/
@Nonnull
@NonNull
Builder clearExpiry();
/**
@ -622,7 +614,7 @@ public interface Node {
* @return the builder
* @see Node#getWorld()
*/
@Nonnull
@NonNull
Builder setWorld(@Nullable String world);
/**
@ -632,7 +624,7 @@ public interface Node {
* @return the builder
* @see Node#getServer()
*/
@Nonnull
@NonNull
Builder setServer(@Nullable String server);
/**
@ -644,8 +636,8 @@ public interface Node {
* @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.
@ -655,8 +647,8 @@ 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.
@ -666,8 +658,8 @@ 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.
@ -677,8 +669,8 @@ public interface Node {
* @see ContextSet
* @see Node#getContexts()
*/
@Nonnull
Builder withExtraContext(@Nonnull Map.Entry<String, String> entry);
@NonNull
Builder withExtraContext(Map.@NonNull Entry<String, String> entry);
/**
* Appends extra contexts onto the node.
@ -688,8 +680,8 @@ 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.
@ -700,15 +692,15 @@ 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
@NonNull
Node build();
}

View File

@ -25,7 +25,7 @@
package me.lucko.luckperms.api;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* A rule for determining if two nodes are equal.
@ -47,6 +47,6 @@ public interface NodeEqualityPredicate {
* @param o2 the second node
* @return true if equal
*/
boolean areEqual(@Nonnull Node o1, @Nonnull Node o2);
boolean areEqual(@NonNull Node o1, @NonNull Node o2);
}

View File

@ -25,7 +25,7 @@
package me.lucko.luckperms.api;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Assists with constructing {@link Node} instances.
@ -41,8 +41,7 @@ public interface NodeFactory {
* @return a node builder instance
* @throws NullPointerException if the permission is null
*/
@Nonnull
Node.Builder newBuilder(@Nonnull String permission);
Node.@NonNull Builder newBuilder(@NonNull String permission);
/**
* Creates a node builder instance from an existing node
@ -51,8 +50,7 @@ public interface NodeFactory {
* @return a node builder instance
* @throws NullPointerException if the other node is null
*/
@Nonnull
Node.Builder newBuilderFromExisting(@Nonnull Node other);
Node.@NonNull Builder newBuilderFromExisting(@NonNull Node other);
/**
@ -64,8 +62,7 @@ public interface NodeFactory {
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
* @since 3.1
*/
@Nonnull
Node.Builder makeGroupNode(@Nonnull Group group);
Node.@NonNull Builder makeGroupNode(@NonNull Group group);
/**
* Creates a node builder from a group
@ -75,8 +72,7 @@ public interface NodeFactory {
* @throws NullPointerException if the groupName is null
* @since 4.0
*/
@Nonnull
Node.Builder makeGroupNode(@Nonnull String groupName);
Node.@NonNull Builder makeGroupNode(@NonNull String groupName);
/**
* Creates a node builder from a key value pair
@ -86,8 +82,7 @@ public interface NodeFactory {
* @return a node builder instance
* @throws NullPointerException if the key or value is null
*/
@Nonnull
Node.Builder makeMetaNode(@Nonnull String key, @Nonnull String value);
Node.@NonNull Builder makeMetaNode(@NonNull String key, @NonNull String value);
/**
* Creates a node builder for the given chat meta type
@ -99,8 +94,7 @@ public interface NodeFactory {
* @throws NullPointerException if the type or value is null
* @since 3.2
*/
@Nonnull
Node.Builder makeChatMetaNode(@Nonnull ChatMetaType type, int priority, @Nonnull String value);
Node.@NonNull Builder makeChatMetaNode(@NonNull ChatMetaType type, int priority, @NonNull String value);
/**
* Creates a node builder from a prefix string and priority
@ -110,8 +104,7 @@ public interface NodeFactory {
* @return a node builder instance
* @throws NullPointerException if the prefix is null
*/
@Nonnull
Node.Builder makePrefixNode(int priority, @Nonnull String prefix);
Node.@NonNull Builder makePrefixNode(int priority, @NonNull String prefix);
/**
* Creates a node builder from a prefix string and priority
@ -121,7 +114,6 @@ public interface NodeFactory {
* @return a node builder instance
* @throws NullPointerException if the suffix is null
*/
@Nonnull
Node.Builder makeSuffixNode(int priority, @Nonnull String suffix);
Node.@NonNull Builder makeSuffixNode(int priority, @NonNull String suffix);
}

View File

@ -37,6 +37,8 @@ import me.lucko.luckperms.api.nodetype.types.MetaType;
import me.lucko.luckperms.api.nodetype.types.PrefixType;
import me.lucko.luckperms.api.nodetype.types.SuffixType;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -45,8 +47,6 @@ import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.function.Predicate;
import javax.annotation.Nonnull;
/**
* Generic superinterface for an object which holds permissions.
*/
@ -68,7 +68,7 @@ public interface PermissionHolder {
*
* @return the identifier for this object. Either a uuid string or name.
*/
@Nonnull
@NonNull
String getObjectName();
/**
@ -86,7 +86,7 @@ public interface PermissionHolder {
* @return a friendly identifier for this holder
* @since 3.2
*/
@Nonnull
@NonNull
String getFriendlyName();
/**
@ -95,7 +95,7 @@ public interface PermissionHolder {
* @return the holders cached data.
* @since 3.2
*/
@Nonnull
@NonNull
CachedData getCachedData();
/**
@ -107,7 +107,7 @@ public interface PermissionHolder {
* @return the task future
* @since 4.0
*/
@Nonnull
@NonNull
CompletableFuture<Void> refreshCachedData();
/**
@ -119,7 +119,7 @@ public interface PermissionHolder {
* @return the holders own permissions
* @since 3.3
*/
@Nonnull
@NonNull
ImmutableSetMultimap<ImmutableContextSet, Node> getNodes();
/**
@ -132,7 +132,7 @@ public interface PermissionHolder {
* @return the holders own permissions
* @since 3.3
*/
@Nonnull
@NonNull
ImmutableSetMultimap<ImmutableContextSet, Node> getTransientNodes();
/**
@ -150,7 +150,7 @@ public interface PermissionHolder {
* @return a list of the holders own nodes.
* @since 3.3
*/
@Nonnull
@NonNull
List<Node> getOwnNodes();
/**
@ -166,7 +166,7 @@ public interface PermissionHolder {
* @return an immutable set of permissions in priority order
* @since 2.6
*/
@Nonnull
@NonNull
SortedSet<? extends Node> getPermissions();
/**
@ -184,7 +184,7 @@ public interface PermissionHolder {
* @return a set of nodes
* @since 2.6
*/
@Nonnull
@NonNull
Set<? extends Node> getEnduringPermissions();
/**
@ -201,7 +201,7 @@ public interface PermissionHolder {
* @return a set of nodes
* @since 2.6
*/
@Nonnull
@NonNull
Set<? extends Node> getTransientPermissions();
/**
@ -217,7 +217,7 @@ public interface PermissionHolder {
* @return a set of permanent nodes
* @since 2.6
*/
@Nonnull
@NonNull
Set<Node> getPermanentPermissionNodes();
/**
@ -233,7 +233,7 @@ public interface PermissionHolder {
* @return a set of temporary nodes
* @since 2.6
*/
@Nonnull
@NonNull
Set<Node> getTemporaryPermissionNodes();
/**
@ -252,8 +252,8 @@ 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,7 +273,7 @@ public interface PermissionHolder {
* @return a list of nodes
* @since 3.3
*/
@Nonnull
@NonNull
List<LocalizedNode> resolveInheritances();
/**
@ -290,8 +290,8 @@ 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,7 +305,7 @@ public interface PermissionHolder {
* @throws NullPointerException if the context is null
* @since 3.3
*/
@Nonnull
@NonNull
SortedSet<LocalizedNode> getAllNodes();
/**
@ -319,8 +319,8 @@ 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,
@ -330,8 +330,8 @@ public interface PermissionHolder {
* @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.
@ -352,8 +352,8 @@ public interface PermissionHolder {
* @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.
@ -366,8 +366,8 @@ public interface PermissionHolder {
* @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.
@ -380,8 +380,8 @@ public interface PermissionHolder {
* @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 +393,8 @@ 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 +406,8 @@ 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 +419,8 @@ 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.
@ -435,7 +435,7 @@ public interface PermissionHolder {
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
* @since 4.0
*/
boolean inheritsGroup(@Nonnull Group group);
boolean inheritsGroup(@NonNull Group group);
/**
* Check to see if this holder inherits another group.
@ -449,7 +449,7 @@ public interface PermissionHolder {
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
* @since 4.0
*/
boolean inheritsGroup(@Nonnull Group group, @Nonnull ContextSet contextSet);
boolean inheritsGroup(@NonNull Group group, @NonNull ContextSet contextSet);
/**
* Sets a permission node for the permission holder.
@ -472,8 +472,8 @@ 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.
@ -497,8 +497,8 @@ public interface PermissionHolder {
* @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 +521,8 @@ 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.
@ -546,8 +546,8 @@ public interface PermissionHolder {
* @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 +570,8 @@ 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 +583,8 @@ 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.
@ -605,7 +605,7 @@ public interface PermissionHolder {
* @param test the predicate to test for nodes which should be removed
* @since 3.2
*/
void clearMatching(@Nonnull Predicate<Node> test);
void clearMatching(@NonNull Predicate<Node> test);
/**
* Clears any transient nodes from the holder which pass the predicate.
@ -624,7 +624,7 @@ public interface PermissionHolder {
* @param test the predicate to test for nodes which should be removed
* @since 3.2
*/
void clearMatchingTransient(@Nonnull Predicate<Node> test);
void clearMatchingTransient(@NonNull Predicate<Node> test);
/**
* Clears all nodes held by the permission holder.
@ -661,7 +661,7 @@ public interface PermissionHolder {
* @param contextSet the contexts to filter by
* @since 3.2
*/
void clearNodes(@Nonnull ContextSet contextSet);
void clearNodes(@NonNull ContextSet contextSet);
/**
* Clears all parent groups.
@ -698,7 +698,7 @@ public interface PermissionHolder {
* @param contextSet the contexts to filter by
* @since 3.2
*/
void clearParents(@Nonnull ContextSet contextSet);
void clearParents(@NonNull ContextSet contextSet);
/**
* Clears all meta held by the permission holder.
@ -741,7 +741,7 @@ public interface PermissionHolder {
* @param contextSet the contexts to filter by
* @since 3.2
*/
void clearMeta(@Nonnull ContextSet contextSet);
void clearMeta(@NonNull ContextSet contextSet);
/**
* Clears all transient nodes the permission holder has.
@ -757,9 +757,8 @@ public interface PermissionHolder {
* @since 3.1
* @deprecated now forwards to {@link #setPermission(Node)}.
*/
@Nonnull
@Deprecated
default DataMutateResult setPermissionUnchecked(@Nonnull Node node) {
default @NonNull DataMutateResult setPermissionUnchecked(@NonNull Node node) {
return setPermission(node);
}
@ -772,9 +771,8 @@ public interface PermissionHolder {
* @since 3.1
* @deprecated now forwards to {@link #setTransientPermission(Node)}
*/
@Nonnull
@Deprecated
default DataMutateResult setTransientPermissionUnchecked(@Nonnull Node node) {
default @NonNull DataMutateResult setTransientPermissionUnchecked(@NonNull Node node) {
return setTransientPermission(node);
}
@ -787,9 +785,8 @@ public interface PermissionHolder {
* @since 3.1
* @deprecated now forwards to {@link #unsetPermission(Node)}
*/
@Nonnull
@Deprecated
default DataMutateResult unsetPermissionUnchecked(@Nonnull Node node) {
default @NonNull DataMutateResult unsetPermissionUnchecked(@NonNull Node node) {
return unsetPermission(node);
}
@ -802,9 +799,8 @@ public interface PermissionHolder {
* @since 3.1
* @deprecated now forwards to {@link #unsetTransientPermission(Node)}
*/
@Nonnull
@Deprecated
default DataMutateResult unsetTransientPermissionUnchecked(@Nonnull Node node) {
default @NonNull DataMutateResult unsetTransientPermissionUnchecked(@NonNull Node node) {
return unsetTransientPermission(node);
}

View File

@ -27,12 +27,12 @@ package me.lucko.luckperms.api;
import me.lucko.luckperms.api.manager.UserManager;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.Set;
import java.util.UUID;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* Encapsulates the result of an operation to save uuid data about a player.
*
@ -48,7 +48,7 @@ public interface PlayerSaveResult {
*
* @return the status
*/
@Nonnull
@NonNull
Set<Status> getStatus();
/**
@ -57,7 +57,7 @@ public interface PlayerSaveResult {
* @param status the status to check for
* @return if the result includes the status
*/
boolean includes(@Nonnull Status status);
boolean includes(@NonNull Status status);
/**
* Gets the old username involved in the result

View File

@ -25,9 +25,9 @@
package me.lucko.luckperms.api;
import java.util.Optional;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnull;
import java.util.Optional;
/**
* Encapsulates the result of {@link User}s promotion along a {@link Track}.
@ -41,7 +41,7 @@ public interface PromotionResult extends MutateResult {
*
* @return the status
*/
@Nonnull
@NonNull
Status getStatus();
@Override
@ -57,7 +57,7 @@ public interface PromotionResult extends MutateResult {
*
* @return the group the user was promoted from.
*/
@Nonnull
@NonNull
Optional<String> getGroupFrom();
/**
@ -71,7 +71,7 @@ public interface PromotionResult extends MutateResult {
*
* @return the group the user was promoted to.
*/
@Nonnull
@NonNull
Optional<String> getGroupTo();
/**

View File

@ -25,7 +25,7 @@
package me.lucko.luckperms.api;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Standard {@link NodeEqualityPredicate}s.
@ -72,7 +72,7 @@ public enum StandardNodeEquality implements NodeEqualityPredicate {
IGNORE_VALUE_OR_IF_TEMPORARY;
@Override
public boolean areEqual(@Nonnull Node o1, @Nonnull Node o2) {
public boolean areEqual(@NonNull Node o1, @NonNull Node o2) {
return o1.standardEquals(o2, this);
}
}

View File

@ -29,15 +29,15 @@ import me.lucko.luckperms.api.manager.GroupManager;
import me.lucko.luckperms.api.manager.TrackManager;
import me.lucko.luckperms.api.manager.UserManager;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* A means of loading and saving permission data to/from the backend.
*
@ -50,7 +50,7 @@ public interface Storage {
*
* @return the name of the implementation
*/
@Nonnull
@NonNull
String getName();
/**
@ -70,9 +70,9 @@ public interface Storage {
* @throws NullPointerException if entry is null
* @deprecated in favour of {@link ActionLogger#submit(LogEntry)}.
*/
@Nonnull
@NonNull
@Deprecated
CompletableFuture<Boolean> logAction(@Nonnull LogEntry entry);
CompletableFuture<Boolean> logAction(@NonNull LogEntry entry);
/**
* Loads and returns the entire log from storage
@ -80,7 +80,7 @@ public interface Storage {
* @return a log instance, could be null if loading failed
* @deprecated in favour of {@link ActionLogger#getLog()}
*/
@Nonnull
@NonNull
@Deprecated
CompletableFuture<Log> getLog();
@ -93,9 +93,9 @@ public interface Storage {
* @throws NullPointerException if uuid is null
* @deprecated in favour of {@link UserManager#loadUser(UUID, String)}
*/
@Nonnull
@NonNull
@Deprecated
CompletableFuture<Boolean> loadUser(@Nonnull UUID uuid, @Nullable String username);
CompletableFuture<Boolean> loadUser(@NonNull UUID uuid, @Nullable String username);
/**
* Loads a user's data from the main storage into the plugins local storage.
@ -105,9 +105,8 @@ public interface Storage {
* @throws NullPointerException if uuid is null
* @deprecated in favour of {@link UserManager#loadUser(UUID)}
*/
@Nonnull
@Deprecated
default CompletableFuture<Boolean> loadUser(@Nonnull UUID uuid) {
default @NonNull CompletableFuture<Boolean> loadUser(@NonNull UUID uuid) {
return loadUser(uuid, null);
}
@ -122,9 +121,9 @@ public interface Storage {
* @throws IllegalStateException if the user instance was not obtained from LuckPerms.
* @deprecated in favour of {@link UserManager#saveUser(User)}
*/
@Nonnull
@NonNull
@Deprecated
CompletableFuture<Boolean> saveUser(@Nonnull User user);
CompletableFuture<Boolean> saveUser(@NonNull User user);
/**
* Gets a set all "unique" user UUIDs.
@ -134,7 +133,7 @@ public interface Storage {
* @return a set of uuids, or null if the operation failed.
* @deprecated in favour of {@link UserManager#getUniqueUsers()}
*/
@Nonnull
@NonNull
@Deprecated
CompletableFuture<Set<UUID>> getUniqueUsers();
@ -147,9 +146,9 @@ public interface Storage {
* @since 2.17
* @deprecated in favour of {@link UserManager#getWithPermission(String)}
*/
@Nonnull
@NonNull
@Deprecated
CompletableFuture<List<HeldPermission<UUID>>> getUsersWithPermission(@Nonnull String permission);
CompletableFuture<List<HeldPermission<UUID>>> getUsersWithPermission(@NonNull String permission);
/**
* Creates and loads a group into the plugins local storage
@ -160,9 +159,9 @@ public interface Storage {
* @throws IllegalArgumentException if the name is invalid
* @deprecated in favour of {@link GroupManager#createAndLoadGroup(String)}
*/
@Nonnull
@NonNull
@Deprecated
CompletableFuture<Boolean> createAndLoadGroup(@Nonnull String name);
CompletableFuture<Boolean> createAndLoadGroup(@NonNull String name);
/**
* Loads a group into the plugins local storage.
@ -173,9 +172,9 @@ public interface Storage {
* @throws IllegalArgumentException if the name is invalid
* @deprecated in favour of {@link GroupManager#loadGroup(String)}
*/
@Nonnull
@NonNull
@Deprecated
CompletableFuture<Boolean> loadGroup(@Nonnull String name);
CompletableFuture<Boolean> loadGroup(@NonNull String name);
/**
* Loads all groups from the storage into memory
@ -183,7 +182,7 @@ public interface Storage {
* @return true if the operation completed successfully.
* @deprecated in favour of {@link GroupManager#loadAllGroups()}
*/
@Nonnull
@NonNull
@Deprecated
CompletableFuture<Boolean> loadAllGroups();
@ -198,9 +197,9 @@ public interface Storage {
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
* @deprecated in favour of {@link GroupManager#saveGroup(Group)}
*/
@Nonnull
@NonNull
@Deprecated
CompletableFuture<Boolean> saveGroup(@Nonnull Group group);
CompletableFuture<Boolean> saveGroup(@NonNull Group group);
/**
* Permanently deletes a group from storage.
@ -211,9 +210,9 @@ public interface Storage {
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
* @deprecated in favour of {@link GroupManager#deleteGroup(Group)}
*/
@Nonnull
@NonNull
@Deprecated
CompletableFuture<Boolean> deleteGroup(@Nonnull Group group);
CompletableFuture<Boolean> deleteGroup(@NonNull Group group);
/**
* Searches for a list of groups with a given permission.
@ -224,9 +223,9 @@ public interface Storage {
* @since 2.17
* @deprecated in favour of {@link GroupManager#getWithPermission(String)}
*/
@Nonnull
@NonNull
@Deprecated
CompletableFuture<List<HeldPermission<String>>> getGroupsWithPermission(@Nonnull String permission);
CompletableFuture<List<HeldPermission<String>>> getGroupsWithPermission(@NonNull String permission);
/**
* Creates and loads a track into the plugins local storage
@ -237,9 +236,9 @@ public interface Storage {
* @throws IllegalArgumentException if the name is invalid
* @deprecated in favour of {@link TrackManager#createAndLoadTrack(String)}
*/
@Nonnull
@NonNull
@Deprecated
CompletableFuture<Boolean> createAndLoadTrack(@Nonnull String name);
CompletableFuture<Boolean> createAndLoadTrack(@NonNull String name);
/**
* Loads a track into the plugins local storage.
@ -250,9 +249,9 @@ public interface Storage {
* @throws IllegalArgumentException if the name is invalid
* @deprecated in favour of {@link TrackManager#loadTrack(String)}
*/
@Nonnull
@NonNull
@Deprecated
CompletableFuture<Boolean> loadTrack(@Nonnull String name);
CompletableFuture<Boolean> loadTrack(@NonNull String name);
/**
* Loads all tracks from the storage into memory
@ -260,7 +259,7 @@ public interface Storage {
* @return true if the operation completed successfully.
* @deprecated in favour of {@link TrackManager#loadAllTracks()}
*/
@Nonnull
@NonNull
@Deprecated
CompletableFuture<Boolean> loadAllTracks();
@ -273,9 +272,9 @@ public interface Storage {
* @throws IllegalStateException if the track instance was not obtained from LuckPerms.
* @deprecated in favour of {@link TrackManager#saveTrack(Track)}
*/
@Nonnull
@NonNull
@Deprecated
CompletableFuture<Boolean> saveTrack(@Nonnull Track track);
CompletableFuture<Boolean> saveTrack(@NonNull Track track);
/**
* Permanently deletes a track from storage
@ -286,9 +285,9 @@ public interface Storage {
* @throws IllegalStateException if the track instance was not obtained from LuckPerms.
* @deprecated in favour of {@link TrackManager#deleteTrack(Track)}
*/
@Nonnull
@NonNull
@Deprecated
CompletableFuture<Boolean> deleteTrack(@Nonnull Track track);
CompletableFuture<Boolean> deleteTrack(@NonNull Track track);
/**
* Saves UUID caching data to the global cache
@ -300,8 +299,8 @@ 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
@ -312,8 +311,8 @@ 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
@ -324,9 +323,9 @@ public interface Storage {
* @since 2.17
* @deprecated in favour of {@link UserManager#lookupUsername(UUID)}
*/
@Nonnull
@NonNull
@Deprecated
CompletableFuture<String> getName(@Nonnull UUID uuid);
CompletableFuture<String> getName(@NonNull UUID uuid);
/**
* Returns an executor which will run all passed runnables on the
@ -338,7 +337,7 @@ public interface Storage {
* @return an executor instance
* @deprecated as plugins should create their own executors
*/
@Nonnull
@NonNull
@Deprecated
Executor getSyncExecutor();
@ -352,7 +351,7 @@ public interface Storage {
* @return an executor instance
* @deprecated as plugins should create their own executors
*/
@Nonnull
@NonNull
@Deprecated
Executor getAsyncExecutor();

View File

@ -25,7 +25,7 @@
package me.lucko.luckperms.api;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Extension of {@link DataMutateResult} for temporary set operations.
@ -39,7 +39,7 @@ public interface TemporaryDataMutateResult {
*
* @return the result
*/
@Nonnull
@NonNull
DataMutateResult getResult();
/**
@ -51,7 +51,7 @@ public interface TemporaryDataMutateResult {
*
* @return the resultant node
*/
@Nonnull
@NonNull
Node getMergedNode();
}

View File

@ -27,10 +27,10 @@ package me.lucko.luckperms.api;
import me.lucko.luckperms.api.context.ContextSet;
import java.util.List;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
/**
* An ordered chain of {@link Group}s.
@ -42,7 +42,7 @@ public interface Track {
*
* @return the name of this track
*/
@Nonnull
@NonNull
String getName();
/**
@ -54,7 +54,7 @@ public interface Track {
*
* @return an ordered {@link List} of the groups on this track
*/
@Nonnull
@NonNull
List<String> getGroups();
/**
@ -75,7 +75,7 @@ public interface Track {
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
*/
@Nullable
String getNext(@Nonnull Group current);
String getNext(@NonNull Group current);
/**
* Gets the previous group on the track, before the one provided
@ -88,7 +88,7 @@ public interface Track {
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
*/
@Nullable
String getPrevious(@Nonnull Group current);
String getPrevious(@NonNull Group current);
/**
* Promotes the given user along this track.
@ -98,8 +98,8 @@ public interface Track {
* @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.
@ -109,8 +109,8 @@ public interface Track {
* @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
@ -120,8 +120,8 @@ public interface Track {
* @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 +133,8 @@ 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 +144,8 @@ 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 +154,8 @@ 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
@ -165,7 +165,7 @@ public interface Track {
* @throws NullPointerException if the group is null
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
*/
boolean containsGroup(@Nonnull Group group);
boolean containsGroup(@NonNull Group group);
/**
* Checks if a group features on this track
@ -174,7 +174,7 @@ public interface Track {
* @return true if the group is on this track
* @throws NullPointerException if the group is null
*/
boolean containsGroup(@Nonnull String group);
boolean containsGroup(@NonNull String group);
/**
* Clear all of the groups from this track

View File

@ -25,7 +25,7 @@
package me.lucko.luckperms.api;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Represents three different states of a setting.
@ -61,8 +61,7 @@ public enum Tristate {
* @param val the boolean value
* @return {@link #TRUE} or {@link #FALSE}, if the value is <code>true</code> or <code>false</code>, respectively.
*/
@Nonnull
public static Tristate fromBoolean(boolean val) {
public static @NonNull Tristate fromBoolean(boolean val) {
return val ? TRUE : FALSE;
}
@ -77,8 +76,7 @@ public enum Tristate {
* is <code>null</code>, <code>true</code> or <code>false</code>, respectively.
* @since 4.1
*/
@Nonnull
public static Tristate fromNullableBoolean(Boolean val) {
public static @NonNull Tristate fromNullableBoolean(Boolean val) {
return val == null ? UNDEFINED : val ? TRUE : FALSE;
}

View File

@ -27,10 +27,10 @@ package me.lucko.luckperms.api;
import me.lucko.luckperms.api.caching.UserData;
import java.util.UUID;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.UUID;
/**
* A player which holds permission data.
@ -42,7 +42,7 @@ public interface User extends PermissionHolder {
*
* @return the users Mojang assigned unique id
*/
@Nonnull
@NonNull
UUID getUuid();
/**
@ -64,7 +64,7 @@ public interface User extends PermissionHolder {
*
* @return the users primary group
*/
@Nonnull
@NonNull
String getPrimaryGroup();
/**
@ -78,8 +78,8 @@ public interface User extends PermissionHolder {
* @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,7 +87,7 @@ public interface User extends PermissionHolder {
* @return the users cached data.
* @since 3.2
*/
@Nonnull
@NonNull
@Override
UserData getCachedData();

View File

@ -25,9 +25,9 @@
package me.lucko.luckperms.api;
import java.util.UUID;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnull;
import java.util.UUID;
/**
* A UUID cache for online users, between external Mojang UUIDs, and internal
@ -50,9 +50,9 @@ public interface UuidCache {
* <code>ProxiedPlayer#getUniqueId</code>
* @return the corresponding internal UUID
*/
@Nonnull
@NonNull
@Deprecated
UUID getUUID(@Nonnull UUID mojangUuid);
UUID getUUID(@NonNull UUID mojangUuid);
/**
* Gets a users "external", server assigned unique id, from the internal
@ -62,8 +62,8 @@ public interface UuidCache {
* <code>User#getUuid</code>
* @return the corresponding external UUID
*/
@Nonnull
@NonNull
@Deprecated
UUID getExternalUUID(@Nonnull UUID internalUuid);
UUID getExternalUUID(@NonNull UUID internalUuid);
}

View File

@ -28,12 +28,12 @@ package me.lucko.luckperms.api.caching;
import me.lucko.luckperms.api.Contexts;
import me.lucko.luckperms.api.PermissionHolder;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import javax.annotation.Nonnull;
/**
* Holds cached permission and meta lookup data for a {@link PermissionHolder}.
*
@ -57,8 +57,8 @@ 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 +68,8 @@ 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 +78,8 @@ 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 +96,8 @@ 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 +115,8 @@ 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 +133,8 @@ 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.
@ -152,7 +152,7 @@ public interface CachedData {
* @param contexts the contexts to recalculate in.
* @throws NullPointerException if contexts is null
*/
void recalculatePermissions(@Nonnull Contexts contexts);
void recalculatePermissions(@NonNull Contexts contexts);
/**
* (Re)calculates meta data for a given context.
@ -171,7 +171,7 @@ public interface CachedData {
* @throws NullPointerException if contexts is null
* @since 3.2
*/
void recalculateMeta(@Nonnull MetaContexts contexts);
void recalculateMeta(@NonNull MetaContexts contexts);
/**
* (Re)calculates meta data for a given context.
@ -189,7 +189,7 @@ public interface CachedData {
* @param contexts the contexts to recalculate in.
* @throws NullPointerException if contexts is null
*/
void recalculateMeta(@Nonnull Contexts contexts);
void recalculateMeta(@NonNull Contexts contexts);
/**
* (Re)loads permission data for a given context.
@ -216,8 +216,8 @@ public interface CachedData {
* @return a future
* @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.
@ -244,8 +244,8 @@ public interface CachedData {
* @return a future
* @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.
@ -272,8 +272,8 @@ public interface CachedData {
* @return a future
* @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,7 +318,7 @@ public interface CachedData {
* @return a future
* @since 4.0
*/
@Nonnull
@NonNull
CompletableFuture<Void> reloadPermissions();
/**
@ -342,7 +342,7 @@ public interface CachedData {
* @return a future
* @since 4.0
*/
@Nonnull
@NonNull
CompletableFuture<Void> reloadMeta();
/**
@ -357,7 +357,7 @@ public interface CachedData {
* @param contexts a set of contexts
* @throws NullPointerException if contexts is null
*/
default void preCalculate(@Nonnull Set<Contexts> contexts) {
default void preCalculate(@NonNull Set<Contexts> contexts) {
contexts.forEach(this::preCalculate);
}
@ -373,7 +373,7 @@ public interface CachedData {
* @param contexts the contexts to pre-calculate for
* @throws NullPointerException if contexts is null
*/
default void preCalculate(@Nonnull Contexts contexts) {
default void preCalculate(@NonNull Contexts contexts) {
Objects.requireNonNull(contexts, "contexts");
// pre-calculate just by requesting the data from this cache.
@ -389,7 +389,7 @@ public interface CachedData {
* @param contexts the contexts to invalidate for
* @since 4.0
*/
void invalidatePermissions(@Nonnull Contexts contexts);
void invalidatePermissions(@NonNull Contexts contexts);
/**
* Invalidates any cached {@link MetaData} instances mapped to the given
@ -398,7 +398,7 @@ public interface CachedData {
* @param contexts the contexts to invalidate for
* @since 4.0
*/
void invalidateMeta(@Nonnull MetaContexts contexts);
void invalidateMeta(@NonNull MetaContexts contexts);
/**
* Invalidates any cached {@link MetaData} instances mapped to the given
@ -407,7 +407,7 @@ public interface CachedData {
* @param contexts the contexts to invalidate for
* @since 4.0
*/
void invalidateMeta(@Nonnull Contexts contexts);
void invalidateMeta(@NonNull Contexts contexts);
/**
* Invalidates all cached {@link PermissionData} instances.

View File

@ -27,7 +27,7 @@ package me.lucko.luckperms.api.caching;
import me.lucko.luckperms.api.Contexts;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Holds cached lookup data in a specific set of contexts.
@ -41,7 +41,7 @@ public interface CachedDataContainer {
*
* @return the contexts this container is caching
*/
@Nonnull
@NonNull
Contexts getContexts();
}

View File

@ -28,10 +28,9 @@ package me.lucko.luckperms.api.caching;
import me.lucko.luckperms.api.Contexts;
import me.lucko.luckperms.api.metastacking.MetaStackDefinition;
import java.util.Objects;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnull;
import javax.annotation.concurrent.Immutable;
import java.util.Objects;
/**
* Encapsulates the options and settings for a meta lookup.
@ -41,7 +40,6 @@ import javax.annotation.concurrent.Immutable;
*
* @since 3.2
*/
@Immutable
public final class MetaContexts {
/**
@ -52,7 +50,7 @@ public final class MetaContexts {
* @param suffixStackDefinition the suffix stack definition to be used
* @return the new instance
*/
public static MetaContexts of(@Nonnull Contexts contexts, @Nonnull MetaStackDefinition prefixStackDefinition, @Nonnull MetaStackDefinition suffixStackDefinition) {
public static MetaContexts of(@NonNull Contexts contexts, @NonNull MetaStackDefinition prefixStackDefinition, @NonNull MetaStackDefinition suffixStackDefinition) {
return new MetaContexts(contexts, prefixStackDefinition, suffixStackDefinition);
}
@ -70,31 +68,27 @@ public final class MetaContexts {
* @param prefixStackDefinition the prefix stack definition to be used
* @param suffixStackDefinition the suffix stack definition to be used
*/
public MetaContexts(@Nonnull Contexts contexts, @Nonnull MetaStackDefinition prefixStackDefinition, @Nonnull MetaStackDefinition suffixStackDefinition) {
public MetaContexts(@NonNull Contexts contexts, @NonNull MetaStackDefinition prefixStackDefinition, @NonNull MetaStackDefinition suffixStackDefinition) {
this.contexts = Objects.requireNonNull(contexts, "contexts");
this.prefixStackDefinition = Objects.requireNonNull(prefixStackDefinition, "prefixStackDefinition");
this.suffixStackDefinition = Objects.requireNonNull(suffixStackDefinition, "suffixStackDefinition");
this.hashCode = calculateHashCode();
}
@Nonnull
public Contexts getContexts() {
public @NonNull Contexts getContexts() {
return this.contexts;
}
@Nonnull
public MetaStackDefinition getPrefixStackDefinition() {
public @NonNull MetaStackDefinition getPrefixStackDefinition() {
return this.prefixStackDefinition;
}
@Nonnull
public MetaStackDefinition getSuffixStackDefinition() {
public @NonNull MetaStackDefinition getSuffixStackDefinition() {
return this.suffixStackDefinition;
}
@Override
@Nonnull
public String toString() {
public @NonNull String toString() {
return "MetaContexts(" +
"contexts=" + this.getContexts() + ", " +
"prefixStackDefinition=" + this.getPrefixStackDefinition() + ", " +

View File

@ -29,12 +29,12 @@ import com.google.common.collect.ListMultimap;
import me.lucko.luckperms.api.metastacking.MetaStackDefinition;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.Map;
import java.util.SortedMap;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* Holds cached meta lookup data for a specific set of contexts.
*
@ -47,7 +47,7 @@ public interface MetaData extends CachedDataContainer {
*
* @return the contexts this container is caching
*/
@Nonnull
@NonNull
MetaContexts getMetaContexts();
/**
@ -62,7 +62,7 @@ public interface MetaData extends CachedDataContainer {
* @return an immutable multimap of meta
* @since 3.3
*/
@Nonnull
@NonNull
ListMultimap<String, String> getMetaMultimap();
/**
@ -73,7 +73,7 @@ public interface MetaData extends CachedDataContainer {
*
* @return an immutable map of meta
*/
@Nonnull
@NonNull
Map<String, String> getMeta();
/**
@ -82,7 +82,7 @@ public interface MetaData extends CachedDataContainer {
*
* @return a sorted map of prefixes
*/
@Nonnull
@NonNull
SortedMap<Integer, String> getPrefixes();
/**
@ -91,7 +91,7 @@ public interface MetaData extends CachedDataContainer {
*
* @return a sorted map of suffixes
*/
@Nonnull
@NonNull
SortedMap<Integer, String> getSuffixes();
/**
@ -116,7 +116,7 @@ public interface MetaData extends CachedDataContainer {
* @return the definition used for the prefix stack
* @since 3.2
*/
@Nonnull
@NonNull
MetaStackDefinition getPrefixStackDefinition();
/**
@ -125,7 +125,7 @@ public interface MetaData extends CachedDataContainer {
* @return the definition used for the suffix stack
* @since 3.2
*/
@Nonnull
@NonNull
MetaStackDefinition getSuffixStackDefinition();
}

View File

@ -27,9 +27,9 @@ package me.lucko.luckperms.api.caching;
import me.lucko.luckperms.api.Tristate;
import java.util.Map;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnull;
import java.util.Map;
/**
* Holds cached permission lookup data for a specific set of contexts.
@ -45,8 +45,8 @@ 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 +60,7 @@ public interface PermissionData extends CachedDataContainer {
*
* @return an immutable set of permissions
*/
@Nonnull
@NonNull
Map<String, Boolean> getImmutableBacking();
}

View File

@ -29,12 +29,12 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Multimap;
import com.google.common.collect.SetMultimap;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Collection;
import java.util.Objects;
import java.util.Set;
import javax.annotation.Nonnull;
abstract class AbstractContextSet implements ContextSet {
protected abstract SetMultimap<String, String> backing();
@ -42,19 +42,18 @@ abstract class AbstractContextSet implements ContextSet {
protected abstract void copyTo(SetMultimap<String, String> other);
@Override
public boolean containsKey(@Nonnull String key) {
public boolean containsKey(@NonNull String key) {
return backing().containsKey(sanitizeKey(key));
}
@Nonnull
@Override
public Set<String> getValues(@Nonnull String key) {
public @NonNull Set<String> getValues(@NonNull String key) {
Collection<String> values = backing().asMap().get(sanitizeKey(key));
return values != null ? ImmutableSet.copyOf(values) : ImmutableSet.of();
}
@Override
public boolean has(@Nonnull String key, @Nonnull String value) {
public boolean has(@NonNull String key, @NonNull String value) {
return backing().containsEntry(sanitizeKey(key), sanitizeValue(value));
}

View File

@ -25,7 +25,7 @@
package me.lucko.luckperms.api.context;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Calculates whether contexts are applicable to a {@link T subject}.
@ -44,7 +44,7 @@ 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);
}

View File

@ -28,9 +28,9 @@ package me.lucko.luckperms.api.context;
import me.lucko.luckperms.api.Contexts;
import me.lucko.luckperms.api.User;
import java.util.Optional;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnull;
import java.util.Optional;
/**
* Manages {@link ContextCalculator}s, and calculates applicable contexts for a
@ -59,8 +59,8 @@ 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 +68,8 @@ 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 +83,8 @@ 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 +98,8 @@ 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,7 +109,7 @@ public interface ContextManager {
*
* @return the current active static contexts
*/
@Nonnull
@NonNull
ImmutableContextSet getStaticContext();
/**
@ -120,7 +120,7 @@ public interface ContextManager {
*
* @return the current active static contexts
*/
@Nonnull
@NonNull
Contexts getStaticContexts();
/**
@ -133,8 +133,8 @@ public interface ContextManager {
* @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,15 +145,15 @@ 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.
*
* @param calculator the calculator
*/
void registerCalculator(@Nonnull ContextCalculator<?> calculator);
void registerCalculator(@NonNull ContextCalculator<?> calculator);
/**
* Registers a static context calculator with the manager.
@ -162,13 +162,13 @@ public interface ContextManager {
*
* @param calculator the calculator
*/
void registerStaticCalculator(@Nonnull StaticContextCalculator calculator);
void registerStaticCalculator(@NonNull StaticContextCalculator calculator);
/**
* Invalidates the lookup cache for a given subject
*
* @param subject the subject
*/
void invalidateCache(@Nonnull Object subject);
void invalidateCache(@NonNull Object subject);
}

View File

@ -27,14 +27,14 @@ package me.lucko.luckperms.api.context;
import com.google.common.collect.Multimap;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Iterator;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import javax.annotation.Nonnull;
/**
* A set of contexts.
*
@ -71,8 +71,7 @@ public interface ContextSet extends Iterable<Map.Entry<String, String>> {
* @return a new ImmutableContextSet containing one context pair
* @throws NullPointerException if key or value is null
*/
@Nonnull
static ImmutableContextSet singleton(@Nonnull String key, @Nonnull String value) {
static @NonNull ImmutableContextSet singleton(@NonNull String key, @NonNull String value) {
return ImmutableContextSet.singleton(key, value);
}
@ -87,8 +86,7 @@ public interface ContextSet extends Iterable<Map.Entry<String, String>> {
* @throws NullPointerException if any of the keys or values are null
* @since 3.1
*/
@Nonnull
static ImmutableContextSet of(@Nonnull String key1, @Nonnull String value1, @Nonnull String key2, @Nonnull String value2) {
static @NonNull ImmutableContextSet of(@NonNull String key1, @NonNull String value1, @NonNull String key2, @NonNull String value2) {
return ImmutableContextSet.of(key1, value1, key2, value2);
}
@ -99,8 +97,7 @@ public interface ContextSet extends Iterable<Map.Entry<String, String>> {
* @return a new ImmutableContextSet representing the pairs in the iterable
* @throws NullPointerException if the iterable is null
*/
@Nonnull
static ImmutableContextSet fromEntries(@Nonnull Iterable<? extends Map.Entry<String, String>> iterable) {
static @NonNull ImmutableContextSet fromEntries(@NonNull Iterable<? extends Map.Entry<String, String>> iterable) {
return ImmutableContextSet.fromEntries(iterable);
}
@ -111,8 +108,7 @@ public interface ContextSet extends Iterable<Map.Entry<String, String>> {
* @return a new ImmutableContextSet representing the pairs from the map
* @throws NullPointerException if the map is null
*/
@Nonnull
static ImmutableContextSet fromMap(@Nonnull Map<String, String> map) {
static @NonNull ImmutableContextSet fromMap(@NonNull Map<String, String> map) {
return ImmutableContextSet.fromMap(map);
}
@ -124,8 +120,7 @@ public interface ContextSet extends Iterable<Map.Entry<String, String>> {
* @throws NullPointerException if the multimap is null
* @since 2.16
*/
@Nonnull
static ImmutableContextSet fromMultimap(@Nonnull Multimap<String, String> multimap) {
static @NonNull ImmutableContextSet fromMultimap(@NonNull Multimap<String, String> multimap) {
return ImmutableContextSet.fromMultimap(multimap);
}
@ -138,8 +133,7 @@ public interface ContextSet extends Iterable<Map.Entry<String, String>> {
* @return a new ImmutableContextSet with the same content and the one provided
* @throws NullPointerException if contextSet is null
*/
@Nonnull
static ImmutableContextSet fromSet(@Nonnull ContextSet contextSet) {
static @NonNull ImmutableContextSet fromSet(@NonNull ContextSet contextSet) {
return ImmutableContextSet.fromSet(contextSet);
}
@ -148,8 +142,7 @@ public interface ContextSet extends Iterable<Map.Entry<String, String>> {
*
* @return an empty ImmutableContextSet
*/
@Nonnull
static ImmutableContextSet empty() {
static @NonNull ImmutableContextSet empty() {
return ImmutableContextSet.empty();
}
@ -170,7 +163,7 @@ public interface ContextSet extends Iterable<Map.Entry<String, String>> {
*
* @return an immutable representation of this set
*/
@Nonnull
@NonNull
ImmutableContextSet makeImmutable();
/**
@ -182,7 +175,7 @@ public interface ContextSet extends Iterable<Map.Entry<String, String>> {
* @return a mutable ContextSet
* @since 2.16
*/
@Nonnull
@NonNull
MutableContextSet mutableCopy();
/**
@ -194,7 +187,7 @@ public interface ContextSet extends Iterable<Map.Entry<String, String>> {
*
* @return an immutable set
*/
@Nonnull
@NonNull
Set<Map.Entry<String, String>> toSet();
/**
@ -214,7 +207,7 @@ 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
@NonNull
@Deprecated
Map<String, String> toMap();
@ -228,7 +221,7 @@ public interface ContextSet extends Iterable<Map.Entry<String, String>> {
* @return a multimap
* @since 2.16
*/
@Nonnull
@NonNull
Multimap<String, String> toMultimap();
/**
@ -241,7 +234,7 @@ public interface ContextSet extends Iterable<Map.Entry<String, String>> {
*
* @return an iterator
*/
@Nonnull
@NonNull
@Override
Iterator<Map.Entry<String, String>> iterator();
@ -253,7 +246,7 @@ public interface ContextSet extends Iterable<Map.Entry<String, String>> {
* @return true if the set contains a value for the key
* @throws NullPointerException if the key is null
*/
boolean containsKey(@Nonnull String key);
boolean containsKey(@NonNull String key);
/**
* Returns a {@link Set} of the values mapped to the given key.
@ -265,8 +258,8 @@ 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.
@ -278,8 +271,7 @@ public interface ContextSet extends Iterable<Map.Entry<String, String>> {
* @return an optional containing any match
* @since 3.1
*/
@Nonnull
default Optional<String> getAnyValue(@Nonnull String key) {
default @NonNull Optional<String> getAnyValue(@NonNull String key) {
return getValues(key).stream().findAny();
}
@ -291,7 +283,7 @@ public interface ContextSet extends Iterable<Map.Entry<String, String>> {
* @return true if the set contains the context pair
* @throws NullPointerException if the key or value is null
*/
boolean has(@Nonnull String key, @Nonnull String value);
boolean has(@NonNull String key, @NonNull String value);
/**
* Returns if the {@link ContextSet} contains a given context pairing.
@ -300,7 +292,7 @@ public interface ContextSet extends Iterable<Map.Entry<String, String>> {
* @return true if the set contains the context pair
* @throws NullPointerException if the key or value is null
*/
default boolean has(@Nonnull Map.Entry<String, String> entry) {
default boolean has(Map.@NonNull Entry<String, String> entry) {
Objects.requireNonNull(entry, "entry");
return has(entry.getKey(), entry.getValue());
}
@ -317,7 +309,7 @@ public interface ContextSet extends Iterable<Map.Entry<String, String>> {
* @return true if all entries in this set are also in the other set
* @since 3.1
*/
default boolean isSatisfiedBy(@Nonnull ContextSet other) {
default boolean isSatisfiedBy(@NonNull ContextSet other) {
if (this == other) {
return true;
}

View File

@ -30,21 +30,19 @@ import com.google.common.collect.ImmutableSetMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.SetMultimap;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Iterator;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.Spliterator;
import javax.annotation.Nonnull;
import javax.annotation.concurrent.Immutable;
/**
* An immutable implementation of {@link ContextSet}.
*
* @since 2.16
*/
@Immutable
public final class ImmutableContextSet extends AbstractContextSet implements ContextSet {
private static final ImmutableContextSet EMPTY = new ImmutableContextSet(ImmutableSetMultimap.of());
@ -54,8 +52,7 @@ public final class ImmutableContextSet extends AbstractContextSet implements Con
* @return a new ImmutableContextSet builder
* @since 4.1
*/
@Nonnull
public static Builder builder() {
public static @NonNull Builder builder() {
return new Builder();
}
@ -67,8 +64,7 @@ public final class ImmutableContextSet extends AbstractContextSet implements Con
* @return a new ImmutableContextSet containing one context pair
* @throws NullPointerException if key or value is null
*/
@Nonnull
public static ImmutableContextSet singleton(@Nonnull String key, @Nonnull String value) {
public static @NonNull ImmutableContextSet singleton(@NonNull String key, @NonNull String value) {
return new ImmutableContextSet(ImmutableSetMultimap.of(sanitizeKey(key), sanitizeValue(value)));
}
@ -83,8 +79,7 @@ public final class ImmutableContextSet extends AbstractContextSet implements Con
* @throws NullPointerException if any of the keys or values are null
* @since 3.1
*/
@Nonnull
public static ImmutableContextSet of(@Nonnull String key1, @Nonnull String value1, @Nonnull String key2, @Nonnull String value2) {
public static @NonNull ImmutableContextSet of(@NonNull String key1, @NonNull String value1, @NonNull String key2, @NonNull String value2) {
return new ImmutableContextSet(ImmutableSetMultimap.of(
sanitizeKey(key1),
sanitizeValue(value1),
@ -100,8 +95,7 @@ public final class ImmutableContextSet extends AbstractContextSet implements Con
* @return a new ImmutableContextSet representing the pairs in the iterable
* @throws NullPointerException if the iterable is null
*/
@Nonnull
public static ImmutableContextSet fromEntries(@Nonnull Iterable<? extends Map.Entry<String, String>> iterable) {
public static @NonNull ImmutableContextSet fromEntries(@NonNull Iterable<? extends Map.Entry<String, String>> iterable) {
Objects.requireNonNull(iterable, "iterable");
ImmutableContextSet.Builder builder = builder();
for (Map.Entry<String, String> entry : iterable) {
@ -117,8 +111,7 @@ public final class ImmutableContextSet extends AbstractContextSet implements Con
* @return a new ImmutableContextSet representing the pairs from the map
* @throws NullPointerException if the map is null
*/
@Nonnull
public static ImmutableContextSet fromMap(@Nonnull Map<String, String> map) {
public static @NonNull ImmutableContextSet fromMap(@NonNull Map<String, String> map) {
return fromEntries(Objects.requireNonNull(map, "map").entrySet());
}
@ -130,8 +123,7 @@ public final class ImmutableContextSet extends AbstractContextSet implements Con
* @throws NullPointerException if the multimap is null
* @since 2.16
*/
@Nonnull
public static ImmutableContextSet fromMultimap(@Nonnull Multimap<String, String> multimap) {
public static @NonNull ImmutableContextSet fromMultimap(@NonNull Multimap<String, String> multimap) {
return fromEntries(Objects.requireNonNull(multimap, "multimap").entries());
}
@ -144,8 +136,7 @@ public final class ImmutableContextSet extends AbstractContextSet implements Con
* @return a new ImmutableContextSet with the same content and the one provided
* @throws NullPointerException if contextSet is null
*/
@Nonnull
public static ImmutableContextSet fromSet(@Nonnull ContextSet contextSet) {
public static @NonNull ImmutableContextSet fromSet(@NonNull ContextSet contextSet) {
return Objects.requireNonNull(contextSet, "contextSet").makeImmutable();
}
@ -154,8 +145,7 @@ public final class ImmutableContextSet extends AbstractContextSet implements Con
*
* @return an empty ImmutableContextSet
*/
@Nonnull
public static ImmutableContextSet empty() {
public static @NonNull ImmutableContextSet empty() {
return EMPTY;
}
@ -182,29 +172,25 @@ public final class ImmutableContextSet extends AbstractContextSet implements Con
return true;
}
@Nonnull
@Override
@Deprecated // This set is already immutable!
public ImmutableContextSet makeImmutable() {
@Deprecated
@Override // This set is already immutable!
public @NonNull ImmutableContextSet makeImmutable() {
return this;
}
@Nonnull
@Override
public MutableContextSet mutableCopy() {
public @NonNull MutableContextSet mutableCopy() {
return MutableContextSet.fromSet(this);
}
@Nonnull
@Override
public Set<Map.Entry<String, String>> toSet() {
public @NonNull Set<Map.Entry<String, String>> toSet() {
return this.map.entries();
}
@Nonnull
@Override
@Deprecated
public Map<String, String> toMap() {
@Override
public @NonNull Map<String, String> toMap() {
ImmutableMap.Builder<String, String> m = ImmutableMap.builder();
for (Map.Entry<String, String> e : this.map.entries()) {
m.put(e.getKey(), e.getValue());
@ -212,15 +198,13 @@ public final class ImmutableContextSet extends AbstractContextSet implements Con
return m.build();
}
@Nonnull
@Override
public Multimap<String, String> toMultimap() {
public @NonNull Multimap<String, String> toMultimap() {
return this.map;
}
@Nonnull
@Override
public Iterator<Map.Entry<String, String>> iterator() {
public @NonNull Iterator<Map.Entry<String, String>> iterator() {
return this.map.entries().iterator();
}
@ -271,8 +255,7 @@ public final class ImmutableContextSet extends AbstractContextSet implements Con
* @throws NullPointerException if the key or value is null
* @see MutableContextSet#add(String, String)
*/
@Nonnull
public Builder add(@Nonnull String key, @Nonnull String value) {
public @NonNull Builder add(@NonNull String key, @NonNull String value) {
put(sanitizeKey(key), sanitizeValue(value));
return this;
}
@ -285,8 +268,7 @@ public final class ImmutableContextSet extends AbstractContextSet implements Con
* @throws NullPointerException if the entry is null
* @see MutableContextSet#add(Map.Entry)
*/
@Nonnull
public Builder add(@Nonnull Map.Entry<String, String> entry) {
public @NonNull Builder add(Map.@NonNull Entry<String, String> entry) {
Objects.requireNonNull(entry, "entry");
add(entry.getKey(), entry.getValue());
return this;
@ -300,8 +282,7 @@ public final class ImmutableContextSet extends AbstractContextSet implements Con
* @throws NullPointerException if iterable is null
* @see MutableContextSet#addAll(Iterable)
*/
@Nonnull
public Builder addAll(@Nonnull Iterable<? extends Map.Entry<String, String>> iterable) {
public @NonNull Builder addAll(@NonNull Iterable<? extends Map.Entry<String, String>> iterable) {
for (Map.Entry<String, String> e : Objects.requireNonNull(iterable, "iterable")) {
add(e);
}
@ -316,8 +297,7 @@ public final class ImmutableContextSet extends AbstractContextSet implements Con
* @throws NullPointerException if the map is null
* @see MutableContextSet#addAll(Map)
*/
@Nonnull
public Builder addAll(@Nonnull Map<String, String> map) {
public @NonNull Builder addAll(@NonNull Map<String, String> map) {
addAll(Objects.requireNonNull(map, "map").entrySet());
return this;
}
@ -331,8 +311,7 @@ public final class ImmutableContextSet extends AbstractContextSet implements Con
* @since 3.4
* @see MutableContextSet#addAll(Multimap)
*/
@Nonnull
public Builder addAll(@Nonnull Multimap<String, String> multimap) {
public @NonNull Builder addAll(@NonNull Multimap<String, String> multimap) {
addAll(Objects.requireNonNull(multimap, "multimap").entries());
return this;
}
@ -345,8 +324,7 @@ public final class ImmutableContextSet extends AbstractContextSet implements Con
* @throws NullPointerException if the contextSet is null
* @see MutableContextSet#addAll(ContextSet)
*/
@Nonnull
public Builder addAll(@Nonnull ContextSet contextSet) {
public @NonNull Builder addAll(@NonNull ContextSet contextSet) {
Objects.requireNonNull(contextSet, "contextSet");
if (contextSet instanceof AbstractContextSet) {
AbstractContextSet other = ((AbstractContextSet) contextSet);
@ -365,8 +343,7 @@ public final class ImmutableContextSet extends AbstractContextSet implements Con
*
* @return an {@link ImmutableContextSet} from the builder
*/
@Nonnull
public ImmutableContextSet build() {
public @NonNull ImmutableContextSet build() {
if (this.builder == null) {
return empty();
} else {

View File

@ -33,14 +33,14 @@ import com.google.common.collect.Multimap;
import com.google.common.collect.Multimaps;
import com.google.common.collect.SetMultimap;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Iterator;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.Spliterator;
import javax.annotation.Nonnull;
/**
* A mutable implementation of {@link ContextSet}.
*
@ -56,8 +56,7 @@ public final class MutableContextSet extends AbstractContextSet implements Conte
* @return a new MutableContextSet containing one context pair
* @throws NullPointerException if key or value is null
*/
@Nonnull
public static MutableContextSet singleton(@Nonnull String key, @Nonnull String value) {
public static @NonNull MutableContextSet singleton(@NonNull String key, @NonNull String value) {
Objects.requireNonNull(key, "key");
Objects.requireNonNull(value, "value");
MutableContextSet set = MutableContextSet.create();
@ -76,8 +75,7 @@ public final class MutableContextSet extends AbstractContextSet implements Conte
* @throws NullPointerException if any of the keys or values are null
* @since 3.1
*/
@Nonnull
public static MutableContextSet of(@Nonnull String key1, @Nonnull String value1, @Nonnull String key2, @Nonnull String value2) {
public static @NonNull MutableContextSet of(@NonNull String key1, @NonNull String value1, @NonNull String key2, @NonNull String value2) {
Objects.requireNonNull(key1, "key1");
Objects.requireNonNull(value1, "value1");
Objects.requireNonNull(key2, "key2");
@ -95,8 +93,7 @@ public final class MutableContextSet extends AbstractContextSet implements Conte
* @return a new MutableContextSet representing the pairs in the iterable
* @throws NullPointerException if the iterable is null
*/
@Nonnull
public static MutableContextSet fromEntries(@Nonnull Iterable<? extends Map.Entry<String, String>> iterable) {
public static @NonNull MutableContextSet fromEntries(@NonNull Iterable<? extends Map.Entry<String, String>> iterable) {
Objects.requireNonNull(iterable, "iterable");
MutableContextSet set = create();
set.addAll(iterable);
@ -110,8 +107,7 @@ public final class MutableContextSet extends AbstractContextSet implements Conte
* @return a new MutableContextSet representing the pairs from the map
* @throws NullPointerException if the map is null
*/
@Nonnull
public static MutableContextSet fromMap(@Nonnull Map<String, String> map) {
public static @NonNull MutableContextSet fromMap(@NonNull Map<String, String> map) {
Objects.requireNonNull(map, "map");
MutableContextSet set = create();
set.addAll(map);
@ -126,8 +122,7 @@ public final class MutableContextSet extends AbstractContextSet implements Conte
* @throws NullPointerException if the multimap is null
* @since 2.16
*/
@Nonnull
public static MutableContextSet fromMultimap(@Nonnull Multimap<String, String> multimap) {
public static @NonNull MutableContextSet fromMultimap(@NonNull Multimap<String, String> multimap) {
Objects.requireNonNull(multimap, "multimap");
MutableContextSet set = create();
set.addAll(multimap);
@ -143,8 +138,7 @@ public final class MutableContextSet extends AbstractContextSet implements Conte
* @return a new MutableContextSet with the same content and the one provided
* @throws NullPointerException if contextSet is null
*/
@Nonnull
public static MutableContextSet fromSet(@Nonnull ContextSet contextSet) {
public static @NonNull MutableContextSet fromSet(@NonNull ContextSet contextSet) {
Objects.requireNonNull(contextSet, "contextSet");
if (contextSet instanceof ImmutableContextSet) {
@ -164,8 +158,7 @@ public final class MutableContextSet extends AbstractContextSet implements Conte
*
* @return a new MutableContextSet
*/
@Nonnull
public static MutableContextSet create() {
public static @NonNull MutableContextSet create() {
return new MutableContextSet();
}
@ -196,9 +189,8 @@ public final class MutableContextSet extends AbstractContextSet implements Conte
return false;
}
@Nonnull
@Override
public ImmutableContextSet makeImmutable() {
public @NonNull ImmutableContextSet makeImmutable() {
// if the map is empty, don't create a new instance
if (this.map.isEmpty()) {
return ImmutableContextSet.empty();
@ -208,27 +200,24 @@ public final class MutableContextSet extends AbstractContextSet implements Conte
}
}
@Nonnull
@Override
public MutableContextSet mutableCopy() {
public @NonNull MutableContextSet mutableCopy() {
synchronized (this.map) {
return new MutableContextSet(this.map);
}
}
@Nonnull
@Override
public Set<Map.Entry<String, String>> toSet() {
public @NonNull Set<Map.Entry<String, String>> toSet() {
synchronized (this.map) {
// map.entries() returns immutable Map.Entry instances, so we can just call copyOf
return ImmutableSet.copyOf(this.map.entries());
}
}
@Nonnull
@Override
@Deprecated
public Map<String, String> toMap() {
@Override
public @NonNull Map<String, String> toMap() {
ImmutableMap.Builder<String, String> m = ImmutableMap.builder();
synchronized (this.map) {
for (Map.Entry<String, String> e : this.map.entries()) {
@ -238,17 +227,15 @@ public final class MutableContextSet extends AbstractContextSet implements Conte
return m.build();
}
@Nonnull
@Override
public Multimap<String, String> toMultimap() {
public @NonNull Multimap<String, String> toMultimap() {
synchronized (this.map) {
return ImmutableSetMultimap.copyOf(this.map);
}
}
@Nonnull
@Override
public Iterator<Map.Entry<String, String>> iterator() {
public @NonNull Iterator<Map.Entry<String, String>> iterator() {
return toSet().iterator();
}
@ -264,7 +251,7 @@ public final class MutableContextSet extends AbstractContextSet implements Conte
* @param value the value to add
* @throws NullPointerException if the key or value is null
*/
public void add(@Nonnull String key, @Nonnull String value) {
public void add(@NonNull String key, @NonNull String value) {
this.map.put(sanitizeKey(key), sanitizeValue(value));
}
@ -274,7 +261,7 @@ public final class MutableContextSet extends AbstractContextSet implements Conte
* @param entry the entry to add
* @throws NullPointerException if the entry is null
*/
public void add(@Nonnull Map.Entry<String, String> entry) {
public void add(Map.@NonNull Entry<String, String> entry) {
Objects.requireNonNull(entry, "entry");
add(entry.getKey(), entry.getValue());
}
@ -285,7 +272,7 @@ public final class MutableContextSet extends AbstractContextSet implements Conte
* @param iterable an iterable of key value context pairs
* @throws NullPointerException if iterable is null
*/
public void addAll(@Nonnull Iterable<? extends Map.Entry<String, String>> iterable) {
public void addAll(@NonNull Iterable<? extends Map.Entry<String, String>> iterable) {
for (Map.Entry<String, String> e : Objects.requireNonNull(iterable, "iterable")) {
add(e);
}
@ -297,7 +284,7 @@ public final class MutableContextSet extends AbstractContextSet implements Conte
* @param map the map to add from
* @throws NullPointerException if the map is null
*/
public void addAll(@Nonnull Map<String, String> map) {
public void addAll(@NonNull Map<String, String> map) {
addAll(Objects.requireNonNull(map, "map").entrySet());
}
@ -308,7 +295,7 @@ public final class MutableContextSet extends AbstractContextSet implements Conte
* @throws NullPointerException if the map is null
* @since 3.4
*/
public void addAll(@Nonnull Multimap<String, String> multimap) {
public void addAll(@NonNull Multimap<String, String> multimap) {
addAll(Objects.requireNonNull(multimap, "multimap").entries());
}
@ -318,7 +305,7 @@ public final class MutableContextSet extends AbstractContextSet implements Conte
* @param contextSet the set to add from
* @throws NullPointerException if the contextSet is null
*/
public void addAll(@Nonnull ContextSet contextSet) {
public void addAll(@NonNull ContextSet contextSet) {
Objects.requireNonNull(contextSet, "contextSet");
if (contextSet instanceof AbstractContextSet) {
AbstractContextSet other = ((AbstractContextSet) contextSet);
@ -337,7 +324,7 @@ public final class MutableContextSet extends AbstractContextSet implements Conte
* @param value the value to remove
* @throws NullPointerException if the key or value is null
*/
public void remove(@Nonnull String key, @Nonnull String value) {
public void remove(@NonNull String key, @NonNull String value) {
this.map.remove(sanitizeKey(key), sanitizeValue(value));
}
@ -347,7 +334,7 @@ public final class MutableContextSet extends AbstractContextSet implements Conte
* @param key the key to remove
* @throws NullPointerException if the key is null
*/
public void removeAll(@Nonnull String key) {
public void removeAll(@NonNull String key) {
this.map.removeAll(sanitizeKey(key));
}

View File

@ -25,8 +25,8 @@
package me.lucko.luckperms.api.context;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
/**
* Extension of {@link ContextCalculator} which provides the same context
@ -43,8 +43,8 @@ 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
@ -53,10 +53,9 @@ public interface StaticContextCalculator extends ContextCalculator<Object> {
* @param accumulator a map of contexts to add to
* @return the map
*/
@Nonnull
@Override
@Deprecated
default MutableContextSet giveApplicableContext(@Nullable Object subject, @Nonnull MutableContextSet accumulator) {
@Override
default @NonNull MutableContextSet giveApplicableContext(@Nullable Object subject, @NonNull MutableContextSet accumulator) {
return giveApplicableContext(accumulator);
}

View File

@ -25,9 +25,9 @@
package me.lucko.luckperms.api.event;
import java.util.concurrent.atomic.AtomicBoolean;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnull;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* Represents an event that can be cancelled
@ -39,7 +39,7 @@ public interface Cancellable {
*
* @return the cancellation
*/
@Nonnull
@NonNull
@Param(-1)
AtomicBoolean getCancellationState();

View File

@ -25,11 +25,11 @@
package me.lucko.luckperms.api.event;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Set;
import java.util.function.Consumer;
import javax.annotation.Nonnull;
/**
* The LuckPerms event bus.
*
@ -51,8 +51,8 @@ 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 +72,8 @@ 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 +82,7 @@ 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);
}

View File

@ -25,9 +25,9 @@
package me.lucko.luckperms.api.event;
import java.util.function.Consumer;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnull;
import java.util.function.Consumer;
/**
* Represents a subscription to a {@link LuckPermsEvent}.
@ -41,7 +41,7 @@ public interface EventHandler<T extends LuckPermsEvent> extends AutoCloseable {
*
* @return the event class
*/
@Nonnull
@NonNull
Class<T> getEventClass();
/**
@ -63,7 +63,7 @@ public interface EventHandler<T extends LuckPermsEvent> extends AutoCloseable {
*
* @return the event consumer
*/
@Nonnull
@NonNull
Consumer<? super T> getConsumer();
/**

View File

@ -27,7 +27,7 @@ package me.lucko.luckperms.api.event;
import me.lucko.luckperms.api.LuckPermsApi;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* A superinterface for all LuckPerms events.
@ -41,7 +41,7 @@ public interface LuckPermsEvent {
*
* @return the api instance
*/
@Nonnull
@NonNull
LuckPermsApi getApi();
}

View File

@ -27,7 +27,7 @@ package me.lucko.luckperms.api.event;
import me.lucko.luckperms.api.event.source.Source;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Represents an event with a {@link Source}.
@ -44,7 +44,7 @@ public interface Sourced {
*
* @return the source
*/
@Nonnull
@NonNull
@Param(-1)
Source getSource();

View File

@ -30,7 +30,7 @@ import me.lucko.luckperms.api.caching.GroupData;
import me.lucko.luckperms.api.event.LuckPermsEvent;
import me.lucko.luckperms.api.event.Param;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a groups {@link GroupData} is loaded.
@ -44,7 +44,7 @@ public interface GroupCacheLoadEvent extends LuckPermsEvent {
*
* @return the group
*/
@Nonnull
@NonNull
@Param(0)
Group getGroup();
@ -53,7 +53,7 @@ public interface GroupCacheLoadEvent extends LuckPermsEvent {
*
* @return the loaded data
*/
@Nonnull
@NonNull
@Param(1)
GroupData getLoadedData();

View File

@ -30,7 +30,7 @@ import me.lucko.luckperms.api.event.LuckPermsEvent;
import me.lucko.luckperms.api.event.Param;
import me.lucko.luckperms.api.event.cause.CreationCause;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a group is created
@ -42,7 +42,7 @@ public interface GroupCreateEvent extends LuckPermsEvent {
*
* @return the new group
*/
@Nonnull
@NonNull
@Param(0)
Group getGroup();
@ -51,7 +51,7 @@ public interface GroupCreateEvent extends LuckPermsEvent {
*
* @return the cause of the creation
*/
@Nonnull
@NonNull
@Param(1)
CreationCause getCause();

View File

@ -30,7 +30,7 @@ import me.lucko.luckperms.api.caching.GroupData;
import me.lucko.luckperms.api.event.LuckPermsEvent;
import me.lucko.luckperms.api.event.Param;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a groups cached data is refreshed
@ -44,7 +44,7 @@ public interface GroupDataRecalculateEvent extends LuckPermsEvent {
*
* @return the group
*/
@Nonnull
@NonNull
@Param(0)
Group getGroup();
@ -53,7 +53,7 @@ public interface GroupDataRecalculateEvent extends LuckPermsEvent {
*
* @return the data
*/
@Nonnull
@NonNull
@Param(1)
GroupData getData();

View File

@ -30,9 +30,9 @@ import me.lucko.luckperms.api.event.LuckPermsEvent;
import me.lucko.luckperms.api.event.Param;
import me.lucko.luckperms.api.event.cause.DeletionCause;
import java.util.Set;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnull;
import java.util.Set;
/**
* Called when a group is deleted
@ -44,7 +44,7 @@ public interface GroupDeleteEvent extends LuckPermsEvent {
*
* @return the name of the deleted group
*/
@Nonnull
@NonNull
@Param(0)
String getGroupName();
@ -53,7 +53,7 @@ public interface GroupDeleteEvent extends LuckPermsEvent {
*
* @return a copy of the groups existing data
*/
@Nonnull
@NonNull
@Param(1)
Set<Node> getExistingData();
@ -62,7 +62,7 @@ public interface GroupDeleteEvent extends LuckPermsEvent {
*
* @return the cause of the deletion
*/
@Nonnull
@NonNull
@Param(2)
DeletionCause getCause();

View File

@ -29,7 +29,7 @@ import me.lucko.luckperms.api.Group;
import me.lucko.luckperms.api.event.LuckPermsEvent;
import me.lucko.luckperms.api.event.Param;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a group is loaded into memory from the storage.
@ -43,7 +43,7 @@ public interface GroupLoadEvent extends LuckPermsEvent {
*
* @return the group that was loaded
*/
@Nonnull
@NonNull
@Param(0)
Group getGroup();

View File

@ -30,7 +30,7 @@ import me.lucko.luckperms.api.event.Cancellable;
import me.lucko.luckperms.api.event.LuckPermsEvent;
import me.lucko.luckperms.api.event.Param;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a log entry is about to be sent to notifiable players on the platform
@ -42,7 +42,7 @@ public interface LogBroadcastEvent extends LuckPermsEvent, Cancellable {
*
* @return the log entry to be broadcasted
*/
@Nonnull
@NonNull
@Param(0)
LogEntry getEntry();
@ -52,7 +52,7 @@ public interface LogBroadcastEvent extends LuckPermsEvent, Cancellable {
* @return the origin of the log
* @since 3.3
*/
@Nonnull
@NonNull
@Param(1)
Origin getOrigin();

View File

@ -30,9 +30,9 @@ import me.lucko.luckperms.api.event.Cancellable;
import me.lucko.luckperms.api.event.LuckPermsEvent;
import me.lucko.luckperms.api.event.Param;
import java.util.UUID;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnull;
import java.util.UUID;
/**
* Called when a log is about to be published to the network via the MessagingService
@ -46,7 +46,7 @@ public interface LogNetworkPublishEvent extends LuckPermsEvent, Cancellable {
*
* @return the id of the log entry being published
*/
@Nonnull
@NonNull
@Param(0)
UUID getLogId();
@ -55,7 +55,7 @@ public interface LogNetworkPublishEvent extends LuckPermsEvent, Cancellable {
*
* @return the log entry to be published
*/
@Nonnull
@NonNull
@Param(1)
LogEntry getEntry();

View File

@ -31,7 +31,7 @@ import me.lucko.luckperms.api.event.Cancellable;
import me.lucko.luckperms.api.event.LuckPermsEvent;
import me.lucko.luckperms.api.event.Param;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a log entry is about to be sent to specific notifiable object on
@ -50,7 +50,7 @@ public interface LogNotifyEvent extends LuckPermsEvent, Cancellable {
*
* @return the log entry to be sent
*/
@Nonnull
@NonNull
@Param(0)
LogEntry getEntry();
@ -59,7 +59,7 @@ public interface LogNotifyEvent extends LuckPermsEvent, Cancellable {
*
* @return the origin of the log
*/
@Nonnull
@NonNull
@Param(1)
Origin getOrigin();
@ -68,7 +68,7 @@ public interface LogNotifyEvent extends LuckPermsEvent, Cancellable {
*
* @return the object to notify
*/
@Nonnull
@NonNull
@Param(2)
Entity getNotifiable();

View File

@ -30,7 +30,7 @@ import me.lucko.luckperms.api.event.Cancellable;
import me.lucko.luckperms.api.event.LuckPermsEvent;
import me.lucko.luckperms.api.event.Param;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a log is about to be published to the storage file/table
@ -42,7 +42,7 @@ public interface LogPublishEvent extends LuckPermsEvent, Cancellable {
*
* @return the log entry to be published
*/
@Nonnull
@NonNull
@Param(0)
LogEntry getEntry();

View File

@ -29,9 +29,9 @@ import me.lucko.luckperms.api.LogEntry;
import me.lucko.luckperms.api.event.LuckPermsEvent;
import me.lucko.luckperms.api.event.Param;
import java.util.UUID;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnull;
import java.util.UUID;
/**
* Called when a log entry is received via the MessagingService
@ -45,7 +45,7 @@ public interface LogReceiveEvent extends LuckPermsEvent {
*
* @return the id of the log entry being received
*/
@Nonnull
@NonNull
@Param(0)
UUID getLogId();
@ -54,7 +54,7 @@ public interface LogReceiveEvent extends LuckPermsEvent {
*
* @return the log entry being received
*/
@Nonnull
@NonNull
@Param(1)
LogEntry getEntry();

View File

@ -28,7 +28,7 @@ package me.lucko.luckperms.api.event.node;
import me.lucko.luckperms.api.Node;
import me.lucko.luckperms.api.event.Param;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a node is added to a holder
@ -40,7 +40,7 @@ public interface NodeAddEvent extends NodeMutateEvent {
*
* @return the node that was added
*/
@Nonnull
@NonNull
@Param(3)
Node getNode();

View File

@ -32,9 +32,9 @@ import me.lucko.luckperms.api.User;
import me.lucko.luckperms.api.event.LuckPermsEvent;
import me.lucko.luckperms.api.event.Param;
import java.util.Set;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnull;
import java.util.Set;
/**
* Called when a node is added to/removed from a user/group
@ -46,7 +46,7 @@ public interface NodeMutateEvent extends LuckPermsEvent {
*
* @return the event target
*/
@Nonnull
@NonNull
@Param(0)
PermissionHolder getTarget();
@ -55,7 +55,7 @@ public interface NodeMutateEvent extends LuckPermsEvent {
*
* @return the data before the change
*/
@Nonnull
@NonNull
@Param(1)
Set<Node> getDataBefore();
@ -64,7 +64,7 @@ public interface NodeMutateEvent extends LuckPermsEvent {
*
* @return the data after the change
*/
@Nonnull
@NonNull
@Param(2)
Set<Node> getDataAfter();

View File

@ -28,7 +28,7 @@ package me.lucko.luckperms.api.event.node;
import me.lucko.luckperms.api.Node;
import me.lucko.luckperms.api.event.Param;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a node is removed from a holder
@ -40,7 +40,7 @@ public interface NodeRemoveEvent extends NodeMutateEvent {
*
* @return the node that was removed
*/
@Nonnull
@NonNull
@Param(3)
Node getNode();

View File

@ -30,9 +30,9 @@ import me.lucko.luckperms.api.event.LuckPermsEvent;
import me.lucko.luckperms.api.event.Param;
import me.lucko.luckperms.api.manager.UserManager;
import java.util.UUID;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnull;
import java.util.UUID;
/**
* Called when player data is saved to the storage.
@ -48,7 +48,7 @@ public interface PlayerDataSaveEvent extends LuckPermsEvent {
*
* @return the uuid
*/
@Nonnull
@NonNull
@Param(0)
UUID getUuid();
@ -57,7 +57,7 @@ public interface PlayerDataSaveEvent extends LuckPermsEvent {
*
* @return the username
*/
@Nonnull
@NonNull
@Param(1)
String getUsername();
@ -66,7 +66,7 @@ public interface PlayerDataSaveEvent extends LuckPermsEvent {
*
* @return the result
*/
@Nonnull
@NonNull
@Param(2)
PlayerSaveResult getResult();

View File

@ -27,7 +27,7 @@ package me.lucko.luckperms.api.event.source;
import me.lucko.luckperms.api.Entity;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Represents an {@link Entity} which was the {@link Source} of something.
@ -41,7 +41,7 @@ public interface EntitySource extends Source {
*
* @return the entity
*/
@Nonnull
@NonNull
Entity getEntity();
}

View File

@ -27,7 +27,7 @@ package me.lucko.luckperms.api.event.source;
import me.lucko.luckperms.api.Entity;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Represents the source of an event.
@ -43,7 +43,7 @@ public interface Source {
*
* @return the type
*/
@Nonnull
@NonNull
Type getType();
/**

View File

@ -29,9 +29,9 @@ import me.lucko.luckperms.api.event.Cancellable;
import me.lucko.luckperms.api.event.LuckPermsEvent;
import me.lucko.luckperms.api.event.Param;
import java.util.UUID;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnull;
import java.util.UUID;
/**
* Called before a received network sync task runs
@ -43,7 +43,7 @@ public interface PreNetworkSyncEvent extends LuckPermsEvent, Cancellable {
*
* @return the id of the sync request
*/
@Nonnull
@NonNull
@Param(0)
UUID getSyncId();

View File

@ -30,7 +30,7 @@ import me.lucko.luckperms.api.event.LuckPermsEvent;
import me.lucko.luckperms.api.event.Param;
import me.lucko.luckperms.api.event.cause.CreationCause;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a track is created
@ -42,7 +42,7 @@ public interface TrackCreateEvent extends LuckPermsEvent {
*
* @return the new track
*/
@Nonnull
@NonNull
@Param(0)
Track getTrack();
@ -51,7 +51,7 @@ public interface TrackCreateEvent extends LuckPermsEvent {
*
* @return the cause of the creation
*/
@Nonnull
@NonNull
@Param(1)
CreationCause getCause();

View File

@ -29,9 +29,9 @@ import me.lucko.luckperms.api.event.LuckPermsEvent;
import me.lucko.luckperms.api.event.Param;
import me.lucko.luckperms.api.event.cause.DeletionCause;
import java.util.List;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnull;
import java.util.List;
/**
* Called when a track is deleted
@ -43,7 +43,7 @@ public interface TrackDeleteEvent extends LuckPermsEvent {
*
* @return the name of the deleted track
*/
@Nonnull
@NonNull
@Param(0)
String getTrackName();
@ -52,7 +52,7 @@ public interface TrackDeleteEvent extends LuckPermsEvent {
*
* @return a copy of the tracks existing data
*/
@Nonnull
@NonNull
@Param(1)
List<String> getExistingData();
@ -61,7 +61,7 @@ public interface TrackDeleteEvent extends LuckPermsEvent {
*
* @return the cause of the deletion
*/
@Nonnull
@NonNull
@Param(2)
DeletionCause getCause();

View File

@ -29,7 +29,7 @@ import me.lucko.luckperms.api.Track;
import me.lucko.luckperms.api.event.LuckPermsEvent;
import me.lucko.luckperms.api.event.Param;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a track is loaded into memory from the storage.
@ -43,7 +43,7 @@ public interface TrackLoadEvent extends LuckPermsEvent {
*
* @return the track that was loaded
*/
@Nonnull
@NonNull
@Param(0)
Track getTrack();

View File

@ -27,7 +27,7 @@ package me.lucko.luckperms.api.event.track.mutate;
import me.lucko.luckperms.api.event.Param;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a group is added to a track
@ -39,7 +39,7 @@ public interface TrackAddGroupEvent extends TrackMutateEvent {
*
* @return the group that was added
*/
@Nonnull
@NonNull
@Param(3)
String getGroup();

View File

@ -29,9 +29,9 @@ import me.lucko.luckperms.api.Track;
import me.lucko.luckperms.api.event.LuckPermsEvent;
import me.lucko.luckperms.api.event.Param;
import java.util.List;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnull;
import java.util.List;
/**
* Called when a track is changed
@ -43,7 +43,7 @@ public interface TrackMutateEvent extends LuckPermsEvent {
*
* @return the track that was mutated
*/
@Nonnull
@NonNull
@Param(0)
Track getTrack();
@ -52,7 +52,7 @@ public interface TrackMutateEvent extends LuckPermsEvent {
*
* @return the data before the change
*/
@Nonnull
@NonNull
@Param(1)
List<String> getDataBefore();
@ -61,7 +61,7 @@ public interface TrackMutateEvent extends LuckPermsEvent {
*
* @return the data after the change
*/
@Nonnull
@NonNull
@Param(2)
List<String> getDataAfter();

View File

@ -27,7 +27,7 @@ package me.lucko.luckperms.api.event.track.mutate;
import me.lucko.luckperms.api.event.Param;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a group is removed from a track
@ -39,7 +39,7 @@ public interface TrackRemoveGroupEvent extends TrackMutateEvent {
*
* @return the group that was removed
*/
@Nonnull
@NonNull
@Param(3)
String getGroup();

View File

@ -30,7 +30,7 @@ import me.lucko.luckperms.api.caching.UserData;
import me.lucko.luckperms.api.event.LuckPermsEvent;
import me.lucko.luckperms.api.event.Param;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a users {@link UserData} is loaded.
@ -42,7 +42,7 @@ public interface UserCacheLoadEvent extends LuckPermsEvent {
*
* @return the user
*/
@Nonnull
@NonNull
@Param(0)
User getUser();
@ -51,7 +51,7 @@ public interface UserCacheLoadEvent extends LuckPermsEvent {
*
* @return the loaded data
*/
@Nonnull
@NonNull
@Param(1)
UserData getLoadedData();

View File

@ -30,7 +30,7 @@ import me.lucko.luckperms.api.caching.UserData;
import me.lucko.luckperms.api.event.LuckPermsEvent;
import me.lucko.luckperms.api.event.Param;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a users cached data is refreshed
@ -42,7 +42,7 @@ public interface UserDataRecalculateEvent extends LuckPermsEvent {
*
* @return the user
*/
@Nonnull
@NonNull
@Param(0)
User getUser();
@ -51,7 +51,7 @@ public interface UserDataRecalculateEvent extends LuckPermsEvent {
*
* @return the data
*/
@Nonnull
@NonNull
@Param(1)
UserData getData();

View File

@ -28,9 +28,9 @@ package me.lucko.luckperms.api.event.user;
import me.lucko.luckperms.api.event.LuckPermsEvent;
import me.lucko.luckperms.api.event.Param;
import java.util.UUID;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnull;
import java.util.UUID;
/**
* Called when the user logs into the network for the first time.
@ -50,7 +50,7 @@ public interface UserFirstLoginEvent extends LuckPermsEvent {
*
* @return the uuid of the user
*/
@Nonnull
@NonNull
@Param(0)
UUID getUuid();
@ -59,7 +59,7 @@ public interface UserFirstLoginEvent extends LuckPermsEvent {
*
* @return the username of the user
*/
@Nonnull
@NonNull
@Param(1)
String getUsername();

View File

@ -29,7 +29,7 @@ import me.lucko.luckperms.api.User;
import me.lucko.luckperms.api.event.LuckPermsEvent;
import me.lucko.luckperms.api.event.Param;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a user is loaded into memory from the storage.
@ -41,7 +41,7 @@ public interface UserLoadEvent extends LuckPermsEvent {
*
* @return the user that was loaded
*/
@Nonnull
@NonNull
@Param(0)
User getUser();

View File

@ -29,9 +29,9 @@ import me.lucko.luckperms.api.User;
import me.lucko.luckperms.api.event.LuckPermsEvent;
import me.lucko.luckperms.api.event.Param;
import java.util.UUID;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnull;
import java.util.UUID;
/**
* Called when LuckPerms has finished processing a certain Player's connection.
@ -52,7 +52,7 @@ public interface UserLoginProcessEvent extends LuckPermsEvent {
*
* @return the uuid of the connection which was processed
*/
@Nonnull
@NonNull
@Param(0)
UUID getUuid();
@ -61,7 +61,7 @@ public interface UserLoginProcessEvent extends LuckPermsEvent {
*
* @return the username of the connection which was processed
*/
@Nonnull
@NonNull
@Param(1)
String getUsername();
@ -70,7 +70,7 @@ public interface UserLoginProcessEvent extends LuckPermsEvent {
*
* @return the user instance
*/
@Nonnull
@NonNull
@Param(2)
User getUser();

View File

@ -25,7 +25,7 @@
package me.lucko.luckperms.api.event.user.track;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a user is demoted down a track.
@ -34,9 +34,8 @@ import javax.annotation.Nonnull;
*/
public interface UserDemoteEvent extends UserTrackEvent {
@Nonnull
@Override
default TrackAction getAction() {
default @NonNull TrackAction getAction() {
return TrackAction.DEMOTION;
}
}

View File

@ -25,7 +25,7 @@
package me.lucko.luckperms.api.event.user.track;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a user is promoted up a track.
@ -34,9 +34,8 @@ import javax.annotation.Nonnull;
*/
public interface UserPromoteEvent extends UserTrackEvent {
@Nonnull
@Override
default TrackAction getAction() {
default @NonNull TrackAction getAction() {
return TrackAction.PROMOTION;
}
}

View File

@ -31,9 +31,9 @@ import me.lucko.luckperms.api.event.LuckPermsEvent;
import me.lucko.luckperms.api.event.Param;
import me.lucko.luckperms.api.event.Sourced;
import java.util.Optional;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnull;
import java.util.Optional;
/**
* Called when a user interacts with a track through a promotion or demotion
@ -45,7 +45,7 @@ public interface UserTrackEvent extends LuckPermsEvent, Sourced {
*
* @return the track involved in the event
*/
@Nonnull
@NonNull
@Param(0)
Track getTrack();
@ -54,7 +54,7 @@ public interface UserTrackEvent extends LuckPermsEvent, Sourced {
*
* @return the user involved in the event
*/
@Nonnull
@NonNull
@Param(1)
User getUser();
@ -63,7 +63,7 @@ public interface UserTrackEvent extends LuckPermsEvent, Sourced {
*
* @return the action performed
*/
@Nonnull
@NonNull
TrackAction getAction();
/**
@ -73,7 +73,7 @@ public interface UserTrackEvent extends LuckPermsEvent, Sourced {
*
* @return the group the user was promoted/demoted from
*/
@Nonnull
@NonNull
@Param(2)
Optional<String> getGroupFrom();
@ -82,7 +82,7 @@ public interface UserTrackEvent extends LuckPermsEvent, Sourced {
*
* @return the group the user was promoted/demoted to
*/
@Nonnull
@NonNull
@Param(3)
Optional<String> getGroupTo();

View File

@ -29,6 +29,9 @@ import me.lucko.luckperms.api.Group;
import me.lucko.luckperms.api.HeldPermission;
import me.lucko.luckperms.api.Storage;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.List;
import java.util.Optional;
import java.util.Set;
@ -36,9 +39,6 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import java.util.function.Consumer;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* Represents the object responsible for managing {@link Group} instances.
*
@ -74,8 +74,8 @@ 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 +95,8 @@ 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 +115,8 @@ 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.
@ -134,8 +134,8 @@ public interface GroupManager {
* @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,7 +149,7 @@ public interface GroupManager {
* @return a future to encapsulate the operation.
* @since 4.1
*/
@Nonnull
@NonNull
CompletableFuture<Void> loadAllGroups();
/**
@ -160,8 +160,8 @@ 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.
@ -171,7 +171,7 @@ public interface GroupManager {
* @throws NullPointerException if the name is null
*/
@Nullable
Group getGroup(@Nonnull String name);
Group getGroup(@NonNull String name);
/**
* Gets a loaded group.
@ -182,8 +182,7 @@ public interface GroupManager {
* @return an optional {@link Group} object
* @throws NullPointerException if the name is null
*/
@Nonnull
default Optional<Group> getGroupOpt(@Nonnull String name) {
default @NonNull Optional<Group> getGroupOpt(@NonNull String name) {
return Optional.ofNullable(getGroup(name));
}
@ -192,7 +191,7 @@ public interface GroupManager {
*
* @return a {@link Set} of {@link Group} objects
*/
@Nonnull
@NonNull
Set<Group> getLoadedGroups();
/**
@ -202,6 +201,6 @@ public interface GroupManager {
* @return true if the group is loaded
* @throws NullPointerException if the name is null
*/
boolean isLoaded(@Nonnull String name);
boolean isLoaded(@NonNull String name);
}

View File

@ -28,15 +28,15 @@ package me.lucko.luckperms.api.manager;
import me.lucko.luckperms.api.Storage;
import me.lucko.luckperms.api.Track;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import java.util.function.Consumer;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* Represents the object responsible for managing {@link Track} instances.
*
@ -72,8 +72,8 @@ 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 +93,8 @@ 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 +113,8 @@ 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.
@ -132,8 +132,8 @@ public interface TrackManager {
* @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,7 +147,7 @@ public interface TrackManager {
* @return a future to encapsulate the operation.
* @since 4.1
*/
@Nonnull
@NonNull
CompletableFuture<Void> loadAllTracks();
/**
@ -158,7 +158,7 @@ public interface TrackManager {
* @throws NullPointerException if the name is null
*/
@Nullable
Track getTrack(@Nonnull String name);
Track getTrack(@NonNull String name);
/**
* Gets a loaded track.
@ -169,8 +169,7 @@ public interface TrackManager {
* @return an optional {@link Track} object
* @throws NullPointerException if the name is null
*/
@Nonnull
default Optional<Track> getTrackOpt(@Nonnull String name) {
default @NonNull Optional<Track> getTrackOpt(@NonNull String name) {
return Optional.ofNullable(getTrack(name));
}
@ -179,7 +178,7 @@ public interface TrackManager {
*
* @return a {@link Set} of {@link Track} objects
*/
@Nonnull
@NonNull
Set<Track> getLoadedTracks();
/**
@ -189,6 +188,6 @@ public interface TrackManager {
* @return true if the track is loaded
* @throws NullPointerException if the name is null
*/
boolean isLoaded(@Nonnull String name);
boolean isLoaded(@NonNull String name);
}

View File

@ -30,6 +30,9 @@ import me.lucko.luckperms.api.PlayerSaveResult;
import me.lucko.luckperms.api.Storage;
import me.lucko.luckperms.api.User;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.List;
import java.util.Optional;
import java.util.Set;
@ -38,9 +41,6 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import java.util.function.Consumer;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* Represents the object responsible for managing {@link User} instances.
*
@ -77,8 +77,8 @@ public interface UserManager {
* @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.
@ -95,8 +95,7 @@ public interface UserManager {
* @throws NullPointerException if the uuid is null
* @since 4.1
*/
@Nonnull
default CompletableFuture<User> loadUser(@Nonnull UUID uuid) {
default @NonNull CompletableFuture<User> loadUser(@NonNull UUID uuid) {
return loadUser(uuid, null);
}
@ -111,8 +110,8 @@ 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.
@ -123,8 +122,8 @@ 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.
@ -143,8 +142,8 @@ 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.
@ -156,8 +155,8 @@ 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.
@ -167,7 +166,7 @@ public interface UserManager {
* @return a set of uuids
* @since 4.2
*/
@Nonnull
@NonNull
CompletableFuture<Set<UUID>> getUniqueUsers();
/**
@ -178,8 +177,8 @@ 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.
@ -189,7 +188,7 @@ public interface UserManager {
* @throws NullPointerException if the uuid is null
*/
@Nullable
User getUser(@Nonnull UUID uuid);
User getUser(@NonNull UUID uuid);
/**
* Gets a loaded user.
@ -198,8 +197,7 @@ public interface UserManager {
* @return an optional {@link User} object
* @throws NullPointerException if the uuid is null
*/
@Nonnull
default Optional<User> getUserOpt(@Nonnull UUID uuid) {
default @NonNull Optional<User> getUserOpt(@NonNull UUID uuid) {
return Optional.ofNullable(getUser(uuid));
}
@ -211,7 +209,7 @@ public interface UserManager {
* @throws NullPointerException if the name is null
*/
@Nullable
User getUser(@Nonnull String name);
User getUser(@NonNull String name);
/**
* Gets a loaded user.
@ -220,8 +218,7 @@ public interface UserManager {
* @return an optional {@link User} object
* @throws NullPointerException if the name is null
*/
@Nonnull
default Optional<User> getUserOpt(@Nonnull String name) {
default @NonNull Optional<User> getUserOpt(@NonNull String name) {
return Optional.ofNullable(getUser(name));
}
@ -230,7 +227,7 @@ public interface UserManager {
*
* @return a {@link Set} of {@link User} objects
*/
@Nonnull
@NonNull
Set<User> getLoadedUsers();
/**
@ -240,7 +237,7 @@ public interface UserManager {
* @return true if the user is loaded
* @throws NullPointerException if the uuid is null
*/
boolean isLoaded(@Nonnull UUID uuid);
boolean isLoaded(@NonNull UUID uuid);
/**
* Unload a user from the internal storage, if they're not currently online.
@ -248,6 +245,6 @@ public interface UserManager {
* @param user the user to unload
* @throws NullPointerException if the user is null
*/
void cleanupUser(@Nonnull User user);
void cleanupUser(@NonNull User user);
}

View File

@ -28,7 +28,7 @@ package me.lucko.luckperms.api.messenger;
import me.lucko.luckperms.api.messenger.message.Message;
import me.lucko.luckperms.api.messenger.message.OutgoingMessage;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Encapsulates the LuckPerms system which accepts incoming {@link Message}s
@ -52,7 +52,7 @@ public interface IncomingMessageConsumer {
* @param message the message
* @return true if the message was accepted by the plugin
*/
boolean consumeIncomingMessage(@Nonnull Message message);
boolean consumeIncomingMessage(@NonNull Message message);
/**
* Consumes a message in an encoded string format.
@ -73,6 +73,6 @@ public interface IncomingMessageConsumer {
* @param encodedString the encoded string
* @return true if the message was accepted by the plugin
*/
boolean consumeIncomingMessageAsString(@Nonnull String encodedString);
boolean consumeIncomingMessageAsString(@NonNull String encodedString);
}

View File

@ -28,7 +28,7 @@ package me.lucko.luckperms.api.messenger;
import me.lucko.luckperms.api.messenger.message.Message;
import me.lucko.luckperms.api.messenger.message.OutgoingMessage;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Represents an object which dispatches {@link OutgoingMessage}s.
@ -52,7 +52,7 @@ public interface Messenger extends AutoCloseable {
*
* @param outgoingMessage the outgoing message
*/
void sendOutgoingMessage(@Nonnull OutgoingMessage outgoingMessage);
void sendOutgoingMessage(@NonNull OutgoingMessage outgoingMessage);
/**
* Performs the necessary action to gracefully shutdown the messenger.

View File

@ -27,7 +27,7 @@ package me.lucko.luckperms.api.messenger;
import me.lucko.luckperms.api.LuckPermsApi;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Represents a provider for {@link Messenger} instances.
@ -45,7 +45,7 @@ public interface MessengerProvider {
*
* @return the provider name
*/
@Nonnull
@NonNull
String getName();
/**
@ -59,7 +59,7 @@ public interface MessengerProvider {
* incoming messages to
* @return a new messenger agent instance
*/
@Nonnull
Messenger obtain(@Nonnull IncomingMessageConsumer incomingMessageConsumer);
@NonNull
Messenger obtain(@NonNull IncomingMessageConsumer incomingMessageConsumer);
}

View File

@ -27,9 +27,9 @@ package me.lucko.luckperms.api.messenger.message;
import me.lucko.luckperms.api.messenger.Messenger;
import java.util.UUID;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnull;
import java.util.UUID;
/**
* Represents a message sent received via a {@link Messenger}.
@ -46,7 +46,7 @@ public interface Message {
*
* @return the id of the message
*/
@Nonnull
@NonNull
UUID getId();
}

View File

@ -27,7 +27,7 @@ package me.lucko.luckperms.api.messenger.message;
import me.lucko.luckperms.api.messenger.IncomingMessageConsumer;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Represents an outgoing {@link Message}.
@ -56,7 +56,7 @@ public interface OutgoingMessage extends Message {
*
* @return an encoded string form of the message
*/
@Nonnull
@NonNull
String asEncodedString();
}

View File

@ -28,7 +28,7 @@ package me.lucko.luckperms.api.messenger.message.type;
import me.lucko.luckperms.api.LogEntry;
import me.lucko.luckperms.api.messenger.message.Message;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Represents an "log" message.
@ -44,7 +44,7 @@ public interface LogMessage extends Message {
*
* @return the log entry
*/
@Nonnull
@NonNull
LogEntry getLogEntry();
}

View File

@ -27,9 +27,9 @@ package me.lucko.luckperms.api.messenger.message.type;
import me.lucko.luckperms.api.messenger.message.Message;
import java.util.UUID;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnull;
import java.util.UUID;
/**
* Represents an "user update" message.
@ -45,7 +45,7 @@ public interface UserUpdateMessage extends Message {
*
* @return the user
*/
@Nonnull
@NonNull
UUID getUser();
}

View File

@ -25,10 +25,9 @@
package me.lucko.luckperms.api.metastacking;
import java.util.List;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnull;
import javax.annotation.concurrent.Immutable;
import java.util.List;
/**
* Represents a meta stack model, consisting of a chain of elements, separated by spacers.
@ -41,7 +40,6 @@ import javax.annotation.concurrent.Immutable;
*
* @since 2.3
*/
@Immutable
public interface MetaStackDefinition {
/**
@ -49,7 +47,7 @@ public interface MetaStackDefinition {
*
* @return the elements in this stack
*/
@Nonnull
@NonNull
List<MetaStackElement> getElements();
/**
@ -57,7 +55,7 @@ public interface MetaStackDefinition {
*
* @return the start spacer
*/
@Nonnull
@NonNull
String getStartSpacer();
/**
@ -65,7 +63,7 @@ public interface MetaStackDefinition {
*
* @return the middle spacer
*/
@Nonnull
@NonNull
String getMiddleSpacer();
/**
@ -73,7 +71,7 @@ public interface MetaStackDefinition {
*
* @return the end spacer
*/
@Nonnull
@NonNull
String getEndSpacer();
}

View File

@ -29,11 +29,10 @@ import me.lucko.luckperms.api.ChatMetaType;
import me.lucko.luckperms.api.LocalizedNode;
import me.lucko.luckperms.api.Node;
import java.util.Map;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
import java.util.Map;
/**
* Represents an element within a {@link MetaStackDefinition}.
@ -42,7 +41,6 @@ import javax.annotation.concurrent.Immutable;
*
* @since 3.2
*/
@Immutable
public interface MetaStackElement {
/**
@ -55,6 +53,6 @@ public interface MetaStackElement {
* @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
*/
boolean shouldAccumulate(@Nonnull LocalizedNode node, @Nonnull ChatMetaType type, @Nullable Map.Entry<Integer, String> current);
boolean shouldAccumulate(@NonNull LocalizedNode node, @NonNull ChatMetaType type, Map.@Nullable Entry<Integer, String> current);
}

View File

@ -25,11 +25,11 @@
package me.lucko.luckperms.api.metastacking;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.List;
import java.util.Optional;
import javax.annotation.Nonnull;
/**
* Factory to create meta stack elements and definitions.
*
@ -43,8 +43,8 @@ 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,8 +54,8 @@ 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.
@ -66,7 +66,7 @@ public interface MetaStackFactory {
* @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);
}

View File

@ -25,11 +25,11 @@
package me.lucko.luckperms.api.nodetype;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import javax.annotation.Nonnull;
/**
* Marks an instance used as a key for a {@link NodeType}.
*
@ -46,8 +46,7 @@ public interface NodeTypeKey<N extends NodeType> {
*
* @return the name of the represented type
*/
@Nonnull
default String getTypeName() {
default @NonNull String getTypeName() {
ParameterizedType thisType = (ParameterizedType) getClass().getGenericSuperclass();
Type nodeType = thisType.getActualTypeArguments()[0];
return ((Class) nodeType).getSimpleName();

View File

@ -29,7 +29,7 @@ import me.lucko.luckperms.api.Node;
import me.lucko.luckperms.api.nodetype.NodeType;
import me.lucko.luckperms.api.nodetype.NodeTypeKey;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* A sub-type of {@link Node} used to mark the display name of the node's holder.
@ -48,7 +48,7 @@ public interface DisplayNameType extends NodeType {
*
* @return the display name
*/
@Nonnull
@NonNull
String getDisplayName();
}

View File

@ -29,7 +29,7 @@ import me.lucko.luckperms.api.Node;
import me.lucko.luckperms.api.nodetype.NodeType;
import me.lucko.luckperms.api.nodetype.NodeTypeKey;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* A sub-type of {@link Node} used to mark that the holder of the node should inherit
@ -51,7 +51,7 @@ public interface InheritanceType extends NodeType {
*
* @return the name of the group
*/
@Nonnull
@NonNull
String getGroupName();
}

View File

@ -29,9 +29,9 @@ import me.lucko.luckperms.api.Node;
import me.lucko.luckperms.api.nodetype.NodeType;
import me.lucko.luckperms.api.nodetype.NodeTypeKey;
import java.util.Map;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnull;
import java.util.Map;
/**
* A sub-type of {@link Node} used to store meta assignments.
@ -50,7 +50,7 @@ public interface MetaType extends NodeType, Map.Entry<String, String> {
*
* @return the meta key
*/
@Nonnull
@NonNull
String getKey();
/**
@ -58,7 +58,7 @@ public interface MetaType extends NodeType, Map.Entry<String, String> {
*
* @return the meta value
*/
@Nonnull
@NonNull
String getValue();
@Override

View File

@ -29,9 +29,9 @@ import me.lucko.luckperms.api.Node;
import me.lucko.luckperms.api.nodetype.NodeType;
import me.lucko.luckperms.api.nodetype.NodeTypeKey;
import java.util.Map;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnull;
import java.util.Map;
/**
* A sub-type of {@link Node} used to store prefix assignments.
@ -57,7 +57,7 @@ public interface PrefixType extends NodeType {
*
* @return the prefix
*/
@Nonnull
@NonNull
String getPrefix();
/**
@ -65,7 +65,6 @@ public interface PrefixType extends NodeType {
*
* @return a map entry representation of the priority and prefix string
*/
@Nonnull
Map.Entry<Integer, String> getAsEntry();
Map.@NonNull Entry<Integer, String> getAsEntry();
}

View File

@ -29,11 +29,11 @@ import me.lucko.luckperms.api.Node;
import me.lucko.luckperms.api.nodetype.NodeType;
import me.lucko.luckperms.api.nodetype.NodeTypeKey;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Optional;
import java.util.regex.Pattern;
import javax.annotation.Nonnull;
/**
* A sub-type of {@link Node} used to store regex permissions.
*
@ -51,7 +51,7 @@ public interface RegexType extends NodeType {
*
* @return the pattern string
*/
@Nonnull
@NonNull
String getPatternString();
/**
@ -61,7 +61,7 @@ public interface RegexType extends NodeType {
*
* @return the pattern
*/
@Nonnull
@NonNull
Optional<Pattern> getPattern();
}

View File

@ -29,9 +29,9 @@ import me.lucko.luckperms.api.Node;
import me.lucko.luckperms.api.nodetype.NodeType;
import me.lucko.luckperms.api.nodetype.NodeTypeKey;
import java.util.Map;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nonnull;
import java.util.Map;
/**
* A sub-type of {@link Node} used to store suffix assignments.
@ -57,7 +57,7 @@ public interface SuffixType extends NodeType {
*
* @return the suffix
*/
@Nonnull
@NonNull
String getSuffix();
/**
@ -65,7 +65,6 @@ public interface SuffixType extends NodeType {
*
* @return a map entry representation of the priority and suffix string
*/
@Nonnull
Map.Entry<Integer, String> getAsEntry();
Map.@NonNull Entry<Integer, String> getAsEntry();
}

View File

@ -25,11 +25,11 @@
package me.lucko.luckperms.api.platform;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Set;
import java.util.UUID;
import javax.annotation.Nonnull;
/**
* Provides information about the platform LuckPerms is running on.
*
@ -42,7 +42,7 @@ public interface PlatformInfo {
*
* @return the version of the plugin running on the platform
*/
@Nonnull
@NonNull
String getVersion();
/**
@ -57,7 +57,7 @@ public interface PlatformInfo {
*
* @return the type of platform LuckPerms is running on
*/
@Nonnull
@NonNull
PlatformType getType();
/**
@ -65,7 +65,7 @@ public interface PlatformInfo {
*
* @return the unique connections
*/
@Nonnull
@NonNull
Set<UUID> getUniqueConnections();
/**

View File

@ -25,7 +25,7 @@
package me.lucko.luckperms.api.platform;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Represents a type of platform which LuckPerms can run on.
@ -51,8 +51,7 @@ public enum PlatformType {
*
* @return a readable name
*/
@Nonnull
public String getFriendlyName() {
public @NonNull String getFriendlyName() {
return this.friendlyName;
}
}

View File

@ -32,8 +32,7 @@ import me.lucko.luckperms.common.config.ConfigKeys;
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
import org.bukkit.entity.Player;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
public class WorldCalculator implements ContextCalculator<Player> {
private final LuckPermsPlugin plugin;
@ -42,9 +41,8 @@ public class WorldCalculator implements ContextCalculator<Player> {
this.plugin = plugin;
}
@Nonnull
@Override
public MutableContextSet giveApplicableContext(@Nonnull Player subject, @Nonnull MutableContextSet accumulator) {
public @NonNull MutableContextSet giveApplicableContext(@NonNull Player subject, @NonNull MutableContextSet accumulator) {
String world = subject.getWorld().getName().toLowerCase();
while (!accumulator.has(Contexts.WORLD_KEY, world)) {
accumulator.add(Contexts.WORLD_KEY, world);

Some files were not shown because too many files have changed in this diff Show More