Add some more annotations to mark API methods

This commit is contained in:
Luck 2021-01-19 14:29:49 +00:00
parent 0a92597767
commit f9030825fd
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
45 changed files with 143 additions and 90 deletions

View File

@ -48,6 +48,7 @@ import net.luckperms.api.track.Track;
import net.luckperms.api.track.TrackManager; import net.luckperms.api.track.TrackManager;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus.Internal;
import java.util.Optional; import java.util.Optional;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -131,6 +132,7 @@ public interface LuckPerms {
* <li>{@code org.bukkit.entity.Player}</li> * <li>{@code org.bukkit.entity.Player}</li>
* <li>{@code net.md_5.bungee.api.connection.ProxiedPlayer}</li> * <li>{@code net.md_5.bungee.api.connection.ProxiedPlayer}</li>
* <li>{@code org.spongepowered.api/entity.living.player.Player}</li> * <li>{@code org.spongepowered.api/entity.living.player.Player}</li>
* <li>{@code net.minecraft.server.network.ServerPlayerEntity} (Fabric)</li>
* <li>{@code cn.nukkit.Player}</li> * <li>{@code cn.nukkit.Player}</li>
* <li>{@code com.velocitypowered.api.proxy.Player}</li> * <li>{@code com.velocitypowered.api.proxy.Player}</li>
* </ul> * </ul>
@ -194,21 +196,6 @@ public interface LuckPerms {
*/ */
@NonNull ContextManager getContextManager(); @NonNull ContextManager getContextManager();
/**
* Gets the {@link NodeBuilderRegistry}.
*
* @return the node builder registry
*/
@NonNull NodeBuilderRegistry getNodeBuilderRegistry();
/**
* Gets the {@link QueryOptionsRegistry}.
*
* @return the query options registry
* @since 5.1
*/
@NonNull QueryOptionsRegistry getQueryOptionsRegistry();
/** /**
* Gets the {@link MetaStackFactory}. * Gets the {@link MetaStackFactory}.
* *
@ -220,14 +207,6 @@ public interface LuckPerms {
*/ */
@NonNull MetaStackFactory getMetaStackFactory(); @NonNull MetaStackFactory getMetaStackFactory();
/**
* Gets the {@link NodeMatcherFactory}.
*
* @return the node matcher factory
* @since 5.1
*/
@NonNull NodeMatcherFactory getNodeMatcherFactory();
/** /**
* Schedules the execution of an update task, and returns an encapsulation * Schedules the execution of an update task, and returns an encapsulation
* of the task as a {@link CompletableFuture}. * of the task as a {@link CompletableFuture}.
@ -251,4 +230,30 @@ public interface LuckPerms {
*/ */
void registerMessengerProvider(@NonNull MessengerProvider messengerProvider); void registerMessengerProvider(@NonNull MessengerProvider messengerProvider);
/**
* Gets the {@link NodeBuilderRegistry}.
*
* @return the node builder registry
*/
@Internal
@NonNull NodeBuilderRegistry getNodeBuilderRegistry();
/**
* Gets the {@link QueryOptionsRegistry}.
*
* @return the query options registry
* @since 5.1
*/
@Internal
@NonNull QueryOptionsRegistry getQueryOptionsRegistry();
/**
* Gets the {@link NodeMatcherFactory}.
*
* @return the node matcher factory
* @since 5.1
*/
@Internal
@NonNull NodeMatcherFactory getNodeMatcherFactory();
} }

View File

@ -26,6 +26,7 @@
package net.luckperms.api.actionlog; package net.luckperms.api.actionlog;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.Unmodifiable;
import java.util.SortedSet; import java.util.SortedSet;
import java.util.UUID; import java.util.UUID;
@ -47,7 +48,7 @@ public interface ActionLog {
* *
* @return the content * @return the content
*/ */
@NonNull SortedSet<Action> getContent(); @NonNull @Unmodifiable SortedSet<Action> getContent();
/** /**
* Gets the entries in the log performed by the given actor. * Gets the entries in the log performed by the given actor.
@ -55,7 +56,7 @@ public interface ActionLog {
* @param actor the uuid of the actor to filter by * @param actor the uuid of the actor to filter by
* @return the content for the given actor * @return the content for the given actor
*/ */
@NonNull SortedSet<Action> getContent(@NonNull UUID actor); @NonNull @Unmodifiable SortedSet<Action> getContent(@NonNull UUID actor);
/** /**
* Gets the log content for a given user * Gets the log content for a given user
@ -63,7 +64,7 @@ public interface ActionLog {
* @param uniqueId the uuid to filter by * @param uniqueId the uuid to filter by
* @return all content in this log where the user = uuid * @return all content in this log where the user = uuid
*/ */
@NonNull SortedSet<Action> getUserHistory(@NonNull UUID uniqueId); @NonNull @Unmodifiable SortedSet<Action> getUserHistory(@NonNull UUID uniqueId);
/** /**
* Gets the log content for a given group * Gets the log content for a given group
@ -71,7 +72,7 @@ public interface ActionLog {
* @param name the name to filter by * @param name the name to filter by
* @return all content in this log where the group = name * @return all content in this log where the group = name
*/ */
@NonNull SortedSet<Action> getGroupHistory(@NonNull String name); @NonNull @Unmodifiable SortedSet<Action> getGroupHistory(@NonNull String name);
/** /**
* Gets the log content for a given track * Gets the log content for a given track
@ -79,6 +80,6 @@ public interface ActionLog {
* @param name the name to filter by * @param name the name to filter by
* @return all content in this log where the track = name * @return all content in this log where the track = name
*/ */
@NonNull SortedSet<Action> getTrackHistory(@NonNull String name); @NonNull @Unmodifiable SortedSet<Action> getTrackHistory(@NonNull String name);
} }

View File

