Compare commits

..
91 Commits
Author SHA1 Message Date
kripypastishka b878ae92ff Fix action log comparator to include target names (#4340) 2026-11-04 20:42:18 +00:00
Aleks Kuznetsov 866086fa87 Fix Fabric placeholders throwing when resolved without a player (#4321) 2026-11-01 14:42:10 +00:00
tahodev e1ff15217a Make the first-time setup suggested command clickable to copy (#4337) 2026-11-01 14:23:57 +00:00
Luck b93a4d7b24 Update to Hytale Update 7 2026-10-20 21:28:14 +01:00
Rishabh Venu 5fc3d583c4 Update Group getWeight javadoc comment (#4325) 2026-10-04 16:51:35 +01:00
Luck aeaab669ab Fix NeoForge NoClassDefFoundError (#4327) 2026-10-04 16:49:40 +01:00
Luck 25f223317a Update to Minecraft 26.3 2026-09-19 08:23:26 +01:00
Luck a81c095f83 Fix grammar/spelling in API javadocs 2026-09-12 21:54:32 +01:00
Luck e794facb05 Use JSpecify annotations (#4312) 2026-09-12 21:26:39 +01:00
Luck 24a25458d6 Increase cleanup delay for users mid-login (#4268) 2026-09-10 19:18:23 +01:00
Luck 32494e9f0a Update to Hytale Update 6 (#4311) 2026-08-27 18:14:09 +01:00
Luck 79770b0dc1 Update InheritanceTest (#4306) 2026-08-27 18:11:25 +01:00
Drex c1c85762a1 Fabric Permission API v1 replace / with . (#4310) 2026-08-26 20:50:07 +01:00
Luck d98a3954fa Remove then add when applying Difference (#4287) 2026-08-25 22:38:55 +01:00
Luck 9b4fe67791 Fix NodeJsonSerializer on older Gson versions (#4301) 2026-08-15 20:39:06 +01:00
Luck 48c652b387 Fix issue on Bukkit with missing Player#locale method (#4295) 2026-08-15 08:33:16 +01:00
Luck 79a269a6b4 Fix shorthand parser int overflow (#4300) 2026-08-15 08:23:04 +01:00
Luck 5a9c096c66 Improve /lp applyedits chat output 2026-08-15 08:11:29 +01:00
Emir f6bcb1676e Fix page number validation in log commands (#4296) 2026-08-13 21:18:50 +01:00
AndyOctopus 2dfd387882 Fix inverted Audience check in PaperAdventureBridge (#4297) 2026-08-13 21:14:56 +01:00
BlockException_ 8fa4c24492 Prevent ClassCastException when estimating dimension-type contexts (#4294) 2026-08-05 22:15:55 +01:00
Luck 461fb34005 Use connection uri database if set for Mongo (#4289) 2026-08-05 21:52:13 +01:00
Luck 7fbb6869f5 Add extra listener for server stopped event (#4281) 2026-08-05 20:22:23 +01:00
Luck aeaf1b9c8a Ignore errors when creating Mongo indexes 2026-08-05 20:12:24 +01:00
Luck c3fd3f7eb8 Use native adventure methods on Paper (#4292) 2026-08-05 20:06:50 +01:00
Luck f25279813e Add limit to shorthand parser (#4293) 2026-08-05 17:56:40 +01:00
Luck 24894df140 Improve Mongo bulk user load implementation 2026-07-23 20:28:47 +01:00
Mason Camara c06039b0dc Add MongoDB Indexes (#4280) 2026-07-23 20:16:53 +01:00
lucko 7b8f8ccb97 Update MongoStorage to use exportChanges (#4286) 2026-07-23 20:15:39 +01:00
Warrior d07dcacab4 Add API bulk user lookup method (#4285) 2026-07-23 20:15:01 +01:00
lucko cb77ed09be Update NodeMap#setContent to avoid clear (#4284) 2026-07-22 22:14:41 +01:00
Luck f19f605650 Add some more unit tests 2026-07-17 21:49:30 +01:00
Luck cd61d05b53 Add some unit tests 2026-06-30 21:39:39 +01:00
Luck 3c1b4d53ea Add abstract listeners for autoop and command list update 2026-06-29 20:53:09 +01:00
lucko 1324c229fd Update to Minecraft 26.2 (#4277) 2026-06-18 21:54:08 +01:00
Luck 16173dd0b7 Fix Hytale maven repo 2026-06-18 21:41:06 +01:00
Luck cd0f009e0f Call ConfigurationTask callback sync (#4272) 2026-06-03 18:05:35 +01:00
Luck 3087cfc494 Fix Fabric placeholder text parsing 2026-05-29 08:15:17 +01:00
Luck 00ed0a0e77 Show logo in Hytale mod menu 2026-05-27 08:00:57 +01:00
lucko 3fb939b416 Support for Hytale Update 5 (#4247) 2026-05-26 18:02:58 +01:00
Luck d01106c6ad Fix Fabric PermissionSet mixin level handling (#4269) 2026-05-25 19:17:10 +01:00
Luck 9ea747c848 Fix Fabric perm API v1 default handling (#4269) 2026-05-23 09:08:14 +01:00
lucko fe3078e5d0 Folia support (#3615) 2026-05-21 22:16:56 +01:00
lucko a97bdba0a0 Implement fabric-permission-api v1 (#4248) 2026-05-21 21:43:28 +01:00
Luck d90b3dbf11 Add Fabric placeholder-api integration 2026-05-21 19:10:02 +01:00
lucko 417989aea1 Add common placeholders module (#4267) 2026-05-21 18:50:01 +01:00
masel.io 441ab5769f Add Redis Sentinel support for messaging (#4244) 2026-05-16 20:23:42 +01:00
Dominik 6f5a8e1cd8 Add context argument to group listmembers command (#4252) 2026-05-11 21:17:53 +01:00
Yannick Schinko 090f218e12 Add index to time column in SQL Messenger (#4255) 2026-05-11 21:17:18 +01:00
Luck 8b3e990106 Fix Fabric shadowJar config 2026-03-26 22:32:50 +00:00
Luck c0005fa070 Update to Minecraft 26.1 2026-03-26 22:12:21 +00:00
Luck cfd1aa276c Update Hytale to target 2026.03.26-89796e57b 2026-03-26 21:46:16 +00:00
Luck 5db9ecb689 Update Gradle to v9.4 2026-03-26 21:38:08 +00:00
powercas_gamer 691a87b5ea Add support for NATS token authentication (#4238) 2026-03-17 21:10:56 +00:00
Luck fc26521594 Update bytebin/bytesocks custom config settings 2026-03-13 07:59:23 +00:00
Luck b25c335b7b Add rate limit for verbose chat output 2026-02-21 09:29:14 +00:00
Luck 6292d2d3e6 Improve debug logging for Hytale login handling 2026-02-21 08:55:33 +00:00
Luck a75643c1e4 Remove Hytale chat formatter and update deps 2026-02-17 18:14:38 +00:00
Luck e148e8e9fa Fix duplicate readNode call in SqlStorage 2026-02-15 13:56:00 +00:00
Luck 053148a9c5 Add inheritance origin metadata for Hytale virtual groups 2026-02-05 20:50:21 +00:00
Luck 71035d96ea Attempt to fix slf4j classloading issue on Hytale 2026-02-05 19:37:24 +00:00
Luck 8c22dd7159 Refactor PermissionProcessors 2026-02-05 18:55:26 +00:00
Luck f944fc0770 Relocate guava and gson in Hytale jar 2026-02-03 19:06:14 +00:00
Luck 1932d0cd5d Fix yaml dependency issue in Hytale jar (#4229) 2026-01-30 18:21:06 +00:00
Luck 38a8f63d86 Add Hytale with-deps Gradle buildscript 2026-01-30 18:19:44 +00:00
Luck e7e7997750 Improve Hytale PermissionProvider compatibility 2026-01-24 21:17:14 +00:00
lucko a60d3f1a4b Hytale (#4213) 2026-01-24 12:49:30 +00:00
John 840ac52f83 Add UUID mismatch warning suppression setting (#4194) 2026-01-10 12:37:19 +00:00
Drex a6382773f0 Fix shared module context keys (#4206) 2026-01-06 08:36:47 +00:00
Luck 2f77191875 Add shared module for Fabric, NeoForge and Forge 2025-12-22 22:14:08 +00:00
lucko 2adb058e96 Update to Minecraft 1.21.11 2025-12-10 12:12:57 +00:00
Luck 61ce546a04 Fix compile/test error with HostAndPort 2025-11-09 13:13:50 +00:00
Luck 10378e882b Support IPv6 addresses (#3753) 2025-11-09 12:36:03 +00:00
Luck 2a1dfb5112 Increase User Housekeeper timeout (#4081) 2025-11-02 12:49:45 +00:00
Luck 40a39c9381 Update to Minecraft 1.21.10 2025-10-11 11:17:59 +01:00
Luck 198e2d6f4b Update Forge module to Minecraft 1.21.9 2025-10-05 10:54:02 +01:00
Luck 1058cb11e8 Update to Minecraft 1.21.9 2025-10-01 18:22:21 +01:00
蒟蒻 0b91732cd3 Prevent handleDisconnect after stopped server on Fabric (#4160) 2025-09-21 11:04:58 +01:00
An5w1r a087f14aa2 Fix classExists checks to handle NoClassDefFoundError (#4136) 2025-09-21 11:03:07 +01:00
Luck d666a2a798 Fix command rate limit for command blocks (#4094) 2025-09-21 10:58:24 +01:00
Luck 65c42b9b09 Micro-optimize temporary node audit (#4155) 2025-08-23 15:39:49 +01:00
Luck 73d710a89e Update to Minecraft 1.21.8 2025-07-21 22:08:21 +01:00
Luck ed863b275d Update to Minecraft 1.21.7 2025-06-30 19:41:56 +01:00
Luck c20776d6aa Remove Forge capability attachment 2025-06-19 19:53:09 +01:00
Luck 3aca721f96 Rollback bytebuddy dependency version upgrade 2025-06-19 19:35:04 +01:00
Luck 8d9c5bf401 Add workaround for Forge eventbus limitation 2025-06-19 19:09:40 +01:00
Luck 0af1038d81 Update to Minecraft 1.21.6 2025-06-19 18:48:44 +01:00
Luck 51fe574a51 Move config load earlier in startup process (#4083) 2025-06-14 09:31:56 +01:00
Max Barrass bac0edd90e Fix missing closing brackets in .conf files (#4109) 2025-06-14 09:24:52 +01:00
Luck 8ab9910ef8 Downgrade jedis and h2 2025-06-01 19:32:26 +01:00
Luck 9538cb9dad Upgrade dependencies and require Java 11 2025-06-01 16:41:39 +01:00
643 changed files with 12136 additions and 5780 deletions

No files matched your search

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