Compare commits

..
5 Commits
703 changed files with 5519 additions and 18545 deletions

No files matched your search

-5
View File
@@ -1,5 +0,0 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# These are explicitly windows files and should use crlf
*.bat text eol=crlf
+17 -15
View File
@@ -19,24 +19,26 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v4
- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v1
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '25'
java-version: '21'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
uses: gradle/gradle-build-action@v2
- name: Run build and tests with Gradle wrapper
run: ./gradlew test build -PdockerTests
- name: Publish test report
uses: mikepenz/action-junit-report@v5
uses: mikepenz/action-junit-report@v3
if: success() || failure()
with:
report_paths: '**/build/test-results/test/TEST-*.xml'
@@ -44,7 +46,7 @@ jobs:
detailed_summary: true
- name: Upload all artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: jars
path: |
@@ -59,7 +61,7 @@ jobs:
standalone/loader/build/libs/LuckPerms-Standalone-*.jar
- name: Upload standalone artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: standalone-binary
path: standalone/loader/build/libs/LuckPerms-Standalone-*.jar
@@ -74,12 +76,12 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Retrieve saved standalone jar artifact
uses: actions/download-artifact@v4
uses: actions/download-artifact@v3
with:
name: standalone-binary
path: standalone/docker/
@@ -88,13 +90,13 @@ jobs:
run: mv standalone/docker/LuckPerms-Standalone-*.jar standalone/docker/luckperms-standalone.jar
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@v1
- name: Log in to the Container registry
uses: docker/login-action@v3
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
@@ -106,7 +108,7 @@ jobs:
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
@@ -119,7 +121,7 @@ jobs:
type=raw,enable=${{ github.ref == 'refs/heads/master' }},value=${{ env.luckperms_version }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
uses: docker/build-push-action@v2
with:
context: standalone/docker/
platforms: linux/amd64,linux/arm64
+7 -13
View File
@@ -1,11 +1,5 @@
apply plugin: 'java-library'
group = 'net.luckperms'
project.version = '5.5'
tasks.withType(JavaCompile).configureEach {
options.release = 8
}
project.version = '5.4'
jar {
manifest {
@@ -14,8 +8,8 @@ jar {
}
dependencies {
api 'org.jspecify:jspecify:1.0.0'
compileOnlyApi 'org.jetbrains:annotations:26.1.0'
compileOnly 'org.checkerframework:checker-qual:3.21.2'
compileOnly 'org.jetbrains:annotations:23.1.0'
}
// Only used occasionally for deployment - not needed for normal builds.
@@ -29,14 +23,14 @@ if (project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePass
options.encoding = 'UTF-8'
options.charSet = 'UTF-8'
options.links(
'https://jspecify.dev/docs/api/',
'https://javadoc.io/static/org.jetbrains/annotations/26.0.2/'
'https://checkerframework.org/api/',
'https://javadoc.io/static/org.jetbrains/annotations/23.0.0/'
)
options.addStringOption('Xdoclint:none', '-quiet')
options.addStringOption('-since', '5.0,5.1,5.2,5.3,5.4,5.5')
if (JavaVersion.current() > JavaVersion.VERSION_1_8) {
options.links.add('https://docs.oracle.com/en/java/javase/21/docs/api/')
options.links.add('https://docs.oracle.com/en/java/javase/11/docs/api/')
} else {
options.links.add('https://docs.oracle.com/javase/8/docs/api/')
}
@@ -69,7 +63,7 @@ if (project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePass
pom {
name = 'LuckPerms API'
description = 'A permissions manager for Minecraft servers.'
description = 'A permissions plugin for Minecraft servers.'
url = 'https://luckperms.net'
licenses {
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<p>
LuckPerms is a permissions manager for Minecraft servers. It allows server admins to control what
LuckPerms is a permissions plugin for Minecraft servers. It allows server admins to control what
features players can use by creating groups and assigning permissions.
</p>
<h4>Useful Links</h4>
@@ -48,6 +48,7 @@ import net.luckperms.api.platform.PluginMetadata;
import net.luckperms.api.query.QueryOptionsRegistry;
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;
@@ -83,18 +84,18 @@ public interface LuckPerms {
*
* @return the server name
*/
String getServerName();
@NonNull String getServerName();
/**
* Gets the {@link UserManager}, responsible for managing
* {@link User} instances.
*
* <p>This manager can be used to retrieve instances of {@link User} by UUID
* <p>This manager can be used to retrieve instances of {@link User} by uuid
* or name, or query all loaded users.</p>
*
* @return the user manager
*/
UserManager getUserManager();
@NonNull UserManager getUserManager();
/**
* Gets the {@link GroupManager}, responsible for managing
@@ -105,7 +106,7 @@ public interface LuckPerms {
*
* @return the group manager
*/
GroupManager getGroupManager();
@NonNull GroupManager getGroupManager();
/**
* Gets the {@link TrackManager}, responsible for managing
@@ -116,7 +117,7 @@ public interface LuckPerms {
*
* @return the track manager
*/
TrackManager getTrackManager();
@NonNull TrackManager getTrackManager();
/**
* Gets the {@link PlayerAdapter} instance, a utility class for adapting platform Player
@@ -143,7 +144,7 @@ public interface LuckPerms {
* @throws IllegalArgumentException if the player class is not correct
* @since 5.1
*/
<T> PlayerAdapter<T> getPlayerAdapter(Class<T> playerClass);
<T> @NonNull PlayerAdapter<T> getPlayerAdapter(@NonNull Class<T> playerClass);
/**
* Gets the {@link Platform}, which represents the server platform the
@@ -151,7 +152,7 @@ public interface LuckPerms {
*
* @return the platform
*/
Platform getPlatform();
@NonNull Platform getPlatform();
/**
* Gets the {@link PluginMetadata}, responsible for providing metadata about
@@ -159,7 +160,7 @@ public interface LuckPerms {
*
* @return the plugin metadata
*/
PluginMetadata getPluginMetadata();
@NonNull PluginMetadata getPluginMetadata();
/**
* Gets the {@link EventBus}, used for subscribing to internal LuckPerms
@@ -167,7 +168,7 @@ public interface LuckPerms {
*
* @return the event bus
*/
EventBus getEventBus();
@NonNull EventBus getEventBus();
/**
* Gets the {@link MessagingService}, used to dispatch updates throughout a
@@ -178,7 +179,7 @@ public interface LuckPerms {
*
* @return the messaging service instance, if present.
*/
Optional<MessagingService> getMessagingService();
@NonNull Optional<MessagingService> getMessagingService();
/**
* Gets the {@link ActionLogger}, responsible for saving and broadcasting
@@ -186,7 +187,7 @@ public interface LuckPerms {
*
* @return the action logger
*/
ActionLogger getActionLogger();
@NonNull ActionLogger getActionLogger();
/**
* Gets the {@link ContextManager}, responsible for managing
@@ -194,7 +195,7 @@ public interface LuckPerms {
*
* @return the context manager
*/
ContextManager getContextManager();
@NonNull ContextManager getContextManager();
/**
* Gets the {@link MetaStackFactory}.
@@ -205,7 +206,7 @@ public interface LuckPerms {
*
* @return the meta stack factory
*/
MetaStackFactory getMetaStackFactory();
@NonNull MetaStackFactory getMetaStackFactory();
/**
* Schedules the execution of an update task, and returns an encapsulation
@@ -218,7 +219,7 @@ public interface LuckPerms {
*
* @return a future
*/
CompletableFuture<Void> runUpdateTask();
@NonNull CompletableFuture<Void> runUpdateTask();
/**
* Executes a health check.
@@ -229,7 +230,7 @@ public interface LuckPerms {
* @return the health status
* @since 5.5
*/
Health runHealthCheck();
@NonNull Health runHealthCheck();
/**
* Registers a {@link MessengerProvider} for use by the platform.
@@ -239,7 +240,7 @@ public interface LuckPerms {
*
* @param messengerProvider the messenger provider.
*/
void registerMessengerProvider(MessengerProvider messengerProvider);
void registerMessengerProvider(@NonNull MessengerProvider messengerProvider);
/**
* Gets the {@link NodeBuilderRegistry}.
@@ -247,7 +248,7 @@ public interface LuckPerms {
* @return the node builder registry
*/
@Internal
NodeBuilderRegistry getNodeBuilderRegistry();
@NonNull NodeBuilderRegistry getNodeBuilderRegistry();
/**
* Gets the {@link QueryOptionsRegistry}.
@@ -256,7 +257,7 @@ public interface LuckPerms {
* @since 5.1
*/
@Internal
QueryOptionsRegistry getQueryOptionsRegistry();
@NonNull QueryOptionsRegistry getQueryOptionsRegistry();
/**
* Gets the {@link NodeMatcherFactory}.
@@ -265,7 +266,7 @@ public interface LuckPerms {
* @since 5.1
*/
@Internal
NodeMatcherFactory getNodeMatcherFactory();
@NonNull NodeMatcherFactory getNodeMatcherFactory();
/**
* Gets the {@link ActionFilterFactory}.
@@ -274,6 +275,7 @@ public interface LuckPerms {
* @since 5.5
*/
@Internal
@NonNull
ActionFilterFactory getActionFilterFactory();
}
@@ -25,7 +25,7 @@
package net.luckperms.api;
import org.jspecify.annotations.Nullable;
import org.checkerframework.checker.nullness.qual.NonNull;
import static org.jetbrains.annotations.ApiStatus.Internal;
@@ -36,7 +36,7 @@ import static org.jetbrains.annotations.ApiStatus.Internal;
* instance, however, this provider can be used if this is not viable.</p>
*/
public final class LuckPermsProvider {
private static @Nullable LuckPerms instance = null;
private static LuckPerms instance = null;
/**
* Gets an instance of the {@link LuckPerms} API,
@@ -47,7 +47,7 @@ public final class LuckPermsProvider {
* @return an instance of the LuckPerms API
* @throws IllegalStateException if the API is not loaded yet
*/
public static LuckPerms get() {
public static @NonNull LuckPerms get() {
LuckPerms instance = LuckPermsProvider.instance;
if (instance == null) {
throw new NotLoadedException();
@@ -79,8 +79,7 @@ public final class LuckPermsProvider {
" a) the LuckPerms plugin is not installed or it failed to enable\n" +
" b) the plugin in the stacktrace does not declare a dependency on LuckPerms\n" +
" c) the plugin in the stacktrace is retrieving the API before the plugin 'enable' phase\n" +
" (call the #get method in onEnable, not the constructor!)\n" +
" d) the plugin in the stacktrace is incorrectly 'shading' the LuckPerms API into its jar\n";
" (call the #get method in onEnable, not the constructor!)\n";
NotLoadedException() {
super(MESSAGE);
@@ -26,8 +26,9 @@
package net.luckperms.api.actionlog;
import net.luckperms.api.LuckPermsProvider;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.jetbrains.annotations.ApiStatus.NonExtendable;
import org.jspecify.annotations.Nullable;
import java.time.Instant;
import java.util.Optional;
@@ -46,7 +47,7 @@ public interface Action extends Comparable<Action> {
*
* @return a new builder
*/
static Builder builder() {
static @NonNull Builder builder() {
return LuckPermsProvider.get().getActionLogger().actionBuilder();
}
@@ -55,21 +56,21 @@ public interface Action extends Comparable<Action> {
*
* @return the timestamp
*/
Instant getTimestamp();
@NonNull Instant getTimestamp();
/**
* Gets the source of the action.
*
* @return the source
*/
Source getSource();
@NonNull Source getSource();
/**
* Gets the target of the action.
*
* @return the target
*/
Target getTarget();
@NonNull Target getTarget();
/**
* Returns a string describing the action which took place.
@@ -79,7 +80,7 @@ public interface Action extends Comparable<Action> {
*
* @return the action
*/
String getDescription();
@NonNull String getDescription();
/**
* Represents the source of an action.
@@ -92,14 +93,14 @@ public interface Action extends Comparable<Action> {
*
* @return the source unique id
*/
UUID getUniqueId();
@NonNull UUID getUniqueId();
/**
* Gets the source name.
*
* @return the source name
*/
String getName();
@NonNull String getName();
}
@@ -114,21 +115,21 @@ public interface Action extends Comparable<Action> {
*
* @return the target unique id
*/
Optional<UUID> getUniqueId();
@NonNull Optional<UUID> getUniqueId();
/**
* Gets the target name.
*
* @return the target name
*/
String getName();
@NonNull String getName();
/**
* Gets the target type.
*
* @return the target type
*/
Type getType();
@NonNull Type getType();
/**
* Represents the type of {@link Target}.
@@ -150,7 +151,7 @@ public interface Action extends Comparable<Action> {
* @return the builder
* @see Action#getTimestamp()
*/
Builder timestamp(Instant timestamp);
@NonNull Builder timestamp(@NonNull Instant timestamp);
/**
* Sets the actor of the entry.
@@ -158,7 +159,7 @@ public interface Action extends Comparable<Action> {
* @param actor the actor
* @return the builder
*/
Builder source(UUID actor);
@NonNull Builder source(@NonNull UUID actor);
/**
* Sets the actor name of the entry.
@@ -166,7 +167,7 @@ public interface Action extends Comparable<Action> {
* @param actorName the actor name
* @return the builder
*/
Builder sourceName(String actorName);
@NonNull Builder sourceName(@NonNull String actorName);
/**
* Sets the type of the entry.
@@ -174,7 +175,7 @@ public interface Action extends Comparable<Action> {
* @param type the type
* @return the builder
*/
Builder targetType(Target.Type type);
@NonNull Builder targetType(Target.@NonNull Type type);
/**
* Sets the acted object for the entry.
@@ -182,7 +183,7 @@ public interface Action extends Comparable<Action> {
* @param acted the acted object
* @return the builder
*/
Builder target(@Nullable UUID acted);
@NonNull Builder target(@Nullable UUID acted);
/**
* Sets the acted name for the entry.
@@ -190,7 +191,7 @@ public interface Action extends Comparable<Action> {
* @param actedName the acted name
* @return the builder
*/
Builder targetName(String actedName);
@NonNull Builder targetName(@NonNull String actedName);
/**
* Sets the action of the entry.
@@ -198,14 +199,14 @@ public interface Action extends Comparable<Action> {
* @param action the action
* @return the builder
*/
Builder description(String action);
@NonNull Builder description(@NonNull String action);
/**
* Creates a {@link Action} instance from the builder.
*
* @return a new log entry instance
*/
Action build();
@NonNull Action build();
}
@@ -26,6 +26,7 @@
package net.luckperms.api.actionlog;
import net.luckperms.api.actionlog.filter.ActionFilter;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.Unmodifiable;
import java.util.SortedSet;
@@ -52,23 +53,23 @@ public interface ActionLog {
*
* @return the content
*/
@Unmodifiable SortedSet<Action> getContent();
@NonNull @Unmodifiable SortedSet<Action> getContent();
/**
* Gets the entries in the log performed by the given actor.
*
* @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
*/
@Unmodifiable SortedSet<Action> getContent(UUID actor);
@NonNull @Unmodifiable SortedSet<Action> getContent(@NonNull UUID actor);
/**
* Gets the log content for a given user
*
* @param uniqueId the UUID to filter by
* @return all content in this log where the user = UUID
* @param uniqueId the uuid to filter by
* @return all content in this log where the user = uuid
*/
@Unmodifiable SortedSet<Action> getUserHistory(UUID uniqueId);
@NonNull @Unmodifiable SortedSet<Action> getUserHistory(@NonNull UUID uniqueId);
/**
* Gets the log content for a given group
@@ -76,7 +77,7 @@ public interface ActionLog {
* @param name the name to filter by
* @return all content in this log where the group = name
*/
@Unmodifiable SortedSet<Action> getGroupHistory(String name);
@NonNull @Unmodifiable SortedSet<Action> getGroupHistory(@NonNull String name);
/**
* Gets the log content for a given track
@@ -84,6 +85,6 @@ public interface ActionLog {
* @param name the name to filter by
* @return all content in this log where the track = name
*/
@Unmodifiable SortedSet<Action> getTrackHistory(String name);
@NonNull @Unmodifiable SortedSet<Action> getTrackHistory(@NonNull String name);
}
@@ -27,6 +27,7 @@ package net.luckperms.api.actionlog;
import net.luckperms.api.actionlog.filter.ActionFilter;
import net.luckperms.api.util.Page;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.List;
import java.util.concurrent.CompletableFuture;
@@ -41,7 +42,7 @@ public interface ActionLogger {
*
* @return a new builder
*/
Action.Builder actionBuilder();
Action.@NonNull Builder actionBuilder();
/**
* Gets a {@link ActionLog} instance from the plugin storage.
@@ -51,7 +52,7 @@ public interface ActionLogger {
* are more efficient (they don't load the full action log into memory) and allow for pagination.
*/
@Deprecated
CompletableFuture<ActionLog> getLog();
@NonNull CompletableFuture<ActionLog> getLog();
/**
* Gets all actions from the action log matching the given {@code filter}.
@@ -65,7 +66,7 @@ public interface ActionLogger {
* @return the actions
* @since 5.5
*/
CompletableFuture<List<Action>> queryActions(ActionFilter filter);
@NonNull CompletableFuture<List<Action>> queryActions(@NonNull ActionFilter filter);
/**
* Gets a page of actions from the action log matching the given {@code filter}.
@@ -78,7 +79,7 @@ public interface ActionLogger {
* @return the page of actions
* @since 5.5
*/
CompletableFuture<Page<Action>> queryActions(ActionFilter filter, int pageSize, int pageNumber);
@NonNull CompletableFuture<Page<Action>> queryActions(@NonNull ActionFilter filter, int pageSize, int pageNumber);
/**
* Submits a logged action to LuckPerms.
@@ -97,7 +98,7 @@ public interface ActionLogger {
* @param entry the entry to submit
* @return a future which will complete when the action is submitted
*/
CompletableFuture<Void> submit(Action entry);
@NonNull CompletableFuture<Void> submit(@NonNull Action entry);
/**
* Submits a logged action to LuckPerms and persists it in the storage backend.
@@ -107,7 +108,7 @@ public interface ActionLogger {
* @param entry the entry to submit
* @return a future which will complete when the action is submitted
*/
CompletableFuture<Void> submitToStorage(Action entry);
@NonNull CompletableFuture<Void> submitToStorage(@NonNull Action entry);
/**
* Submits a logged action to LuckPerms and broadcasts it to administrators.
@@ -120,6 +121,6 @@ public interface ActionLogger {
* @param entry the entry to submit
* @return a future which will complete when the action is broadcasted
*/
CompletableFuture<Void> broadcastAction(Action entry);
@NonNull CompletableFuture<Void> broadcastAction(@NonNull Action entry);
}
@@ -26,5 +26,4 @@
/**
* {@link net.luckperms.api.actionlog.Action} filters.
*/
@org.jspecify.annotations.NullMarked
package net.luckperms.api.actionlog.filter;
@@ -24,7 +24,6 @@
*/
/**
* {@link net.luckperms.api.actionlog.ActionLogger} related functionality.
* {@link net.luckperms.api.actionlog.ActionLog} related functionality.
*/
@org.jspecify.annotations.NullMarked
package net.luckperms.api.actionlog;
@@ -26,6 +26,7 @@
package net.luckperms.api.cacheddata;
import net.luckperms.api.query.QueryOptions;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Holds cached lookup data for a given set of query options.
@@ -41,6 +42,6 @@ public interface CachedData {
*
* @return the query options this container is caching
*/
QueryOptions getQueryOptions();
@NonNull QueryOptions getQueryOptions();
}
@@ -30,6 +30,7 @@ import net.luckperms.api.model.PermissionHolder;
import net.luckperms.api.model.group.Group;
import net.luckperms.api.model.user.User;
import net.luckperms.api.query.QueryOptions;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.concurrent.CompletableFuture;
@@ -47,14 +48,14 @@ public interface CachedDataManager {
*
* @return the permission data manager
*/
Container<CachedPermissionData> permissionData();
@NonNull Container<CachedPermissionData> permissionData();
/**
* Gets the manager for {@link CachedMetaData}.
*
* @return the meta data manager
*/
Container<CachedMetaData> metaData();
@NonNull Container<CachedMetaData> metaData();
/**
* Gets PermissionData from the cache, using the given query options.
@@ -62,7 +63,7 @@ public interface CachedDataManager {
* @param queryOptions the query options
* @return a permission data instance
*/
CachedPermissionData getPermissionData(QueryOptions queryOptions);
@NonNull CachedPermissionData getPermissionData(@NonNull QueryOptions queryOptions);
/**
* Gets MetaData from the cache, using the given query options.
@@ -70,7 +71,7 @@ public interface CachedDataManager {
* @param queryOptions the query options
* @return a meta data instance
*/
CachedMetaData getMetaData(QueryOptions queryOptions);
@NonNull CachedMetaData getMetaData(@NonNull QueryOptions queryOptions);
/**
* Gets PermissionData from the cache, using the most appropriate query options
@@ -78,7 +79,7 @@ public interface CachedDataManager {
*
* <p>For {@link User}s, the most appropriate query options will be their
* {@link ContextManager#getQueryOptions(User) current active query options} if the
* corresponding player is online, and otherwise, will fall back to
* corresponding player is online, and otherwise, will fallback to
* {@link ContextManager#getStaticQueryOptions() the current static query options}.</p>
*
* <p>For {@link Group}s, the most appropriate query options will always be
@@ -87,7 +88,7 @@ public interface CachedDataManager {
* @return a permission data instance
* @since 5.1
*/
CachedPermissionData getPermissionData();
@NonNull CachedPermissionData getPermissionData();
/**
* Gets MetaData from the cache, using the most appropriate query options
@@ -95,7 +96,7 @@ public interface CachedDataManager {
*
* <p>For {@link User}s, the most appropriate query options will be their
* {@link ContextManager#getQueryOptions(User) current active query options} if the
* corresponding player is online, and otherwise, will fall back to
* corresponding player is online, and otherwise, will fallback to
* {@link ContextManager#getStaticQueryOptions() the current static query options}.</p>
*
* <p>For {@link Group}s, the most appropriate query options will always be
@@ -105,7 +106,7 @@ public interface CachedDataManager {
* @since 5.1
* @see PermissionHolder#getQueryOptions()
*/
CachedMetaData getMetaData();
@NonNull CachedMetaData getMetaData();
/**
* Invalidates all cached {@link CachedPermissionData} and {@link CachedMetaData}
@@ -135,7 +136,7 @@ public interface CachedDataManager {
* @return a data instance
* @throws NullPointerException if contexts is null
*/
T get(QueryOptions queryOptions);
@NonNull T get(@NonNull QueryOptions queryOptions);
/**
* Calculates {@link T data}, bypassing the cache.
@@ -152,7 +153,7 @@ public interface CachedDataManager {
* @return a data instance
* @throws NullPointerException if contexts is null
*/
T calculate(QueryOptions queryOptions);
@NonNull T calculate(@NonNull QueryOptions queryOptions);
/**
* (Re)calculates data for a given context.
@@ -170,7 +171,7 @@ public interface CachedDataManager {
* @param queryOptions the query options
* @throws NullPointerException if contexts is null
*/
void recalculate(QueryOptions queryOptions);
void recalculate(@NonNull QueryOptions queryOptions);
/**
* (Re)loads permission data for a given context.
@@ -196,7 +197,7 @@ public interface CachedDataManager {
* @return a future
* @throws NullPointerException if contexts is null
*/
CompletableFuture<? extends T> reload(QueryOptions queryOptions);
@NonNull CompletableFuture<? extends T> reload(@NonNull QueryOptions queryOptions);
/**
* Recalculates data for all known contexts.
@@ -228,14 +229,14 @@ public interface CachedDataManager {
*
* @return a future
*/
CompletableFuture<Void> reload();
@NonNull CompletableFuture<Void> reload();
/**
* Invalidates any cached data instances mapped to the given context.
*
* @param queryOptions the queryOptions to invalidate for
*/
void invalidate(QueryOptions queryOptions);
void invalidate(@NonNull QueryOptions queryOptions);
/**
* Invalidates all cached data instances.
@@ -30,8 +30,9 @@ import net.luckperms.api.node.types.MetaNode;
import net.luckperms.api.node.types.PrefixNode;
import net.luckperms.api.node.types.SuffixNode;
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.Unmodifiable;
import org.jspecify.annotations.Nullable;
import java.util.List;
import java.util.Map;
@@ -62,7 +63,7 @@ public interface CachedMetaData extends CachedData {
* @return a result containing the value
* @since 5.4
*/
Result<String, MetaNode> queryMetaValue(String key);
@NonNull Result<String, MetaNode> queryMetaValue(@NonNull String key);
/**
* Gets a value for the given meta key.
@@ -72,7 +73,7 @@ public interface CachedMetaData extends CachedData {
* @param key the key
* @return the value
*/
default @Nullable String getMetaValue(String key) {
default @Nullable String getMetaValue(@NonNull String key) {
return queryMetaValue(key).result();
}
@@ -96,7 +97,7 @@ public interface CachedMetaData extends CachedData {
* @return the meta value
* @since 5.3
*/
default <T> Optional<T> getMetaValue(String key, Function<String, ? extends T> valueTransformer) {
default <T> @NonNull Optional<T> getMetaValue(@NonNull String key, @NonNull Function<String, ? extends T> valueTransformer) {
return Optional.ofNullable(getMetaValue(key)).map(value -> {
try {
return valueTransformer.apply(value);
@@ -117,12 +118,12 @@ public interface CachedMetaData extends CachedData {
*
* <p>This method will always return a {@link Result}, but the
* {@link Result#result() inner result} {@link String} will be null if
* the resultant prefix stack contained no elements.</p>
* a the resultant prefix stack contained no elements.</p>
*
* @return a result containing the prefix
* @since 5.4
*/
Result<String, PrefixNode> queryPrefix();
@NonNull Result<String, PrefixNode> queryPrefix();
/**
* Gets the prefix.
@@ -152,12 +153,12 @@ public interface CachedMetaData extends CachedData {
*
* <p>This method will always return a {@link Result}, but the
* {@link Result#result() inner result} {@link String} will be null if
* the resultant suffix stack contained no elements.</p>
* a the resultant suffix stack contained no elements.</p>
*
* @return a result containing the suffix
* @since 5.4
*/
Result<String, SuffixNode> querySuffix();
@NonNull Result<String, SuffixNode> querySuffix();
/**
* Gets the suffix.
@@ -186,7 +187,7 @@ public interface CachedMetaData extends CachedData {
* @return a result containing the weight
* @since 5.5
*/
Result<Integer, WeightNode> queryWeight();
@NonNull Result<Integer, WeightNode> queryWeight();
/**
* Gets the weight.
@@ -207,7 +208,7 @@ public interface CachedMetaData extends CachedData {
*
* @return a map of meta
*/
@Unmodifiable Map<String, List<String>> getMeta();
@NonNull @Unmodifiable Map<String, List<String>> getMeta();
/**
* Gets a sorted map of all accumulated {@link PrefixNode prefixes}.
@@ -216,7 +217,7 @@ public interface CachedMetaData extends CachedData {
*
* @return a sorted map of prefixes
*/
@Unmodifiable SortedMap<Integer, String> getPrefixes();
@NonNull @Unmodifiable SortedMap<Integer, String> getPrefixes();
/**
* Gets a sorted map of all accumulated {@link SuffixNode suffixes}.
@@ -225,7 +226,7 @@ public interface CachedMetaData extends CachedData {
*
* @return a sorted map of suffixes
*/
@Unmodifiable SortedMap<Integer, String> getSuffixes();
@NonNull @Unmodifiable SortedMap<Integer, String> getSuffixes();
/**
* Gets the name of the holders primary group.
@@ -242,13 +243,13 @@ public interface CachedMetaData extends CachedData {
*
* @return the definition used for the prefix stack
*/
MetaStackDefinition getPrefixStackDefinition();
@NonNull MetaStackDefinition getPrefixStackDefinition();
/**
* Gets the definition used for the suffix stack.
*
* @return the definition used for the suffix stack
*/
MetaStackDefinition getSuffixStackDefinition();
@NonNull MetaStackDefinition getSuffixStackDefinition();
}
@@ -27,6 +27,7 @@ package net.luckperms.api.cacheddata;
import net.luckperms.api.node.Node;
import net.luckperms.api.util.Tristate;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.Unmodifiable;
import java.util.Map;
@@ -51,7 +52,7 @@ public interface CachedPermissionData extends CachedData {
* @throws NullPointerException if permission is null
* @since 5.4
*/
Result<Tristate, Node> queryPermission(String permission);
@NonNull Result<Tristate, Node> queryPermission(@NonNull String permission);
/**
* Performs a permission check for the given {@code permission} node.
@@ -63,7 +64,7 @@ public interface CachedPermissionData extends CachedData {
* @return a tristate result
* @throws NullPointerException if permission is null
*/
default Tristate checkPermission(String permission) {
default @NonNull Tristate checkPermission(@NonNull String permission) {
return queryPermission(permission).result();
}
@@ -79,6 +80,6 @@ public interface CachedPermissionData extends CachedData {
*
* @return an immutable set of permissions
*/
@Unmodifiable Map<String, Boolean> getPermissionMap();
@NonNull @Unmodifiable Map<String, Boolean> getPermissionMap();
}
@@ -26,7 +26,7 @@
package net.luckperms.api.cacheddata;
import net.luckperms.api.node.Node;
import org.jspecify.annotations.Nullable;
import org.checkerframework.checker.nullness.qual.Nullable;
/**
* Represents the result of a cached data lookup.
@@ -27,5 +27,4 @@
* Caches permission checks and meta lookups for {@link net.luckperms.api.model.user.User}s and
* {@link net.luckperms.api.model.group.Group}s.
*/
@org.jspecify.annotations.NullMarked
package net.luckperms.api.cacheddata;
@@ -25,7 +25,8 @@
package net.luckperms.api.context;
import org.jspecify.annotations.Nullable;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
/**
* Represents an individual context pair.
@@ -88,13 +89,13 @@ public interface Context {
*
* @return the key
*/
String getKey();
@NonNull String getKey();
/**
* Gets the context value
*
* @return the value
*/
String getValue();
@NonNull String getValue();
}
@@ -25,7 +25,7 @@
package net.luckperms.api.context;
import org.jspecify.annotations.Nullable;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Objects;
import java.util.function.Function;
@@ -38,8 +38,8 @@ import java.util.function.Function;
* <ul>
* <li>Context lookups should be <i>fast</i>: lookup methods are likely to
* be invoked frequently, and should therefore be fast to execute. If
* determining the current contexts involves a particularly time-consuming
* lookup (database queries, network requests, etc.), then such results
* determining the current contexts involves a particularly time consuming
* lookup (database queries, network requests, etc), then such results
* should be cached ahead of time.</li>
*
* <li>Context lookups should be <i>thread-safe</i>: lookups will sometimes
@@ -70,7 +70,7 @@ public interface ContextCalculator<T> {
* @param <T> the contextual type
* @return the resultant calculator
*/
static <T> ContextCalculator<T> forSingleContext(String key, Function<T, @Nullable String> valueFunction) {
static <T> @NonNull ContextCalculator<T> forSingleContext(@NonNull String key, @NonNull Function<T, String> valueFunction) {
Objects.requireNonNull(key, "key");
Objects.requireNonNull(valueFunction, "valueFunction");
return (target, consumer) -> {
@@ -92,7 +92,7 @@ public interface ContextCalculator<T> {
* @param target the target contextual subject for this operation
* @param consumer the {@link ContextConsumer} to submit contexts to
*/
void calculate(T target, ContextConsumer consumer);
void calculate(@NonNull T target, @NonNull ContextConsumer consumer);
/**
* Gets a {@link ContextSet}, containing some/all of the contexts this
@@ -103,7 +103,7 @@ public interface ContextCalculator<T> {
*
* @return a set of potential contexts
*/
default ContextSet estimatePotentialContexts() {
default @NonNull ContextSet estimatePotentialContexts() {
return ImmutableContextSet.empty();
}
@@ -25,6 +25,8 @@
package net.luckperms.api.context;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Functional interface that accepts context key value pairs.
*/
@@ -37,14 +39,14 @@ public interface ContextConsumer {
* @param key the key
* @param value the value
*/
void accept(String key, String value);
void accept(@NonNull String key, @NonNull String value);
/**
* Accepts a context pair.
*
* @param context the context
*/
default void accept(Context context) {
default void accept(@NonNull Context context) {
accept(context.getKey(), context.getValue());
}
@@ -53,7 +55,7 @@ public interface ContextConsumer {
*
* @param contextSet the context set
*/
default void accept(ContextSet contextSet) {
default void accept(@NonNull ContextSet contextSet) {
for (Context entry : contextSet) {
accept(entry);
}
@@ -28,6 +28,7 @@ package net.luckperms.api.context;
import net.luckperms.api.model.user.User;
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;
@@ -60,7 +61,7 @@ public interface ContextManager {
* @param subject the subject
* @return the applicable context for the subject
*/
ImmutableContextSet getContext(Object subject);
@NonNull ImmutableContextSet getContext(@NonNull Object subject);
/**
* Queries the ContextManager for current context values for the given User.
@@ -75,7 +76,7 @@ public interface ContextManager {
* @param user the user
* @return the applicable context for the subject
*/
Optional<ImmutableContextSet> getContext(User user);
@NonNull Optional<ImmutableContextSet> getContext(@NonNull User user);
/**
* Gets the contexts from the static calculators in this manager.
@@ -85,7 +86,7 @@ public interface ContextManager {
*
* @return the current active static contexts
*/
ImmutableContextSet getStaticContext();
@NonNull ImmutableContextSet getStaticContext();
/**
* Creates a new {@link QueryOptions.Builder}.
@@ -93,7 +94,7 @@ public interface ContextManager {
* @param mode the mode
* @return a new query options builder
*/
QueryOptions.Builder queryOptionsBuilder(QueryMode mode);
QueryOptions.@NonNull Builder queryOptionsBuilder(@NonNull QueryMode mode);
/**
* Obtains current {@link QueryOptions} for the subject.
@@ -101,7 +102,7 @@ public interface ContextManager {
* @param subject the subject
* @return the query options for the subject
*/
QueryOptions getQueryOptions(Object subject);
@NonNull QueryOptions getQueryOptions(@NonNull Object subject);
/**
* Obtains current {@link QueryOptions} for the given User.
@@ -115,28 +116,28 @@ public interface ContextManager {
* @param user the user
* @return the query options for the subject
*/
Optional<QueryOptions> getQueryOptions(User user);
@NonNull Optional<QueryOptions> getQueryOptions(@NonNull User user);
/**
* Gets the static query options, using the registered static context calculators.
*
* @return the current static query options
*/
QueryOptions getStaticQueryOptions();
@NonNull QueryOptions getStaticQueryOptions();
/**
* Registers a context calculator with the manager.
*
* @param calculator the calculator
*/
void registerCalculator(ContextCalculator<?> calculator);
void registerCalculator(@NonNull ContextCalculator<?> calculator);
/**
* Unregisters a context calculator with the manager.
*
* @param calculator the calculator
*/
void unregisterCalculator(ContextCalculator<?> calculator);
void unregisterCalculator(@NonNull ContextCalculator<?> calculator);
/**
* Signal to the {@link ContextManager} that a {@code subject}s
@@ -148,7 +149,7 @@ public interface ContextManager {
* @param subject the subject
* @since 5.2
*/
void signalContextUpdate(Object subject);
void signalContextUpdate(@NonNull Object subject);
/**
* Gets the {@link ContextSetFactory}, responsible for creating
@@ -157,7 +158,7 @@ public interface ContextManager {
* @return the context set factory
*/
@Internal
ContextSetFactory getContextSetFactory();
@NonNull ContextSetFactory getContextSetFactory();
/**
* Invalidates the lookup cache for a given subject
@@ -166,7 +167,7 @@ public interface ContextManager {
* @deprecated Use {@link #signalContextUpdate(Object)} instead
*/
@Deprecated
default void invalidateCache(Object subject) {
default void invalidateCache(@NonNull Object subject) {
signalContextUpdate(subject);
}
@@ -25,6 +25,7 @@
package net.luckperms.api.context;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.Unmodifiable;
import java.util.Iterator;
@@ -64,7 +65,7 @@ import java.util.Set;
* the '{@code :}' character. (e.g. "{@code worldguard:region}" for WorldGuard
* regions)</p>
*
* <p>Contexts can be combined with each other to form so-called
* <p>Contexts can be combined with each other to form so called
* "context sets" - simply a collection of context pairs.</p>
*
* <p>Two default ContextSet implementations are provided.
@@ -90,7 +91,7 @@ public interface ContextSet extends Iterable<Context> {
*
* @return an immutable representation of this set
*/
ImmutableContextSet immutableCopy();
@NonNull ImmutableContextSet immutableCopy();
/**
* Creates a mutable copy of this {@link ContextSet}.
@@ -100,7 +101,7 @@ public interface ContextSet extends Iterable<Context> {
*
* @return a mutable ContextSet
*/
MutableContextSet mutableCopy();
@NonNull MutableContextSet mutableCopy();
/**
* Returns a {@link Set} of {@link Context}s representing the current
@@ -111,7 +112,7 @@ public interface ContextSet extends Iterable<Context> {
*
* @return an immutable set
*/
@Unmodifiable Set<Context> toSet();
@NonNull @Unmodifiable Set<Context> toSet();
/**
* Returns a {@link Map} representing the current state of this
@@ -122,7 +123,7 @@ public interface ContextSet extends Iterable<Context> {
*
* @return a map
*/
@Unmodifiable Map<String, Set<String>> toMap();
@NonNull @Unmodifiable Map<String, Set<String>> toMap();
/**
* Returns a {@link Map} <b>loosely</b> representing the current state of
@@ -138,7 +139,7 @@ public interface ContextSet extends Iterable<Context> {
* @deprecated Deprecated because the returned map may not contain all data in the ContextSet
*/
@Deprecated
@Unmodifiable Map<String, String> toFlattenedMap();
@NonNull @Unmodifiable Map<String, String> toFlattenedMap();
/**
* 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
*/
@Override
@Unmodifiable Iterator<Context> iterator();
@NonNull @Unmodifiable Iterator<Context> iterator();
/**
* Returns if the {@link ContextSet} contains at least one value for the
@@ -161,7 +162,7 @@ public interface ContextSet extends Iterable<Context> {
* @return true if the set contains a value for the key
* @throws NullPointerException if the key is null
*/
boolean containsKey(String key);
boolean containsKey(@NonNull String key);
/**
* Returns a {@link Set} of the values mapped to the given key.
@@ -173,7 +174,7 @@ public interface ContextSet extends Iterable<Context> {
* @return a set of values
* @throws NullPointerException if the key is null
*/
@Unmodifiable Set<String> getValues(String key);
@NonNull @Unmodifiable Set<String> getValues(@NonNull String key);
/**
* Returns any value from this {@link ContextSet} matching the key, if present.
@@ -184,7 +185,7 @@ public interface ContextSet extends Iterable<Context> {
* @param key the key to find values for
* @return an optional containing any match
*/
default Optional<String> getAnyValue(String key) {
default @NonNull Optional<String> getAnyValue(@NonNull String key) {
return getValues(key).stream().findAny();
}
@@ -196,7 +197,7 @@ public interface ContextSet extends Iterable<Context> {
* @return true if the set contains the context pair
* @throws NullPointerException if the key or value is null
*/
boolean contains(String key, String value);
boolean contains(@NonNull String key, @NonNull String value);
/**
* Returns if the {@link ContextSet} contains a given context pairing.
@@ -205,7 +206,7 @@ public interface ContextSet extends Iterable<Context> {
* @return true if the set contains the context pair
* @throws NullPointerException if the key or value is null
*/
default boolean contains(Context entry) {
default boolean contains(@NonNull Context entry) {
Objects.requireNonNull(entry, "entry");
return contains(entry.getKey(), entry.getValue());
}
@@ -218,7 +219,7 @@ public interface ContextSet extends Iterable<Context> {
* @return true if the set contains any of the pairs
* @since 5.2
*/
default boolean containsAny(String key, Iterable<String> values) {
default boolean containsAny(@NonNull String key, @NonNull Iterable<String> values) {
Objects.requireNonNull(key, "key");
Objects.requireNonNull(values, "values");
@@ -238,7 +239,7 @@ public interface ContextSet extends Iterable<Context> {
* @param other the other set
* @return true if this context set is satisfied by the other
*/
default boolean isSatisfiedBy(ContextSet other) {
default boolean isSatisfiedBy(@NonNull ContextSet other) {
return isSatisfiedBy(other, ContextSatisfyMode.AT_LEAST_ONE_VALUE_PER_KEY);
}
@@ -251,7 +252,7 @@ public interface ContextSet extends Iterable<Context> {
* @return true if this context set is satisfied by the other
* @since 5.2
*/
boolean isSatisfiedBy(ContextSet other, ContextSatisfyMode mode);
boolean isSatisfiedBy(@NonNull ContextSet other, @NonNull ContextSatisfyMode mode);
/**
* Returns if the {@link ContextSet} is empty.
@@ -25,6 +25,7 @@
package net.luckperms.api.context;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus.Internal;
/**
@@ -39,10 +40,10 @@ public interface ContextSetFactory {
/**
* Prefer using {@link ImmutableContextSet#builder()}.
*
* @return an immutable context set builder
* @return a immutable context set builder
* @see ImmutableContextSet#builder()
*/
ImmutableContextSet.Builder immutableBuilder();
ImmutableContextSet.@NonNull Builder immutableBuilder();
/**
* Prefer using {@link ImmutableContextSet#of(String, String)}.
@@ -52,7 +53,7 @@ public interface ContextSetFactory {
* @return an immutable context set
* @see ImmutableContextSet#of(String, String)
*/
ImmutableContextSet immutableOf(String key, String value);
@NonNull ImmutableContextSet immutableOf(@NonNull String key, @NonNull String value);
/**
* Prefer using {@link ImmutableContextSet#empty()}.
@@ -60,7 +61,7 @@ public interface ContextSetFactory {
* @return an empty immutable context set
* @see ImmutableContextSet#empty()
*/
ImmutableContextSet immutableEmpty();
@NonNull ImmutableContextSet immutableEmpty();
/**
* Prefer using {@link MutableContextSet#create()}.
@@ -68,6 +69,6 @@ public interface ContextSetFactory {
* @return a new mutable context set
* @see MutableContextSet#create()
*/
MutableContextSet mutable();
@NonNull MutableContextSet mutable();
}
@@ -34,17 +34,17 @@ public final class DefaultContextKeys {
}
/**
* The context key used to denote the name of the subject's server.
* The context key used to denote the name of the subjects server.
*/
public static final String SERVER_KEY = "server";
/**
* The context key used to denote the name of the subject's world.
* The context key used to denote the name of the subjects world.
*/
public static final String WORLD_KEY = "world";
/**
* The context key used to denote the dimension type of the subject's world.
* The context key used to denote the dimension type of the subjects world.
*
* <p>Possible values: overworld, the_nether, the_end</p>
*
@@ -53,7 +53,7 @@ public final class DefaultContextKeys {
public static final String DIMENSION_TYPE_KEY = "dimension-type";
/**
* The context key used to denote the subject's gamemode.
* The context key used to denote the subjects gamemode.
*
* <p>Possible values: survival, creative, adventure, spectator</p>
*
@@ -26,6 +26,7 @@
package net.luckperms.api.context;
import net.luckperms.api.LuckPermsProvider;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Objects;
@@ -39,7 +40,7 @@ public interface ImmutableContextSet extends ContextSet {
*
* @return a new ImmutableContextSet builder
*/
static Builder builder() {
static @NonNull Builder builder() {
return LuckPermsProvider.get().getContextManager().getContextSetFactory().immutableBuilder();
}
@@ -48,7 +49,7 @@ public interface ImmutableContextSet extends ContextSet {
*
* @return an empty ImmutableContextSet
*/
static ImmutableContextSet empty() {
static @NonNull ImmutableContextSet empty() {
return LuckPermsProvider.get().getContextManager().getContextSetFactory().immutableEmpty();
}
@@ -60,7 +61,7 @@ public interface ImmutableContextSet extends ContextSet {
* @return a new ImmutableContextSet containing one context pair
* @throws NullPointerException if key or value is null
*/
static ImmutableContextSet of(String key, String value) {
static @NonNull ImmutableContextSet of(@NonNull String key, @NonNull String value) {
return LuckPermsProvider.get().getContextManager().getContextSetFactory().immutableOf(key, value);
}
@@ -69,7 +70,7 @@ public interface ImmutableContextSet extends ContextSet {
*/
@Override
@Deprecated
ImmutableContextSet immutableCopy();
@NonNull ImmutableContextSet immutableCopy();
/**
* A builder for {@link ImmutableContextSet}.
@@ -85,7 +86,7 @@ public interface ImmutableContextSet extends ContextSet {
* @throws NullPointerException if the key or value is null
* @see MutableContextSet#add(String, String)
*/
Builder add(String key, String value);
@NonNull Builder add(@NonNull String key, @NonNull String value);
/**
* Adds a context to the set.
@@ -95,7 +96,7 @@ public interface ImmutableContextSet extends ContextSet {
* @throws NullPointerException if the entry is null
* @see MutableContextSet#add(Context)
*/
default Builder add(Context entry) {
default @NonNull Builder add(@NonNull Context entry) {
Objects.requireNonNull(entry, "entry");
add(entry.getKey(), entry.getValue());
return this;
@@ -109,7 +110,7 @@ public interface ImmutableContextSet extends ContextSet {
* @throws NullPointerException if iterable is null
* @see MutableContextSet#addAll(Iterable)
*/
default Builder addAll(Iterable<Context> iterable) {
default @NonNull Builder addAll(@NonNull Iterable<Context> iterable) {
for (Context e : Objects.requireNonNull(iterable, "iterable")) {
add(e);
}
@@ -124,7 +125,7 @@ public interface ImmutableContextSet extends ContextSet {
* @throws NullPointerException if the contextSet is null
* @see MutableContextSet#addAll(ContextSet)
*/
Builder addAll(ContextSet contextSet);
@NonNull Builder addAll(@NonNull ContextSet contextSet);
/**
* Creates a {@link ImmutableContextSet} from the values previously
@@ -132,6 +133,6 @@ public interface ImmutableContextSet extends ContextSet {
*
* @return an {@link ImmutableContextSet} from the builder
*/
ImmutableContextSet build();
@NonNull ImmutableContextSet build();
}
}
@@ -26,6 +26,7 @@
package net.luckperms.api.context;
import net.luckperms.api.LuckPermsProvider;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Objects;
@@ -39,7 +40,7 @@ public interface MutableContextSet extends ContextSet {
*
* @return a new MutableContextSet
*/
static MutableContextSet create() {
static @NonNull MutableContextSet create() {
return LuckPermsProvider.get().getContextManager().getContextSetFactory().mutable();
}
@@ -51,7 +52,7 @@ public interface MutableContextSet extends ContextSet {
* @return a new MutableContextSet containing one context pair
* @throws NullPointerException if key or value is null
*/
static MutableContextSet of(String key, String value) {
static @NonNull MutableContextSet of(@NonNull String key, @NonNull String value) {
Objects.requireNonNull(key, "key");
Objects.requireNonNull(value, "value");
MutableContextSet set = create();
@@ -66,7 +67,7 @@ public interface MutableContextSet extends ContextSet {
* @param value the value to add
* @throws NullPointerException if the key or value is null
*/
void add(String key, String value);
void add(@NonNull String key, @NonNull String value);
/**
* Adds a context to this set.
@@ -74,7 +75,7 @@ public interface MutableContextSet extends ContextSet {
* @param entry the entry to add
* @throws NullPointerException if the entry is null
*/
default void add(Context entry) {
default void add(@NonNull Context entry) {
Objects.requireNonNull(entry, "entry");
add(entry.getKey(), entry.getValue());
}
@@ -85,7 +86,7 @@ public interface MutableContextSet extends ContextSet {
* @param iterable an iterable of key value context pairs
* @throws NullPointerException if iterable is null
*/
default void addAll(Iterable<Context> iterable) {
default void addAll(@NonNull Iterable<Context> iterable) {
for (Context e : Objects.requireNonNull(iterable, "iterable")) {
add(e);
}
@@ -97,7 +98,7 @@ public interface MutableContextSet extends ContextSet {
* @param contextSet the set to add from
* @throws NullPointerException if the contextSet is null
*/
void addAll(ContextSet contextSet);
void addAll(@NonNull ContextSet contextSet);
/**
* Removes a context from this set.
@@ -106,7 +107,7 @@ public interface MutableContextSet extends ContextSet {
* @param value the value to remove
* @throws NullPointerException if the key or value is null
*/
void remove(String key, String value);
void remove(@NonNull String key, @NonNull String value);
/**
* Removes all contexts from this set with the given key.
@@ -114,7 +115,7 @@ public interface MutableContextSet extends ContextSet {
* @param key the key to remove
* @throws NullPointerException if the key is null
*/
void removeAll(String key);
void removeAll(@NonNull String key);
/**
* Removes all contexts from the set.
@@ -25,7 +25,7 @@
package net.luckperms.api.context;
import org.jspecify.annotations.Nullable;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Objects;
import java.util.function.Supplier;
@@ -46,7 +46,7 @@ public interface StaticContextCalculator extends ContextCalculator<Object> {
* if the value returned is null.
* @return the resultant calculator
*/
static StaticContextCalculator forSingleContext(String key, Supplier<@Nullable String> valueFunction) {
static StaticContextCalculator forSingleContext(String key, Supplier<String> valueFunction) {
Objects.requireNonNull(key, "key");
Objects.requireNonNull(valueFunction, "valueFunction");
return consumer -> {
@@ -66,10 +66,10 @@ public interface StaticContextCalculator extends ContextCalculator<Object> {
*
* @param consumer the {@link ContextConsumer} to submit contexts to
*/
void calculate(ContextConsumer consumer);
void calculate(@NonNull ContextConsumer consumer);
@Override
default void calculate(Object target, ContextConsumer consumer) {
default void calculate(@NonNull Object target, @NonNull ContextConsumer consumer) {
calculate(consumer);
}
}
@@ -27,5 +27,4 @@
* Context functionality, including {@link net.luckperms.api.context.ContextSet}s and
* {@link net.luckperms.api.context.ContextCalculator}s.
*/
@org.jspecify.annotations.NullMarked
package net.luckperms.api.context;
@@ -25,6 +25,7 @@
package net.luckperms.api.event;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.Unmodifiable;
import java.util.Set;
@@ -49,7 +50,7 @@ public interface EventBus {
* @param <T> the event class
* @return an event handler instance representing this subscription
*/
<T extends LuckPermsEvent> EventSubscription<T> subscribe(Class<T> eventClass, 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.
@@ -69,7 +70,7 @@ public interface EventBus {
* @param handler the event handler
* @return an event handler instance representing this subscription
*/
<T extends LuckPermsEvent> EventSubscription<T> subscribe(Object plugin, Class<T> eventClass, 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.
@@ -78,6 +79,6 @@ public interface EventBus {
* @param <T> the event class
* @return an immutable set of event handlers
*/
<T extends LuckPermsEvent> @Unmodifiable Set<EventSubscription<T>> getSubscriptions(Class<T> eventClass);
<T extends LuckPermsEvent> @NonNull @Unmodifiable Set<EventSubscription<T>> getSubscriptions(@NonNull Class<T> eventClass);
}
@@ -25,6 +25,8 @@
package net.luckperms.api.event;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.function.Consumer;
/**
@@ -39,7 +41,7 @@ public interface EventSubscription<T extends LuckPermsEvent> extends AutoCloseab
*
* @return the event class
*/
Class<T> getEventClass();
@NonNull Class<T> getEventClass();
/**
* Returns true if this handler is active
@@ -59,5 +61,5 @@ public interface EventSubscription<T extends LuckPermsEvent> extends AutoCloseab
*
* @return the event consumer
*/
Consumer<? super T> getHandler();
@NonNull Consumer<? super T> getHandler();
}
@@ -26,6 +26,7 @@
package net.luckperms.api.event;
import net.luckperms.api.LuckPerms;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* A superinterface for all LuckPerms events.
@@ -37,13 +38,13 @@ public interface LuckPermsEvent {
*
* @return the api instance
*/
LuckPerms getLuckPerms();
@NonNull LuckPerms getLuckPerms();
/**
* Gets the type of the event.
*
* @return the type of the event
*/
Class<? extends LuckPermsEvent> getEventType();
@NonNull Class<? extends LuckPermsEvent> getEventType();
}
@@ -26,5 +26,4 @@
/**
* Event causes.
*/
@org.jspecify.annotations.NullMarked
package net.luckperms.api.event.cause;
@@ -28,6 +28,7 @@ package net.luckperms.api.event.context;
import net.luckperms.api.context.ContextManager;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.util.Param;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Optional;
@@ -57,16 +58,16 @@ public interface ContextUpdateEvent extends LuckPermsEvent {
* @return the subject
*/
@Param(0)
Object getSubject();
@NonNull Object getSubject();
/**
* Gets the subject whose contexts were updated, cast to a given type.
* Gets the subject whose contexts were updated, casted to a given type.
*
* @param subjectClass the type to cast to
* @param <T> the subject type
* @return the cast subject
* @return the casted subject
*/
default <T> Optional<T> getSubject(Class<T> subjectClass) {
default <T> @NonNull Optional<T> getSubject(@NonNull Class<T> subjectClass) {
Object subject = getSubject();
return subjectClass.isInstance(subject) ? Optional.of(subjectClass.cast(subject)) : Optional.empty();
}
@@ -26,5 +26,4 @@
/**
* Events relating to {@link net.luckperms.api.context.Context}s.
*/
@org.jspecify.annotations.NullMarked
package net.luckperms.api.event.context;
@@ -28,6 +28,7 @@ package net.luckperms.api.event.extension;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.extension.Extension;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when an {@link Extension} is loaded.
@@ -40,6 +41,6 @@ public interface ExtensionLoadEvent extends LuckPermsEvent {
* @return the extension
*/
@Param(0)
Extension getExtension();
@NonNull Extension getExtension();
}
@@ -26,5 +26,4 @@
/**
* Events relating to {@link net.luckperms.api.extension.Extension}s.
*/
@org.jspecify.annotations.NullMarked
package net.luckperms.api.event.extension;
@@ -29,6 +29,7 @@ import net.luckperms.api.cacheddata.CachedDataManager;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.model.group.Group;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a groups {@link CachedDataManager} is loaded.
@@ -41,7 +42,7 @@ public interface GroupCacheLoadEvent extends LuckPermsEvent {
* @return the group
*/
@Param(0)
Group getGroup();
@NonNull Group getGroup();
/**
* Gets the data that was loaded
@@ -49,6 +50,6 @@ public interface GroupCacheLoadEvent extends LuckPermsEvent {
* @return the loaded data
*/
@Param(1)
CachedDataManager getLoadedData();
@NonNull CachedDataManager getLoadedData();
}
@@ -29,6 +29,7 @@ import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.cause.CreationCause;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.model.group.Group;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a group is created
@@ -41,7 +42,7 @@ public interface GroupCreateEvent extends LuckPermsEvent {
* @return the new group
*/
@Param(0)
Group getGroup();
@NonNull Group getGroup();
/**
* Gets the cause of the creation
@@ -49,6 +50,6 @@ public interface GroupCreateEvent extends LuckPermsEvent {
* @return the cause of the creation
*/
@Param(1)
CreationCause getCause();
@NonNull CreationCause getCause();
}
@@ -29,6 +29,7 @@ import net.luckperms.api.cacheddata.CachedDataManager;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.model.group.Group;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a groups cached data is refreshed
@@ -41,7 +42,7 @@ public interface GroupDataRecalculateEvent extends LuckPermsEvent {
* @return the group
*/
@Param(0)
Group getGroup();
@NonNull Group getGroup();
/**
* Gets the data that was recalculated
@@ -49,6 +50,6 @@ public interface GroupDataRecalculateEvent extends LuckPermsEvent {
* @return the data
*/
@Param(1)
CachedDataManager getData();
@NonNull CachedDataManager getData();
}
@@ -29,6 +29,7 @@ import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.cause.DeletionCause;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.node.Node;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Set;
@@ -43,7 +44,7 @@ public interface GroupDeleteEvent extends LuckPermsEvent {
* @return the name of the deleted group
*/
@Param(0)
String getGroupName();
@NonNull String getGroupName();
/**
* Gets an immutable copy of the groups existing data
@@ -51,7 +52,7 @@ public interface GroupDeleteEvent extends LuckPermsEvent {
* @return a copy of the groups existing data
*/
@Param(1)
Set<Node> getExistingData();
@NonNull Set<Node> getExistingData();
/**
* Gets the cause of the deletion
@@ -59,6 +60,6 @@ public interface GroupDeleteEvent extends LuckPermsEvent {
* @return the cause of the deletion
*/
@Param(2)
DeletionCause getCause();
@NonNull DeletionCause getCause();
}
@@ -28,11 +28,12 @@ package net.luckperms.api.event.group;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.model.group.Group;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a group is loaded into memory from the storage.
*
* <p>Note that this event is not the same as {@link GroupCreateEvent}.</p>
* Note that this event is not the same as {@link GroupCreateEvent}
*/
public interface GroupLoadEvent extends LuckPermsEvent {
@@ -42,6 +43,6 @@ public interface GroupLoadEvent extends LuckPermsEvent {
* @return the group that was loaded
*/
@Param(0)
Group getGroup();
@NonNull Group getGroup();
}
@@ -26,5 +26,4 @@
/**
* Events relating to {@link net.luckperms.api.model.group.Group}s.
*/
@org.jspecify.annotations.NullMarked
package net.luckperms.api.event.group;
@@ -29,6 +29,7 @@ import net.luckperms.api.actionlog.Action;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.type.Cancellable;
import net.luckperms.api.event.util.Param;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a log entry is about to be sent to notifiable players on the platform
@@ -41,7 +42,7 @@ public interface LogBroadcastEvent extends LuckPermsEvent, Cancellable {
* @return the log entry to be broadcasted
*/
@Param(0)
Action getEntry();
@NonNull Action getEntry();
/**
* Gets where the log entry originated from.
@@ -49,7 +50,7 @@ public interface LogBroadcastEvent extends LuckPermsEvent, Cancellable {
* @return the origin of the log
*/
@Param(1)
Origin getOrigin();
@NonNull Origin getOrigin();
/**
* Represents where a log entry is from
@@ -29,6 +29,7 @@ import net.luckperms.api.actionlog.Action;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.type.Cancellable;
import net.luckperms.api.event.util.Param;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.UUID;
@@ -43,7 +44,7 @@ public interface LogNetworkPublishEvent extends LuckPermsEvent, Cancellable {
* @return the id of the log entry being published
*/
@Param(0)
UUID getLogId();
@NonNull UUID getLogId();
/**
* Gets the log entry to be published
@@ -51,6 +52,6 @@ public interface LogNetworkPublishEvent extends LuckPermsEvent, Cancellable {
* @return the log entry to be published
*/
@Param(1)
Action getEntry();
@NonNull Action getEntry();
}
@@ -30,6 +30,7 @@ import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.type.Cancellable;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.platform.PlatformEntity;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a log entry is about to be sent to specific notifiable object on
@@ -47,7 +48,7 @@ public interface LogNotifyEvent extends LuckPermsEvent, Cancellable {
* @return the log entry to be sent
*/
@Param(0)
Action getEntry();
@NonNull Action getEntry();
/**
* Gets where the log entry originated from.
@@ -55,7 +56,7 @@ public interface LogNotifyEvent extends LuckPermsEvent, Cancellable {
* @return the origin of the log
*/
@Param(1)
Origin getOrigin();
@NonNull Origin getOrigin();
/**
* Gets the object to be notified.
@@ -63,7 +64,7 @@ public interface LogNotifyEvent extends LuckPermsEvent, Cancellable {
* @return the object to notify
*/
@Param(2)
PlatformEntity getNotifiable();
@NonNull PlatformEntity getNotifiable();
/**
* Represents where a log entry is from
@@ -29,6 +29,7 @@ import net.luckperms.api.actionlog.Action;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.type.Cancellable;
import net.luckperms.api.event.util.Param;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a log is about to be published to the storage file/table
@@ -41,6 +42,6 @@ public interface LogPublishEvent extends LuckPermsEvent, Cancellable {
* @return the log entry to be published
*/
@Param(0)
Action getEntry();
@NonNull Action getEntry();
}
@@ -28,6 +28,7 @@ package net.luckperms.api.event.log;
import net.luckperms.api.actionlog.Action;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.util.Param;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.UUID;
@@ -46,7 +47,7 @@ public interface LogReceiveEvent extends LuckPermsEvent {
* @return the id of the log entry being received
*/
@Param(0)
UUID getLogId();
@NonNull UUID getLogId();
/**
* Gets the log entry being received
@@ -54,6 +55,6 @@ public interface LogReceiveEvent extends LuckPermsEvent {
* @return the log entry being received
*/
@Param(1)
Action getEntry();
@NonNull Action getEntry();
}
@@ -24,7 +24,6 @@
*/
/**
* Events relating to the {@link net.luckperms.api.actionlog.ActionLogger}.
* Events relating to the {@link net.luckperms.api.actionlog.ActionLog}.
*/
@org.jspecify.annotations.NullMarked
package net.luckperms.api.event.log;
@@ -28,6 +28,7 @@ package net.luckperms.api.event.messaging;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.messaging.MessagingService;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a custom payload message is received via the {@link MessagingService}.
@@ -45,7 +46,7 @@ public interface CustomMessageReceiveEvent extends LuckPermsEvent {
* @return the channel id
*/
@Param(0)
String getChannelId();
@NonNull String getChannelId();
/**
* Gets the custom payload that was sent.
@@ -53,6 +54,6 @@ public interface CustomMessageReceiveEvent extends LuckPermsEvent {
* @return the custom payload
*/
@Param(1)
String getPayload();
@NonNull String getPayload();
}
@@ -26,5 +26,4 @@
/**
* Events relating to the {@link net.luckperms.api.messaging.MessagingService}.
*/
@org.jspecify.annotations.NullMarked
package net.luckperms.api.event.messaging;
@@ -27,6 +27,7 @@ package net.luckperms.api.event.node;
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;
@@ -44,10 +45,10 @@ public interface NodeAddEvent extends NodeMutateEvent {
* @return the node that was added
*/
@Param(3)
Node getNode();
@NonNull Node getNode();
@Override
default @Unmodifiable Set<Node> getDataBefore() {
default @NonNull @Unmodifiable Set<Node> getDataBefore() {
// Get data after, then reverse the action
Set<Node> nodes = new HashSet<>(this.getDataAfter());
nodes.remove(this.getNode());
@@ -27,6 +27,7 @@ package net.luckperms.api.event.node;
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;
@@ -45,10 +46,10 @@ public interface NodeClearEvent extends NodeMutateEvent {
* @since 5.3
*/
@Param(3)
@Unmodifiable Set<Node> getNodes();
@NonNull @Unmodifiable Set<Node> getNodes();
@Override
default @Unmodifiable Set<Node> getDataBefore() {
default @NonNull @Unmodifiable Set<Node> getDataBefore() {
// Get data after, then reverse the action
Set<Node> nodes = new HashSet<>(this.getDataAfter());
nodes.addAll(this.getNodes());
@@ -32,6 +32,7 @@ import net.luckperms.api.model.data.DataType;
import net.luckperms.api.model.group.Group;
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;
@@ -47,7 +48,7 @@ public interface NodeMutateEvent extends LuckPermsEvent {
* @return the event target
*/
@Param(0)
PermissionHolder getTarget();
@NonNull PermissionHolder getTarget();
/**
* Gets the data type that was mutated.
@@ -55,14 +56,14 @@ public interface NodeMutateEvent extends LuckPermsEvent {
* @return the data type
*/
@Param(1)
DataType getDataType();
@NonNull DataType getDataType();
/**
* Gets an immutable copy of the holders data before the change
*
* @return the data before the change
*/
@Unmodifiable Set<Node> getDataBefore();
@NonNull @Unmodifiable Set<Node> getDataBefore();
/**
* Gets an immutable copy of the holders data after the change
@@ -70,7 +71,7 @@ public interface NodeMutateEvent extends LuckPermsEvent {
* @return the data after the change
*/
@Param(2)
@Unmodifiable Set<Node> getDataAfter();
@NonNull @Unmodifiable Set<Node> getDataAfter();
/**
* Gets whether the target of this event is a {@link User}
@@ -27,6 +27,7 @@ package net.luckperms.api.event.node;
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;
@@ -44,10 +45,10 @@ public interface NodeRemoveEvent extends NodeMutateEvent {
* @return the node that was removed
*/
@Param(3)
Node getNode();
@NonNull Node getNode();
@Override
default @Unmodifiable Set<Node> getDataBefore() {
default @NonNull @Unmodifiable Set<Node> getDataBefore() {
// Get data after, then reverse the action
Set<Node> nodes = new HashSet<>(this.getDataAfter());
nodes.add(this.getNode());
@@ -27,5 +27,4 @@
* Events relating to changes to a {@link net.luckperms.api.model.user.User} or
* {@link net.luckperms.api.model.group.Group}s {@link net.luckperms.api.model.data.NodeMap}.
*/
@org.jspecify.annotations.NullMarked
package net.luckperms.api.event.node;
@@ -26,5 +26,4 @@
/**
* Main events package.
*/
@org.jspecify.annotations.NullMarked
package net.luckperms.api.event;
@@ -29,6 +29,7 @@ import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.model.PlayerSaveResult;
import net.luckperms.api.model.user.UserManager;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.UUID;
@@ -42,10 +43,10 @@ public interface PlayerDataSaveEvent extends LuckPermsEvent {
/**
* Gets the unique ID that was saved.
*
* @return the UUID
* @return the uuid
*/
@Param(0)
UUID getUniqueId();
@NonNull UUID getUniqueId();
/**
* Gets the username that was saved.
@@ -53,7 +54,7 @@ public interface PlayerDataSaveEvent extends LuckPermsEvent {
* @return the username
*/
@Param(1)
String getUsername();
@NonNull String getUsername();
/**
* Gets the result of the operation.
@@ -61,6 +62,6 @@ public interface PlayerDataSaveEvent extends LuckPermsEvent {
* @return the result
*/
@Param(2)
PlayerSaveResult getResult();
@NonNull PlayerSaveResult getResult();
}
@@ -29,7 +29,8 @@ import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.model.user.User;
import net.luckperms.api.util.Result;
import org.jspecify.annotations.Nullable;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.UUID;
@@ -54,10 +55,10 @@ public interface PlayerLoginProcessEvent extends LuckPermsEvent, Result {
/**
* Gets the UUID of the connection which was processed
*
* @return the UUID of the connection which was processed
* @return the uuid of the connection which was processed
*/
@Param(0)
UUID getUniqueId();
@NonNull UUID getUniqueId();
/**
* Gets the username of the connection which was processed
@@ -65,7 +66,7 @@ public interface PlayerLoginProcessEvent extends LuckPermsEvent, Result {
* @return the username of the connection which was processed
*/
@Param(1)
String getUsername();
@NonNull String getUsername();
/**
* Gets if the login was processed successfully.
@@ -28,26 +28,27 @@ package net.luckperms.api.event.player.lookup;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.type.ResultEvent;
import net.luckperms.api.event.util.Param;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Objects;
import java.util.UUID;
/**
* Called when the platform needs to determine a player's {@link UUID unique id} type.
* Called when the platform needs to determine the type of a player's {@link UUID unique id}.
*
* @since 5.3
*/
public interface UniqueIdDetermineTypeEvent extends LuckPermsEvent, ResultEvent<String> {
/**
* The player's UUID has been obtained by authenticating with the Mojang session servers.
* The players UUID has been obtained by authenticating with the Mojang session servers.
*
* <p>Usually indicated by the UUID being {@link UUID#version() version} 4.</p>
*/
String TYPE_AUTHENTICATED = "authenticated";
/**
* The player's UUID has not been obtained through authentication, and instead is likely based
* The players UUID has not been obtained through authentication, and instead is likely based
* on the username they connected with.
*
* <p>Usually indicated by the UUID being {@link UUID#version() version} 3.</p>
@@ -55,7 +56,7 @@ public interface UniqueIdDetermineTypeEvent extends LuckPermsEvent, ResultEvent<
String TYPE_UNAUTHENTICATED = "unauthenticated";
/**
* The player's UUID most likely belongs to a NPC (non-player character).
* The players UUID most likely belongs to a NPC (non-player character).
*
* <p>Usually indicated by the UUID being {@link UUID#version() version} 2.</p>
*
@@ -76,14 +77,14 @@ public interface UniqueIdDetermineTypeEvent extends LuckPermsEvent, ResultEvent<
* @return the unique id
*/
@Param(0)
UUID getUniqueId();
@NonNull UUID getUniqueId();
/**
* Gets the current result unique id type.
*
* @return the type
*/
default String getType() {
default @NonNull String getType() {
return result().get();
}
@@ -92,7 +93,7 @@ public interface UniqueIdDetermineTypeEvent extends LuckPermsEvent, ResultEvent<
*
* @param type the type
*/
default void setType(String type) {
default void setType(@NonNull String type) {
Objects.requireNonNull(type, "type");
result().set(type);
}
@@ -28,7 +28,8 @@ package net.luckperms.api.event.player.lookup;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.type.ResultEvent;
import net.luckperms.api.event.util.Param;
import org.jspecify.annotations.Nullable;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.UUID;
@@ -37,7 +38,7 @@ import java.util.UUID;
*
* @since 5.3
*/
public interface UniqueIdLookupEvent extends LuckPermsEvent, ResultEvent<@Nullable UUID> {
public interface UniqueIdLookupEvent extends LuckPermsEvent, ResultEvent<UUID> {
/**
* Gets the username being looked up.
@@ -45,7 +46,7 @@ public interface UniqueIdLookupEvent extends LuckPermsEvent, ResultEvent<@Nullab
* @return the username
*/
@Param(0)
String getUsername();
@NonNull String getUsername();
/**
* Sets the result unique id.
@@ -28,7 +28,8 @@ package net.luckperms.api.event.player.lookup;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.type.ResultEvent;
import net.luckperms.api.event.util.Param;
import org.jspecify.annotations.Nullable;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.UUID;
@@ -37,7 +38,7 @@ import java.util.UUID;
*
* @since 5.3
*/
public interface UsernameLookupEvent extends LuckPermsEvent, ResultEvent<@Nullable String> {
public interface UsernameLookupEvent extends LuckPermsEvent, ResultEvent<String> {
/**
* Gets the {@link UUID unique id} being looked up.
@@ -45,7 +46,7 @@ public interface UsernameLookupEvent extends LuckPermsEvent, ResultEvent<@Nullab
* @return the unique id
*/
@Param(0)
UUID getUniqueId();
@NonNull UUID getUniqueId();
/**
* Sets the result username.
@@ -27,6 +27,7 @@ package net.luckperms.api.event.player.lookup;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.util.Param;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -43,7 +44,7 @@ public interface UsernameValidityCheckEvent extends LuckPermsEvent {
* @return the username
*/
@Param(0)
String getUsername();
@NonNull String getUsername();
/**
* Gets the current validity state for the username.
@@ -51,7 +52,7 @@ public interface UsernameValidityCheckEvent extends LuckPermsEvent {
* @return the validity state
*/
@Param(1)
AtomicBoolean validityState();
@NonNull AtomicBoolean validityState();
/**
* Gets if the username is currently considered to be valid.
@@ -26,5 +26,4 @@
/**
* Events relating to a player {@link java.util.UUID unique id} or username lookup.
*/
@org.jspecify.annotations.NullMarked
package net.luckperms.api.event.player.lookup;
@@ -26,5 +26,4 @@
/**
* Events relating to a player.
*/
@org.jspecify.annotations.NullMarked
package net.luckperms.api.event.player;
@@ -26,6 +26,7 @@
package net.luckperms.api.event.source;
import net.luckperms.api.platform.PlatformEntity;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Represents an {@link PlatformEntity} which was the {@link Source} of something.
@@ -37,6 +38,6 @@ public interface EntitySource extends Source {
*
* @return the entity
*/
PlatformEntity getEntity();
@NonNull PlatformEntity getEntity();
}
@@ -26,6 +26,7 @@
package net.luckperms.api.event.source;
import net.luckperms.api.platform.PlatformEntity;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Represents the source of an event.
@@ -39,7 +40,7 @@ public interface Source {
*
* @return the type
*/
Type getType();
@NonNull Type getType();
/**
* Represents a type of source
@@ -26,5 +26,4 @@
/**
* Event sources.
*/
@org.jspecify.annotations.NullMarked
package net.luckperms.api.event.source;
@@ -27,7 +27,8 @@ package net.luckperms.api.event.sync;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.util.Param;
import org.jspecify.annotations.Nullable;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.UUID;
@@ -46,7 +47,7 @@ public interface PostNetworkSyncEvent extends LuckPermsEvent {
* @return the id of the sync request
*/
@Param(0)
UUID getSyncId();
@NonNull UUID getSyncId();
/**
* Gets the sync type.
@@ -54,7 +55,7 @@ public interface PostNetworkSyncEvent extends LuckPermsEvent {
* @return the sync type
*/
@Param(1)
SyncType getType();
@NonNull SyncType getType();
/**
* Gets if a sync occurred.
@@ -28,7 +28,8 @@ package net.luckperms.api.event.sync;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.type.Cancellable;
import net.luckperms.api.event.util.Param;
import org.jspecify.annotations.Nullable;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.UUID;
@@ -46,7 +47,7 @@ public interface PreNetworkSyncEvent extends LuckPermsEvent, Cancellable {
* @return the id of the sync request
*/
@Param(0)
UUID getSyncId();
@NonNull UUID getSyncId();
/**
* Gets the sync type.
@@ -55,7 +56,7 @@ public interface PreNetworkSyncEvent extends LuckPermsEvent, Cancellable {
* @since 5.5
*/
@Param(1)
SyncType getType();
@NonNull SyncType getType();
/**
* Gets the unique id of the specific user that will be synced, if applicable.
@@ -26,5 +26,4 @@
/**
* Events relating to {@link net.luckperms.api.LuckPerms#runUpdateTask() sync/update task}s.
*/
@org.jspecify.annotations.NullMarked
package net.luckperms.api.event.sync;
@@ -29,6 +29,7 @@ import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.cause.CreationCause;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.track.Track;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a track is created
@@ -41,7 +42,7 @@ public interface TrackCreateEvent extends LuckPermsEvent {
* @return the new track
*/
@Param(0)
Track getTrack();
@NonNull Track getTrack();
/**
* Gets the cause of the creation
@@ -49,6 +50,6 @@ public interface TrackCreateEvent extends LuckPermsEvent {
* @return the cause of the creation
*/
@Param(1)
CreationCause getCause();
@NonNull CreationCause getCause();
}
@@ -28,6 +28,7 @@ package net.luckperms.api.event.track;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.cause.DeletionCause;
import net.luckperms.api.event.util.Param;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.List;
@@ -42,7 +43,7 @@ public interface TrackDeleteEvent extends LuckPermsEvent {
* @return the name of the deleted track
*/
@Param(0)
String getTrackName();
@NonNull String getTrackName();
/**
* Gets an immutable copy of the tracks existing data
@@ -50,7 +51,7 @@ public interface TrackDeleteEvent extends LuckPermsEvent {
* @return a copy of the tracks existing data
*/
@Param(1)
List<String> getExistingData();
@NonNull List<String> getExistingData();
/**
* Gets the cause of the deletion
@@ -58,6 +59,6 @@ public interface TrackDeleteEvent extends LuckPermsEvent {
* @return the cause of the deletion
*/
@Param(2)
DeletionCause getCause();
@NonNull DeletionCause getCause();
}
@@ -28,11 +28,12 @@ package net.luckperms.api.event.track;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.track.Track;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a track is loaded into memory from the storage.
*
* <p>Note that this event is not the same as {@link TrackCreateEvent}.</p>
* Note that this event is not the same as {@link TrackCreateEvent}
*/
public interface TrackLoadEvent extends LuckPermsEvent {
@@ -42,6 +43,6 @@ public interface TrackLoadEvent extends LuckPermsEvent {
* @return the track that was loaded
*/
@Param(0)
Track getTrack();
@NonNull Track getTrack();
}
@@ -26,6 +26,7 @@
package net.luckperms.api.event.track.mutate;
import net.luckperms.api.event.util.Param;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a group is added to a track
@@ -38,6 +39,6 @@ public interface TrackAddGroupEvent extends TrackMutateEvent {
* @return the group that was added
*/
@Param(3)
String getGroup();
@NonNull String getGroup();
}
@@ -28,6 +28,7 @@ package net.luckperms.api.event.track.mutate;
import net.luckperms.api.event.LuckPermsEvent;
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;
@@ -43,7 +44,7 @@ public interface TrackMutateEvent extends LuckPermsEvent {
* @return the track that was mutated
*/
@Param(0)
Track getTrack();
@NonNull Track getTrack();
/**
* Gets an immutable copy of the tracks data before the change
@@ -51,7 +52,7 @@ public interface TrackMutateEvent extends LuckPermsEvent {
* @return the data before the change
*/
@Param(1)
@Unmodifiable List<String> getStateBefore();
@NonNull @Unmodifiable List<String> getStateBefore();
/**
* Gets an immutable copy of the tracks data after the change
@@ -59,6 +60,6 @@ public interface TrackMutateEvent extends LuckPermsEvent {
* @return the data after the change
*/
@Param(2)
@Unmodifiable List<String> getStateAfter();
@NonNull @Unmodifiable List<String> getStateAfter();
}
@@ -26,6 +26,7 @@
package net.luckperms.api.event.track.mutate;
import net.luckperms.api.event.util.Param;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a group is removed from a track
@@ -38,6 +39,6 @@ public interface TrackRemoveGroupEvent extends TrackMutateEvent {
* @return the group that was removed
*/
@Param(3)
String getGroup();
@NonNull String getGroup();
}
@@ -26,5 +26,4 @@
/**
* Events relating to changes to a {@link net.luckperms.api.track.Track}s contents.
*/
@org.jspecify.annotations.NullMarked
package net.luckperms.api.event.track.mutate;
@@ -26,5 +26,4 @@
/**
* Events relating to {@link net.luckperms.api.track.Track}s.
*/
@org.jspecify.annotations.NullMarked
package net.luckperms.api.event.track;
@@ -26,6 +26,7 @@
package net.luckperms.api.event.type;
import net.luckperms.api.event.util.Param;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -40,7 +41,7 @@ public interface Cancellable {
* @return the cancellation
*/
@Param(-1)
AtomicBoolean cancellationState();
@NonNull AtomicBoolean cancellationState();
/**
* Returns true if the event is currently cancelled.
@@ -26,7 +26,7 @@
package net.luckperms.api.event.type;
import net.luckperms.api.event.util.Param;
import org.jspecify.annotations.Nullable;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.concurrent.atomic.AtomicReference;
@@ -36,7 +36,7 @@ import java.util.concurrent.atomic.AtomicReference;
* @param <T> the type of the result
* @since 5.3
*/
public interface ResultEvent<T extends @Nullable Object> {
public interface ResultEvent<T> {
/**
* Gets an {@link AtomicReference} containing the result.
@@ -44,7 +44,7 @@ public interface ResultEvent<T extends @Nullable Object> {
* @return the result
*/
@Param(-1)
AtomicReference<T> result();
@NonNull AtomicReference<T> result();
/**
* Gets if a result has been set for the event.
@@ -27,6 +27,7 @@ package net.luckperms.api.event.type;
import net.luckperms.api.event.source.Source;
import net.luckperms.api.event.util.Param;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Represents an event with a {@link Source}.
@@ -41,6 +42,6 @@ public interface Sourced {
*
* @return the source
*/
@Param(-1) Source getSource();
@NonNull @Param(-1) Source getSource();
}
@@ -26,5 +26,4 @@
/**
* Event abstract types.
*/
@org.jspecify.annotations.NullMarked
package net.luckperms.api.event.type;
@@ -29,6 +29,7 @@ import net.luckperms.api.cacheddata.CachedDataManager;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.model.user.User;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a users {@link CachedDataManager} is loaded.
@@ -41,7 +42,7 @@ public interface UserCacheLoadEvent extends LuckPermsEvent {
* @return the user
*/
@Param(0)
User getUser();
@NonNull User getUser();
/**
* Gets the data that was loaded
@@ -49,6 +50,6 @@ public interface UserCacheLoadEvent extends LuckPermsEvent {
* @return the loaded data
*/
@Param(1)
CachedDataManager getLoadedData();
@NonNull CachedDataManager getLoadedData();
}
@@ -29,6 +29,7 @@ import net.luckperms.api.cacheddata.CachedDataManager;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.model.user.User;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a users cached data is refreshed
@@ -41,7 +42,7 @@ public interface UserDataRecalculateEvent extends LuckPermsEvent {
* @return the user
*/
@Param(0)
User getUser();
@NonNull User getUser();
/**
* Gets the data that was recalculated
@@ -49,6 +50,6 @@ public interface UserDataRecalculateEvent extends LuckPermsEvent {
* @return the data
*/
@Param(1)
CachedDataManager getData();
@NonNull CachedDataManager getData();
}
@@ -27,6 +27,7 @@ package net.luckperms.api.event.user;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.util.Param;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.UUID;
@@ -46,10 +47,10 @@ public interface UserFirstLoginEvent extends LuckPermsEvent {
/**
* Gets the UUID of the user
*
* @return the UUID of the user
* @return the uuid of the user
*/
@Param(0)
UUID getUniqueId();
@NonNull UUID getUniqueId();
/**
* Gets the username of the user
@@ -57,6 +58,6 @@ public interface UserFirstLoginEvent extends LuckPermsEvent {
* @return the username of the user
*/
@Param(1)
String getUsername();
@NonNull String getUsername();
}
@@ -28,6 +28,7 @@ package net.luckperms.api.event.user;
import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.model.user.User;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a user is loaded into memory from the storage.
@@ -40,6 +41,6 @@ public interface UserLoadEvent extends LuckPermsEvent {
* @return the user that was loaded
*/
@Param(0)
User getUser();
@NonNull User getUser();
}
@@ -29,6 +29,7 @@ import net.luckperms.api.event.LuckPermsEvent;
import net.luckperms.api.event.type.Cancellable;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.model.user.User;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a user is about to be unloaded from memory.
@@ -43,6 +44,6 @@ public interface UserUnloadEvent extends LuckPermsEvent, Cancellable {
* @return the user that is being unloaded
*/
@Param(0)
User getUser();
@NonNull User getUser();
}
@@ -26,5 +26,4 @@
/**
* Events relating to {@link net.luckperms.api.model.user.User}s.
*/
@org.jspecify.annotations.NullMarked
package net.luckperms.api.event.user;
@@ -25,6 +25,8 @@
package net.luckperms.api.event.user.track;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a user is demoted down a track.
*
@@ -33,7 +35,7 @@ package net.luckperms.api.event.user.track;
public interface UserDemoteEvent extends UserTrackEvent {
@Override
default TrackAction getAction() {
default @NonNull TrackAction getAction() {
return TrackAction.DEMOTION;
}
}
@@ -25,6 +25,8 @@
package net.luckperms.api.event.user.track;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* Called when a user is promoted up a track.
*
@@ -33,7 +35,7 @@ package net.luckperms.api.event.user.track;
public interface UserPromoteEvent extends UserTrackEvent {
@Override
default TrackAction getAction() {
default @NonNull TrackAction getAction() {
return TrackAction.PROMOTION;
}
}
@@ -30,6 +30,7 @@ import net.luckperms.api.event.type.Sourced;
import net.luckperms.api.event.util.Param;
import net.luckperms.api.model.user.User;
import net.luckperms.api.track.Track;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Optional;
@@ -44,7 +45,7 @@ public interface UserTrackEvent extends LuckPermsEvent, Sourced {
* @return the track involved in the event
*/
@Param(0)
Track getTrack();
@NonNull Track getTrack();
/**
* Gets the user who was promoted or demoted
@@ -52,14 +53,14 @@ public interface UserTrackEvent extends LuckPermsEvent, Sourced {
* @return the user involved in the event
*/
@Param(1)
User getUser();
@NonNull User getUser();
/**
* Gets the action performed
*
* @return the action performed
*/
TrackAction getAction();
@NonNull TrackAction getAction();
/**
* Gets the group the user was promoted/demoted from.
@@ -69,7 +70,7 @@ public interface UserTrackEvent extends LuckPermsEvent, Sourced {
* @return the group the user was promoted/demoted from
*/
@Param(2)
Optional<String> getGroupFrom();
@NonNull Optional<String> getGroupFrom();
/**
* Gets the group the user was promoted/demoted to
@@ -77,6 +78,6 @@ public interface UserTrackEvent extends LuckPermsEvent, Sourced {
* @return the group the user was promoted/demoted to
*/
@Param(3)
Optional<String> getGroupTo();
@NonNull Optional<String> getGroupTo();
}
@@ -27,5 +27,4 @@
* Events relating to a {@link net.luckperms.api.model.user.User}s movement on a
* {@link net.luckperms.api.track.Track}.
*/
@org.jspecify.annotations.NullMarked
package net.luckperms.api.event.user.track;
@@ -26,5 +26,4 @@
/**
* Event utilities.
*/
@org.jspecify.annotations.NullMarked
package net.luckperms.api.event.util;
@@ -25,6 +25,7 @@
package net.luckperms.api.extension;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.Unmodifiable;
import java.io.IOException;
@@ -50,13 +51,13 @@ public interface ExtensionManager {
* @return the extension
* @throws IOException if the extension could not be loaded
*/
Extension loadExtension(Path path) throws IOException;
@NonNull Extension loadExtension(Path path) throws IOException;
/**
* Gets a collection of all loaded extensions.
*
* @return the loaded extensions
*/
@Unmodifiable Collection<Extension> getLoadedExtensions();
@NonNull @Unmodifiable Collection<Extension> getLoadedExtensions();
}
@@ -26,5 +26,4 @@
/**
* {@link net.luckperms.api.extension.Extension}s functionality.
*/
@org.jspecify.annotations.NullMarked
package net.luckperms.api.extension;
@@ -28,6 +28,7 @@ package net.luckperms.api.messaging;
import net.luckperms.api.LuckPerms;
import net.luckperms.api.event.messaging.CustomMessageReceiveEvent;
import net.luckperms.api.model.user.User;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* A means to send messages to other servers using the platforms networking
@@ -39,13 +40,13 @@ public interface MessagingService {
*
* @return the name of this messaging service
*/
String getName();
@NonNull String getName();
/**
* Uses the messaging service to inform other servers about a general
* change.
*
* <p>The standard response by other servers will be to execute an overall
* <p>The standard response by other servers will be to execute a overall
* sync of all live data, equivalent to calling
* {@link LuckPerms#runUpdateTask()}.</p>
*
@@ -69,14 +70,14 @@ public interface MessagingService {
*
* @param user the user to push the update for
*/
void pushUserUpdate(User user);
void pushUserUpdate(@NonNull User user);
/**
* Uses the messaging service to send a message with a custom payload.
*
* <p>The intended use case of this functionality is to allow plugins/mods
* to send <b>lightweight</b> and <b>permissions-related</b> custom messages
* between instances, piggybacking on top of the messenger abstraction
* between instances, piggy-backing on top of the messenger abstraction
* already built into LuckPerms.</p>
*
* <p>It is <b>not</b> intended as a full message broker replacement/abstraction.
@@ -109,6 +110,6 @@ public interface MessagingService {
* @param payload the message payload
* @since 5.5
*/
void sendCustomMessage(String channelId, String payload);
void sendCustomMessage(@NonNull String channelId, @NonNull String payload);
}
@@ -26,5 +26,4 @@
/**
* {@link net.luckperms.api.messaging.MessagingService} functionality.
*/
@org.jspecify.annotations.NullMarked
package net.luckperms.api.messaging;
@@ -27,6 +27,7 @@ package net.luckperms.api.messenger;
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;
/**
@@ -50,7 +51,7 @@ public interface IncomingMessageConsumer {
* @param message the message
* @return true if the message was accepted by the plugin
*/
boolean consumeIncomingMessage(Message message);
boolean consumeIncomingMessage(@NonNull Message message);
/**
* Consumes a message in an encoded string format.
@@ -71,6 +72,6 @@ public interface IncomingMessageConsumer {
* @param encodedString the encoded string
* @return true if the message was accepted by the plugin
*/
boolean consumeIncomingMessageAsString(String encodedString);
boolean consumeIncomingMessageAsString(@NonNull String encodedString);
}
@@ -27,6 +27,7 @@ package net.luckperms.api.messenger;
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;
/**
@@ -50,10 +51,10 @@ public interface Messenger extends AutoCloseable {
*
* @param outgoingMessage the outgoing message
*/
void sendOutgoingMessage(OutgoingMessage outgoingMessage);
void sendOutgoingMessage(@NonNull OutgoingMessage outgoingMessage);
/**
* Performs the necessary action to gracefully shut down the messenger.
* Performs the necessary action to gracefully shutdown the messenger.
*/
@Override
default void close() {
@@ -26,6 +26,7 @@
package net.luckperms.api.messenger;
import net.luckperms.api.LuckPerms;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.jetbrains.annotations.ApiStatus.OverrideOnly;
/**
@@ -44,7 +45,7 @@ public interface MessengerProvider {
*
* @return the provider name
*/
String getName();
@NonNull String getName();
/**
* Creates and returns a new {@link Messenger} instance, which passes
@@ -57,6 +58,6 @@ public interface MessengerProvider {
* incoming messages to
* @return a new messenger agent instance
*/
Messenger obtain(IncomingMessageConsumer incomingMessageConsumer);
@NonNull Messenger obtain(@NonNull IncomingMessageConsumer incomingMessageConsumer);
}
Loaded 100 of 703 files, more files were not shown because too many files have changed in this diff. Show more