@ -29,6 +29,7 @@ import net.luckperms.api.metastacking.MetaStackDefinition;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import org.jetbrains.annotations.Unmodifiable;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -66,7 +67,7 @@ public interface CachedMetaData extends CachedData {
* *
* @return an immutable map of meta * @return an immutable map of meta
*/ */
@NonNull Map<String, List<String>> getMeta(); @NonNull @Unmodifiable Map<String, List<String>> getMeta();
/** /**
* Gets an immutable sorted map of all of the prefixes the holder has, whereby the first * Gets an immutable sorted map of all of the prefixes the holder has, whereby the first
@ -74,7 +75,7 @@ public interface CachedMetaData extends CachedData {
* *
* @return a sorted map of prefixes * @return a sorted map of prefixes
*/ */
@NonNull SortedMap<Integer, String> getPrefixes(); @NonNull @Unmodifiable SortedMap<Integer, String> getPrefixes();
/** /**
* Gets an immutable sorted map of all of the suffixes the holder has, whereby the first * Gets an immutable sorted map of all of the suffixes the holder has, whereby the first
@ -82,7 +83,7 @@ public interface CachedMetaData extends CachedData {
* *
* @return a sorted map of suffixes * @return a sorted map of suffixes
*/ */
@NonNull SortedMap<Integer, String> getSuffixes(); @NonNull @Unmodifiable SortedMap<Integer, String> getSuffixes();
/** /**
* Gets the name of the holders primary group. * Gets the name of the holders primary group.

View File

@ -28,6 +28,7 @@ package net.luckperms.api.cacheddata;
import net.luckperms.api.util.Tristate; import net.luckperms.api.util.Tristate;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.Unmodifiable;
import java.util.Map; import java.util.Map;
@ -57,6 +58,6 @@ public interface CachedPermissionData extends CachedData {
* *
* @return an immutable set of permissions * @return an immutable set of permissions
*/ */
@NonNull Map<String, Boolean> getPermissionMap(); @NonNull @Unmodifiable Map<String, Boolean> getPermissionMap();
} }

View File

