From f9030825fdfc19195a8bc78062dbcc9e3e58b461 Mon Sep 17 00:00:00 2001 From: Luck Date: Tue, 19 Jan 2021 14:29:49 +0000 Subject: [PATCH] Add some more annotations to mark API methods --- .../java/net/luckperms/api/LuckPerms.java | 51 ++++++++++--------- .../luckperms/api/actionlog/ActionLog.java | 11 ++-- .../api/cacheddata/CachedMetaData.java | 7 +-- .../api/cacheddata/CachedPermissionData.java | 3 +- .../luckperms/api/context/ContextManager.java | 3 ++ .../net/luckperms/api/context/ContextSet.java | 11 ++-- .../api/context/ContextSetFactory.java | 2 + .../net/luckperms/api/event/EventBus.java | 7 +-- .../api/event/node/NodeAddEvent.java | 3 +- .../api/event/node/NodeClearEvent.java | 5 +- .../api/event/node/NodeMutateEvent.java | 5 +- .../api/event/node/NodeRemoveEvent.java | 3 +- .../event/track/mutate/TrackMutateEvent.java | 5 +- .../api/extension/ExtensionManager.java | 3 +- .../messenger/IncomingMessageConsumer.java | 2 + .../luckperms/api/messenger/Messenger.java | 2 + .../api/messenger/MessengerProvider.java | 2 + .../api/messenger/message/Message.java | 2 + .../api/metastacking/MetaStackDefinition.java | 3 +- .../api/metastacking/MetaStackFactory.java | 3 +- .../luckperms/api/model/PermissionHolder.java | 15 +++--- .../luckperms/api/model/PlayerSaveResult.java | 5 +- .../net/luckperms/api/model/data/NodeMap.java | 5 +- .../api/model/group/GroupManager.java | 7 +-- .../luckperms/api/model/user/UserManager.java | 9 ++-- .../java/net/luckperms/api/node/Node.java | 3 +- .../net/luckperms/api/node/NodeBuilder.java | 4 +- .../api/node/NodeBuilderRegistry.java | 2 + .../api/node/matcher/NodeMatcherFactory.java | 4 +- .../types/InheritanceOriginMetadata.java | 2 + .../net/luckperms/api/platform/Platform.java | 5 +- .../net/luckperms/api/query/QueryOptions.java | 3 ++ .../api/query/QueryOptionsRegistry.java | 2 + .../java/net/luckperms/api/track/Track.java | 3 +- .../net/luckperms/api/track/TrackManager.java | 3 +- .../permissible/LuckPermsPermissible.java | 2 +- .../common/api/LuckPermsApiProvider.java | 2 +- .../api/implementation/ApiGroupManager.java | 2 +- .../implementation/ApiNodeMatcherFactory.java | 4 +- .../implementation/ApiPermissionHolder.java | 4 +- .../common/event/AbstractEventBus.java | 6 +-- .../common/node/AbstractNodeBuilder.java | 2 +- .../common/query/QueryOptionsImpl.java | 2 +- .../permissible/LuckPermsPermissible.java | 2 +- .../service/model/ContextCalculatorProxy.java | 2 +- 45 files changed, 143 insertions(+), 90 deletions(-) diff --git a/api/src/main/java/net/luckperms/api/LuckPerms.java b/api/src/main/java/net/luckperms/api/LuckPerms.java index fa1a81020..ddd07606f 100644 --- a/api/src/main/java/net/luckperms/api/LuckPerms.java +++ b/api/src/main/java/net/luckperms/api/LuckPerms.java @@ -48,6 +48,7 @@ import net.luckperms.api.track.Track; import net.luckperms.api.track.TrackManager; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jetbrains.annotations.ApiStatus.Internal; import java.util.Optional; import java.util.concurrent.CompletableFuture; @@ -131,6 +132,7 @@ public interface LuckPerms { *
  • {@code org.bukkit.entity.Player}
  • *
  • {@code net.md_5.bungee.api.connection.ProxiedPlayer}
  • *
  • {@code org.spongepowered.api/entity.living.player.Player}
  • + *
  • {@code net.minecraft.server.network.ServerPlayerEntity} (Fabric)
  • *
  • {@code cn.nukkit.Player}
  • *
  • {@code com.velocitypowered.api.proxy.Player}
  • * @@ -194,21 +196,6 @@ public interface LuckPerms { */ @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}. * @@ -220,14 +207,6 @@ public interface LuckPerms { */ @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 * of the task as a {@link CompletableFuture}. @@ -251,4 +230,30 @@ public interface LuckPerms { */ 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(); + } diff --git a/api/src/main/java/net/luckperms/api/actionlog/ActionLog.java b/api/src/main/java/net/luckperms/api/actionlog/ActionLog.java index 9002602a4..bba6eb457 100644 --- a/api/src/main/java/net/luckperms/api/actionlog/ActionLog.java +++ b/api/src/main/java/net/luckperms/api/actionlog/ActionLog.java @@ -26,6 +26,7 @@ package net.luckperms.api.actionlog; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jetbrains.annotations.Unmodifiable; import java.util.SortedSet; import java.util.UUID; @@ -47,7 +48,7 @@ public interface ActionLog { * * @return the content */ - @NonNull SortedSet getContent(); + @NonNull @Unmodifiable SortedSet getContent(); /** * 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 * @return the content for the given actor */ - @NonNull SortedSet getContent(@NonNull UUID actor); + @NonNull @Unmodifiable SortedSet getContent(@NonNull UUID actor); /** * Gets the log content for a given user @@ -63,7 +64,7 @@ public interface ActionLog { * @param uniqueId the uuid to filter by * @return all content in this log where the user = uuid */ - @NonNull SortedSet getUserHistory(@NonNull UUID uniqueId); + @NonNull @Unmodifiable SortedSet getUserHistory(@NonNull UUID uniqueId); /** * Gets the log content for a given group @@ -71,7 +72,7 @@ public interface ActionLog { * @param name the name to filter by * @return all content in this log where the group = name */ - @NonNull SortedSet getGroupHistory(@NonNull String name); + @NonNull @Unmodifiable SortedSet getGroupHistory(@NonNull String name); /** * Gets the log content for a given track @@ -79,6 +80,6 @@ public interface ActionLog { * @param name the name to filter by * @return all content in this log where the track = name */ - @NonNull SortedSet getTrackHistory(@NonNull String name); + @NonNull @Unmodifiable SortedSet getTrackHistory(@NonNull String name); } diff --git a/api/src/main/java/net/luckperms/api/cacheddata/CachedMetaData.java b/api/src/main/java/net/luckperms/api/cacheddata/CachedMetaData.java index cc2e42561..57c18bb3e 100644 --- a/api/src/main/java/net/luckperms/api/cacheddata/CachedMetaData.java +++ b/api/src/main/java/net/luckperms/api/cacheddata/CachedMetaData.java @@ -29,6 +29,7 @@ import net.luckperms.api.metastacking.MetaStackDefinition; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.Unmodifiable; import java.util.List; import java.util.Map; @@ -66,7 +67,7 @@ public interface CachedMetaData extends CachedData { * * @return an immutable map of meta */ - @NonNull Map> getMeta(); + @NonNull @Unmodifiable Map> getMeta(); /** * 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 */ - @NonNull SortedMap getPrefixes(); + @NonNull @Unmodifiable SortedMap getPrefixes(); /** * 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 */ - @NonNull SortedMap getSuffixes(); + @NonNull @Unmodifiable SortedMap getSuffixes(); /** * Gets the name of the holders primary group. diff --git a/api/src/main/java/net/luckperms/api/cacheddata/CachedPermissionData.java b/api/src/main/java/net/luckperms/api/cacheddata/CachedPermissionData.java index 7d156aa60..2b8e65aa8 100644 --- a/api/src/main/java/net/luckperms/api/cacheddata/CachedPermissionData.java +++ b/api/src/main/java/net/luckperms/api/cacheddata/CachedPermissionData.java @@ -28,6 +28,7 @@ package net.luckperms.api.cacheddata; import net.luckperms.api.util.Tristate; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jetbrains.annotations.Unmodifiable; import java.util.Map; @@ -57,6 +58,6 @@ public interface CachedPermissionData extends CachedData { * * @return an immutable set of permissions */ - @NonNull Map getPermissionMap(); + @NonNull @Unmodifiable Map getPermissionMap(); } diff --git a/api/src/main/java/net/luckperms/api/context/ContextManager.java b/api/src/main/java/net/luckperms/api/context/ContextManager.java index 00d4b894f..d20229aa5 100644 --- a/api/src/main/java/net/luckperms/api/context/ContextManager.java +++ b/api/src/main/java/net/luckperms/api/context/ContextManager.java @@ -30,6 +30,7 @@ import net.luckperms.api.query.QueryMode; import net.luckperms.api.query.QueryOptions; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jetbrains.annotations.ApiStatus.Internal; import java.util.Optional; @@ -48,6 +49,7 @@ import java.util.Optional; *
  • {@code org.bukkit.entity.Player}
  • *
  • {@code net.md_5.bungee.api.connection.ProxiedPlayer}
  • *
  • {@code org.spongepowered.api.service.permission.Subject}
  • + *
  • {@code net.minecraft.server.network.ServerPlayerEntity} (Fabric)
  • *
  • {@code cn.nukkit.Player}
  • *
  • {@code com.velocitypowered.api.proxy.Player}
  • * @@ -156,6 +158,7 @@ public interface ContextManager { * * @return the context set factory */ + @Internal @NonNull ContextSetFactory getContextSetFactory(); /** diff --git a/api/src/main/java/net/luckperms/api/context/ContextSet.java b/api/src/main/java/net/luckperms/api/context/ContextSet.java index 868c71046..cec8306ca 100644 --- a/api/src/main/java/net/luckperms/api/context/ContextSet.java +++ b/api/src/main/java/net/luckperms/api/context/ContextSet.java @@ -26,6 +26,7 @@ package net.luckperms.api.context; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jetbrains.annotations.Unmodifiable; import java.util.Iterator; import java.util.Map; @@ -111,7 +112,7 @@ public interface ContextSet extends Iterable { * * @return an immutable set */ - @NonNull Set toSet(); + @NonNull @Unmodifiable Set toSet(); /** * Returns a {@link Map} representing the current state of this @@ -122,7 +123,7 @@ public interface ContextSet extends Iterable { * * @return a map */ - @NonNull Map> toMap(); + @NonNull @Unmodifiable Map> toMap(); /** * Returns a {@link Map} loosely representing the current state of @@ -138,7 +139,7 @@ public interface ContextSet extends Iterable { * @deprecated because the resultant map may not contain all data in the ContextSet */ @Deprecated - @NonNull Map toFlattenedMap(); + @NonNull @Unmodifiable Map toFlattenedMap(); /** * Returns an {@link Iterator} over each of the context pairs in this set. @@ -151,7 +152,7 @@ public interface ContextSet extends Iterable { * @return an iterator */ @Override - @NonNull Iterator iterator(); + @NonNull @Unmodifiable Iterator iterator(); /** * Returns if the {@link ContextSet} contains at least one value for the @@ -173,7 +174,7 @@ public interface ContextSet extends Iterable { * @return a set of values * @throws NullPointerException if the key is null */ - @NonNull Set getValues(@NonNull String key); + @NonNull @Unmodifiable Set getValues(@NonNull String key); /** * Returns any value from this {@link ContextSet} matching the key, if present. diff --git a/api/src/main/java/net/luckperms/api/context/ContextSetFactory.java b/api/src/main/java/net/luckperms/api/context/ContextSetFactory.java index b261f9f00..3a42f89c7 100644 --- a/api/src/main/java/net/luckperms/api/context/ContextSetFactory.java +++ b/api/src/main/java/net/luckperms/api/context/ContextSetFactory.java @@ -26,10 +26,12 @@ package net.luckperms.api.context; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jetbrains.annotations.ApiStatus.Internal; /** * A factory for creating {@link ContextSet}s. */ +@Internal public interface ContextSetFactory { ImmutableContextSet.@NonNull Builder immutableBuilder(); diff --git a/api/src/main/java/net/luckperms/api/event/EventBus.java b/api/src/main/java/net/luckperms/api/event/EventBus.java index 2cbc833eb..15f827a32 100644 --- a/api/src/main/java/net/luckperms/api/event/EventBus.java +++ b/api/src/main/java/net/luckperms/api/event/EventBus.java @@ -26,6 +26,7 @@ package net.luckperms.api.event; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jetbrains.annotations.Unmodifiable; import java.util.Set; import java.util.function.Consumer; @@ -49,7 +50,7 @@ public interface EventBus { * @param the event class * @return an event handler instance representing this subscription */ - @NonNull EventSubscription subscribe(@NonNull Class eventClass, @NonNull Consumer handler); + @NonNull EventSubscription subscribe(@NonNull Class eventClass, @NonNull Consumer handler); /** * Registers a new subscription to the given event. @@ -69,7 +70,7 @@ public interface EventBus { * @param handler the event handler * @return an event handler instance representing this subscription */ - @NonNull EventSubscription subscribe(Object plugin, @NonNull Class eventClass, @NonNull Consumer handler); + @NonNull EventSubscription subscribe(Object plugin, @NonNull Class eventClass, @NonNull Consumer handler); /** * Gets a set of all registered handlers for a given event. @@ -78,6 +79,6 @@ public interface EventBus { * @param the event class * @return an immutable set of event handlers */ - @NonNull Set> getSubscriptions(@NonNull Class eventClass); + @NonNull @Unmodifiable Set> getSubscriptions(@NonNull Class eventClass); } diff --git a/api/src/main/java/net/luckperms/api/event/node/NodeAddEvent.java b/api/src/main/java/net/luckperms/api/event/node/NodeAddEvent.java index 8628b4e44..96f1f99c3 100644 --- a/api/src/main/java/net/luckperms/api/event/node/NodeAddEvent.java +++ b/api/src/main/java/net/luckperms/api/event/node/NodeAddEvent.java @@ -29,6 +29,7 @@ import net.luckperms.api.event.util.Param; import net.luckperms.api.node.Node; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jetbrains.annotations.Unmodifiable; import java.util.Collections; import java.util.HashSet; @@ -48,7 +49,7 @@ public interface NodeAddEvent extends NodeMutateEvent { @NonNull Node getNode(); @Override - default @NonNull Set getDataBefore() { + default @NonNull @Unmodifiable Set getDataBefore() { // Get data after, then reverse the action Set nodes = new HashSet<>(this.getDataAfter()); nodes.remove(this.getNode()); diff --git a/api/src/main/java/net/luckperms/api/event/node/NodeClearEvent.java b/api/src/main/java/net/luckperms/api/event/node/NodeClearEvent.java index 9768f6cff..fb6ec7b3f 100644 --- a/api/src/main/java/net/luckperms/api/event/node/NodeClearEvent.java +++ b/api/src/main/java/net/luckperms/api/event/node/NodeClearEvent.java @@ -29,6 +29,7 @@ import net.luckperms.api.event.util.Param; import net.luckperms.api.node.Node; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jetbrains.annotations.Unmodifiable; import java.util.Collections; import java.util.HashSet; @@ -46,10 +47,10 @@ public interface NodeClearEvent extends NodeMutateEvent { * @since 5.3 */ @Param(3) - @NonNull Set getNodes(); + @NonNull @Unmodifiable Set getNodes(); @Override - default @NonNull Set getDataBefore() { + default @NonNull @Unmodifiable Set getDataBefore() { // Get data after, then reverse the action Set nodes = new HashSet<>(this.getDataAfter()); nodes.addAll(this.getNodes()); diff --git a/api/src/main/java/net/luckperms/api/event/node/NodeMutateEvent.java b/api/src/main/java/net/luckperms/api/event/node/NodeMutateEvent.java index 6a49f3d23..42fd02751 100644 --- a/api/src/main/java/net/luckperms/api/event/node/NodeMutateEvent.java +++ b/api/src/main/java/net/luckperms/api/event/node/NodeMutateEvent.java @@ -34,6 +34,7 @@ import net.luckperms.api.model.user.User; import net.luckperms.api.node.Node; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jetbrains.annotations.Unmodifiable; import java.util.Set; @@ -63,7 +64,7 @@ public interface NodeMutateEvent extends LuckPermsEvent { * * @return the data before the change */ - @NonNull Set getDataBefore(); + @NonNull @Unmodifiable Set getDataBefore(); /** * 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 */ @Param(2) - @NonNull Set getDataAfter(); + @NonNull @Unmodifiable Set getDataAfter(); /** * Gets whether the target of this event is a {@link User} diff --git a/api/src/main/java/net/luckperms/api/event/node/NodeRemoveEvent.java b/api/src/main/java/net/luckperms/api/event/node/NodeRemoveEvent.java index 7ad5137d2..d53fa2d2a 100644 --- a/api/src/main/java/net/luckperms/api/event/node/NodeRemoveEvent.java +++ b/api/src/main/java/net/luckperms/api/event/node/NodeRemoveEvent.java @@ -29,6 +29,7 @@ import net.luckperms.api.event.util.Param; import net.luckperms.api.node.Node; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jetbrains.annotations.Unmodifiable; import java.util.Collections; import java.util.HashSet; @@ -48,7 +49,7 @@ public interface NodeRemoveEvent extends NodeMutateEvent { @NonNull Node getNode(); @Override - default @NonNull Set getDataBefore() { + default @NonNull @Unmodifiable Set getDataBefore() { // Get data after, then reverse the action Set nodes = new HashSet<>(this.getDataAfter()); nodes.add(this.getNode()); diff --git a/api/src/main/java/net/luckperms/api/event/track/mutate/TrackMutateEvent.java b/api/src/main/java/net/luckperms/api/event/track/mutate/TrackMutateEvent.java index 8eae42901..88f6b0445 100644 --- a/api/src/main/java/net/luckperms/api/event/track/mutate/TrackMutateEvent.java +++ b/api/src/main/java/net/luckperms/api/event/track/mutate/TrackMutateEvent.java @@ -30,6 +30,7 @@ import net.luckperms.api.event.util.Param; import net.luckperms.api.track.Track; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jetbrains.annotations.Unmodifiable; import java.util.List; @@ -52,7 +53,7 @@ public interface TrackMutateEvent extends LuckPermsEvent { * @return the data before the change */ @Param(1) - @NonNull List getStateBefore(); + @NonNull @Unmodifiable List getStateBefore(); /** * 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 */ @Param(2) - @NonNull List getStateAfter(); + @NonNull @Unmodifiable List getStateAfter(); } diff --git a/api/src/main/java/net/luckperms/api/extension/ExtensionManager.java b/api/src/main/java/net/luckperms/api/extension/ExtensionManager.java index 352a4594f..d097665ac 100644 --- a/api/src/main/java/net/luckperms/api/extension/ExtensionManager.java +++ b/api/src/main/java/net/luckperms/api/extension/ExtensionManager.java @@ -26,6 +26,7 @@ package net.luckperms.api.extension; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jetbrains.annotations.Unmodifiable; import java.io.IOException; import java.nio.file.Path; @@ -57,6 +58,6 @@ public interface ExtensionManager { * * @return the loaded extensions */ - @NonNull Collection getLoadedExtensions(); + @NonNull @Unmodifiable Collection getLoadedExtensions(); } diff --git a/api/src/main/java/net/luckperms/api/messenger/IncomingMessageConsumer.java b/api/src/main/java/net/luckperms/api/messenger/IncomingMessageConsumer.java index 6d53df5cb..fe6eb9324 100644 --- a/api/src/main/java/net/luckperms/api/messenger/IncomingMessageConsumer.java +++ b/api/src/main/java/net/luckperms/api/messenger/IncomingMessageConsumer.java @@ -29,11 +29,13 @@ import net.luckperms.api.messenger.message.Message; import net.luckperms.api.messenger.message.OutgoingMessage; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jetbrains.annotations.ApiStatus.NonExtendable; /** * Encapsulates the LuckPerms system which accepts incoming {@link Message}s * from implementations of {@link Messenger}. */ +@NonExtendable public interface IncomingMessageConsumer { /** diff --git a/api/src/main/java/net/luckperms/api/messenger/Messenger.java b/api/src/main/java/net/luckperms/api/messenger/Messenger.java index 611a8e739..6d585f7b2 100644 --- a/api/src/main/java/net/luckperms/api/messenger/Messenger.java +++ b/api/src/main/java/net/luckperms/api/messenger/Messenger.java @@ -29,10 +29,12 @@ import net.luckperms.api.messenger.message.Message; import net.luckperms.api.messenger.message.OutgoingMessage; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jetbrains.annotations.ApiStatus.OverrideOnly; /** * Represents an object which dispatches {@link OutgoingMessage}s. */ +@OverrideOnly public interface Messenger extends AutoCloseable { /** diff --git a/api/src/main/java/net/luckperms/api/messenger/MessengerProvider.java b/api/src/main/java/net/luckperms/api/messenger/MessengerProvider.java index 3a49cf6a5..a20cd7a32 100644 --- a/api/src/main/java/net/luckperms/api/messenger/MessengerProvider.java +++ b/api/src/main/java/net/luckperms/api/messenger/MessengerProvider.java @@ -28,6 +28,7 @@ package net.luckperms.api.messenger; import net.luckperms.api.LuckPerms; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jetbrains.annotations.ApiStatus.OverrideOnly; /** * Represents a provider for {@link Messenger} instances. @@ -37,6 +38,7 @@ import org.checkerframework.checker.nullness.qual.NonNull; * * @see LuckPerms#registerMessengerProvider(MessengerProvider) */ +@OverrideOnly public interface MessengerProvider { /** diff --git a/api/src/main/java/net/luckperms/api/messenger/message/Message.java b/api/src/main/java/net/luckperms/api/messenger/message/Message.java index c1372d672..edbd689af 100644 --- a/api/src/main/java/net/luckperms/api/messenger/message/Message.java +++ b/api/src/main/java/net/luckperms/api/messenger/message/Message.java @@ -28,12 +28,14 @@ package net.luckperms.api.messenger.message; import net.luckperms.api.messenger.Messenger; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jetbrains.annotations.ApiStatus.NonExtendable; import java.util.UUID; /** * Represents a message sent received via a {@link Messenger}. */ +@NonExtendable public interface Message { /** diff --git a/api/src/main/java/net/luckperms/api/metastacking/MetaStackDefinition.java b/api/src/main/java/net/luckperms/api/metastacking/MetaStackDefinition.java index 062f61bbc..71140281d 100644 --- a/api/src/main/java/net/luckperms/api/metastacking/MetaStackDefinition.java +++ b/api/src/main/java/net/luckperms/api/metastacking/MetaStackDefinition.java @@ -28,6 +28,7 @@ package net.luckperms.api.metastacking; import net.luckperms.api.query.OptionKey; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jetbrains.annotations.Unmodifiable; import java.util.List; @@ -57,7 +58,7 @@ public interface MetaStackDefinition { * * @return the elements in this stack */ - @NonNull List getElements(); + @NonNull @Unmodifiable List getElements(); /** * Gets the duplicate removal function, applied to the entries before diff --git a/api/src/main/java/net/luckperms/api/metastacking/MetaStackFactory.java b/api/src/main/java/net/luckperms/api/metastacking/MetaStackFactory.java index 24c404726..88ecd40ff 100644 --- a/api/src/main/java/net/luckperms/api/metastacking/MetaStackFactory.java +++ b/api/src/main/java/net/luckperms/api/metastacking/MetaStackFactory.java @@ -26,6 +26,7 @@ package net.luckperms.api.metastacking; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jetbrains.annotations.Unmodifiable; import java.util.List; import java.util.Optional; @@ -51,7 +52,7 @@ public interface MetaStackFactory { * @param definitions the definition strings * @return a list of parsed elements */ - @NonNull List fromStrings(@NonNull List definitions); + @NonNull @Unmodifiable List fromStrings(@NonNull List definitions); /** * Creates a new {@link MetaStackDefinition} with the given properties. diff --git a/api/src/main/java/net/luckperms/api/model/PermissionHolder.java b/api/src/main/java/net/luckperms/api/model/PermissionHolder.java index 34710a140..dd1dae4b5 100644 --- a/api/src/main/java/net/luckperms/api/model/PermissionHolder.java +++ b/api/src/main/java/net/luckperms/api/model/PermissionHolder.java @@ -37,6 +37,7 @@ import net.luckperms.api.query.Flag; import net.luckperms.api.query.QueryOptions; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jetbrains.annotations.Unmodifiable; import java.util.ArrayList; import java.util.Collection; @@ -186,7 +187,7 @@ public interface PermissionHolder { * * @return a collection of the holders own nodes. */ - default @NonNull Collection getNodes() { + default @NonNull @Unmodifiable Collection getNodes() { /* This default method is overridden in the implementation, and is just here to demonstrate what this method does in the API sources. */ List nodes = new ArrayList<>(); @@ -204,7 +205,7 @@ public interface PermissionHolder { * @see #getNodes() * @since 5.1 */ - default @NonNull Collection getNodes(@NonNull NodeType type) { + default @NonNull @Unmodifiable Collection getNodes(@NonNull NodeType type) { /* This default method is overridden in the implementation, and is just here to demonstrate what this method does in the API sources. */ return getNodes().stream() @@ -223,7 +224,7 @@ public interface PermissionHolder { * * @return a sorted set of the holders own distinct nodes */ - @NonNull SortedSet getDistinctNodes(); + @NonNull @Unmodifiable SortedSet getDistinctNodes(); /** * 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 * @return a list of the holders inherited nodes */ - @NonNull Collection resolveInheritedNodes(@NonNull QueryOptions queryOptions); + @NonNull @Unmodifiable Collection resolveInheritedNodes(@NonNull QueryOptions queryOptions); /** * 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) * @since 5.1 */ - default @NonNull Collection resolveInheritedNodes(@NonNull NodeType type, @NonNull QueryOptions queryOptions) { + default @NonNull @Unmodifiable Collection resolveInheritedNodes(@NonNull NodeType type, @NonNull QueryOptions queryOptions) { /* This default method is overridden in the implementation, and is just here to demonstrate what this method does in the API sources. */ return resolveInheritedNodes(queryOptions).stream() @@ -275,7 +276,7 @@ public interface PermissionHolder { * @param queryOptions the query options * @return a sorted set of the holders distinct inherited nodes */ - @NonNull SortedSet resolveDistinctInheritedNodes(@NonNull QueryOptions queryOptions); + @NonNull @Unmodifiable SortedSet resolveDistinctInheritedNodes(@NonNull QueryOptions queryOptions); /** * 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 * @since 5.1 */ - @NonNull Collection getInheritedGroups(@NonNull QueryOptions queryOptions); + @NonNull @Unmodifiable Collection getInheritedGroups(@NonNull QueryOptions queryOptions); /** * Removes any temporary permissions that have expired. diff --git a/api/src/main/java/net/luckperms/api/model/PlayerSaveResult.java b/api/src/main/java/net/luckperms/api/model/PlayerSaveResult.java index 80f13bf3c..9a9bcfd14 100644 --- a/api/src/main/java/net/luckperms/api/model/PlayerSaveResult.java +++ b/api/src/main/java/net/luckperms/api/model/PlayerSaveResult.java @@ -29,6 +29,7 @@ import net.luckperms.api.model.user.UserManager; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.Unmodifiable; import java.util.Objects; import java.util.Set; @@ -47,7 +48,7 @@ public interface PlayerSaveResult { * * @return the status */ - @NonNull Set getOutcomes(); + @NonNull @Unmodifiable Set getOutcomes(); /** * Gets if the result includes a certain outcome. @@ -80,7 +81,7 @@ public interface PlayerSaveResult { * @return the other uuids * @see Outcome#OTHER_UNIQUE_IDS_PRESENT_FOR_USERNAME */ - @Nullable Set getOtherUniqueIds(); + @Nullable @Unmodifiable Set getOtherUniqueIds(); /** * The various states the result can take diff --git a/api/src/main/java/net/luckperms/api/model/data/NodeMap.java b/api/src/main/java/net/luckperms/api/model/data/NodeMap.java index 272ef7b0f..abdd86135 100644 --- a/api/src/main/java/net/luckperms/api/model/data/NodeMap.java +++ b/api/src/main/java/net/luckperms/api/model/data/NodeMap.java @@ -37,6 +37,7 @@ import net.luckperms.api.node.NodeEqualityPredicate; import net.luckperms.api.util.Tristate; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jetbrains.annotations.Unmodifiable; import java.util.Collection; import java.util.Map; @@ -65,7 +66,7 @@ public interface NodeMap { * * @return a map of nodes */ - @NonNull Map> toMap(); + @NonNull @Unmodifiable Map> toMap(); /** * 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 */ - @NonNull Collection toCollection(); + @NonNull @Unmodifiable Collection toCollection(); /** * Gets if this instance contains a given {@link Node}. diff --git a/api/src/main/java/net/luckperms/api/model/group/GroupManager.java b/api/src/main/java/net/luckperms/api/model/group/GroupManager.java index b8d681a50..5f995c82e 100644 --- a/api/src/main/java/net/luckperms/api/model/group/GroupManager.java +++ b/api/src/main/java/net/luckperms/api/model/group/GroupManager.java @@ -31,6 +31,7 @@ import net.luckperms.api.node.matcher.NodeMatcher; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.Unmodifiable; import java.util.Collection; import java.util.List; @@ -138,7 +139,7 @@ public interface GroupManager { * @return the entries which matched * @since 5.1 */ - @NonNull CompletableFuture>> searchAll(@NonNull NodeMatcher matcher); + @NonNull CompletableFuture<@Unmodifiable Map>> searchAll(@NonNull NodeMatcher matcher); /** * Searches for a list of groups with a given permission. @@ -149,7 +150,7 @@ public interface GroupManager { * @deprecated use {@link #searchAll(NodeMatcher)} */ @Deprecated - @NonNull CompletableFuture>> getWithPermission(@NonNull String permission); + @NonNull CompletableFuture<@Unmodifiable List>> getWithPermission(@NonNull String permission); /** * Gets a loaded group. @@ -165,7 +166,7 @@ public interface GroupManager { * * @return a {@link Set} of {@link Group} objects */ - @NonNull Set getLoadedGroups(); + @NonNull @Unmodifiable Set getLoadedGroups(); /** * Check if a group is loaded in memory diff --git a/api/src/main/java/net/luckperms/api/model/user/UserManager.java b/api/src/main/java/net/luckperms/api/model/user/UserManager.java index 07fcf2387..06a678418 100644 --- a/api/src/main/java/net/luckperms/api/model/user/UserManager.java +++ b/api/src/main/java/net/luckperms/api/model/user/UserManager.java @@ -32,6 +32,7 @@ import net.luckperms.api.node.matcher.NodeMatcher; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.Unmodifiable; import java.util.Collection; import java.util.List; @@ -165,7 +166,7 @@ public interface UserManager { * * @return a set of uuids */ - @NonNull CompletableFuture> getUniqueUsers(); + @NonNull CompletableFuture<@Unmodifiable Set> getUniqueUsers(); /** * 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 * @since 5.1 */ - @NonNull CompletableFuture>> searchAll(@NonNull NodeMatcher matcher); + @NonNull CompletableFuture<@Unmodifiable Map>> searchAll(@NonNull NodeMatcher matcher); /** * Searches for a list of users with a given permission. @@ -186,7 +187,7 @@ public interface UserManager { * @deprecated use {@link #searchAll(NodeMatcher)} */ @Deprecated - @NonNull CompletableFuture>> getWithPermission(@NonNull String permission); + @NonNull CompletableFuture<@Unmodifiable List>> getWithPermission(@NonNull String permission); /** * Gets a loaded user. @@ -211,7 +212,7 @@ public interface UserManager { * * @return a {@link Set} of {@link User} objects */ - @NonNull Set getLoadedUsers(); + @NonNull @Unmodifiable Set getLoadedUsers(); /** * Check if a user is loaded in memory diff --git a/api/src/main/java/net/luckperms/api/node/Node.java b/api/src/main/java/net/luckperms/api/node/Node.java index b9013c101..d13f1ae2d 100644 --- a/api/src/main/java/net/luckperms/api/node/Node.java +++ b/api/src/main/java/net/luckperms/api/node/Node.java @@ -40,6 +40,7 @@ import net.luckperms.api.node.types.WeightNode; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; import org.jetbrains.annotations.ApiStatus.NonExtendable; +import org.jetbrains.annotations.Unmodifiable; import java.time.Duration; import java.time.Instant; @@ -153,7 +154,7 @@ public interface Node { * * @return a list of full nodes */ - @NonNull Collection resolveShorthand(); + @NonNull @Unmodifiable Collection resolveShorthand(); /** * Gets if this node is assigned temporarily. diff --git a/api/src/main/java/net/luckperms/api/node/NodeBuilder.java b/api/src/main/java/net/luckperms/api/node/NodeBuilder.java index ab0991c07..01811872d 100644 --- a/api/src/main/java/net/luckperms/api/node/NodeBuilder.java +++ b/api/src/main/java/net/luckperms/api/node/NodeBuilder.java @@ -30,6 +30,7 @@ import net.luckperms.api.node.metadata.NodeMetadataKey; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.ApiStatus.NonExtendable; import java.time.Duration; import java.time.temporal.TemporalAccessor; @@ -43,6 +44,7 @@ import java.util.concurrent.TimeUnit; * @param the node type * @param the node builder type */ +@NonExtendable public interface NodeBuilder, B extends NodeBuilder> { /** @@ -161,7 +163,7 @@ public interface NodeBuilder, B extends NodeBuilder the metadata type * @return the builder */ - @NonNull B withMetadata(@NonNull NodeMetadataKey key, @Nullable T metadata); + @NonNull B withMetadata(@NonNull NodeMetadataKey key, @Nullable T metadata); /** * Creates a {@link Node} instance from the builder. diff --git a/api/src/main/java/net/luckperms/api/node/NodeBuilderRegistry.java b/api/src/main/java/net/luckperms/api/node/NodeBuilderRegistry.java index 3128fd450..35366b2b1 100644 --- a/api/src/main/java/net/luckperms/api/node/NodeBuilderRegistry.java +++ b/api/src/main/java/net/luckperms/api/node/NodeBuilderRegistry.java @@ -35,11 +35,13 @@ import net.luckperms.api.node.types.SuffixNode; import net.luckperms.api.node.types.WeightNode; 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 * node types. */ +@Internal public interface NodeBuilderRegistry { /** diff --git a/api/src/main/java/net/luckperms/api/node/matcher/NodeMatcherFactory.java b/api/src/main/java/net/luckperms/api/node/matcher/NodeMatcherFactory.java index ab7f44064..04c32687c 100644 --- a/api/src/main/java/net/luckperms/api/node/matcher/NodeMatcherFactory.java +++ b/api/src/main/java/net/luckperms/api/node/matcher/NodeMatcherFactory.java @@ -31,12 +31,14 @@ import net.luckperms.api.node.NodeType; import net.luckperms.api.node.types.MetaNode; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jetbrains.annotations.ApiStatus.Internal; /** * A factory which creates {@link NodeMatcher}s. * * @since 5.1 */ +@Internal public interface NodeMatcherFactory { /** @@ -87,7 +89,7 @@ public interface NodeMatcherFactory { * @param the node type * @return the matcher */ - @NonNull NodeMatcher equals(@NonNull T other, @NonNull NodeEqualityPredicate equalityPredicate); + @NonNull NodeMatcher equals(@NonNull T other, @NonNull NodeEqualityPredicate equalityPredicate); /** * Gets a {@link NodeMatcher} which matches {@link MetaNode}s with the same diff --git a/api/src/main/java/net/luckperms/api/node/metadata/types/InheritanceOriginMetadata.java b/api/src/main/java/net/luckperms/api/node/metadata/types/InheritanceOriginMetadata.java index a25b223f6..68b70f95b 100644 --- a/api/src/main/java/net/luckperms/api/node/metadata/types/InheritanceOriginMetadata.java +++ b/api/src/main/java/net/luckperms/api/node/metadata/types/InheritanceOriginMetadata.java @@ -30,10 +30,12 @@ import net.luckperms.api.node.Node; import net.luckperms.api.node.metadata.NodeMetadataKey; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jetbrains.annotations.ApiStatus.NonExtendable; /** * Node metadata indicating where a node was inherited from. */ +@NonExtendable public interface InheritanceOriginMetadata { /** diff --git a/api/src/main/java/net/luckperms/api/platform/Platform.java b/api/src/main/java/net/luckperms/api/platform/Platform.java index 316ee956f..9ed38beee 100644 --- a/api/src/main/java/net/luckperms/api/platform/Platform.java +++ b/api/src/main/java/net/luckperms/api/platform/Platform.java @@ -26,6 +26,7 @@ package net.luckperms.api.platform; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jetbrains.annotations.Unmodifiable; import java.time.Instant; import java.util.Collection; @@ -49,14 +50,14 @@ public interface Platform { * * @return the unique connections */ - @NonNull Set getUniqueConnections(); + @NonNull @Unmodifiable Set getUniqueConnections(); /** * Gets a {@link Collection} of all known permission strings. * * @return a collection of the known permissions */ - @NonNull Collection getKnownPermissions(); + @NonNull @Unmodifiable Collection getKnownPermissions(); /** * Gets the time when the plugin first started. diff --git a/api/src/main/java/net/luckperms/api/query/QueryOptions.java b/api/src/main/java/net/luckperms/api/query/QueryOptions.java index e3aa59fcc..0d10ac2b3 100644 --- a/api/src/main/java/net/luckperms/api/query/QueryOptions.java +++ b/api/src/main/java/net/luckperms/api/query/QueryOptions.java @@ -32,6 +32,7 @@ import net.luckperms.api.context.ImmutableContextSet; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.ApiStatus.NonExtendable; import java.util.Map; import java.util.Optional; @@ -40,6 +41,7 @@ import java.util.Set; /** * Represents the parameters for a lookup query. */ +@NonExtendable public interface QueryOptions { /** @@ -201,6 +203,7 @@ public interface QueryOptions { /** * Builder for {@link QueryOptions}. */ + @NonExtendable interface Builder { /** diff --git a/api/src/main/java/net/luckperms/api/query/QueryOptionsRegistry.java b/api/src/main/java/net/luckperms/api/query/QueryOptionsRegistry.java index f86e59e7f..260700922 100644 --- a/api/src/main/java/net/luckperms/api/query/QueryOptionsRegistry.java +++ b/api/src/main/java/net/luckperms/api/query/QueryOptionsRegistry.java @@ -26,12 +26,14 @@ package net.luckperms.api.query; import org.checkerframework.checker.nullness.qual.NonNull; +import org.jetbrains.annotations.ApiStatus.Internal; /** * A registry providing useful {@link QueryOptions} instances. * * @since 5.1 */ +@Internal public interface QueryOptionsRegistry { /** diff --git a/api/src/main/java/net/luckperms/api/track/Track.java b/api/src/main/java/net/luckperms/api/track/Track.java index 503ce8308..4ba433de6 100644 --- a/api/src/main/java/net/luckperms/api/track/Track.java +++ b/api/src/main/java/net/luckperms/api/track/Track.java @@ -32,6 +32,7 @@ import net.luckperms.api.model.user.User; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.Unmodifiable; import java.util.List; @@ -56,7 +57,7 @@ public interface Track { * * @return an ordered {@link List} of the groups on this track */ - @NonNull List getGroups(); + @NonNull @Unmodifiable List getGroups(); /** * Gets the next group on the track, after the one provided diff --git a/api/src/main/java/net/luckperms/api/track/TrackManager.java b/api/src/main/java/net/luckperms/api/track/TrackManager.java index 15d831ae0..f1719a673 100644 --- a/api/src/main/java/net/luckperms/api/track/TrackManager.java +++ b/api/src/main/java/net/luckperms/api/track/TrackManager.java @@ -27,6 +27,7 @@ package net.luckperms.api.track; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.Unmodifiable; import java.util.Optional; import java.util.Set; @@ -116,7 +117,7 @@ public interface TrackManager { * * @return a {@link Set} of {@link Track} objects */ - @NonNull Set getLoadedTracks(); + @NonNull @Unmodifiable Set getLoadedTracks(); /** * Check if a track is loaded in memory diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/permissible/LuckPermsPermissible.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/permissible/LuckPermsPermissible.java index 82c0a563f..8958aad92 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/permissible/LuckPermsPermissible.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/inject/permissible/LuckPermsPermissible.java @@ -396,7 +396,7 @@ public class LuckPermsPermissible extends PermissibleBase { } @Override - public @NonNull T[] toArray(@NonNull T[] a) { + public @NonNull T[] toArray(@NonNull T[] a) { return ImmutableList.copyOf(LuckPermsPermissible.this.hookedAttachments).toArray(a); } diff --git a/common/src/main/java/me/lucko/luckperms/common/api/LuckPermsApiProvider.java b/common/src/main/java/me/lucko/luckperms/common/api/LuckPermsApiProvider.java index 7a5fbaf1e..77aecbc4f 100644 --- a/common/src/main/java/me/lucko/luckperms/common/api/LuckPermsApiProvider.java +++ b/common/src/main/java/me/lucko/luckperms/common/api/LuckPermsApiProvider.java @@ -125,7 +125,7 @@ public class LuckPermsApiProvider implements LuckPerms { @SuppressWarnings("unchecked") @Override - public @NonNull PlayerAdapter getPlayerAdapter(@NonNull Class playerClass) { + public @NonNull PlayerAdapter getPlayerAdapter(@NonNull Class playerClass) { Objects.requireNonNull(playerClass, "playerClass"); Class expectedClass = this.plugin.getContextManager().getPlayerClass(); if (!expectedClass.equals(playerClass)) { diff --git a/common/src/main/java/me/lucko/luckperms/common/api/implementation/ApiGroupManager.java b/common/src/main/java/me/lucko/luckperms/common/api/implementation/ApiGroupManager.java index 754587d4b..d4aeba13b 100644 --- a/common/src/main/java/me/lucko/luckperms/common/api/implementation/ApiGroupManager.java +++ b/common/src/main/java/me/lucko/luckperms/common/api/implementation/ApiGroupManager.java @@ -120,7 +120,7 @@ public class ApiGroupManager extends ApiAbstractManager CompletableFuture>> searchAll(@NonNull NodeMatcher matcher) { + public @NonNull CompletableFuture>> searchAll(@NonNull NodeMatcher matcher) { Objects.requireNonNull(matcher, "matcher"); ConstraintNodeMatcher constraint = (ConstraintNodeMatcher) matcher; return this.plugin.getStorage().searchGroupNodes(constraint).thenApply(list -> { diff --git a/common/src/main/java/me/lucko/luckperms/common/api/implementation/ApiNodeMatcherFactory.java b/common/src/main/java/me/lucko/luckperms/common/api/implementation/ApiNodeMatcherFactory.java index 5b92b13c9..e1f6f9dd6 100644 --- a/common/src/main/java/me/lucko/luckperms/common/api/implementation/ApiNodeMatcherFactory.java +++ b/common/src/main/java/me/lucko/luckperms/common/api/implementation/ApiNodeMatcherFactory.java @@ -52,7 +52,7 @@ public final class ApiNodeMatcherFactory implements NodeMatcherFactory { } @Override - public @NonNull NodeMatcher key(@NonNull T node) { + public @NonNull NodeMatcher key(@NonNull T node) { return StandardNodeMatchers.key(node); } @@ -76,7 +76,7 @@ public final class ApiNodeMatcherFactory implements NodeMatcherFactory { } @Override - public @NonNull NodeMatcher type(NodeType type) { + public @NonNull NodeMatcher type(NodeType type) { Objects.requireNonNull(type, "type"); return StandardNodeMatchers.type(type); } diff --git a/common/src/main/java/me/lucko/luckperms/common/api/implementation/ApiPermissionHolder.java b/common/src/main/java/me/lucko/luckperms/common/api/implementation/ApiPermissionHolder.java index e35e5c086..1b9c24838 100644 --- a/common/src/main/java/me/lucko/luckperms/common/api/implementation/ApiPermissionHolder.java +++ b/common/src/main/java/me/lucko/luckperms/common/api/implementation/ApiPermissionHolder.java @@ -123,7 +123,7 @@ public class ApiPermissionHolder implements net.luckperms.api.model.PermissionHo } @Override - public @NonNull Collection getNodes(@NonNull NodeType type) { + public @NonNull Collection getNodes(@NonNull NodeType type) { Objects.requireNonNull(type, "type"); return this.handle.getOwnNodes(type, QueryOptionsImpl.DEFAULT_NON_CONTEXTUAL); } @@ -140,7 +140,7 @@ public class ApiPermissionHolder implements net.luckperms.api.model.PermissionHo } @Override - public @NonNull Collection resolveInheritedNodes(@NonNull NodeType type, @NonNull QueryOptions queryOptions) { + public @NonNull Collection resolveInheritedNodes(@NonNull NodeType type, @NonNull QueryOptions queryOptions) { Objects.requireNonNull(type, "type"); Objects.requireNonNull(queryOptions, "queryOptions"); return this.handle.resolveInheritedNodes(type, queryOptions); diff --git a/common/src/main/java/me/lucko/luckperms/common/event/AbstractEventBus.java b/common/src/main/java/me/lucko/luckperms/common/event/AbstractEventBus.java index 9ecb810f6..1ee804366 100644 --- a/common/src/main/java/me/lucko/luckperms/common/event/AbstractEventBus.java +++ b/common/src/main/java/me/lucko/luckperms/common/event/AbstractEventBus.java @@ -93,14 +93,14 @@ public abstract class AbstractEventBus

    implements EventBus, AutoCloseable { } @Override - public @NonNull EventSubscription subscribe(@NonNull Class eventClass, @NonNull Consumer handler) { + public @NonNull EventSubscription subscribe(@NonNull Class eventClass, @NonNull Consumer handler) { Objects.requireNonNull(eventClass, "eventClass"); Objects.requireNonNull(handler, "handler"); return registerSubscription(eventClass, handler, null); } @Override - public @NonNull EventSubscription subscribe(Object plugin, @NonNull Class eventClass, @NonNull Consumer handler) { + public @NonNull EventSubscription subscribe(Object plugin, @NonNull Class eventClass, @NonNull Consumer handler) { Objects.requireNonNull(plugin, "plugin"); Objects.requireNonNull(eventClass, "eventClass"); Objects.requireNonNull(handler, "handler"); @@ -122,7 +122,7 @@ public abstract class AbstractEventBus

    implements EventBus, AutoCloseable { } @Override - public @NonNull Set> getSubscriptions(@NonNull Class eventClass) { + public @NonNull Set> getSubscriptions(@NonNull Class eventClass) { return this.bus.getHandlers(eventClass); } diff --git a/common/src/main/java/me/lucko/luckperms/common/node/AbstractNodeBuilder.java b/common/src/main/java/me/lucko/luckperms/common/node/AbstractNodeBuilder.java index 35e927706..552c92533 100644 --- a/common/src/main/java/me/lucko/luckperms/common/node/AbstractNodeBuilder.java +++ b/common/src/main/java/me/lucko/luckperms/common/node/AbstractNodeBuilder.java @@ -128,7 +128,7 @@ public abstract class AbstractNodeBuilder, B extends } @Override - public @NonNull B withMetadata(@NonNull NodeMetadataKey key, @Nullable T metadata) { + public @NonNull B withMetadata(@NonNull NodeMetadataKey key, @Nullable T metadata) { Objects.requireNonNull(key, "key"); if (metadata == null) { this.metadata.remove(key); diff --git a/common/src/main/java/me/lucko/luckperms/common/query/QueryOptionsImpl.java b/common/src/main/java/me/lucko/luckperms/common/query/QueryOptionsImpl.java index 20fd64f25..7eab66e99 100644 --- a/common/src/main/java/me/lucko/luckperms/common/query/QueryOptionsImpl.java +++ b/common/src/main/java/me/lucko/luckperms/common/query/QueryOptionsImpl.java @@ -101,7 +101,7 @@ public class QueryOptionsImpl implements QueryOptions { } @Override - public @NonNull Optional option(@NonNull OptionKey key) { + public @NonNull Optional option(@NonNull OptionKey key) { if (this.options == null) { return Optional.empty(); } diff --git a/nukkit/src/main/java/me/lucko/luckperms/nukkit/inject/permissible/LuckPermsPermissible.java b/nukkit/src/main/java/me/lucko/luckperms/nukkit/inject/permissible/LuckPermsPermissible.java index 9909356b3..0b31a4ca4 100644 --- a/nukkit/src/main/java/me/lucko/luckperms/nukkit/inject/permissible/LuckPermsPermissible.java +++ b/nukkit/src/main/java/me/lucko/luckperms/nukkit/inject/permissible/LuckPermsPermissible.java @@ -379,7 +379,7 @@ public class LuckPermsPermissible extends PermissibleBase { } @Override - public @NonNull T[] toArray(@NonNull T[] a) { + public @NonNull T[] toArray(@NonNull T[] a) { return ImmutableList.copyOf(LuckPermsPermissible.this.hookedAttachments).toArray(a); } diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/service/model/ContextCalculatorProxy.java b/sponge/src/main/java/me/lucko/luckperms/sponge/service/model/ContextCalculatorProxy.java index 9fd13f63c..cb43a76f2 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/service/model/ContextCalculatorProxy.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/service/model/ContextCalculatorProxy.java @@ -85,7 +85,7 @@ public class ContextCalculatorProxy implements ForwardingContextCalculator iterator() { throw new UnsupportedOperationException(); } @Override public @NonNull Object[] toArray() { throw new UnsupportedOperationException(); } - @Override public @NonNull T[] toArray(@NonNull T[] a) { throw new UnsupportedOperationException(); } + @Override public @NonNull T[] toArray(@NonNull T[] a) { 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 retainAll(@NonNull Collection c) { throw new UnsupportedOperationException(); }