@ -30,6 +30,7 @@ import net.luckperms.api.query.QueryMode;
import net.luckperms.api.query.QueryOptions; import net.luckperms.api.query.QueryOptions;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus.Internal;
import java.util.Optional; import java.util.Optional;
@ -48,6 +49,7 @@ import java.util.Optional;
* <li>{@code org.bukkit.entity.Player}</li> * <li>{@code org.bukkit.entity.Player}</li>
* <li>{@code net.md_5.bungee.api.connection.ProxiedPlayer}</li> * <li>{@code net.md_5.bungee.api.connection.ProxiedPlayer}</li>
* <li>{@code org.spongepowered.api.service.permission.Subject}</li> * <li>{@code org.spongepowered.api.service.permission.Subject}</li>
* <li>{@code net.minecraft.server.network.ServerPlayerEntity} (Fabric)</li>
* <li>{@code cn.nukkit.Player}</li> * <li>{@code cn.nukkit.Player}</li>
* <li>{@code com.velocitypowered.api.proxy.Player}</li> * <li>{@code com.velocitypowered.api.proxy.Player}</li>
* </ul> * </ul>
@ -156,6 +158,7 @@ public interface ContextManager {
* *
* @return the context set factory * @return the context set factory
*/ */
@Internal
@NonNull ContextSetFactory getContextSetFactory(); @NonNull ContextSetFactory getContextSetFactory();
/** /**

View File

@ -26,6 +26,7 @@
package net.luckperms.api.context; package net.luckperms.api.context;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.Unmodifiable;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
@ -111,7 +112,7 @@ public interface ContextSet extends Iterable<Context> {
* *
* @return an immutable set * @return an immutable set
*/ */
@NonNull Set<Context> toSet(); @NonNull @Unmodifiable Set<Context> toSet();
/** /**
* Returns a {@link Map} representing the current state of this * Returns a {@link Map} representing the current state of this
@ -122,7 +123,7 @@ public interface ContextSet extends Iterable<Context> {
* *
* @return a map * @return a map
*/ */
@NonNull Map<String, Set<String>> toMap(); @NonNull @Unmodifiable Map<String, Set<String>> toMap();
/** /**
* Returns a {@link Map} <b>loosely</b> representing the current state of * Returns a {@link Map} <b>loosely</b> representing the current state of
@ -138,7 +139,7 @@ public interface ContextSet extends Iterable<Context> {
* @deprecated because the resultant map may not contain all data in the ContextSet * @deprecated because the resultant map may not contain all data in the ContextSet
*/ */
@Deprecated @Deprecated
@NonNull Map<String, String> toFlattenedMap(); @NonNull @Unmodifiable Map<String, String> toFlattenedMap();
/** /**
* Returns an {@link Iterator} over each of the context pairs in this set. * Returns an {@link Iterator} over each of the context pairs in this set.
@ -151,7 +152,7 @@ public interface ContextSet extends Iterable<Context> {
* @return an iterator * @return an iterator
*/ */
@Override @Override
@NonNull Iterator<Context> iterator(); @NonNull @Unmodifiable Iterator<Context> iterator();
/** /**
* Returns if the {@link ContextSet} contains at least one value for the * Returns if the {@link ContextSet} contains at least one value for the
@ -173,7 +174,7 @@ public interface ContextSet extends Iterable<Context> {
* @return a set of values * @return a set of values
* @throws NullPointerException if the key is null * @throws NullPointerException if the key is null
*/ */
@NonNull Set<String> getValues(@NonNull String key); @NonNull @Unmodifiable Set<String> getValues(@NonNull String key);
/** /**
* Returns any value from this {@link ContextSet} matching the key, if present. * Returns any value from this {@link ContextSet} matching the key, if present.

View File

@ -26,10 +26,12 @@
package net.luckperms.api.context; package net.luckperms.api.context;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus.Internal;
/** /**
* A factory for creating {@link ContextSet}s. * A factory for creating {@link ContextSet}s.
*/ */
@Internal
public interface ContextSetFactory { public interface ContextSetFactory {
ImmutableContextSet.@NonNull Builder immutableBuilder(); ImmutableContextSet.@NonNull Builder immutableBuilder();

View File

@ -26,6 +26,7 @@
package net.luckperms.api.event; package net.luckperms.api.event;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.Unmodifiable;
import java.util.Set; import java.util.Set;
import java.util.function.Consumer; import java.util.function.Consumer;
@ -49,7 +50,7 @@ public interface EventBus {
* @param <T> the event class * @param <T> the event class
* @return an event handler instance representing this subscription * @return an event handler instance representing this subscription
*/ */
@NonNull <T extends LuckPermsEvent> EventSubscription<T> subscribe(@NonNull Class<T> eventClass, @NonNull Consumer<? super T> handler); <T extends LuckPermsEvent> @NonNull EventSubscription<T> subscribe(@NonNull Class<T> eventClass, @NonNull Consumer<? super T> handler);
/** /**
* Registers a new subscription to the given event. * Registers a new subscription to the given event.
@ -69,7 +70,7 @@ public interface EventBus {
* @param handler the event handler * @param handler the event handler
* @return an event handler instance representing this subscription * @return an event handler instance representing this subscription
*/ */
@NonNull <T extends LuckPermsEvent> EventSubscription<T> subscribe(Object plugin, @NonNull Class<T> eventClass, @NonNull Consumer<? super T> handler); <T extends LuckPermsEvent> @NonNull EventSubscription<T> subscribe(Object plugin, @NonNull Class<T> eventClass, @NonNull Consumer<? super T> handler);
/** /**
* Gets a set of all registered handlers for a given event. * Gets a set of all registered handlers for a given event.
@ -78,6 +79,6 @@ public interface EventBus {
* @param <T> the event class * @param <T> the event class
* @return an immutable set of event handlers * @return an immutable set of event handlers
*/ */
@NonNull <T extends LuckPermsEvent> Set<EventSubscription<T>> getSubscriptions(@NonNull Class<T> eventClass); <T extends LuckPermsEvent> @NonNull @Unmodifiable Set<EventSubscription<T>> getSubscriptions(@NonNull Class<T> eventClass);
} }

View File

@ -29,6 +29,7 @@ import net.luckperms.api.event.util.Param;
import net.luckperms.api.node.Node; import net.luckperms.api.node.Node;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.Unmodifiable;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
@ -48,7 +49,7 @@ public interface NodeAddEvent extends NodeMutateEvent {
@NonNull Node getNode(); @NonNull Node getNode();
@Override @Override
default @NonNull Set<Node> getDataBefore() { default @NonNull @Unmodifiable Set<Node> getDataBefore() {
// Get data after, then reverse the action // Get data after, then reverse the action
Set<Node> nodes = new HashSet<>(this.getDataAfter()); Set<Node> nodes = new HashSet<>(this.getDataAfter());
nodes.remove(this.getNode()); nodes.remove(this.getNode());

View File

@ -29,6 +29,7 @@ import net.luckperms.api.event.util.Param;
import net.luckperms.api.node.Node; import net.luckperms.api.node.Node;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.Unmodifiable;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
@ -46,10 +47,10 @@ public interface NodeClearEvent extends NodeMutateEvent {
* @since 5.3 * @since 5.3
*/ */
@Param(3) @Param(3)
@NonNull Set<Node> getNodes(); @NonNull @Unmodifiable Set<Node> getNodes();
@Override @Override
default @NonNull Set<Node> getDataBefore() { default @NonNull @Unmodifiable Set<Node> getDataBefore() {
// Get data after, then reverse the action // Get data after, then reverse the action
Set<Node> nodes = new HashSet<>(this.getDataAfter()); Set<Node> nodes = new HashSet<>(this.getDataAfter());
nodes.addAll(this.getNodes()); nodes.addAll(this.getNodes());

View File

@ -34,6 +34,7 @@ import net.luckperms.api.model.user.User;
import net.luckperms.api.node.Node; import net.luckperms.api.node.Node;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.Unmodifiable;
import java.util.Set; import java.util.Set;
@ -63,7 +64,7 @@ public interface NodeMutateEvent extends LuckPermsEvent {
* *
* @return the data before the change * @return the data before the change
*/ */
@NonNull Set<Node> getDataBefore(); @NonNull @Unmodifiable Set<Node> getDataBefore();
/** /**
* Gets an immutable copy of the holders data after the change * Gets an immutable copy of the holders data after the change
@ -71,7 +72,7 @@ public interface NodeMutateEvent extends LuckPermsEvent {
* @return the data after the change * @return the data after the change
*/ */
@Param(2) @Param(2)
@NonNull Set<Node> getDataAfter(); @NonNull @Unmodifiable Set<Node> getDataAfter();
/** /**
* Gets whether the target of this event is a {@link User} * Gets whether the target of this event is a {@link User}

View File

@ -29,6 +29,7 @@ import net.luckperms.api.event.util.Param;
import net.luckperms.api.node.Node; import net.luckperms.api.node.Node;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.Unmodifiable;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
@ -48,7 +49,7 @@ public interface NodeRemoveEvent extends NodeMutateEvent {
@NonNull Node getNode(); @NonNull Node getNode();
@Override @Override
default @NonNull Set<Node> getDataBefore() { default @NonNull @Unmodifiable Set<Node> getDataBefore() {
// Get data after, then reverse the action // Get data after, then reverse the action
Set<Node> nodes = new HashSet<>(this.getDataAfter()); Set<Node> nodes = new HashSet<>(this.getDataAfter());
nodes.add(this.getNode()); nodes.add(this.getNode());

View File

@ -30,6 +30,7 @@ import net.luckperms.api.event.util.Param;
import net.luckperms.api.track.Track; import net.luckperms.api.track.Track;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.Unmodifiable;
import java.util.List; import java.util.List;
@ -52,7 +53,7 @@ public interface TrackMutateEvent extends LuckPermsEvent {
* @return the data before the change * @return the data before the change
*/ */
@Param(1) @Param(1)
@NonNull List<String> getStateBefore(); @NonNull @Unmodifiable List<String> getStateBefore();
/** /**
* Gets an immutable copy of the tracks data after the change * Gets an immutable copy of the tracks data after the change
@ -60,6 +61,6 @@ public interface TrackMutateEvent extends LuckPermsEvent {
* @return the data after the change * @return the data after the change
*/ */
@Param(2) @Param(2)
@NonNull List<String> getStateAfter(); @NonNull @Unmodifiable List<String> getStateAfter();
} }

View File

@ -26,6 +26,7 @@
package net.luckperms.api.extension; package net.luckperms.api.extension;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.Unmodifiable;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Path; import java.nio.file.Path;
@ -57,6 +58,6 @@ public interface ExtensionManager {
* *
* @return the loaded extensions * @return the loaded extensions
*/ */
@NonNull Collection<Extension> getLoadedExtensions(); @NonNull @Unmodifiable Collection<Extension> getLoadedExtensions();
} }

View File

@ -29,11 +29,13 @@ import net.luckperms.api.messenger.message.Message;
import net.luckperms.api.messenger.message.OutgoingMessage; import net.luckperms.api.messenger.message.OutgoingMessage;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus.NonExtendable;
/** /**
* Encapsulates the LuckPerms system which accepts incoming {@link Message}s * Encapsulates the LuckPerms system which accepts incoming {@link Message}s
* from implementations of {@link Messenger}. * from implementations of {@link Messenger}.
*/ */
@NonExtendable
public interface IncomingMessageConsumer { public interface IncomingMessageConsumer {
/** /**

View File

@ -29,10 +29,12 @@ import net.luckperms.api.messenger.message.Message;
import net.luckperms.api.messenger.message.OutgoingMessage; import net.luckperms.api.messenger.message.OutgoingMessage;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus.OverrideOnly;
/** /**
* Represents an object which dispatches {@link OutgoingMessage}s. * Represents an object which dispatches {@link OutgoingMessage}s.
*/ */
@OverrideOnly
public interface Messenger extends AutoCloseable { public interface Messenger extends AutoCloseable {
/** /**

View File

@ -28,6 +28,7 @@ package net.luckperms.api.messenger;
import net.luckperms.api.LuckPerms; import net.luckperms.api.LuckPerms;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus.OverrideOnly;
/** /**
* Represents a provider for {@link Messenger} instances. * Represents a provider for {@link Messenger} instances.
@ -37,6 +38,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
* *
* @see LuckPerms#registerMessengerProvider(MessengerProvider) * @see LuckPerms#registerMessengerProvider(MessengerProvider)
*/ */
@OverrideOnly
public interface MessengerProvider { public interface MessengerProvider {
/** /**

View File

@ -28,12 +28,14 @@ package net.luckperms.api.messenger.message;
import net.luckperms.api.messenger.Messenger; import net.luckperms.api.messenger.Messenger;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus.NonExtendable;
import java.util.UUID; import java.util.UUID;
/** /**
* Represents a message sent received via a {@link Messenger}. * Represents a message sent received via a {@link Messenger}.
*/ */
@NonExtendable
public interface Message { public interface Message {
/** /**

View File

@ -28,6 +28,7 @@ package net.luckperms.api.metastacking;
import net.luckperms.api.query.OptionKey; import net.luckperms.api.query.OptionKey;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.Unmodifiable;
import java.util.List; import java.util.List;
@ -57,7 +58,7 @@ public interface MetaStackDefinition {
* *
* @return the elements in this stack * @return the elements in this stack
*/ */
@NonNull List<MetaStackElement> getElements(); @NonNull @Unmodifiable List<MetaStackElement> getElements();
/** /**
* Gets the duplicate removal function, applied to the entries before * Gets the duplicate removal function, applied to the entries before

View File

@ -26,6 +26,7 @@
package net.luckperms.api.metastacking; package net.luckperms.api.metastacking;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.Unmodifiable;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
@ -51,7 +52,7 @@ public interface MetaStackFactory {
* @param definitions the definition strings * @param definitions the definition strings
* @return a list of parsed elements * @return a list of parsed elements
*/ */
@NonNull List<MetaStackElement> fromStrings(@NonNull List<String> definitions); @NonNull @Unmodifiable List<MetaStackElement> fromStrings(@NonNull List<String> definitions);
/** /**
* Creates a new {@link MetaStackDefinition} with the given properties. * Creates a new {@link MetaStackDefinition} with the given properties.

View File

@ -37,6 +37,7 @@ import net.luckperms.api.query.Flag;
import net.luckperms.api.query.QueryOptions; import net.luckperms.api.query.QueryOptions;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.Unmodifiable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -186,7 +187,7 @@ public interface PermissionHolder {
* *
* @return a collection of the holders own nodes. * @return a collection of the holders own nodes.
*/ */
default @NonNull Collection<Node> getNodes() { default @NonNull @Unmodifiable Collection<Node> getNodes() {
/* This default method is overridden in the implementation, and is just here /* This default method is overridden in the implementation, and is just here
to demonstrate what this method does in the API sources. */ to demonstrate what this method does in the API sources. */
List<Node> nodes = new ArrayList<>(); List<Node> nodes = new ArrayList<>();
@ -204,7 +205,7 @@ public interface PermissionHolder {
* @see #getNodes() * @see #getNodes()
* @since 5.1 * @since 5.1
*/ */
default <T extends Node> @NonNull Collection<T> getNodes(@NonNull NodeType<T> type) { default <T extends Node> @NonNull @Unmodifiable Collection<T> getNodes(@NonNull NodeType<T> type) {
/* This default method is overridden in the implementation, and is just here /* This default method is overridden in the implementation, and is just here
to demonstrate what this method does in the API sources. */ to demonstrate what this method does in the API sources. */
return getNodes().stream() return getNodes().stream()
@ -223,7 +224,7 @@ public interface PermissionHolder {
* *
* @return a sorted set of the holders own distinct nodes * @return a sorted set of the holders own distinct nodes
*/ */
@NonNull SortedSet<Node> getDistinctNodes(); @NonNull @Unmodifiable SortedSet<Node> getDistinctNodes();
/** /**
* Gets a resolved view of the holders own and inherited {@link Node}s. * Gets a resolved view of the holders own and inherited {@link Node}s.
@ -240,7 +241,7 @@ public interface PermissionHolder {
* @param queryOptions the query options * @param queryOptions the query options
* @return a list of the holders inherited nodes * @return a list of the holders inherited nodes
*/ */
@NonNull Collection<Node> resolveInheritedNodes(@NonNull QueryOptions queryOptions); @NonNull @Unmodifiable Collection<Node> resolveInheritedNodes(@NonNull QueryOptions queryOptions);
/** /**
* Gets a resolved view of the holders own and inherited {@link Node}s of a given {@code type}. * Gets a resolved view of the holders own and inherited {@link Node}s of a given {@code type}.
@ -252,7 +253,7 @@ public interface PermissionHolder {
* @see #resolveInheritedNodes(QueryOptions) * @see #resolveInheritedNodes(QueryOptions)
* @since 5.1 * @since 5.1
*/ */
default <T extends Node> @NonNull Collection<T> resolveInheritedNodes(@NonNull NodeType<T> type, @NonNull QueryOptions queryOptions) { default <T extends Node> @NonNull @Unmodifiable Collection<T> resolveInheritedNodes(@NonNull NodeType<T> type, @NonNull QueryOptions queryOptions) {
/* This default method is overridden in the implementation, and is just here /* This default method is overridden in the implementation, and is just here
to demonstrate what this method does in the API sources. */ to demonstrate what this method does in the API sources. */
return resolveInheritedNodes(queryOptions).stream() return resolveInheritedNodes(queryOptions).stream()
@ -275,7 +276,7 @@ public interface PermissionHolder {
* @param queryOptions the query options * @param queryOptions the query options
* @return a sorted set of the holders distinct inherited nodes * @return a sorted set of the holders distinct inherited nodes
*/ */
@NonNull SortedSet<Node> resolveDistinctInheritedNodes(@NonNull QueryOptions queryOptions); @NonNull @Unmodifiable SortedSet<Node> resolveDistinctInheritedNodes(@NonNull QueryOptions queryOptions);
/** /**
* Gets a collection of the {@link Group}s this holder inherits nodes from. * Gets a collection of the {@link Group}s this holder inherits nodes from.
@ -296,7 +297,7 @@ public interface PermissionHolder {
* @return a collection of the groups the holder inherits from * @return a collection of the groups the holder inherits from
* @since 5.1 * @since 5.1
*/ */
@NonNull Collection<Group> getInheritedGroups(@NonNull QueryOptions queryOptions); @NonNull @Unmodifiable Collection<Group> getInheritedGroups(@NonNull QueryOptions queryOptions);
/** /**
* Removes any temporary permissions that have expired. * Removes any temporary permissions that have expired.

View File

@ -29,6 +29,7 @@ import net.luckperms.api.model.user.UserManager;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import org.jetbrains.annotations.Unmodifiable;
import java.util.Objects; import java.util.Objects;
import java.util.Set; import java.util.Set;
@ -47,7 +48,7 @@ public interface PlayerSaveResult {
* *
* @return the status * @return the status
*/ */
@NonNull Set<Outcome> getOutcomes(); @NonNull @Unmodifiable Set<Outcome> getOutcomes();
/** /**
* Gets if the result includes a certain outcome. * Gets if the result includes a certain outcome.
@ -80,7 +81,7 @@ public interface PlayerSaveResult {
* @return the other uuids * @return the other uuids
* @see Outcome#OTHER_UNIQUE_IDS_PRESENT_FOR_USERNAME * @see Outcome#OTHER_UNIQUE_IDS_PRESENT_FOR_USERNAME
*/ */
@Nullable Set<UUID> getOtherUniqueIds(); @Nullable @Unmodifiable Set<UUID> getOtherUniqueIds();
/** /**
* The various states the result can take * The various states the result can take

View File

@ -37,6 +37,7 @@ import net.luckperms.api.node.NodeEqualityPredicate;
import net.luckperms.api.util.Tristate; import net.luckperms.api.util.Tristate;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.Unmodifiable;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;
@ -65,7 +66,7 @@ public interface NodeMap {
* *
* @return a map of nodes * @return a map of nodes
*/ */
@NonNull Map<ImmutableContextSet, Collection<Node>> toMap(); @NonNull @Unmodifiable Map<ImmutableContextSet, Collection<Node>> toMap();
/** /**
* Gets a flattened view of {@link Node}s contained within this instance. * Gets a flattened view of {@link Node}s contained within this instance.
@ -75,7 +76,7 @@ public interface NodeMap {
* *
* @return a flattened collection of nodes * @return a flattened collection of nodes
*/ */
@NonNull Collection<Node> toCollection(); @NonNull @Unmodifiable Collection<Node> toCollection();
/** /**
* Gets if this instance contains a given {@link Node}. * Gets if this instance contains a given {@link Node}.

View File

@ -31,6 +31,7 @@ import net.luckperms.api.node.matcher.NodeMatcher;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import org.jetbrains.annotations.Unmodifiable;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
@ -138,7 +139,7 @@ public interface GroupManager {
* @return the entries which matched * @return the entries which matched
* @since 5.1 * @since 5.1
*/ */
@NonNull <T extends Node> CompletableFuture<Map<String, Collection<T>>> searchAll(@NonNull NodeMatcher<? extends T> matcher); <T extends Node> @NonNull CompletableFuture<@Unmodifiable Map<String, Collection<T>>> searchAll(@NonNull NodeMatcher<? extends T> matcher);
/** /**
* Searches for a list of groups with a given permission. * Searches for a list of groups with a given permission.
@ -149,7 +150,7 @@ public interface GroupManager {
* @deprecated use {@link #searchAll(NodeMatcher)} * @deprecated use {@link #searchAll(NodeMatcher)}
*/ */
@Deprecated @Deprecated
@NonNull CompletableFuture<List<HeldNode<String>>> getWithPermission(@NonNull String permission); @NonNull CompletableFuture<@Unmodifiable List<HeldNode<String>>> getWithPermission(@NonNull String permission);
/** /**
* Gets a loaded group. * Gets a loaded group.
@ -165,7 +166,7 @@ public interface GroupManager {
* *
* @return a {@link Set} of {@link Group} objects * @return a {@link Set} of {@link Group} objects
*/ */
@NonNull Set<Group> getLoadedGroups(); @NonNull @Unmodifiable Set<Group> getLoadedGroups();
/** /**
* Check if a group is loaded in memory * Check if a group is loaded in memory

View File

@ -32,6 +32,7 @@ import net.luckperms.api.node.matcher.NodeMatcher;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import org.jetbrains.annotations.Unmodifiable;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
@ -165,7 +166,7 @@ public interface UserManager {
* *
* @return a set of uuids * @return a set of uuids
*/ */
@NonNull CompletableFuture<Set<UUID>> getUniqueUsers(); @NonNull CompletableFuture<@Unmodifiable Set<UUID>> getUniqueUsers();
/** /**
* Searches the {@link User#data() normal node maps} of all known {@link User}s for {@link Node} * Searches the {@link User#data() normal node maps} of all known {@link User}s for {@link Node}
@ -175,7 +176,7 @@ public interface UserManager {
* @return the entries which matched * @return the entries which matched
* @since 5.1 * @since 5.1
*/ */
@NonNull <T extends Node> CompletableFuture<Map<UUID, Collection<T>>> searchAll(@NonNull NodeMatcher<? extends T> matcher); <T extends Node> @NonNull CompletableFuture<@Unmodifiable Map<UUID, Collection<T>>> searchAll(@NonNull NodeMatcher<? extends T> matcher);
/** /**
* Searches for a list of users with a given permission. * Searches for a list of users with a given permission.
@ -186,7 +187,7 @@ public interface UserManager {
* @deprecated use {@link #searchAll(NodeMatcher)} * @deprecated use {@link #searchAll(NodeMatcher)}
*/ */
@Deprecated @Deprecated
@NonNull CompletableFuture<List<HeldNode<UUID>>> getWithPermission(@NonNull String permission); @NonNull CompletableFuture<@Unmodifiable List<HeldNode<UUID>>> getWithPermission(@NonNull String permission);
/** /**
* Gets a loaded user. * Gets a loaded user.
@ -211,7 +212,7 @@ public interface UserManager {
* *
* @return a {@link Set} of {@link User} objects * @return a {@link Set} of {@link User} objects
*/ */
@NonNull Set<User> getLoadedUsers(); @NonNull @Unmodifiable Set<User> getLoadedUsers();
/** /**
* Check if a user is loaded in memory * Check if a user is loaded in memory

View File

@ -40,6 +40,7 @@ import net.luckperms.api.node.types.WeightNode;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import org.jetbrains.annotations.ApiStatus.NonExtendable; import org.jetbrains.annotations.ApiStatus.NonExtendable;
import org.jetbrains.annotations.Unmodifiable;
import java.time.Duration; import java.time.Duration;
import java.time.Instant; import java.time.Instant;
@ -153,7 +154,7 @@ public interface Node {
* *
* @return a list of full nodes * @return a list of full nodes
*/ */
@NonNull Collection<String> resolveShorthand(); @NonNull @Unmodifiable Collection<String> resolveShorthand();
/** /**
* Gets if this node is assigned temporarily. * Gets if this node is assigned temporarily.

View File

@ -30,6 +30,7 @@ import net.luckperms.api.node.metadata.NodeMetadataKey;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import org.jetbrains.annotations.ApiStatus.NonExtendable;
import java.time.Duration; import java.time.Duration;
import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalAccessor;
@ -43,6 +44,7 @@ import java.util.concurrent.TimeUnit;
* @param <N> the node type * @param <N> the node type
* @param <B> the node builder type * @param <B> the node builder type
*/ */
@NonExtendable
public interface NodeBuilder<N extends ScopedNode<N, B>, B extends NodeBuilder<N, B>> { public interface NodeBuilder<N extends ScopedNode<N, B>, B extends NodeBuilder<N, B>> {
/** /**
@ -161,7 +163,7 @@ public interface NodeBuilder<N extends ScopedNode<N, B>, B extends NodeBuilder<N
* @param <T> the metadata type * @param <T> the metadata type
* @return the builder * @return the builder
*/ */
@NonNull <T> B withMetadata(@NonNull NodeMetadataKey<T> key, @Nullable T metadata); <T> @NonNull B withMetadata(@NonNull NodeMetadataKey<T> key, @Nullable T metadata);
/** /**
* Creates a {@link Node} instance from the builder. * Creates a {@link Node} instance from the builder.

View File

@ -35,11 +35,13 @@ import net.luckperms.api.node.types.SuffixNode;
import net.luckperms.api.node.types.WeightNode; import net.luckperms.api.node.types.WeightNode;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus.Internal;
/** /**
* A registry of methods for obtaining {@link NodeBuilder}s for the various * A registry of methods for obtaining {@link NodeBuilder}s for the various
* node types. * node types.
*/ */
@Internal
public interface NodeBuilderRegistry { public interface NodeBuilderRegistry {
/** /**

View File

@ -31,12 +31,14 @@ import net.luckperms.api.node.NodeType;
import net.luckperms.api.node.types.MetaNode; import net.luckperms.api.node.types.MetaNode;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus.Internal;
/** /**
* A factory which creates {@link NodeMatcher}s. * A factory which creates {@link NodeMatcher}s.
* *
* @since 5.1 * @since 5.1
*/ */
@Internal
public interface NodeMatcherFactory { public interface NodeMatcherFactory {
/** /**
@ -87,7 +89,7 @@ public interface NodeMatcherFactory {
* @param <T> the node type * @param <T> the node type
* @return the matcher * @return the matcher
*/ */
@NonNull <T extends Node> NodeMatcher<T> equals(@NonNull T other, @NonNull NodeEqualityPredicate equalityPredicate); <T extends Node> @NonNull NodeMatcher<T> equals(@NonNull T other, @NonNull NodeEqualityPredicate equalityPredicate);
/** /**
* Gets a {@link NodeMatcher} which matches {@link MetaNode}s with the same * Gets a {@link NodeMatcher} which matches {@link MetaNode}s with the same

View File

@ -30,10 +30,12 @@ import net.luckperms.api.node.Node;
import net.luckperms.api.node.metadata.NodeMetadataKey; import net.luckperms.api.node.metadata.NodeMetadataKey;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus.NonExtendable;
/** /**
* Node metadata indicating where a node was inherited from. * Node metadata indicating where a node was inherited from.
*/ */
@NonExtendable
public interface InheritanceOriginMetadata { public interface InheritanceOriginMetadata {
/** /**

View File

@ -26,6 +26,7 @@
package net.luckperms.api.platform; package net.luckperms.api.platform;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.Unmodifiable;
import java.time.Instant; import java.time.Instant;
import java.util.Collection; import java.util.Collection;
@ -49,14 +50,14 @@ public interface Platform {
* *
* @return the unique connections * @return the unique connections
*/ */
@NonNull Set<UUID> getUniqueConnections(); @NonNull @Unmodifiable Set<UUID> getUniqueConnections();
/** /**
* Gets a {@link Collection} of all known permission strings. * Gets a {@link Collection} of all known permission strings.
* *
* @return a collection of the known permissions * @return a collection of the known permissions
*/ */
@NonNull Collection<String> getKnownPermissions(); @NonNull @Unmodifiable Collection<String> getKnownPermissions();
/** /**
* Gets the time when the plugin first started. * Gets the time when the plugin first started.

View File

@ -32,6 +32,7 @@ import net.luckperms.api.context.ImmutableContextSet;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import org.jetbrains.annotations.ApiStatus.NonExtendable;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
@ -40,6 +41,7 @@ import java.util.Set;
/** /**
* Represents the parameters for a lookup query. * Represents the parameters for a lookup query.
*/ */
@NonExtendable
public interface QueryOptions { public interface QueryOptions {
/** /**
@ -201,6 +203,7 @@ public interface QueryOptions {
/** /**
* Builder for {@link QueryOptions}. * Builder for {@link QueryOptions}.
*/ */
@NonExtendable
interface Builder { interface Builder {
/** /**

View File

@ -26,12 +26,14 @@
package net.luckperms.api.query; package net.luckperms.api.query;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus.Internal;
/** /**
* A registry providing useful {@link QueryOptions} instances. * A registry providing useful {@link QueryOptions} instances.
* *
* @since 5.1 * @since 5.1
*/ */
@Internal
public interface QueryOptionsRegistry { public interface QueryOptionsRegistry {
/** /**

View File

@ -32,6 +32,7 @@ import net.luckperms.api.model.user.User;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import org.jetbrains.annotations.Unmodifiable;
import java.util.List; import java.util.List;
@ -56,7 +57,7 @@ public interface Track {
* *
* @return an ordered {@link List} of the groups on this track * @return an ordered {@link List} of the groups on this track
*/ */
@NonNull List<String> getGroups(); @NonNull @Unmodifiable List<String> getGroups();
/** /**
* Gets the next group on the track, after the one provided * Gets the next group on the track, after the one provided

View File

@ -27,6 +27,7 @@ package net.luckperms.api.track;
import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
import org.jetbrains.annotations.Unmodifiable;
import java.util.Optional; import java.util.Optional;
import java.util.Set; import java.util.Set;
@ -116,7 +117,7 @@ public interface TrackManager {
* *
* @return a {@link Set} of {@link Track} objects * @return a {@link Set} of {@link Track} objects
*/ */
@NonNull Set<Track> getLoadedTracks(); @NonNull @Unmodifiable Set<Track> getLoadedTracks();
/** /**
* Check if a track is loaded in memory * Check if a track is loaded in memory

View File

@ -396,7 +396,7 @@ public class LuckPermsPermissible extends PermissibleBase {
} }
@Override @Override
public @NonNull <T> T[] toArray(@NonNull T[] a) { public <T> @NonNull T[] toArray(@NonNull T[] a) {
return ImmutableList.<PermissionAttachment>copyOf(LuckPermsPermissible.this.hookedAttachments).toArray(a); return ImmutableList.<PermissionAttachment>copyOf(LuckPermsPermissible.this.hookedAttachments).toArray(a);
} }

View File

@ -125,7 +125,7 @@ public class LuckPermsApiProvider implements LuckPerms {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public @NonNull <T> PlayerAdapter<T> getPlayerAdapter(@NonNull Class<T> playerClass) { public <T> @NonNull PlayerAdapter<T> getPlayerAdapter(@NonNull Class<T> playerClass) {
Objects.requireNonNull(playerClass, "playerClass"); Objects.requireNonNull(playerClass, "playerClass");
Class<?> expectedClass = this.plugin.getContextManager().getPlayerClass(); Class<?> expectedClass = this.plugin.getContextManager().getPlayerClass();
if (!expectedClass.equals(playerClass)) { if (!expectedClass.equals(playerClass)) {

View File

@ -120,7 +120,7 @@ public class ApiGroupManager extends ApiAbstractManager<Group, net.luckperms.api
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public @NonNull <T extends Node> CompletableFuture<Map<String, Collection<T>>> searchAll(@NonNull NodeMatcher<? extends T> matcher) { public <T extends Node> @NonNull CompletableFuture<Map<String, Collection<T>>> searchAll(@NonNull NodeMatcher<? extends T> matcher) {
Objects.requireNonNull(matcher, "matcher"); Objects.requireNonNull(matcher, "matcher");
ConstraintNodeMatcher<? extends T> constraint = (ConstraintNodeMatcher<? extends T>) matcher; ConstraintNodeMatcher<? extends T> constraint = (ConstraintNodeMatcher<? extends T>) matcher;
return this.plugin.getStorage().searchGroupNodes(constraint).thenApply(list -> { return this.plugin.getStorage().searchGroupNodes(constraint).thenApply(list -> {

View File

@ -52,7 +52,7 @@ public final class ApiNodeMatcherFactory implements NodeMatcherFactory {
} }
@Override @Override
public @NonNull <T extends Node> NodeMatcher<T> key(@NonNull T node) { public <T extends Node> @NonNull NodeMatcher<T> key(@NonNull T node) {
return StandardNodeMatchers.key(node); return StandardNodeMatchers.key(node);
} }
@ -76,7 +76,7 @@ public final class ApiNodeMatcherFactory implements NodeMatcherFactory {
} }
@Override @Override
public @NonNull <T extends Node> NodeMatcher<T> type(NodeType<? extends T> type) { public <T extends Node> @NonNull NodeMatcher<T> type(NodeType<? extends T> type) {
Objects.requireNonNull(type, "type"); Objects.requireNonNull(type, "type");
return StandardNodeMatchers.type(type); return StandardNodeMatchers.type(type);
} }

View File

@ -123,7 +123,7 @@ public class ApiPermissionHolder implements net.luckperms.api.model.PermissionHo
} }
@Override @Override
public @NonNull <T extends Node> Collection<T> getNodes(@NonNull NodeType<T> type) { public <T extends Node> @NonNull Collection<T> getNodes(@NonNull NodeType<T> type) {
Objects.requireNonNull(type, "type"); Objects.requireNonNull(type, "type");
return this.handle.getOwnNodes(type, QueryOptionsImpl.DEFAULT_NON_CONTEXTUAL); return this.handle.getOwnNodes(type, QueryOptionsImpl.DEFAULT_NON_CONTEXTUAL);
} }
@ -140,7 +140,7 @@ public class ApiPermissionHolder implements net.luckperms.api.model.PermissionHo
} }
@Override @Override
public @NonNull <T extends Node> Collection<T> resolveInheritedNodes(@NonNull NodeType<T> type, @NonNull QueryOptions queryOptions) { public <T extends Node> @NonNull Collection<T> resolveInheritedNodes(@NonNull NodeType<T> type, @NonNull QueryOptions queryOptions) {
Objects.requireNonNull(type, "type"); Objects.requireNonNull(type, "type");
Objects.requireNonNull(queryOptions, "queryOptions"); Objects.requireNonNull(queryOptions, "queryOptions");
return this.handle.resolveInheritedNodes(type, queryOptions); return this.handle.resolveInheritedNodes(type, queryOptions);

View File

@ -93,14 +93,14 @@ public abstract class AbstractEventBus<P> implements EventBus, AutoCloseable {
} }
@Override @Override
public @NonNull <T extends LuckPermsEvent> EventSubscription<T> subscribe(@NonNull Class<T> eventClass, @NonNull Consumer<? super T> handler) { public <T extends LuckPermsEvent> @NonNull EventSubscription<T> subscribe(@NonNull Class<T> eventClass, @NonNull Consumer<? super T> handler) {
Objects.requireNonNull(eventClass, "eventClass"); Objects.requireNonNull(eventClass, "eventClass");
Objects.requireNonNull(handler, "handler"); Objects.requireNonNull(handler, "handler");
return registerSubscription(eventClass, handler, null); return registerSubscription(eventClass, handler, null);
} }
@Override @Override
public @NonNull <T extends LuckPermsEvent> EventSubscription<T> subscribe(Object plugin, @NonNull Class<T> eventClass, @NonNull Consumer<? super T> handler) { public <T extends LuckPermsEvent> @NonNull EventSubscription<T> subscribe(Object plugin, @NonNull Class<T> eventClass, @NonNull Consumer<? super T> handler) {
Objects.requireNonNull(plugin, "plugin"); Objects.requireNonNull(plugin, "plugin");
Objects.requireNonNull(eventClass, "eventClass"); Objects.requireNonNull(eventClass, "eventClass");
Objects.requireNonNull(handler, "handler"); Objects.requireNonNull(handler, "handler");
@ -122,7 +122,7 @@ public abstract class AbstractEventBus<P> implements EventBus, AutoCloseable {
} }
@Override @Override
public @NonNull <T extends LuckPermsEvent> Set<EventSubscription<T>> getSubscriptions(@NonNull Class<T> eventClass) { public <T extends LuckPermsEvent> @NonNull Set<EventSubscription<T>> getSubscriptions(@NonNull Class<T> eventClass) {
return this.bus.getHandlers(eventClass); return this.bus.getHandlers(eventClass);
} }

View File

@ -128,7 +128,7 @@ public abstract class AbstractNodeBuilder<N extends ScopedNode<N, B>, B extends
} }
@Override @Override
public @NonNull <T> B withMetadata(@NonNull NodeMetadataKey<T> key, @Nullable T metadata) { public <T> @NonNull B withMetadata(@NonNull NodeMetadataKey<T> key, @Nullable T metadata) {
Objects.requireNonNull(key, "key"); Objects.requireNonNull(key, "key");
if (metadata == null) { if (metadata == null) {
this.metadata.remove(key); this.metadata.remove(key);

View File

@ -101,7 +101,7 @@ public class QueryOptionsImpl implements QueryOptions {
} }
@Override @Override
public @NonNull <O> Optional<O> option(@NonNull OptionKey<O> key) { public <O> @NonNull Optional<O> option(@NonNull OptionKey<O> key) {
if (this.options == null) { if (this.options == null) {
return Optional.empty(); return Optional.empty();
} }

View File

@ -379,7 +379,7 @@ public class LuckPermsPermissible extends PermissibleBase {
} }
@Override @Override
public @NonNull <T> T[] toArray(@NonNull T[] a) { public <T> @NonNull T[] toArray(@NonNull T[] a) {
return ImmutableList.<PermissionAttachment>copyOf(LuckPermsPermissible.this.hookedAttachments).toArray(a); return ImmutableList.<PermissionAttachment>copyOf(LuckPermsPermissible.this.hookedAttachments).toArray(a);
} }

View File

@ -85,7 +85,7 @@ public class ContextCalculatorProxy implements ForwardingContextCalculator<Subje
@Override public boolean contains(Object o) { throw new UnsupportedOperationException(); } @Override public boolean contains(Object o) { throw new UnsupportedOperationException(); }
@Override public @NonNull Iterator<Context> iterator() { throw new UnsupportedOperationException(); } @Override public @NonNull Iterator<Context> iterator() { throw new UnsupportedOperationException(); }
@Override public @NonNull Object[] toArray() { throw new UnsupportedOperationException(); } @Override public @NonNull Object[] toArray() { throw new UnsupportedOperationException(); }
@Override public @NonNull <T> T[] toArray(@NonNull T[] a) { throw new UnsupportedOperationException(); } @Override public <T> @NonNull T[] toArray(@NonNull T[] a) { throw new UnsupportedOperationException(); }
@Override public boolean remove(Object o) { throw new UnsupportedOperationException(); } @Override public boolean remove(Object o) { throw new UnsupportedOperationException(); }
@Override public boolean containsAll(@NonNull Collection<?> c) { throw new UnsupportedOperationException(); } @Override public boolean containsAll(@NonNull Collection<?> c) { throw new UnsupportedOperationException(); }
@Override public boolean retainAll(@NonNull Collection<?> c) { throw new UnsupportedOperationException(); } @Override public boolean retainAll(@NonNull Collection<?> c) { throw new UnsupportedOperationException(); }