mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2026-11-04 16:50:13 -05:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e9ea98e84e |
No files matched your search
@@ -1,5 +0,0 @@
|
||||
#
|
||||
# https://help.github.com/articles/dealing-with-line-endings/
|
||||
#
|
||||
# These are explicitly windows files and should use crlf
|
||||
*.bat text eol=crlf
|
||||
+17
-18
@@ -19,24 +19,26 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v4
|
||||
- name: validate gradle wrapper
|
||||
uses: gradle/wrapper-validation-action@v1
|
||||
|
||||
- uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '25'
|
||||
java-version: '17'
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v4
|
||||
uses: gradle/gradle-build-action@v2
|
||||
|
||||
- name: Run build and tests with Gradle wrapper
|
||||
run: ./gradlew test build -PdockerTests
|
||||
|
||||
- name: Publish test report
|
||||
uses: mikepenz/action-junit-report@v5
|
||||
uses: mikepenz/action-junit-report@v3
|
||||
if: success() || failure()
|
||||
with:
|
||||
report_paths: '**/build/test-results/test/TEST-*.xml'
|
||||
@@ -44,7 +46,7 @@ jobs:
|
||||
detailed_summary: true
|
||||
|
||||
- name: Upload all artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: jars
|
||||
path: |
|
||||
@@ -59,7 +61,7 @@ jobs:
|
||||
standalone/loader/build/libs/LuckPerms-Standalone-*.jar
|
||||
|
||||
- name: Upload standalone artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: standalone-binary
|
||||
path: standalone/loader/build/libs/LuckPerms-Standalone-*.jar
|
||||
@@ -74,27 +76,24 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Retrieve saved standalone jar artifact
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: standalone-binary
|
||||
path: standalone/docker/
|
||||
|
||||
- name: Remove version number from jar artifact name
|
||||
run: mv standalone/docker/LuckPerms-Standalone-*.jar standalone/docker/luckperms-standalone.jar
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
uses: docker/setup-qemu-action@v1
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@v3
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
@@ -106,7 +105,7 @@ jobs:
|
||||
|
||||
- name: Extract metadata for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
uses: docker/metadata-action@v3
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
flavor: |
|
||||
@@ -119,7 +118,7 @@ jobs:
|
||||
type=raw,enable=${{ github.ref == 'refs/heads/master' }},value=${{ env.luckperms_version }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v6
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: standalone/docker/
|
||||
platforms: linux/amd64,linux/arm64
|
||||
|
||||
@@ -24,7 +24,7 @@ For more information, see the wiki article on [Why LuckPerms?](https://luckperms
|
||||
LuckPerms uses Gradle to handle dependencies & building.
|
||||
|
||||
#### Requirements
|
||||
* Java 21 JDK or newer
|
||||
* Java 17 JDK or newer
|
||||
* Git
|
||||
|
||||
#### Compiling from source
|
||||
|
||||
+24
-17
@@ -1,11 +1,5 @@
|
||||
apply plugin: 'java-library'
|
||||
|
||||
group = 'net.luckperms'
|
||||
project.version = '5.5'
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.release = 8
|
||||
}
|
||||
project.version = '5.4'
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
@@ -14,8 +8,8 @@ jar {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api 'org.jspecify:jspecify:1.0.0'
|
||||
compileOnlyApi 'org.jetbrains:annotations:26.1.0'
|
||||
compileOnly 'org.checkerframework:checker-qual:3.21.2'
|
||||
compileOnly 'org.jetbrains:annotations:23.1.0'
|
||||
}
|
||||
|
||||
// Only used occasionally for deployment - not needed for normal builds.
|
||||
@@ -29,22 +23,32 @@ if (project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePass
|
||||
options.encoding = 'UTF-8'
|
||||
options.charSet = 'UTF-8'
|
||||
options.links(
|
||||
'https://jspecify.dev/docs/api/',
|
||||
'https://javadoc.io/static/org.jetbrains/annotations/26.0.2/'
|
||||
'https://checkerframework.org/api/',
|
||||
'https://javadoc.io/static/org.jetbrains/annotations/23.0.0/'
|
||||
)
|
||||
options.addStringOption('Xdoclint:none', '-quiet')
|
||||
options.addStringOption('-since', '5.0,5.1,5.2,5.3,5.4,5.5')
|
||||
options.addStringOption('-since', '5.0,5.1,5.2,5.3,5.4')
|
||||
|
||||
if (JavaVersion.current() > JavaVersion.VERSION_1_8) {
|
||||
options.links.add('https://docs.oracle.com/en/java/javase/21/docs/api/')
|
||||
options.links.add('https://docs.oracle.com/en/java/javase/11/docs/api/')
|
||||
} else {
|
||||
options.links.add('https://docs.oracle.com/javase/8/docs/api/')
|
||||
}
|
||||
}
|
||||
|
||||
java {
|
||||
withJavadocJar()
|
||||
withSourcesJar()
|
||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||
classifier 'javadoc'
|
||||
from javadoc.destinationDir
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
classifier 'sources'
|
||||
from sourceSets.main.allSource
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives javadocJar
|
||||
archives sourcesJar
|
||||
}
|
||||
|
||||
publishing {
|
||||
@@ -66,10 +70,12 @@ if (project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePass
|
||||
artifactId = 'api'
|
||||
|
||||
from components.java
|
||||
artifact sourcesJar
|
||||
artifact javadocJar
|
||||
|
||||
pom {
|
||||
name = 'LuckPerms API'
|
||||
description = 'A permissions manager for Minecraft servers.'
|
||||
description = 'A permissions plugin for Minecraft servers.'
|
||||
url = 'https://luckperms.net'
|
||||
|
||||
licenses {
|
||||
@@ -105,6 +111,7 @@ if (project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePass
|
||||
|
||||
signing {
|
||||
useGpgCmd()
|
||||
sign configurations.archives
|
||||
sign publishing.publications.mavenJava
|
||||
required = true
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<p>
|
||||
LuckPerms is a permissions manager for Minecraft servers. It allows server admins to control what
|
||||
LuckPerms is a permissions plugin for Minecraft servers. It allows server admins to control what
|
||||
features players can use by creating groups and assigning permissions.
|
||||
</p>
|
||||
<h4>Useful Links</h4>
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
package net.luckperms.api;
|
||||
|
||||
import net.luckperms.api.actionlog.ActionLogger;
|
||||
import net.luckperms.api.actionlog.filter.ActionFilterFactory;
|
||||
import net.luckperms.api.context.ContextCalculator;
|
||||
import net.luckperms.api.context.ContextManager;
|
||||
import net.luckperms.api.event.EventBus;
|
||||
@@ -41,13 +40,13 @@ import net.luckperms.api.model.user.User;
|
||||
import net.luckperms.api.model.user.UserManager;
|
||||
import net.luckperms.api.node.NodeBuilderRegistry;
|
||||
import net.luckperms.api.node.matcher.NodeMatcherFactory;
|
||||
import net.luckperms.api.platform.Health;
|
||||
import net.luckperms.api.platform.Platform;
|
||||
import net.luckperms.api.platform.PlayerAdapter;
|
||||
import net.luckperms.api.platform.PluginMetadata;
|
||||
import net.luckperms.api.query.QueryOptionsRegistry;
|
||||
import net.luckperms.api.track.Track;
|
||||
import net.luckperms.api.track.TrackManager;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus.Internal;
|
||||
|
||||
import java.util.Optional;
|
||||
@@ -83,18 +82,18 @@ public interface LuckPerms {
|
||||
*
|
||||
* @return the server name
|
||||
*/
|
||||
String getServerName();
|
||||
@NonNull String getServerName();
|
||||
|
||||
/**
|
||||
* Gets the {@link UserManager}, responsible for managing
|
||||
* {@link User} instances.
|
||||
*
|
||||
* <p>This manager can be used to retrieve instances of {@link User} by UUID
|
||||
* <p>This manager can be used to retrieve instances of {@link User} by uuid
|
||||
* or name, or query all loaded users.</p>
|
||||
*
|
||||
* @return the user manager
|
||||
*/
|
||||
UserManager getUserManager();
|
||||
@NonNull UserManager getUserManager();
|
||||
|
||||
/**
|
||||
* Gets the {@link GroupManager}, responsible for managing
|
||||
@@ -105,7 +104,7 @@ public interface LuckPerms {
|
||||
*
|
||||
* @return the group manager
|
||||
*/
|
||||
GroupManager getGroupManager();
|
||||
@NonNull GroupManager getGroupManager();
|
||||
|
||||
/**
|
||||
* Gets the {@link TrackManager}, responsible for managing
|
||||
@@ -116,7 +115,7 @@ public interface LuckPerms {
|
||||
*
|
||||
* @return the track manager
|
||||
*/
|
||||
TrackManager getTrackManager();
|
||||
@NonNull TrackManager getTrackManager();
|
||||
|
||||
/**
|
||||
* Gets the {@link PlayerAdapter} instance, a utility class for adapting platform Player
|
||||
@@ -143,7 +142,7 @@ public interface LuckPerms {
|
||||
* @throws IllegalArgumentException if the player class is not correct
|
||||
* @since 5.1
|
||||
*/
|
||||
<T> PlayerAdapter<T> getPlayerAdapter(Class<T> playerClass);
|
||||
<T> @NonNull PlayerAdapter<T> getPlayerAdapter(@NonNull Class<T> playerClass);
|
||||
|
||||
/**
|
||||
* Gets the {@link Platform}, which represents the server platform the
|
||||
@@ -151,7 +150,7 @@ public interface LuckPerms {
|
||||
*
|
||||
* @return the platform
|
||||
*/
|
||||
Platform getPlatform();
|
||||
@NonNull Platform getPlatform();
|
||||
|
||||
/**
|
||||
* Gets the {@link PluginMetadata}, responsible for providing metadata about
|
||||
@@ -159,7 +158,7 @@ public interface LuckPerms {
|
||||
*
|
||||
* @return the plugin metadata
|
||||
*/
|
||||
PluginMetadata getPluginMetadata();
|
||||
@NonNull PluginMetadata getPluginMetadata();
|
||||
|
||||
/**
|
||||
* Gets the {@link EventBus}, used for subscribing to internal LuckPerms
|
||||
@@ -167,7 +166,7 @@ public interface LuckPerms {
|
||||
*
|
||||
* @return the event bus
|
||||
*/
|
||||
EventBus getEventBus();
|
||||
@NonNull EventBus getEventBus();
|
||||
|
||||
/**
|
||||
* Gets the {@link MessagingService}, used to dispatch updates throughout a
|
||||
@@ -178,7 +177,7 @@ public interface LuckPerms {
|
||||
*
|
||||
* @return the messaging service instance, if present.
|
||||
*/
|
||||
Optional<MessagingService> getMessagingService();
|
||||
@NonNull Optional<MessagingService> getMessagingService();
|
||||
|
||||
/**
|
||||
* Gets the {@link ActionLogger}, responsible for saving and broadcasting
|
||||
@@ -186,7 +185,7 @@ public interface LuckPerms {
|
||||
*
|
||||
* @return the action logger
|
||||
*/
|
||||
ActionLogger getActionLogger();
|
||||
@NonNull ActionLogger getActionLogger();
|
||||
|
||||
/**
|
||||
* Gets the {@link ContextManager}, responsible for managing
|
||||
@@ -194,7 +193,7 @@ public interface LuckPerms {
|
||||
*
|
||||
* @return the context manager
|
||||
*/
|
||||
ContextManager getContextManager();
|
||||
@NonNull ContextManager getContextManager();
|
||||
|
||||
/**
|
||||
* Gets the {@link MetaStackFactory}.
|
||||
@@ -205,7 +204,7 @@ public interface LuckPerms {
|
||||
*
|
||||
* @return the meta stack factory
|
||||
*/
|
||||
MetaStackFactory getMetaStackFactory();
|
||||
@NonNull MetaStackFactory getMetaStackFactory();
|
||||
|
||||
/**
|
||||
* Schedules the execution of an update task, and returns an encapsulation
|
||||
@@ -218,18 +217,7 @@ public interface LuckPerms {
|
||||
*
|
||||
* @return a future
|
||||
*/
|
||||
CompletableFuture<Void> runUpdateTask();
|
||||
|
||||
/**
|
||||
* Executes a health check.
|
||||
*
|
||||
* <p>This task checks if the LuckPerms implementation is running and
|
||||
* whether it has a connection to the database (if applicable).</p>
|
||||
*
|
||||
* @return the health status
|
||||
* @since 5.5
|
||||
*/
|
||||
Health runHealthCheck();
|
||||
@NonNull CompletableFuture<Void> runUpdateTask();
|
||||
|
||||
/**
|
||||
* Registers a {@link MessengerProvider} for use by the platform.
|
||||
@@ -239,7 +227,7 @@ public interface LuckPerms {
|
||||
*
|
||||
* @param messengerProvider the messenger provider.
|
||||
*/
|
||||
void registerMessengerProvider(MessengerProvider messengerProvider);
|
||||
void registerMessengerProvider(@NonNull MessengerProvider messengerProvider);
|
||||
|
||||
/**
|
||||
* Gets the {@link NodeBuilderRegistry}.
|
||||
@@ -247,7 +235,7 @@ public interface LuckPerms {
|
||||
* @return the node builder registry
|
||||
*/
|
||||
@Internal
|
||||
NodeBuilderRegistry getNodeBuilderRegistry();
|
||||
@NonNull NodeBuilderRegistry getNodeBuilderRegistry();
|
||||
|
||||
/**
|
||||
* Gets the {@link QueryOptionsRegistry}.
|
||||
@@ -256,7 +244,7 @@ public interface LuckPerms {
|
||||
* @since 5.1
|
||||
*/
|
||||
@Internal
|
||||
QueryOptionsRegistry getQueryOptionsRegistry();
|
||||
@NonNull QueryOptionsRegistry getQueryOptionsRegistry();
|
||||
|
||||
/**
|
||||
* Gets the {@link NodeMatcherFactory}.
|
||||
@@ -265,15 +253,6 @@ public interface LuckPerms {
|
||||
* @since 5.1
|
||||
*/
|
||||
@Internal
|
||||
NodeMatcherFactory getNodeMatcherFactory();
|
||||
|
||||
/**
|
||||
* Gets the {@link ActionFilterFactory}.
|
||||
*
|
||||
* @return the action filter factory
|
||||
* @since 5.5
|
||||
*/
|
||||
@Internal
|
||||
ActionFilterFactory getActionFilterFactory();
|
||||
@NonNull NodeMatcherFactory getNodeMatcherFactory();
|
||||
|
||||
}
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
package net.luckperms.api;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import static org.jetbrains.annotations.ApiStatus.Internal;
|
||||
|
||||
@@ -36,7 +36,7 @@ import static org.jetbrains.annotations.ApiStatus.Internal;
|
||||
* instance, however, this provider can be used if this is not viable.</p>
|
||||
*/
|
||||
public final class LuckPermsProvider {
|
||||
private static @Nullable LuckPerms instance = null;
|
||||
private static LuckPerms instance = null;
|
||||
|
||||
/**
|
||||
* Gets an instance of the {@link LuckPerms} API,
|
||||
@@ -47,7 +47,7 @@ public final class LuckPermsProvider {
|
||||
* @return an instance of the LuckPerms API
|
||||
* @throws IllegalStateException if the API is not loaded yet
|
||||
*/
|
||||
public static LuckPerms get() {
|
||||
public static @NonNull LuckPerms get() {
|
||||
LuckPerms instance = LuckPermsProvider.instance;
|
||||
if (instance == null) {
|
||||
throw new NotLoadedException();
|
||||
@@ -79,8 +79,7 @@ public final class LuckPermsProvider {
|
||||
" a) the LuckPerms plugin is not installed or it failed to enable\n" +
|
||||
" b) the plugin in the stacktrace does not declare a dependency on LuckPerms\n" +
|
||||
" c) the plugin in the stacktrace is retrieving the API before the plugin 'enable' phase\n" +
|
||||
" (call the #get method in onEnable, not the constructor!)\n" +
|
||||
" d) the plugin in the stacktrace is incorrectly 'shading' the LuckPerms API into its jar\n";
|
||||
" (call the #get method in onEnable, not the constructor!)\n";
|
||||
|
||||
NotLoadedException() {
|
||||
super(MESSAGE);
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
package net.luckperms.api.actionlog;
|
||||
|
||||
import net.luckperms.api.LuckPermsProvider;
|
||||
import org.jetbrains.annotations.ApiStatus.NonExtendable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Optional;
|
||||
@@ -35,10 +35,7 @@ import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Represents a logged action.
|
||||
*
|
||||
* <p>API users should not implement this interface directly.</p>
|
||||
*/
|
||||
@NonExtendable
|
||||
public interface Action extends Comparable<Action> {
|
||||
|
||||
/**
|
||||
@@ -46,7 +43,7 @@ public interface Action extends Comparable<Action> {
|
||||
*
|
||||
* @return a new builder
|
||||
*/
|
||||
static Builder builder() {
|
||||
static @NonNull Builder builder() {
|
||||
return LuckPermsProvider.get().getActionLogger().actionBuilder();
|
||||
}
|
||||
|
||||
@@ -55,21 +52,21 @@ public interface Action extends Comparable<Action> {
|
||||
*
|
||||
* @return the timestamp
|
||||
*/
|
||||
Instant getTimestamp();
|
||||
@NonNull Instant getTimestamp();
|
||||
|
||||
/**
|
||||
* Gets the source of the action.
|
||||
*
|
||||
* @return the source
|
||||
*/
|
||||
Source getSource();
|
||||
@NonNull Source getSource();
|
||||
|
||||
/**
|
||||
* Gets the target of the action.
|
||||
*
|
||||
* @return the target
|
||||
*/
|
||||
Target getTarget();
|
||||
@NonNull Target getTarget();
|
||||
|
||||
/**
|
||||
* Returns a string describing the action which took place.
|
||||
@@ -79,12 +76,11 @@ public interface Action extends Comparable<Action> {
|
||||
*
|
||||
* @return the action
|
||||
*/
|
||||
String getDescription();
|
||||
@NonNull String getDescription();
|
||||
|
||||
/**
|
||||
* Represents the source of an action.
|
||||
*/
|
||||
@NonExtendable
|
||||
interface Source {
|
||||
|
||||
/**
|
||||
@@ -92,21 +88,20 @@ public interface Action extends Comparable<Action> {
|
||||
*
|
||||
* @return the source unique id
|
||||
*/
|
||||
UUID getUniqueId();
|
||||
@NonNull UUID getUniqueId();
|
||||
|
||||
/**
|
||||
* Gets the source name.
|
||||
*
|
||||
* @return the source name
|
||||
*/
|
||||
String getName();
|
||||
@NonNull String getName();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the target of an action.
|
||||
*/
|
||||
@NonExtendable
|
||||
interface Target {
|
||||
|
||||
/**
|
||||
@@ -114,24 +109,24 @@ public interface Action extends Comparable<Action> {
|
||||
*
|
||||
* @return the target unique id
|
||||
*/
|
||||
Optional<UUID> getUniqueId();
|
||||
@NonNull Optional<UUID> getUniqueId();
|
||||
|
||||
/**
|
||||
* Gets the target name.
|
||||
*
|
||||
* @return the target name
|
||||
*/
|
||||
String getName();
|
||||
@NonNull String getName();
|
||||
|
||||
/**
|
||||
* Gets the target type.
|
||||
*
|
||||
* @return the target type
|
||||
*/
|
||||
Type getType();
|
||||
@NonNull Type getType();
|
||||
|
||||
/**
|
||||
* Represents the type of {@link Target}.
|
||||
* Represents the type of a {@link Target}.
|
||||
*/
|
||||
enum Type {
|
||||
USER, GROUP, TRACK
|
||||
@@ -150,7 +145,7 @@ public interface Action extends Comparable<Action> {
|
||||
* @return the builder
|
||||
* @see Action#getTimestamp()
|
||||
*/
|
||||
Builder timestamp(Instant timestamp);
|
||||
@NonNull Builder timestamp(@NonNull Instant timestamp);
|
||||
|
||||
/**
|
||||
* Sets the actor of the entry.
|
||||
@@ -158,7 +153,7 @@ public interface Action extends Comparable<Action> {
|
||||
* @param actor the actor
|
||||
* @return the builder
|
||||
*/
|
||||
Builder source(UUID actor);
|
||||
@NonNull Builder source(@NonNull UUID actor);
|
||||
|
||||
/**
|
||||
* Sets the actor name of the entry.
|
||||
@@ -166,7 +161,7 @@ public interface Action extends Comparable<Action> {
|
||||
* @param actorName the actor name
|
||||
* @return the builder
|
||||
*/
|
||||
Builder sourceName(String actorName);
|
||||
@NonNull Builder sourceName(@NonNull String actorName);
|
||||
|
||||
/**
|
||||
* Sets the type of the entry.
|
||||
@@ -174,7 +169,7 @@ public interface Action extends Comparable<Action> {
|
||||
* @param type the type
|
||||
* @return the builder
|
||||
*/
|
||||
Builder targetType(Target.Type type);
|
||||
@NonNull Builder targetType(Target.@NonNull Type type);
|
||||
|
||||
/**
|
||||
* Sets the acted object for the entry.
|
||||
@@ -182,7 +177,7 @@ public interface Action extends Comparable<Action> {
|
||||
* @param acted the acted object
|
||||
* @return the builder
|
||||
*/
|
||||
Builder target(@Nullable UUID acted);
|
||||
@NonNull Builder target(@Nullable UUID acted);
|
||||
|
||||
/**
|
||||
* Sets the acted name for the entry.
|
||||
@@ -190,7 +185,7 @@ public interface Action extends Comparable<Action> {
|
||||
* @param actedName the acted name
|
||||
* @return the builder
|
||||
*/
|
||||
Builder targetName(String actedName);
|
||||
@NonNull Builder targetName(@NonNull String actedName);
|
||||
|
||||
/**
|
||||
* Sets the action of the entry.
|
||||
@@ -198,14 +193,14 @@ public interface Action extends Comparable<Action> {
|
||||
* @param action the action
|
||||
* @return the builder
|
||||
*/
|
||||
Builder description(String action);
|
||||
@NonNull Builder description(@NonNull String action);
|
||||
|
||||
/**
|
||||
* Creates a {@link Action} instance from the builder.
|
||||
*
|
||||
* @return a new log entry instance
|
||||
*/
|
||||
Action build();
|
||||
@NonNull Action build();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
package net.luckperms.api.actionlog;
|
||||
|
||||
import net.luckperms.api.actionlog.filter.ActionFilter;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
import java.util.SortedSet;
|
||||
@@ -40,11 +40,7 @@ import java.util.UUID;
|
||||
* You can add to the log using the {@link ActionLogger}, and then request an updated copy.</p>
|
||||
*
|
||||
* <p>All methods are thread safe, and return immutable and thread safe collections.</p>
|
||||
*
|
||||
* @deprecated Use {@link ActionLogger#queryActions(ActionFilter)} or
|
||||
* {@link ActionLogger#queryActions(ActionFilter, int, int)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public interface ActionLog {
|
||||
|
||||
/**
|
||||
@@ -52,23 +48,23 @@ public interface ActionLog {
|
||||
*
|
||||
* @return the content
|
||||
*/
|
||||
@Unmodifiable SortedSet<Action> getContent();
|
||||
@NonNull @Unmodifiable SortedSet<Action> getContent();
|
||||
|
||||
/**
|
||||
* Gets the entries in the log performed by the given actor.
|
||||
*
|
||||
* @param actor the UUID of the actor to filter by
|
||||
* @param actor the uuid of the actor to filter by
|
||||
* @return the content for the given actor
|
||||
*/
|
||||
@Unmodifiable SortedSet<Action> getContent(UUID actor);
|
||||
@NonNull @Unmodifiable SortedSet<Action> getContent(@NonNull UUID actor);
|
||||
|
||||
/**
|
||||
* Gets the log content for a given user
|
||||
*
|
||||
* @param uniqueId the UUID to filter by
|
||||
* @return all content in this log where the user = UUID
|
||||
* @param uniqueId the uuid to filter by
|
||||
* @return all content in this log where the user = uuid
|
||||
*/
|
||||
@Unmodifiable SortedSet<Action> getUserHistory(UUID uniqueId);
|
||||
@NonNull @Unmodifiable SortedSet<Action> getUserHistory(@NonNull UUID uniqueId);
|
||||
|
||||
/**
|
||||
* Gets the log content for a given group
|
||||
@@ -76,7 +72,7 @@ public interface ActionLog {
|
||||
* @param name the name to filter by
|
||||
* @return all content in this log where the group = name
|
||||
*/
|
||||
@Unmodifiable SortedSet<Action> getGroupHistory(String name);
|
||||
@NonNull @Unmodifiable SortedSet<Action> getGroupHistory(@NonNull String name);
|
||||
|
||||
/**
|
||||
* Gets the log content for a given track
|
||||
@@ -84,6 +80,6 @@ public interface ActionLog {
|
||||
* @param name the name to filter by
|
||||
* @return all content in this log where the track = name
|
||||
*/
|
||||
@Unmodifiable SortedSet<Action> getTrackHistory(String name);
|
||||
@NonNull @Unmodifiable SortedSet<Action> getTrackHistory(@NonNull String name);
|
||||
|
||||
}
|
||||
@@ -25,10 +25,9 @@
|
||||
|
||||
package net.luckperms.api.actionlog;
|
||||
|
||||
import net.luckperms.api.actionlog.filter.ActionFilter;
|
||||
import net.luckperms.api.util.Page;
|
||||
import net.luckperms.api.messaging.MessagingService;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
@@ -41,85 +40,50 @@ public interface ActionLogger {
|
||||
*
|
||||
* @return a new builder
|
||||
*/
|
||||
Action.Builder actionBuilder();
|
||||
Action.@NonNull Builder actionBuilder();
|
||||
|
||||
/**
|
||||
* Gets a {@link ActionLog} instance from the plugin storage.
|
||||
*
|
||||
* @return a log instance
|
||||
* @deprecated Use {@link #queryActions(ActionFilter)} or {@link #queryActions(ActionFilter, int, int)} instead. These methods
|
||||
* are more efficient (they don't load the full action log into memory) and allow for pagination.
|
||||
*/
|
||||
@Deprecated
|
||||
CompletableFuture<ActionLog> getLog();
|
||||
@NonNull CompletableFuture<ActionLog> getLog();
|
||||
|
||||
/**
|
||||
* Gets all actions from the action log matching the given {@code filter}.
|
||||
* Submits a log entry to the plugin to be handled.
|
||||
*
|
||||
* <p>If the filter is {@code null}, all actions will be returned.</p>
|
||||
* <p>This method submits the log to the storage provider and broadcasts
|
||||
* it.</p>
|
||||
*
|
||||
* <p>Unlike {@link #queryActions(ActionFilter, int, int)}, this method does not implement any pagination and will return
|
||||
* all entries at once.</p>
|
||||
* <p>It is therefore roughly equivalent to calling
|
||||
* {@link #submitToStorage(Action)} and {@link #broadcastAction(Action)},
|
||||
* however, using this method is preferred to making the calls individually.</p>
|
||||
*
|
||||
* @param filter the filter, optional
|
||||
* @return the actions
|
||||
* @since 5.5
|
||||
*/
|
||||
CompletableFuture<List<Action>> queryActions(ActionFilter filter);
|
||||
|
||||
/**
|
||||
* Gets a page of actions from the action log matching the given {@code filter}.
|
||||
*
|
||||
* <p>If the filter is {@code null}, all actions will be returned.</p>
|
||||
*
|
||||
* @param filter the filter, optional
|
||||
* @param pageSize the size of the page
|
||||
* @param pageNumber the page number
|
||||
* @return the page of actions
|
||||
* @since 5.5
|
||||
*/
|
||||
CompletableFuture<Page<Action>> queryActions(ActionFilter filter, int pageSize, int pageNumber);
|
||||
|
||||
/**
|
||||
* Submits a logged action to LuckPerms.
|
||||
*
|
||||
* <p>This method submits the action to the storage provider to be persisted in the action log.
|
||||
* It also broadcasts it to administrator players on the current instance and to admins on other
|
||||
* connected servers if a messaging service is configured.</p>
|
||||
*
|
||||
* <p>It is roughly equivalent to calling
|
||||
* {@link #submitToStorage(Action)} followed by {@link #broadcastAction(Action)},
|
||||
* however using this method is preferred to making the calls individually.</p>
|
||||
*
|
||||
* <p>If you want to submit an action log entry but don't know which method to pick,
|
||||
* <p>If you want to submit a log entry but don't know which method to pick,
|
||||
* use this one.</p>
|
||||
*
|
||||
* @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 done
|
||||
*/
|
||||
CompletableFuture<Void> submit(Action entry);
|
||||
@NonNull CompletableFuture<Void> submit(@NonNull Action entry);
|
||||
|
||||
/**
|
||||
* Submits a logged action to LuckPerms and persists it in the storage backend.
|
||||
*
|
||||
* <p>This method does not broadcast the action or send it through the messaging service.</p>
|
||||
* Submits a log entry to the plugins storage handler.
|
||||
*
|
||||
* @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 done
|
||||
*/
|
||||
CompletableFuture<Void> submitToStorage(Action entry);
|
||||
@NonNull CompletableFuture<Void> submitToStorage(@NonNull Action entry);
|
||||
|
||||
/**
|
||||
* Submits a logged action to LuckPerms and broadcasts it to administrators.
|
||||
* Submits a log entry to the plugins log broadcasting handler.
|
||||
*
|
||||
* <p>The broadcast is made to administrator players on the current instance
|
||||
* and to admins on other connected servers if a messaging service is configured.</p>
|
||||
*
|
||||
* <p>This method does not save the action to the plugin storage backend.</p>
|
||||
* <p>If enabled, this method will also dispatch the log entry via the
|
||||
* plugins {@link MessagingService}.</p>
|
||||
*
|
||||
* @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 done
|
||||
*/
|
||||
CompletableFuture<Void> broadcastAction(Action entry);
|
||||
@NonNull CompletableFuture<Void> broadcastAction(@NonNull Action entry);
|
||||
|
||||
}
|
||||
@@ -1,114 +0,0 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package net.luckperms.api.actionlog.filter;
|
||||
|
||||
import net.luckperms.api.LuckPermsProvider;
|
||||
import net.luckperms.api.actionlog.Action;
|
||||
import org.jetbrains.annotations.ApiStatus.NonExtendable;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
* A predicate filter which matches certain {@link Action}s.
|
||||
*
|
||||
* <p>API users should not implement this interface directly.</p>
|
||||
*
|
||||
* @since 5.5
|
||||
*/
|
||||
@NonExtendable
|
||||
public interface ActionFilter extends Predicate<Action> {
|
||||
|
||||
/**
|
||||
* Gets an {@link ActionFilter} which matches any action.
|
||||
*
|
||||
* @return the matcher
|
||||
*/
|
||||
static ActionFilter any() {
|
||||
return LuckPermsProvider.get().getActionFilterFactory().any();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an {@link ActionFilter} which matches actions with a specific source user.
|
||||
*
|
||||
* @param uniqueId the source user unique id
|
||||
* @return the matcher
|
||||
*/
|
||||
static ActionFilter source(UUID uniqueId) {
|
||||
return LuckPermsProvider.get().getActionFilterFactory().source(uniqueId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an {@link ActionFilter} which matches actions which target a specific user.
|
||||
*
|
||||
* @param uniqueId the target user unique id
|
||||
* @return the matcher
|
||||
*/
|
||||
static ActionFilter user(UUID uniqueId) {
|
||||
return LuckPermsProvider.get().getActionFilterFactory().user(uniqueId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an {@link ActionFilter} which matches actions which target a specific group.
|
||||
*
|
||||
* @param name the target group name
|
||||
* @return the matcher
|
||||
*/
|
||||
static ActionFilter group(String name) {
|
||||
return LuckPermsProvider.get().getActionFilterFactory().group(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an {@link ActionFilter} which matches actions which target a specific track.
|
||||
*
|
||||
* @param name the target track name
|
||||
* @return the matcher
|
||||
*/
|
||||
static ActionFilter track(String name) {
|
||||
return LuckPermsProvider.get().getActionFilterFactory().track(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an {@link ActionFilter} which matches actions which contain a specific search query in the source name,
|
||||
* target name or description.
|
||||
*
|
||||
* @param query the search query
|
||||
* @return the matcher
|
||||
*/
|
||||
static ActionFilter search(String query) {
|
||||
return LuckPermsProvider.get().getActionFilterFactory().search(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests to see if the given {@link Action} matches the filter.
|
||||
*
|
||||
* @param action the action to test
|
||||
* @return true if the action matched
|
||||
*/
|
||||
@Override
|
||||
boolean test(Action action);
|
||||
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package net.luckperms.api.actionlog.filter;
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus.Internal;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* A factory which creates {@link ActionFilter}s.
|
||||
*
|
||||
* @since 5.5
|
||||
*/
|
||||
@Internal
|
||||
public interface ActionFilterFactory {
|
||||
|
||||
/**
|
||||
* Gets an {@link ActionFilter} which matches any action.
|
||||
*
|
||||
* @return the matcher
|
||||
*/
|
||||
ActionFilter any();
|
||||
|
||||
/**
|
||||
* Gets an {@link ActionFilter} which matches actions with a specific source user.
|
||||
*
|
||||
* @param uniqueId the source user unique id
|
||||
* @return the matcher
|
||||
*/
|
||||
ActionFilter source(UUID uniqueId);
|
||||
|
||||
/**
|
||||
* Gets an {@link ActionFilter} which matches actions which target a specific user.
|
||||
*
|
||||
* @param uniqueId the target user unique id
|
||||
* @return the matcher
|
||||
*/
|
||||
ActionFilter user(UUID uniqueId);
|
||||
|
||||
/**
|
||||
* Gets an {@link ActionFilter} which matches actions which target a specific group.
|
||||
*
|
||||
* @param name the target group name
|
||||
* @return the matcher
|
||||
*/
|
||||
ActionFilter group(String name);
|
||||
|
||||
/**
|
||||
* Gets an {@link ActionFilter} which matches actions which target a specific track.
|
||||
*
|
||||
* @param name the target track name
|
||||
* @return the matcher
|
||||
*/
|
||||
ActionFilter track(String name);
|
||||
|
||||
/**
|
||||
* Gets an {@link ActionFilter} which matches actions which contain a specific search query in the source name,
|
||||
* target name or description.
|
||||
*
|
||||
* @param query the search query
|
||||
* @return the matcher
|
||||
*/
|
||||
ActionFilter search(String query);
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* {@link net.luckperms.api.actionlog.Action} filters.
|
||||
*/
|
||||
@org.jspecify.annotations.NullMarked
|
||||
package net.luckperms.api.actionlog.filter;
|
||||
@@ -24,7 +24,6 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* {@link net.luckperms.api.actionlog.ActionLogger} related functionality.
|
||||
* {@link net.luckperms.api.actionlog.ActionLog} related functionality.
|
||||
*/
|
||||
@org.jspecify.annotations.NullMarked
|
||||
package net.luckperms.api.actionlog;
|
||||
@@ -26,6 +26,7 @@
|
||||
package net.luckperms.api.cacheddata;
|
||||
|
||||
import net.luckperms.api.query.QueryOptions;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Holds cached lookup data for a given set of query options.
|
||||
@@ -41,6 +42,6 @@ public interface CachedData {
|
||||
*
|
||||
* @return the query options this container is caching
|
||||
*/
|
||||
QueryOptions getQueryOptions();
|
||||
@NonNull QueryOptions getQueryOptions();
|
||||
|
||||
}
|
||||
@@ -30,6 +30,7 @@ import net.luckperms.api.model.PermissionHolder;
|
||||
import net.luckperms.api.model.group.Group;
|
||||
import net.luckperms.api.model.user.User;
|
||||
import net.luckperms.api.query.QueryOptions;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@@ -47,14 +48,14 @@ public interface CachedDataManager {
|
||||
*
|
||||
* @return the permission data manager
|
||||
*/
|
||||
Container<CachedPermissionData> permissionData();
|
||||
@NonNull Container<CachedPermissionData> permissionData();
|
||||
|
||||
/**
|
||||
* Gets the manager for {@link CachedMetaData}.
|
||||
*
|
||||
* @return the meta data manager
|
||||
*/
|
||||
Container<CachedMetaData> metaData();
|
||||
@NonNull Container<CachedMetaData> metaData();
|
||||
|
||||
/**
|
||||
* Gets PermissionData from the cache, using the given query options.
|
||||
@@ -62,7 +63,7 @@ public interface CachedDataManager {
|
||||
* @param queryOptions the query options
|
||||
* @return a permission data instance
|
||||
*/
|
||||
CachedPermissionData getPermissionData(QueryOptions queryOptions);
|
||||
@NonNull CachedPermissionData getPermissionData(@NonNull QueryOptions queryOptions);
|
||||
|
||||
/**
|
||||
* Gets MetaData from the cache, using the given query options.
|
||||
@@ -70,7 +71,7 @@ public interface CachedDataManager {
|
||||
* @param queryOptions the query options
|
||||
* @return a meta data instance
|
||||
*/
|
||||
CachedMetaData getMetaData(QueryOptions queryOptions);
|
||||
@NonNull CachedMetaData getMetaData(@NonNull QueryOptions queryOptions);
|
||||
|
||||
/**
|
||||
* Gets PermissionData from the cache, using the most appropriate query options
|
||||
@@ -78,7 +79,7 @@ public interface CachedDataManager {
|
||||
*
|
||||
* <p>For {@link User}s, the most appropriate query options will be their
|
||||
* {@link ContextManager#getQueryOptions(User) current active query options} if the
|
||||
* corresponding player is online, and otherwise, will fall back to
|
||||
* corresponding player is online, and otherwise, will fallback to
|
||||
* {@link ContextManager#getStaticQueryOptions() the current static query options}.</p>
|
||||
*
|
||||
* <p>For {@link Group}s, the most appropriate query options will always be
|
||||
@@ -87,7 +88,7 @@ public interface CachedDataManager {
|
||||
* @return a permission data instance
|
||||
* @since 5.1
|
||||
*/
|
||||
CachedPermissionData getPermissionData();
|
||||
@NonNull CachedPermissionData getPermissionData();
|
||||
|
||||
/**
|
||||
* Gets MetaData from the cache, using the most appropriate query options
|
||||
@@ -95,7 +96,7 @@ public interface CachedDataManager {
|
||||
*
|
||||
* <p>For {@link User}s, the most appropriate query options will be their
|
||||
* {@link ContextManager#getQueryOptions(User) current active query options} if the
|
||||
* corresponding player is online, and otherwise, will fall back to
|
||||
* corresponding player is online, and otherwise, will fallback to
|
||||
* {@link ContextManager#getStaticQueryOptions() the current static query options}.</p>
|
||||
*
|
||||
* <p>For {@link Group}s, the most appropriate query options will always be
|
||||
@@ -105,7 +106,7 @@ public interface CachedDataManager {
|
||||
* @since 5.1
|
||||
* @see PermissionHolder#getQueryOptions()
|
||||
*/
|
||||
CachedMetaData getMetaData();
|
||||
@NonNull CachedMetaData getMetaData();
|
||||
|
||||
/**
|
||||
* Invalidates all cached {@link CachedPermissionData} and {@link CachedMetaData}
|
||||
@@ -135,7 +136,7 @@ public interface CachedDataManager {
|
||||
* @return a data instance
|
||||
* @throws NullPointerException if contexts is null
|
||||
*/
|
||||
T get(QueryOptions queryOptions);
|
||||
@NonNull T get(@NonNull QueryOptions queryOptions);
|
||||
|
||||
/**
|
||||
* Calculates {@link T data}, bypassing the cache.
|
||||
@@ -152,7 +153,7 @@ public interface CachedDataManager {
|
||||
* @return a data instance
|
||||
* @throws NullPointerException if contexts is null
|
||||
*/
|
||||
T calculate(QueryOptions queryOptions);
|
||||
@NonNull T calculate(@NonNull QueryOptions queryOptions);
|
||||
|
||||
/**
|
||||
* (Re)calculates data for a given context.
|
||||
@@ -170,7 +171,7 @@ public interface CachedDataManager {
|
||||
* @param queryOptions the query options
|
||||
* @throws NullPointerException if contexts is null
|
||||
*/
|
||||
void recalculate(QueryOptions queryOptions);
|
||||
void recalculate(@NonNull QueryOptions queryOptions);
|
||||
|
||||
/**
|
||||
* (Re)loads permission data for a given context.
|
||||
@@ -196,7 +197,7 @@ public interface CachedDataManager {
|
||||
* @return a future
|
||||
* @throws NullPointerException if contexts is null
|
||||
*/
|
||||
CompletableFuture<? extends T> reload(QueryOptions queryOptions);
|
||||
@NonNull CompletableFuture<? extends T> reload(@NonNull QueryOptions queryOptions);
|
||||
|
||||
/**
|
||||
* Recalculates data for all known contexts.
|
||||
@@ -228,14 +229,14 @@ public interface CachedDataManager {
|
||||
*
|
||||
* @return a future
|
||||
*/
|
||||
CompletableFuture<Void> reload();
|
||||
@NonNull CompletableFuture<Void> reload();
|
||||
|
||||
/**
|
||||
* Invalidates any cached data instances mapped to the given context.
|
||||
*
|
||||
* @param queryOptions the queryOptions to invalidate for
|
||||
*/
|
||||
void invalidate(QueryOptions queryOptions);
|
||||
void invalidate(@NonNull QueryOptions queryOptions);
|
||||
|
||||
/**
|
||||
* Invalidates all cached data instances.
|
||||
|
||||
@@ -30,8 +30,9 @@ import net.luckperms.api.node.types.MetaNode;
|
||||
import net.luckperms.api.node.types.PrefixNode;
|
||||
import net.luckperms.api.node.types.SuffixNode;
|
||||
import net.luckperms.api.node.types.WeightNode;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -62,7 +63,7 @@ public interface CachedMetaData extends CachedData {
|
||||
* @return a result containing the value
|
||||
* @since 5.4
|
||||
*/
|
||||
Result<String, MetaNode> queryMetaValue(String key);
|
||||
@NonNull Result<String, MetaNode> queryMetaValue(@NonNull String key);
|
||||
|
||||
/**
|
||||
* Gets a value for the given meta key.
|
||||
@@ -72,7 +73,7 @@ public interface CachedMetaData extends CachedData {
|
||||
* @param key the key
|
||||
* @return the value
|
||||
*/
|
||||
default @Nullable String getMetaValue(String key) {
|
||||
default @Nullable String getMetaValue(@NonNull String key) {
|
||||
return queryMetaValue(key).result();
|
||||
}
|
||||
|
||||
@@ -96,7 +97,7 @@ public interface CachedMetaData extends CachedData {
|
||||
* @return the meta value
|
||||
* @since 5.3
|
||||
*/
|
||||
default <T> Optional<T> getMetaValue(String key, Function<String, ? extends T> valueTransformer) {
|
||||
default <T> @NonNull Optional<T> getMetaValue(@NonNull String key, @NonNull Function<String, ? extends T> valueTransformer) {
|
||||
return Optional.ofNullable(getMetaValue(key)).map(value -> {
|
||||
try {
|
||||
return valueTransformer.apply(value);
|
||||
@@ -117,12 +118,12 @@ public interface CachedMetaData extends CachedData {
|
||||
*
|
||||
* <p>This method will always return a {@link Result}, but the
|
||||
* {@link Result#result() inner result} {@link String} will be null if
|
||||
* the resultant prefix stack contained no elements.</p>
|
||||
* a the resultant prefix stack contained no elements.</p>
|
||||
*
|
||||
* @return a result containing the prefix
|
||||
* @since 5.4
|
||||
*/
|
||||
Result<String, PrefixNode> queryPrefix();
|
||||
@NonNull Result<String, PrefixNode> queryPrefix();
|
||||
|
||||
/**
|
||||
* Gets the prefix.
|
||||
@@ -152,12 +153,12 @@ public interface CachedMetaData extends CachedData {
|
||||
*
|
||||
* <p>This method will always return a {@link Result}, but the
|
||||
* {@link Result#result() inner result} {@link String} will be null if
|
||||
* the resultant suffix stack contained no elements.</p>
|
||||
* a the resultant suffix stack contained no elements.</p>
|
||||
*
|
||||
* @return a result containing the suffix
|
||||
* @since 5.4
|
||||
*/
|
||||
Result<String, SuffixNode> querySuffix();
|
||||
@NonNull Result<String, SuffixNode> querySuffix();
|
||||
|
||||
/**
|
||||
* Gets the suffix.
|
||||
@@ -186,7 +187,7 @@ public interface CachedMetaData extends CachedData {
|
||||
* @return a result containing the weight
|
||||
* @since 5.5
|
||||
*/
|
||||
Result<Integer, WeightNode> queryWeight();
|
||||
@NonNull Result<Integer, WeightNode> queryWeight();
|
||||
|
||||
/**
|
||||
* Gets the weight.
|
||||
@@ -207,7 +208,7 @@ public interface CachedMetaData extends CachedData {
|
||||
*
|
||||
* @return a map of meta
|
||||
*/
|
||||
@Unmodifiable Map<String, List<String>> getMeta();
|
||||
@NonNull @Unmodifiable Map<String, List<String>> getMeta();
|
||||
|
||||
/**
|
||||
* Gets a sorted map of all accumulated {@link PrefixNode prefixes}.
|
||||
@@ -216,7 +217,7 @@ public interface CachedMetaData extends CachedData {
|
||||
*
|
||||
* @return a sorted map of prefixes
|
||||
*/
|
||||
@Unmodifiable SortedMap<Integer, String> getPrefixes();
|
||||
@NonNull @Unmodifiable SortedMap<Integer, String> getPrefixes();
|
||||
|
||||
/**
|
||||
* Gets a sorted map of all accumulated {@link SuffixNode suffixes}.
|
||||
@@ -225,7 +226,7 @@ public interface CachedMetaData extends CachedData {
|
||||
*
|
||||
* @return a sorted map of suffixes
|
||||
*/
|
||||
@Unmodifiable SortedMap<Integer, String> getSuffixes();
|
||||
@NonNull @Unmodifiable SortedMap<Integer, String> getSuffixes();
|
||||
|
||||
/**
|
||||
* Gets the name of the holders primary group.
|
||||
@@ -242,13 +243,13 @@ public interface CachedMetaData extends CachedData {
|
||||
*
|
||||
* @return the definition used for the prefix stack
|
||||
*/
|
||||
MetaStackDefinition getPrefixStackDefinition();
|
||||
@NonNull MetaStackDefinition getPrefixStackDefinition();
|
||||
|
||||
/**
|
||||
* Gets the definition used for the suffix stack.
|
||||
*
|
||||
* @return the definition used for the suffix stack
|
||||
*/
|
||||
MetaStackDefinition getSuffixStackDefinition();
|
||||
@NonNull MetaStackDefinition getSuffixStackDefinition();
|
||||
|
||||
}
|
||||
@@ -27,6 +27,7 @@ package net.luckperms.api.cacheddata;
|
||||
|
||||
import net.luckperms.api.node.Node;
|
||||
import net.luckperms.api.util.Tristate;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -51,7 +52,7 @@ public interface CachedPermissionData extends CachedData {
|
||||
* @throws NullPointerException if permission is null
|
||||
* @since 5.4
|
||||
*/
|
||||
Result<Tristate, Node> queryPermission(String permission);
|
||||
@NonNull Result<Tristate, Node> queryPermission(@NonNull String permission);
|
||||
|
||||
/**
|
||||
* Performs a permission check for the given {@code permission} node.
|
||||
@@ -63,7 +64,7 @@ public interface CachedPermissionData extends CachedData {
|
||||
* @return a tristate result
|
||||
* @throws NullPointerException if permission is null
|
||||
*/
|
||||
default Tristate checkPermission(String permission) {
|
||||
default @NonNull Tristate checkPermission(@NonNull String permission) {
|
||||
return queryPermission(permission).result();
|
||||
}
|
||||
|
||||
@@ -79,6 +80,6 @@ public interface CachedPermissionData extends CachedData {
|
||||
*
|
||||
* @return an immutable set of permissions
|
||||
*/
|
||||
@Unmodifiable Map<String, Boolean> getPermissionMap();
|
||||
@NonNull @Unmodifiable Map<String, Boolean> getPermissionMap();
|
||||
|
||||
}
|
||||
@@ -26,7 +26,7 @@
|
||||
package net.luckperms.api.cacheddata;
|
||||
|
||||
import net.luckperms.api.node.Node;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
/**
|
||||
* Represents the result of a cached data lookup.
|
||||
|
||||
@@ -27,5 +27,4 @@
|
||||
* Caches permission checks and meta lookups for {@link net.luckperms.api.model.user.User}s and
|
||||
* {@link net.luckperms.api.model.group.Group}s.
|
||||
*/
|
||||
@org.jspecify.annotations.NullMarked
|
||||
package net.luckperms.api.cacheddata;
|
||||
@@ -25,7 +25,8 @@
|
||||
|
||||
package net.luckperms.api.context;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
/**
|
||||
* Represents an individual context pair.
|
||||
@@ -88,13 +89,13 @@ public interface Context {
|
||||
*
|
||||
* @return the key
|
||||
*/
|
||||
String getKey();
|
||||
@NonNull String getKey();
|
||||
|
||||
/**
|
||||
* Gets the context value
|
||||
*
|
||||
* @return the value
|
||||
*/
|
||||
String getValue();
|
||||
@NonNull String getValue();
|
||||
|
||||
}
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
package net.luckperms.api.context;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
@@ -38,8 +38,8 @@ import java.util.function.Function;
|
||||
* <ul>
|
||||
* <li>Context lookups should be <i>fast</i>: lookup methods are likely to
|
||||
* be invoked frequently, and should therefore be fast to execute. If
|
||||
* determining the current contexts involves a particularly time-consuming
|
||||
* lookup (database queries, network requests, etc.), then such results
|
||||
* determining the current contexts involves a particularly time consuming
|
||||
* lookup (database queries, network requests, etc), then such results
|
||||
* should be cached ahead of time.</li>
|
||||
*
|
||||
* <li>Context lookups should be <i>thread-safe</i>: lookups will sometimes
|
||||
@@ -70,7 +70,7 @@ public interface ContextCalculator<T> {
|
||||
* @param <T> the contextual type
|
||||
* @return the resultant calculator
|
||||
*/
|
||||
static <T> ContextCalculator<T> forSingleContext(String key, Function<T, @Nullable String> valueFunction) {
|
||||
static <T> @NonNull ContextCalculator<T> forSingleContext(@NonNull String key, @NonNull Function<T, String> valueFunction) {
|
||||
Objects.requireNonNull(key, "key");
|
||||
Objects.requireNonNull(valueFunction, "valueFunction");
|
||||
return (target, consumer) -> {
|
||||
@@ -92,7 +92,7 @@ public interface ContextCalculator<T> {
|
||||
* @param target the target contextual subject for this operation
|
||||
* @param consumer the {@link ContextConsumer} to submit contexts to
|
||||
*/
|
||||
void calculate(T target, ContextConsumer consumer);
|
||||
void calculate(@NonNull T target, @NonNull ContextConsumer consumer);
|
||||
|
||||
/**
|
||||
* Gets a {@link ContextSet}, containing some/all of the contexts this
|
||||
@@ -103,7 +103,7 @@ public interface ContextCalculator<T> {
|
||||
*
|
||||
* @return a set of potential contexts
|
||||
*/
|
||||
default ContextSet estimatePotentialContexts() {
|
||||
default @NonNull ContextSet estimatePotentialContexts() {
|
||||
return ImmutableContextSet.empty();
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
package net.luckperms.api.context;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Functional interface that accepts context key value pairs.
|
||||
*/
|
||||
@@ -37,14 +39,14 @@ public interface ContextConsumer {
|
||||
* @param key the key
|
||||
* @param value the value
|
||||
*/
|
||||
void accept(String key, String value);
|
||||
void accept(@NonNull String key, @NonNull String value);
|
||||
|
||||
/**
|
||||
* Accepts a context pair.
|
||||
*
|
||||
* @param context the context
|
||||
*/
|
||||
default void accept(Context context) {
|
||||
default void accept(@NonNull Context context) {
|
||||
accept(context.getKey(), context.getValue());
|
||||
}
|
||||
|
||||
@@ -53,7 +55,7 @@ public interface ContextConsumer {
|
||||
*
|
||||
* @param contextSet the context set
|
||||
*/
|
||||
default void accept(ContextSet contextSet) {
|
||||
default void accept(@NonNull ContextSet contextSet) {
|
||||
for (Context entry : contextSet) {
|
||||
accept(entry);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ package net.luckperms.api.context;
|
||||
import net.luckperms.api.model.user.User;
|
||||
import net.luckperms.api.query.QueryMode;
|
||||
import net.luckperms.api.query.QueryOptions;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus.Internal;
|
||||
|
||||
import java.util.Optional;
|
||||
@@ -60,7 +61,7 @@ public interface ContextManager {
|
||||
* @param subject the subject
|
||||
* @return the applicable context for the subject
|
||||
*/
|
||||
ImmutableContextSet getContext(Object subject);
|
||||
@NonNull ImmutableContextSet getContext(@NonNull Object subject);
|
||||
|
||||
/**
|
||||
* Queries the ContextManager for current context values for the given User.
|
||||
@@ -75,7 +76,7 @@ public interface ContextManager {
|
||||
* @param user the user
|
||||
* @return the applicable context for the subject
|
||||
*/
|
||||
Optional<ImmutableContextSet> getContext(User user);
|
||||
@NonNull Optional<ImmutableContextSet> getContext(@NonNull User user);
|
||||
|
||||
/**
|
||||
* Gets the contexts from the static calculators in this manager.
|
||||
@@ -85,7 +86,7 @@ public interface ContextManager {
|
||||
*
|
||||
* @return the current active static contexts
|
||||
*/
|
||||
ImmutableContextSet getStaticContext();
|
||||
@NonNull ImmutableContextSet getStaticContext();
|
||||
|
||||
/**
|
||||
* Creates a new {@link QueryOptions.Builder}.
|
||||
@@ -93,7 +94,7 @@ public interface ContextManager {
|
||||
* @param mode the mode
|
||||
* @return a new query options builder
|
||||
*/
|
||||
QueryOptions.Builder queryOptionsBuilder(QueryMode mode);
|
||||
QueryOptions.@NonNull Builder queryOptionsBuilder(@NonNull QueryMode mode);
|
||||
|
||||
/**
|
||||
* Obtains current {@link QueryOptions} for the subject.
|
||||
@@ -101,7 +102,7 @@ public interface ContextManager {
|
||||
* @param subject the subject
|
||||
* @return the query options for the subject
|
||||
*/
|
||||
QueryOptions getQueryOptions(Object subject);
|
||||
@NonNull QueryOptions getQueryOptions(@NonNull Object subject);
|
||||
|
||||
/**
|
||||
* Obtains current {@link QueryOptions} for the given User.
|
||||
@@ -115,28 +116,28 @@ public interface ContextManager {
|
||||
* @param user the user
|
||||
* @return the query options for the subject
|
||||
*/
|
||||
Optional<QueryOptions> getQueryOptions(User user);
|
||||
@NonNull Optional<QueryOptions> getQueryOptions(@NonNull User user);
|
||||
|
||||
/**
|
||||
* Gets the static query options, using the registered static context calculators.
|
||||
*
|
||||
* @return the current static query options
|
||||
*/
|
||||
QueryOptions getStaticQueryOptions();
|
||||
@NonNull QueryOptions getStaticQueryOptions();
|
||||
|
||||
/**
|
||||
* Registers a context calculator with the manager.
|
||||
*
|
||||
* @param calculator the calculator
|
||||
*/
|
||||
void registerCalculator(ContextCalculator<?> calculator);
|
||||
void registerCalculator(@NonNull ContextCalculator<?> calculator);
|
||||
|
||||
/**
|
||||
* Unregisters a context calculator with the manager.
|
||||
*
|
||||
* @param calculator the calculator
|
||||
*/
|
||||
void unregisterCalculator(ContextCalculator<?> calculator);
|
||||
void unregisterCalculator(@NonNull ContextCalculator<?> calculator);
|
||||
|
||||
/**
|
||||
* Signal to the {@link ContextManager} that a {@code subject}s
|
||||
@@ -148,7 +149,7 @@ public interface ContextManager {
|
||||
* @param subject the subject
|
||||
* @since 5.2
|
||||
*/
|
||||
void signalContextUpdate(Object subject);
|
||||
void signalContextUpdate(@NonNull Object subject);
|
||||
|
||||
/**
|
||||
* Gets the {@link ContextSetFactory}, responsible for creating
|
||||
@@ -157,7 +158,7 @@ public interface ContextManager {
|
||||
* @return the context set factory
|
||||
*/
|
||||
@Internal
|
||||
ContextSetFactory getContextSetFactory();
|
||||
@NonNull ContextSetFactory getContextSetFactory();
|
||||
|
||||
/**
|
||||
* Invalidates the lookup cache for a given subject
|
||||
@@ -166,7 +167,7 @@ public interface ContextManager {
|
||||
* @deprecated Use {@link #signalContextUpdate(Object)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
default void invalidateCache(Object subject) {
|
||||
default void invalidateCache(@NonNull Object subject) {
|
||||
signalContextUpdate(subject);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
package net.luckperms.api.context;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
import java.util.Iterator;
|
||||
@@ -64,7 +65,7 @@ import java.util.Set;
|
||||
* the '{@code :}' character. (e.g. "{@code worldguard:region}" for WorldGuard
|
||||
* regions)</p>
|
||||
*
|
||||
* <p>Contexts can be combined with each other to form so-called
|
||||
* <p>Contexts can be combined with each other to form so called
|
||||
* "context sets" - simply a collection of context pairs.</p>
|
||||
*
|
||||
* <p>Two default ContextSet implementations are provided.
|
||||
@@ -90,7 +91,7 @@ public interface ContextSet extends Iterable<Context> {
|
||||
*
|
||||
* @return an immutable representation of this set
|
||||
*/
|
||||
ImmutableContextSet immutableCopy();
|
||||
@NonNull ImmutableContextSet immutableCopy();
|
||||
|
||||
/**
|
||||
* Creates a mutable copy of this {@link ContextSet}.
|
||||
@@ -100,7 +101,7 @@ public interface ContextSet extends Iterable<Context> {
|
||||
*
|
||||
* @return a mutable ContextSet
|
||||
*/
|
||||
MutableContextSet mutableCopy();
|
||||
@NonNull MutableContextSet mutableCopy();
|
||||
|
||||
/**
|
||||
* Returns a {@link Set} of {@link Context}s representing the current
|
||||
@@ -111,7 +112,7 @@ public interface ContextSet extends Iterable<Context> {
|
||||
*
|
||||
* @return an immutable set
|
||||
*/
|
||||
@Unmodifiable Set<Context> toSet();
|
||||
@NonNull @Unmodifiable Set<Context> toSet();
|
||||
|
||||
/**
|
||||
* Returns a {@link Map} representing the current state of this
|
||||
@@ -122,7 +123,7 @@ public interface ContextSet extends Iterable<Context> {
|
||||
*
|
||||
* @return a map
|
||||
*/
|
||||
@Unmodifiable Map<String, Set<String>> toMap();
|
||||
@NonNull @Unmodifiable Map<String, Set<String>> toMap();
|
||||
|
||||
/**
|
||||
* Returns a {@link Map} <b>loosely</b> representing the current state of
|
||||
@@ -138,7 +139,7 @@ public interface ContextSet extends Iterable<Context> {
|
||||
* @deprecated Deprecated because the returned map may not contain all data in the ContextSet
|
||||
*/
|
||||
@Deprecated
|
||||
@Unmodifiable Map<String, String> toFlattenedMap();
|
||||
@NonNull @Unmodifiable Map<String, String> toFlattenedMap();
|
||||
|
||||
/**
|
||||
* Returns an {@link Iterator} over each of the context pairs in this set.
|
||||
@@ -151,7 +152,7 @@ public interface ContextSet extends Iterable<Context> {
|
||||
* @return an iterator
|
||||
*/
|
||||
@Override
|
||||
@Unmodifiable Iterator<Context> iterator();
|
||||
@NonNull @Unmodifiable Iterator<Context> iterator();
|
||||
|
||||
/**
|
||||
* Returns if the {@link ContextSet} contains at least one value for the
|
||||
@@ -161,7 +162,7 @@ public interface ContextSet extends Iterable<Context> {
|
||||
* @return true if the set contains a value for the key
|
||||
* @throws NullPointerException if the key is null
|
||||
*/
|
||||
boolean containsKey(String key);
|
||||
boolean containsKey(@NonNull String key);
|
||||
|
||||
/**
|
||||
* Returns a {@link Set} of the values mapped to the given key.
|
||||
@@ -173,7 +174,7 @@ public interface ContextSet extends Iterable<Context> {
|
||||
* @return a set of values
|
||||
* @throws NullPointerException if the key is null
|
||||
*/
|
||||
@Unmodifiable Set<String> getValues(String key);
|
||||
@NonNull @Unmodifiable Set<String> getValues(@NonNull String key);
|
||||
|
||||
/**
|
||||
* Returns any value from this {@link ContextSet} matching the key, if present.
|
||||
@@ -184,7 +185,7 @@ public interface ContextSet extends Iterable<Context> {
|
||||
* @param key the key to find values for
|
||||
* @return an optional containing any match
|
||||
*/
|
||||
default Optional<String> getAnyValue(String key) {
|
||||
default @NonNull Optional<String> getAnyValue(@NonNull String key) {
|
||||
return getValues(key).stream().findAny();
|
||||
}
|
||||
|
||||
@@ -196,7 +197,7 @@ public interface ContextSet extends Iterable<Context> {
|
||||
* @return true if the set contains the context pair
|
||||
* @throws NullPointerException if the key or value is null
|
||||
*/
|
||||
boolean contains(String key, String value);
|
||||
boolean contains(@NonNull String key, @NonNull String value);
|
||||
|
||||
/**
|
||||
* Returns if the {@link ContextSet} contains a given context pairing.
|
||||
@@ -205,7 +206,7 @@ public interface ContextSet extends Iterable<Context> {
|
||||
* @return true if the set contains the context pair
|
||||
* @throws NullPointerException if the key or value is null
|
||||
*/
|
||||
default boolean contains(Context entry) {
|
||||
default boolean contains(@NonNull Context entry) {
|
||||
Objects.requireNonNull(entry, "entry");
|
||||
return contains(entry.getKey(), entry.getValue());
|
||||
}
|
||||
@@ -218,7 +219,7 @@ public interface ContextSet extends Iterable<Context> {
|
||||
* @return true if the set contains any of the pairs
|
||||
* @since 5.2
|
||||
*/
|
||||
default boolean containsAny(String key, Iterable<String> values) {
|
||||
default boolean containsAny(@NonNull String key, @NonNull Iterable<String> values) {
|
||||
Objects.requireNonNull(key, "key");
|
||||
Objects.requireNonNull(values, "values");
|
||||
|
||||
@@ -238,7 +239,7 @@ public interface ContextSet extends Iterable<Context> {
|
||||
* @param other the other set
|
||||
* @return true if this context set is satisfied by the other
|
||||
*/
|
||||
default boolean isSatisfiedBy(ContextSet other) {
|
||||
default boolean isSatisfiedBy(@NonNull ContextSet other) {
|
||||
return isSatisfiedBy(other, ContextSatisfyMode.AT_LEAST_ONE_VALUE_PER_KEY);
|
||||
}
|
||||
|
||||
@@ -251,7 +252,7 @@ public interface ContextSet extends Iterable<Context> {
|
||||
* @return true if this context set is satisfied by the other
|
||||
* @since 5.2
|
||||
*/
|
||||
boolean isSatisfiedBy(ContextSet other, ContextSatisfyMode mode);
|
||||
boolean isSatisfiedBy(@NonNull ContextSet other, @NonNull ContextSatisfyMode mode);
|
||||
|
||||
/**
|
||||
* Returns if the {@link ContextSet} is empty.
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
package net.luckperms.api.context;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus.Internal;
|
||||
|
||||
/**
|
||||
@@ -39,10 +40,10 @@ public interface ContextSetFactory {
|
||||
/**
|
||||
* Prefer using {@link ImmutableContextSet#builder()}.
|
||||
*
|
||||
* @return an immutable context set builder
|
||||
* @return a immutable context set builder
|
||||
* @see ImmutableContextSet#builder()
|
||||
*/
|
||||
ImmutableContextSet.Builder immutableBuilder();
|
||||
ImmutableContextSet.@NonNull Builder immutableBuilder();
|
||||
|
||||
/**
|
||||
* Prefer using {@link ImmutableContextSet#of(String, String)}.
|
||||
@@ -52,7 +53,7 @@ public interface ContextSetFactory {
|
||||
* @return an immutable context set
|
||||
* @see ImmutableContextSet#of(String, String)
|
||||
*/
|
||||
ImmutableContextSet immutableOf(String key, String value);
|
||||
@NonNull ImmutableContextSet immutableOf(@NonNull String key, @NonNull String value);
|
||||
|
||||
/**
|
||||
* Prefer using {@link ImmutableContextSet#empty()}.
|
||||
@@ -60,7 +61,7 @@ public interface ContextSetFactory {
|
||||
* @return an empty immutable context set
|
||||
* @see ImmutableContextSet#empty()
|
||||
*/
|
||||
ImmutableContextSet immutableEmpty();
|
||||
@NonNull ImmutableContextSet immutableEmpty();
|
||||
|
||||
/**
|
||||
* Prefer using {@link MutableContextSet#create()}.
|
||||
@@ -68,6 +69,6 @@ public interface ContextSetFactory {
|
||||
* @return a new mutable context set
|
||||
* @see MutableContextSet#create()
|
||||
*/
|
||||
MutableContextSet mutable();
|
||||
@NonNull MutableContextSet mutable();
|
||||
|
||||
}
|
||||
@@ -34,17 +34,17 @@ public final class DefaultContextKeys {
|
||||
}
|
||||
|
||||
/**
|
||||
* The context key used to denote the name of the subject's server.
|
||||
* The context key used to denote the name of the subjects server.
|
||||
*/
|
||||
public static final String SERVER_KEY = "server";
|
||||
|
||||
/**
|
||||
* The context key used to denote the name of the subject's world.
|
||||
* The context key used to denote the name of the subjects world.
|
||||
*/
|
||||
public static final String WORLD_KEY = "world";
|
||||
|
||||
/**
|
||||
* The context key used to denote the dimension type of the subject's world.
|
||||
* The context key used to denote the dimension type of the subjects world.
|
||||
*
|
||||
* <p>Possible values: overworld, the_nether, the_end</p>
|
||||
*
|
||||
@@ -53,7 +53,7 @@ public final class DefaultContextKeys {
|
||||
public static final String DIMENSION_TYPE_KEY = "dimension-type";
|
||||
|
||||
/**
|
||||
* The context key used to denote the subject's gamemode.
|
||||
* The context key used to denote the subjects gamemode.
|
||||
*
|
||||
* <p>Possible values: survival, creative, adventure, spectator</p>
|
||||
*
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
package net.luckperms.api.context;
|
||||
|
||||
import net.luckperms.api.LuckPermsProvider;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -39,7 +40,7 @@ public interface ImmutableContextSet extends ContextSet {
|
||||
*
|
||||
* @return a new ImmutableContextSet builder
|
||||
*/
|
||||
static Builder builder() {
|
||||
static @NonNull Builder builder() {
|
||||
return LuckPermsProvider.get().getContextManager().getContextSetFactory().immutableBuilder();
|
||||
}
|
||||
|
||||
@@ -48,7 +49,7 @@ public interface ImmutableContextSet extends ContextSet {
|
||||
*
|
||||
* @return an empty ImmutableContextSet
|
||||
*/
|
||||
static ImmutableContextSet empty() {
|
||||
static @NonNull ImmutableContextSet empty() {
|
||||
return LuckPermsProvider.get().getContextManager().getContextSetFactory().immutableEmpty();
|
||||
}
|
||||
|
||||
@@ -60,7 +61,7 @@ public interface ImmutableContextSet extends ContextSet {
|
||||
* @return a new ImmutableContextSet containing one context pair
|
||||
* @throws NullPointerException if key or value is null
|
||||
*/
|
||||
static ImmutableContextSet of(String key, String value) {
|
||||
static @NonNull ImmutableContextSet of(@NonNull String key, @NonNull String value) {
|
||||
return LuckPermsProvider.get().getContextManager().getContextSetFactory().immutableOf(key, value);
|
||||
}
|
||||
|
||||
@@ -69,7 +70,7 @@ public interface ImmutableContextSet extends ContextSet {
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
ImmutableContextSet immutableCopy();
|
||||
@NonNull ImmutableContextSet immutableCopy();
|
||||
|
||||
/**
|
||||
* A builder for {@link ImmutableContextSet}.
|
||||
@@ -85,7 +86,7 @@ public interface ImmutableContextSet extends ContextSet {
|
||||
* @throws NullPointerException if the key or value is null
|
||||
* @see MutableContextSet#add(String, String)
|
||||
*/
|
||||
Builder add(String key, String value);
|
||||
@NonNull Builder add(@NonNull String key, @NonNull String value);
|
||||
|
||||
/**
|
||||
* Adds a context to the set.
|
||||
@@ -95,7 +96,7 @@ public interface ImmutableContextSet extends ContextSet {
|
||||
* @throws NullPointerException if the entry is null
|
||||
* @see MutableContextSet#add(Context)
|
||||
*/
|
||||
default Builder add(Context entry) {
|
||||
default @NonNull Builder add(@NonNull Context entry) {
|
||||
Objects.requireNonNull(entry, "entry");
|
||||
add(entry.getKey(), entry.getValue());
|
||||
return this;
|
||||
@@ -109,7 +110,7 @@ public interface ImmutableContextSet extends ContextSet {
|
||||
* @throws NullPointerException if iterable is null
|
||||
* @see MutableContextSet#addAll(Iterable)
|
||||
*/
|
||||
default Builder addAll(Iterable<Context> iterable) {
|
||||
default @NonNull Builder addAll(@NonNull Iterable<Context> iterable) {
|
||||
for (Context e : Objects.requireNonNull(iterable, "iterable")) {
|
||||
add(e);
|
||||
}
|
||||
@@ -124,7 +125,7 @@ public interface ImmutableContextSet extends ContextSet {
|
||||
* @throws NullPointerException if the contextSet is null
|
||||
* @see MutableContextSet#addAll(ContextSet)
|
||||
*/
|
||||
Builder addAll(ContextSet contextSet);
|
||||
@NonNull Builder addAll(@NonNull ContextSet contextSet);
|
||||
|
||||
/**
|
||||
* Creates a {@link ImmutableContextSet} from the values previously
|
||||
@@ -132,6 +133,6 @@ public interface ImmutableContextSet extends ContextSet {
|
||||
*
|
||||
* @return an {@link ImmutableContextSet} from the builder
|
||||
*/
|
||||
ImmutableContextSet build();
|
||||
@NonNull ImmutableContextSet build();
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,7 @@
|
||||
package net.luckperms.api.context;
|
||||
|
||||
import net.luckperms.api.LuckPermsProvider;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -39,7 +40,7 @@ public interface MutableContextSet extends ContextSet {
|
||||
*
|
||||
* @return a new MutableContextSet
|
||||
*/
|
||||
static MutableContextSet create() {
|
||||
static @NonNull MutableContextSet create() {
|
||||
return LuckPermsProvider.get().getContextManager().getContextSetFactory().mutable();
|
||||
}
|
||||
|
||||
@@ -51,7 +52,7 @@ public interface MutableContextSet extends ContextSet {
|
||||
* @return a new MutableContextSet containing one context pair
|
||||
* @throws NullPointerException if key or value is null
|
||||
*/
|
||||
static MutableContextSet of(String key, String value) {
|
||||
static @NonNull MutableContextSet of(@NonNull String key, @NonNull String value) {
|
||||
Objects.requireNonNull(key, "key");
|
||||
Objects.requireNonNull(value, "value");
|
||||
MutableContextSet set = create();
|
||||
@@ -66,7 +67,7 @@ public interface MutableContextSet extends ContextSet {
|
||||
* @param value the value to add
|
||||
* @throws NullPointerException if the key or value is null
|
||||
*/
|
||||
void add(String key, String value);
|
||||
void add(@NonNull String key, @NonNull String value);
|
||||
|
||||
/**
|
||||
* Adds a context to this set.
|
||||
@@ -74,7 +75,7 @@ public interface MutableContextSet extends ContextSet {
|
||||
* @param entry the entry to add
|
||||
* @throws NullPointerException if the entry is null
|
||||
*/
|
||||
default void add(Context entry) {
|
||||
default void add(@NonNull Context entry) {
|
||||
Objects.requireNonNull(entry, "entry");
|
||||
add(entry.getKey(), entry.getValue());
|
||||
}
|
||||
@@ -85,7 +86,7 @@ public interface MutableContextSet extends ContextSet {
|
||||
* @param iterable an iterable of key value context pairs
|
||||
* @throws NullPointerException if iterable is null
|
||||
*/
|
||||
default void addAll(Iterable<Context> iterable) {
|
||||
default void addAll(@NonNull Iterable<Context> iterable) {
|
||||
for (Context e : Objects.requireNonNull(iterable, "iterable")) {
|
||||
add(e);
|
||||
}
|
||||
@@ -97,7 +98,7 @@ public interface MutableContextSet extends ContextSet {
|
||||
* @param contextSet the set to add from
|
||||
* @throws NullPointerException if the contextSet is null
|
||||
*/
|
||||
void addAll(ContextSet contextSet);
|
||||
void addAll(@NonNull ContextSet contextSet);
|
||||
|
||||
/**
|
||||
* Removes a context from this set.
|
||||
@@ -106,7 +107,7 @@ public interface MutableContextSet extends ContextSet {
|
||||
* @param value the value to remove
|
||||
* @throws NullPointerException if the key or value is null
|
||||
*/
|
||||
void remove(String key, String value);
|
||||
void remove(@NonNull String key, @NonNull String value);
|
||||
|
||||
/**
|
||||
* Removes all contexts from this set with the given key.
|
||||
@@ -114,7 +115,7 @@ public interface MutableContextSet extends ContextSet {
|
||||
* @param key the key to remove
|
||||
* @throws NullPointerException if the key is null
|
||||
*/
|
||||
void removeAll(String key);
|
||||
void removeAll(@NonNull String key);
|
||||
|
||||
/**
|
||||
* Removes all contexts from the set.
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
package net.luckperms.api.context;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.function.Supplier;
|
||||
@@ -46,7 +46,7 @@ public interface StaticContextCalculator extends ContextCalculator<Object> {
|
||||
* if the value returned is null.
|
||||
* @return the resultant calculator
|
||||
*/
|
||||
static StaticContextCalculator forSingleContext(String key, Supplier<@Nullable String> valueFunction) {
|
||||
static StaticContextCalculator forSingleContext(String key, Supplier<String> valueFunction) {
|
||||
Objects.requireNonNull(key, "key");
|
||||
Objects.requireNonNull(valueFunction, "valueFunction");
|
||||
return consumer -> {
|
||||
@@ -66,10 +66,10 @@ public interface StaticContextCalculator extends ContextCalculator<Object> {
|
||||
*
|
||||
* @param consumer the {@link ContextConsumer} to submit contexts to
|
||||
*/
|
||||
void calculate(ContextConsumer consumer);
|
||||
void calculate(@NonNull ContextConsumer consumer);
|
||||
|
||||
@Override
|
||||
default void calculate(Object target, ContextConsumer consumer) {
|
||||
default void calculate(@NonNull Object target, @NonNull ContextConsumer consumer) {
|
||||
calculate(consumer);
|
||||
}
|
||||
}
|
||||
@@ -27,5 +27,4 @@
|
||||
* Context functionality, including {@link net.luckperms.api.context.ContextSet}s and
|
||||
* {@link net.luckperms.api.context.ContextCalculator}s.
|
||||
*/
|
||||
@org.jspecify.annotations.NullMarked
|
||||
package net.luckperms.api.context;
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
package net.luckperms.api.event;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
import java.util.Set;
|
||||
@@ -49,7 +50,7 @@ public interface EventBus {
|
||||
* @param <T> the event class
|
||||
* @return an event handler instance representing this subscription
|
||||
*/
|
||||
<T extends LuckPermsEvent> EventSubscription<T> subscribe(Class<T> eventClass, Consumer<? super T> handler);
|
||||
<T extends LuckPermsEvent> @NonNull EventSubscription<T> subscribe(@NonNull Class<T> eventClass, @NonNull Consumer<? super T> handler);
|
||||
|
||||
/**
|
||||
* Registers a new subscription to the given event.
|
||||
@@ -69,7 +70,7 @@ public interface EventBus {
|
||||
* @param handler the event handler
|
||||
* @return an event handler instance representing this subscription
|
||||
*/
|
||||
<T extends LuckPermsEvent> EventSubscription<T> subscribe(Object plugin, Class<T> eventClass, Consumer<? super T> handler);
|
||||
<T extends LuckPermsEvent> @NonNull EventSubscription<T> subscribe(Object plugin, @NonNull Class<T> eventClass, @NonNull Consumer<? super T> handler);
|
||||
|
||||
/**
|
||||
* Gets a set of all registered handlers for a given event.
|
||||
@@ -78,6 +79,6 @@ public interface EventBus {
|
||||
* @param <T> the event class
|
||||
* @return an immutable set of event handlers
|
||||
*/
|
||||
<T extends LuckPermsEvent> @Unmodifiable Set<EventSubscription<T>> getSubscriptions(Class<T> eventClass);
|
||||
<T extends LuckPermsEvent> @NonNull @Unmodifiable Set<EventSubscription<T>> getSubscriptions(@NonNull Class<T> eventClass);
|
||||
|
||||
}
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
package net.luckperms.api.event;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
@@ -39,7 +41,7 @@ public interface EventSubscription<T extends LuckPermsEvent> extends AutoCloseab
|
||||
*
|
||||
* @return the event class
|
||||
*/
|
||||
Class<T> getEventClass();
|
||||
@NonNull Class<T> getEventClass();
|
||||
|
||||
/**
|
||||
* Returns true if this handler is active
|
||||
@@ -59,5 +61,5 @@ public interface EventSubscription<T extends LuckPermsEvent> extends AutoCloseab
|
||||
*
|
||||
* @return the event consumer
|
||||
*/
|
||||
Consumer<? super T> getHandler();
|
||||
@NonNull Consumer<? super T> getHandler();
|
||||
}
|
||||
@@ -26,6 +26,7 @@
|
||||
package net.luckperms.api.event;
|
||||
|
||||
import net.luckperms.api.LuckPerms;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* A superinterface for all LuckPerms events.
|
||||
@@ -37,13 +38,13 @@ public interface LuckPermsEvent {
|
||||
*
|
||||
* @return the api instance
|
||||
*/
|
||||
LuckPerms getLuckPerms();
|
||||
@NonNull LuckPerms getLuckPerms();
|
||||
|
||||
/**
|
||||
* Gets the type of the event.
|
||||
*
|
||||
* @return the type of the event
|
||||
*/
|
||||
Class<? extends LuckPermsEvent> getEventType();
|
||||
@NonNull Class<? extends LuckPermsEvent> getEventType();
|
||||
|
||||
}
|
||||
@@ -26,5 +26,4 @@
|
||||
/**
|
||||
* Event causes.
|
||||
*/
|
||||
@org.jspecify.annotations.NullMarked
|
||||
package net.luckperms.api.event.cause;
|
||||
@@ -28,6 +28,7 @@ package net.luckperms.api.event.context;
|
||||
import net.luckperms.api.context.ContextManager;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -57,16 +58,16 @@ public interface ContextUpdateEvent extends LuckPermsEvent {
|
||||
* @return the subject
|
||||
*/
|
||||
@Param(0)
|
||||
Object getSubject();
|
||||
@NonNull Object getSubject();
|
||||
|
||||
/**
|
||||
* Gets the subject whose contexts were updated, cast to a given type.
|
||||
* Gets the subject whose contexts were updated, casted to a given type.
|
||||
*
|
||||
* @param subjectClass the type to cast to
|
||||
* @param <T> the subject type
|
||||
* @return the cast subject
|
||||
* @return the casted subject
|
||||
*/
|
||||
default <T> Optional<T> getSubject(Class<T> subjectClass) {
|
||||
default <T> @NonNull Optional<T> getSubject(@NonNull Class<T> subjectClass) {
|
||||
Object subject = getSubject();
|
||||
return subjectClass.isInstance(subject) ? Optional.of(subjectClass.cast(subject)) : Optional.empty();
|
||||
}
|
||||
|
||||
@@ -26,5 +26,4 @@
|
||||
/**
|
||||
* Events relating to {@link net.luckperms.api.context.Context}s.
|
||||
*/
|
||||
@org.jspecify.annotations.NullMarked
|
||||
package net.luckperms.api.event.context;
|
||||
@@ -28,6 +28,7 @@ package net.luckperms.api.event.extension;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.extension.Extension;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Called when an {@link Extension} is loaded.
|
||||
@@ -40,6 +41,6 @@ public interface ExtensionLoadEvent extends LuckPermsEvent {
|
||||
* @return the extension
|
||||
*/
|
||||
@Param(0)
|
||||
Extension getExtension();
|
||||
@NonNull Extension getExtension();
|
||||
|
||||
}
|
||||
@@ -26,5 +26,4 @@
|
||||
/**
|
||||
* Events relating to {@link net.luckperms.api.extension.Extension}s.
|
||||
*/
|
||||
@org.jspecify.annotations.NullMarked
|
||||
package net.luckperms.api.event.extension;
|
||||
@@ -29,6 +29,7 @@ import net.luckperms.api.cacheddata.CachedDataManager;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.model.group.Group;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Called when a groups {@link CachedDataManager} is loaded.
|
||||
@@ -41,7 +42,7 @@ public interface GroupCacheLoadEvent extends LuckPermsEvent {
|
||||
* @return the group
|
||||
*/
|
||||
@Param(0)
|
||||
Group getGroup();
|
||||
@NonNull Group getGroup();
|
||||
|
||||
/**
|
||||
* Gets the data that was loaded
|
||||
@@ -49,6 +50,6 @@ public interface GroupCacheLoadEvent extends LuckPermsEvent {
|
||||
* @return the loaded data
|
||||
*/
|
||||
@Param(1)
|
||||
CachedDataManager getLoadedData();
|
||||
@NonNull CachedDataManager getLoadedData();
|
||||
|
||||
}
|
||||
@@ -29,6 +29,7 @@ import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.cause.CreationCause;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.model.group.Group;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Called when a group is created
|
||||
@@ -41,7 +42,7 @@ public interface GroupCreateEvent extends LuckPermsEvent {
|
||||
* @return the new group
|
||||
*/
|
||||
@Param(0)
|
||||
Group getGroup();
|
||||
@NonNull Group getGroup();
|
||||
|
||||
/**
|
||||
* Gets the cause of the creation
|
||||
@@ -49,6 +50,6 @@ public interface GroupCreateEvent extends LuckPermsEvent {
|
||||
* @return the cause of the creation
|
||||
*/
|
||||
@Param(1)
|
||||
CreationCause getCause();
|
||||
@NonNull CreationCause getCause();
|
||||
|
||||
}
|
||||
@@ -29,6 +29,7 @@ import net.luckperms.api.cacheddata.CachedDataManager;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.model.group.Group;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Called when a groups cached data is refreshed
|
||||
@@ -41,7 +42,7 @@ public interface GroupDataRecalculateEvent extends LuckPermsEvent {
|
||||
* @return the group
|
||||
*/
|
||||
@Param(0)
|
||||
Group getGroup();
|
||||
@NonNull Group getGroup();
|
||||
|
||||
/**
|
||||
* Gets the data that was recalculated
|
||||
@@ -49,6 +50,6 @@ public interface GroupDataRecalculateEvent extends LuckPermsEvent {
|
||||
* @return the data
|
||||
*/
|
||||
@Param(1)
|
||||
CachedDataManager getData();
|
||||
@NonNull CachedDataManager getData();
|
||||
|
||||
}
|
||||
@@ -29,6 +29,7 @@ import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.cause.DeletionCause;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.node.Node;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@@ -43,7 +44,7 @@ public interface GroupDeleteEvent extends LuckPermsEvent {
|
||||
* @return the name of the deleted group
|
||||
*/
|
||||
@Param(0)
|
||||
String getGroupName();
|
||||
@NonNull String getGroupName();
|
||||
|
||||
/**
|
||||
* Gets an immutable copy of the groups existing data
|
||||
@@ -51,7 +52,7 @@ public interface GroupDeleteEvent extends LuckPermsEvent {
|
||||
* @return a copy of the groups existing data
|
||||
*/
|
||||
@Param(1)
|
||||
Set<Node> getExistingData();
|
||||
@NonNull Set<Node> getExistingData();
|
||||
|
||||
/**
|
||||
* Gets the cause of the deletion
|
||||
@@ -59,6 +60,6 @@ public interface GroupDeleteEvent extends LuckPermsEvent {
|
||||
* @return the cause of the deletion
|
||||
*/
|
||||
@Param(2)
|
||||
DeletionCause getCause();
|
||||
@NonNull DeletionCause getCause();
|
||||
|
||||
}
|
||||
@@ -28,11 +28,12 @@ package net.luckperms.api.event.group;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.model.group.Group;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Called when a group is loaded into memory from the storage.
|
||||
*
|
||||
* <p>Note that this event is not the same as {@link GroupCreateEvent}.</p>
|
||||
* Note that this event is not the same as {@link GroupCreateEvent}
|
||||
*/
|
||||
public interface GroupLoadEvent extends LuckPermsEvent {
|
||||
|
||||
@@ -42,6 +43,6 @@ public interface GroupLoadEvent extends LuckPermsEvent {
|
||||
* @return the group that was loaded
|
||||
*/
|
||||
@Param(0)
|
||||
Group getGroup();
|
||||
@NonNull Group getGroup();
|
||||
|
||||
}
|
||||
@@ -26,5 +26,4 @@
|
||||
/**
|
||||
* Events relating to {@link net.luckperms.api.model.group.Group}s.
|
||||
*/
|
||||
@org.jspecify.annotations.NullMarked
|
||||
package net.luckperms.api.event.group;
|
||||
@@ -29,6 +29,7 @@ import net.luckperms.api.actionlog.Action;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.type.Cancellable;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Called when a log entry is about to be sent to notifiable players on the platform
|
||||
@@ -41,7 +42,7 @@ public interface LogBroadcastEvent extends LuckPermsEvent, Cancellable {
|
||||
* @return the log entry to be broadcasted
|
||||
*/
|
||||
@Param(0)
|
||||
Action getEntry();
|
||||
@NonNull Action getEntry();
|
||||
|
||||
/**
|
||||
* Gets where the log entry originated from.
|
||||
@@ -49,7 +50,7 @@ public interface LogBroadcastEvent extends LuckPermsEvent, Cancellable {
|
||||
* @return the origin of the log
|
||||
*/
|
||||
@Param(1)
|
||||
Origin getOrigin();
|
||||
@NonNull Origin getOrigin();
|
||||
|
||||
/**
|
||||
* Represents where a log entry is from
|
||||
|
||||
@@ -29,6 +29,7 @@ import net.luckperms.api.actionlog.Action;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.type.Cancellable;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -43,7 +44,7 @@ public interface LogNetworkPublishEvent extends LuckPermsEvent, Cancellable {
|
||||
* @return the id of the log entry being published
|
||||
*/
|
||||
@Param(0)
|
||||
UUID getLogId();
|
||||
@NonNull UUID getLogId();
|
||||
|
||||
/**
|
||||
* Gets the log entry to be published
|
||||
@@ -51,6 +52,6 @@ public interface LogNetworkPublishEvent extends LuckPermsEvent, Cancellable {
|
||||
* @return the log entry to be published
|
||||
*/
|
||||
@Param(1)
|
||||
Action getEntry();
|
||||
@NonNull Action getEntry();
|
||||
|
||||
}
|
||||
@@ -30,6 +30,7 @@ import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.type.Cancellable;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.platform.PlatformEntity;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Called when a log entry is about to be sent to specific notifiable object on
|
||||
@@ -47,7 +48,7 @@ public interface LogNotifyEvent extends LuckPermsEvent, Cancellable {
|
||||
* @return the log entry to be sent
|
||||
*/
|
||||
@Param(0)
|
||||
Action getEntry();
|
||||
@NonNull Action getEntry();
|
||||
|
||||
/**
|
||||
* Gets where the log entry originated from.
|
||||
@@ -55,7 +56,7 @@ public interface LogNotifyEvent extends LuckPermsEvent, Cancellable {
|
||||
* @return the origin of the log
|
||||
*/
|
||||
@Param(1)
|
||||
Origin getOrigin();
|
||||
@NonNull Origin getOrigin();
|
||||
|
||||
/**
|
||||
* Gets the object to be notified.
|
||||
@@ -63,7 +64,7 @@ public interface LogNotifyEvent extends LuckPermsEvent, Cancellable {
|
||||
* @return the object to notify
|
||||
*/
|
||||
@Param(2)
|
||||
PlatformEntity getNotifiable();
|
||||
@NonNull PlatformEntity getNotifiable();
|
||||
|
||||
/**
|
||||
* Represents where a log entry is from
|
||||
|
||||
@@ -29,6 +29,7 @@ import net.luckperms.api.actionlog.Action;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.type.Cancellable;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Called when a log is about to be published to the storage file/table
|
||||
@@ -41,6 +42,6 @@ public interface LogPublishEvent extends LuckPermsEvent, Cancellable {
|
||||
* @return the log entry to be published
|
||||
*/
|
||||
@Param(0)
|
||||
Action getEntry();
|
||||
@NonNull Action getEntry();
|
||||
|
||||
}
|
||||
@@ -28,15 +28,12 @@ package net.luckperms.api.event.log;
|
||||
import net.luckperms.api.actionlog.Action;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Called when a log entry is received via the MessagingService.
|
||||
*
|
||||
* <p>Note: listening to this event is the same as listening to the {@link LogBroadcastEvent}
|
||||
* and filtering for {@link LogBroadcastEvent#getOrigin() origin} =
|
||||
* {@link net.luckperms.api.event.log.LogBroadcastEvent.Origin#REMOTE REMOTE}.</p>
|
||||
* Called when a log entry is received via the MessagingService
|
||||
*/
|
||||
public interface LogReceiveEvent extends LuckPermsEvent {
|
||||
|
||||
@@ -46,7 +43,7 @@ public interface LogReceiveEvent extends LuckPermsEvent {
|
||||
* @return the id of the log entry being received
|
||||
*/
|
||||
@Param(0)
|
||||
UUID getLogId();
|
||||
@NonNull UUID getLogId();
|
||||
|
||||
/**
|
||||
* Gets the log entry being received
|
||||
@@ -54,6 +51,6 @@ public interface LogReceiveEvent extends LuckPermsEvent {
|
||||
* @return the log entry being received
|
||||
*/
|
||||
@Param(1)
|
||||
Action getEntry();
|
||||
@NonNull Action getEntry();
|
||||
|
||||
}
|
||||
@@ -24,7 +24,6 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Events relating to the {@link net.luckperms.api.actionlog.ActionLogger}.
|
||||
* Events relating to the {@link net.luckperms.api.actionlog.ActionLog}.
|
||||
*/
|
||||
@org.jspecify.annotations.NullMarked
|
||||
package net.luckperms.api.event.log;
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package net.luckperms.api.event.messaging;
|
||||
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.messaging.MessagingService;
|
||||
|
||||
/**
|
||||
* Called when a custom payload message is received via the {@link MessagingService}.
|
||||
*
|
||||
* <p>This event is effectively the 'other end' of
|
||||
* {@link MessagingService#sendCustomMessage(String, String)}.</p>
|
||||
*
|
||||
* @since 5.5
|
||||
*/
|
||||
public interface CustomMessageReceiveEvent extends LuckPermsEvent {
|
||||
|
||||
/**
|
||||
* Gets the channel id.
|
||||
*
|
||||
* @return the channel id
|
||||
*/
|
||||
@Param(0)
|
||||
String getChannelId();
|
||||
|
||||
/**
|
||||
* Gets the custom payload that was sent.
|
||||
*
|
||||
* @return the custom payload
|
||||
*/
|
||||
@Param(1)
|
||||
String getPayload();
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Events relating to the {@link net.luckperms.api.messaging.MessagingService}.
|
||||
*/
|
||||
@org.jspecify.annotations.NullMarked
|
||||
package net.luckperms.api.event.messaging;
|
||||
@@ -27,6 +27,7 @@ package net.luckperms.api.event.node;
|
||||
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.node.Node;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -44,10 +45,10 @@ public interface NodeAddEvent extends NodeMutateEvent {
|
||||
* @return the node that was added
|
||||
*/
|
||||
@Param(3)
|
||||
Node getNode();
|
||||
@NonNull Node getNode();
|
||||
|
||||
@Override
|
||||
default @Unmodifiable Set<Node> getDataBefore() {
|
||||
default @NonNull @Unmodifiable Set<Node> getDataBefore() {
|
||||
// Get data after, then reverse the action
|
||||
Set<Node> nodes = new HashSet<>(this.getDataAfter());
|
||||
nodes.remove(this.getNode());
|
||||
|
||||
@@ -27,6 +27,7 @@ package net.luckperms.api.event.node;
|
||||
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.node.Node;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -45,10 +46,10 @@ public interface NodeClearEvent extends NodeMutateEvent {
|
||||
* @since 5.3
|
||||
*/
|
||||
@Param(3)
|
||||
@Unmodifiable Set<Node> getNodes();
|
||||
@NonNull @Unmodifiable Set<Node> getNodes();
|
||||
|
||||
@Override
|
||||
default @Unmodifiable Set<Node> getDataBefore() {
|
||||
default @NonNull @Unmodifiable Set<Node> getDataBefore() {
|
||||
// Get data after, then reverse the action
|
||||
Set<Node> nodes = new HashSet<>(this.getDataAfter());
|
||||
nodes.addAll(this.getNodes());
|
||||
|
||||
@@ -32,6 +32,7 @@ import net.luckperms.api.model.data.DataType;
|
||||
import net.luckperms.api.model.group.Group;
|
||||
import net.luckperms.api.model.user.User;
|
||||
import net.luckperms.api.node.Node;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
import java.util.Set;
|
||||
@@ -47,7 +48,7 @@ public interface NodeMutateEvent extends LuckPermsEvent {
|
||||
* @return the event target
|
||||
*/
|
||||
@Param(0)
|
||||
PermissionHolder getTarget();
|
||||
@NonNull PermissionHolder getTarget();
|
||||
|
||||
/**
|
||||
* Gets the data type that was mutated.
|
||||
@@ -55,14 +56,14 @@ public interface NodeMutateEvent extends LuckPermsEvent {
|
||||
* @return the data type
|
||||
*/
|
||||
@Param(1)
|
||||
DataType getDataType();
|
||||
@NonNull DataType getDataType();
|
||||
|
||||
/**
|
||||
* Gets an immutable copy of the holders data before the change
|
||||
*
|
||||
* @return the data before the change
|
||||
*/
|
||||
@Unmodifiable Set<Node> getDataBefore();
|
||||
@NonNull @Unmodifiable Set<Node> getDataBefore();
|
||||
|
||||
/**
|
||||
* Gets an immutable copy of the holders data after the change
|
||||
@@ -70,7 +71,7 @@ public interface NodeMutateEvent extends LuckPermsEvent {
|
||||
* @return the data after the change
|
||||
*/
|
||||
@Param(2)
|
||||
@Unmodifiable Set<Node> getDataAfter();
|
||||
@NonNull @Unmodifiable Set<Node> getDataAfter();
|
||||
|
||||
/**
|
||||
* Gets whether the target of this event is a {@link User}
|
||||
|
||||
@@ -27,6 +27,7 @@ package net.luckperms.api.event.node;
|
||||
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.node.Node;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -44,10 +45,10 @@ public interface NodeRemoveEvent extends NodeMutateEvent {
|
||||
* @return the node that was removed
|
||||
*/
|
||||
@Param(3)
|
||||
Node getNode();
|
||||
@NonNull Node getNode();
|
||||
|
||||
@Override
|
||||
default @Unmodifiable Set<Node> getDataBefore() {
|
||||
default @NonNull @Unmodifiable Set<Node> getDataBefore() {
|
||||
// Get data after, then reverse the action
|
||||
Set<Node> nodes = new HashSet<>(this.getDataAfter());
|
||||
nodes.add(this.getNode());
|
||||
|
||||
@@ -27,5 +27,4 @@
|
||||
* Events relating to changes to a {@link net.luckperms.api.model.user.User} or
|
||||
* {@link net.luckperms.api.model.group.Group}s {@link net.luckperms.api.model.data.NodeMap}.
|
||||
*/
|
||||
@org.jspecify.annotations.NullMarked
|
||||
package net.luckperms.api.event.node;
|
||||
@@ -26,5 +26,4 @@
|
||||
/**
|
||||
* Main events package.
|
||||
*/
|
||||
@org.jspecify.annotations.NullMarked
|
||||
package net.luckperms.api.event;
|
||||
@@ -29,6 +29,7 @@ import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.model.PlayerSaveResult;
|
||||
import net.luckperms.api.model.user.UserManager;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -42,10 +43,10 @@ public interface PlayerDataSaveEvent extends LuckPermsEvent {
|
||||
/**
|
||||
* Gets the unique ID that was saved.
|
||||
*
|
||||
* @return the UUID
|
||||
* @return the uuid
|
||||
*/
|
||||
@Param(0)
|
||||
UUID getUniqueId();
|
||||
@NonNull UUID getUniqueId();
|
||||
|
||||
/**
|
||||
* Gets the username that was saved.
|
||||
@@ -53,7 +54,7 @@ public interface PlayerDataSaveEvent extends LuckPermsEvent {
|
||||
* @return the username
|
||||
*/
|
||||
@Param(1)
|
||||
String getUsername();
|
||||
@NonNull String getUsername();
|
||||
|
||||
/**
|
||||
* Gets the result of the operation.
|
||||
@@ -61,6 +62,6 @@ public interface PlayerDataSaveEvent extends LuckPermsEvent {
|
||||
* @return the result
|
||||
*/
|
||||
@Param(2)
|
||||
PlayerSaveResult getResult();
|
||||
@NonNull PlayerSaveResult getResult();
|
||||
|
||||
}
|
||||
@@ -29,7 +29,8 @@ import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.model.user.User;
|
||||
import net.luckperms.api.util.Result;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -54,10 +55,10 @@ public interface PlayerLoginProcessEvent extends LuckPermsEvent, Result {
|
||||
/**
|
||||
* Gets the UUID of the connection which was processed
|
||||
*
|
||||
* @return the UUID of the connection which was processed
|
||||
* @return the uuid of the connection which was processed
|
||||
*/
|
||||
@Param(0)
|
||||
UUID getUniqueId();
|
||||
@NonNull UUID getUniqueId();
|
||||
|
||||
/**
|
||||
* Gets the username of the connection which was processed
|
||||
@@ -65,7 +66,7 @@ public interface PlayerLoginProcessEvent extends LuckPermsEvent, Result {
|
||||
* @return the username of the connection which was processed
|
||||
*/
|
||||
@Param(1)
|
||||
String getUsername();
|
||||
@NonNull String getUsername();
|
||||
|
||||
/**
|
||||
* Gets if the login was processed successfully.
|
||||
|
||||
+8
-7
@@ -28,26 +28,27 @@ package net.luckperms.api.event.player.lookup;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.type.ResultEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Called when the platform needs to determine a player's {@link UUID unique id} type.
|
||||
* Called when the platform needs to determine the type of a player's {@link UUID unique id}.
|
||||
*
|
||||
* @since 5.3
|
||||
*/
|
||||
public interface UniqueIdDetermineTypeEvent extends LuckPermsEvent, ResultEvent<String> {
|
||||
|
||||
/**
|
||||
* The player's UUID has been obtained by authenticating with the Mojang session servers.
|
||||
* The players UUID has been obtained by authenticating with the Mojang session servers.
|
||||
*
|
||||
* <p>Usually indicated by the UUID being {@link UUID#version() version} 4.</p>
|
||||
*/
|
||||
String TYPE_AUTHENTICATED = "authenticated";
|
||||
|
||||
/**
|
||||
* The player's UUID has not been obtained through authentication, and instead is likely based
|
||||
* The players UUID has not been obtained through authentication, and instead is likely based
|
||||
* on the username they connected with.
|
||||
*
|
||||
* <p>Usually indicated by the UUID being {@link UUID#version() version} 3.</p>
|
||||
@@ -55,7 +56,7 @@ public interface UniqueIdDetermineTypeEvent extends LuckPermsEvent, ResultEvent<
|
||||
String TYPE_UNAUTHENTICATED = "unauthenticated";
|
||||
|
||||
/**
|
||||
* The player's UUID most likely belongs to a NPC (non-player character).
|
||||
* The players UUID most likely belongs to a NPC (non-player character).
|
||||
*
|
||||
* <p>Usually indicated by the UUID being {@link UUID#version() version} 2.</p>
|
||||
*
|
||||
@@ -76,14 +77,14 @@ public interface UniqueIdDetermineTypeEvent extends LuckPermsEvent, ResultEvent<
|
||||
* @return the unique id
|
||||
*/
|
||||
@Param(0)
|
||||
UUID getUniqueId();
|
||||
@NonNull UUID getUniqueId();
|
||||
|
||||
/**
|
||||
* Gets the current result unique id type.
|
||||
*
|
||||
* @return the type
|
||||
*/
|
||||
default String getType() {
|
||||
default @NonNull String getType() {
|
||||
return result().get();
|
||||
}
|
||||
|
||||
@@ -92,7 +93,7 @@ public interface UniqueIdDetermineTypeEvent extends LuckPermsEvent, ResultEvent<
|
||||
*
|
||||
* @param type the type
|
||||
*/
|
||||
default void setType(String type) {
|
||||
default void setType(@NonNull String type) {
|
||||
Objects.requireNonNull(type, "type");
|
||||
result().set(type);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,8 @@ package net.luckperms.api.event.player.lookup;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.type.ResultEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -37,7 +38,7 @@ import java.util.UUID;
|
||||
*
|
||||
* @since 5.3
|
||||
*/
|
||||
public interface UniqueIdLookupEvent extends LuckPermsEvent, ResultEvent<@Nullable UUID> {
|
||||
public interface UniqueIdLookupEvent extends LuckPermsEvent, ResultEvent<UUID> {
|
||||
|
||||
/**
|
||||
* Gets the username being looked up.
|
||||
@@ -45,7 +46,7 @@ public interface UniqueIdLookupEvent extends LuckPermsEvent, ResultEvent<@Nullab
|
||||
* @return the username
|
||||
*/
|
||||
@Param(0)
|
||||
String getUsername();
|
||||
@NonNull String getUsername();
|
||||
|
||||
/**
|
||||
* Sets the result unique id.
|
||||
|
||||
@@ -28,7 +28,8 @@ package net.luckperms.api.event.player.lookup;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.type.ResultEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -37,7 +38,7 @@ import java.util.UUID;
|
||||
*
|
||||
* @since 5.3
|
||||
*/
|
||||
public interface UsernameLookupEvent extends LuckPermsEvent, ResultEvent<@Nullable String> {
|
||||
public interface UsernameLookupEvent extends LuckPermsEvent, ResultEvent<String> {
|
||||
|
||||
/**
|
||||
* Gets the {@link UUID unique id} being looked up.
|
||||
@@ -45,7 +46,7 @@ public interface UsernameLookupEvent extends LuckPermsEvent, ResultEvent<@Nullab
|
||||
* @return the unique id
|
||||
*/
|
||||
@Param(0)
|
||||
UUID getUniqueId();
|
||||
@NonNull UUID getUniqueId();
|
||||
|
||||
/**
|
||||
* Sets the result username.
|
||||
|
||||
+3
-2
@@ -27,6 +27,7 @@ package net.luckperms.api.event.player.lookup;
|
||||
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
@@ -43,7 +44,7 @@ public interface UsernameValidityCheckEvent extends LuckPermsEvent {
|
||||
* @return the username
|
||||
*/
|
||||
@Param(0)
|
||||
String getUsername();
|
||||
@NonNull String getUsername();
|
||||
|
||||
/**
|
||||
* Gets the current validity state for the username.
|
||||
@@ -51,7 +52,7 @@ public interface UsernameValidityCheckEvent extends LuckPermsEvent {
|
||||
* @return the validity state
|
||||
*/
|
||||
@Param(1)
|
||||
AtomicBoolean validityState();
|
||||
@NonNull AtomicBoolean validityState();
|
||||
|
||||
/**
|
||||
* Gets if the username is currently considered to be valid.
|
||||
|
||||
@@ -26,5 +26,4 @@
|
||||
/**
|
||||
* Events relating to a player {@link java.util.UUID unique id} or username lookup.
|
||||
*/
|
||||
@org.jspecify.annotations.NullMarked
|
||||
package net.luckperms.api.event.player.lookup;
|
||||
@@ -26,5 +26,4 @@
|
||||
/**
|
||||
* Events relating to a player.
|
||||
*/
|
||||
@org.jspecify.annotations.NullMarked
|
||||
package net.luckperms.api.event.player;
|
||||
@@ -26,6 +26,7 @@
|
||||
package net.luckperms.api.event.source;
|
||||
|
||||
import net.luckperms.api.platform.PlatformEntity;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Represents an {@link PlatformEntity} which was the {@link Source} of something.
|
||||
@@ -37,6 +38,6 @@ public interface EntitySource extends Source {
|
||||
*
|
||||
* @return the entity
|
||||
*/
|
||||
PlatformEntity getEntity();
|
||||
@NonNull PlatformEntity getEntity();
|
||||
|
||||
}
|
||||
@@ -26,6 +26,7 @@
|
||||
package net.luckperms.api.event.source;
|
||||
|
||||
import net.luckperms.api.platform.PlatformEntity;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Represents the source of an event.
|
||||
@@ -39,7 +40,7 @@ public interface Source {
|
||||
*
|
||||
* @return the type
|
||||
*/
|
||||
Type getType();
|
||||
@NonNull Type getType();
|
||||
|
||||
/**
|
||||
* Represents a type of source
|
||||
|
||||
@@ -26,5 +26,4 @@
|
||||
/**
|
||||
* Event sources.
|
||||
*/
|
||||
@org.jspecify.annotations.NullMarked
|
||||
package net.luckperms.api.event.source;
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package net.luckperms.api.event.sync;
|
||||
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Called after a network synchronisation task has been completed.
|
||||
*
|
||||
* <p>Note: the generic {@link PostSyncEvent} will also be called for {@link SyncType#FULL full syncs}.</p>
|
||||
*
|
||||
* @since 5.5
|
||||
*/
|
||||
public interface PostNetworkSyncEvent extends LuckPermsEvent {
|
||||
|
||||
/**
|
||||
* Gets the ID of the sync request
|
||||
*
|
||||
* @return the id of the sync request
|
||||
*/
|
||||
@Param(0)
|
||||
UUID getSyncId();
|
||||
|
||||
/**
|
||||
* Gets the sync type.
|
||||
*
|
||||
* @return the sync type
|
||||
*/
|
||||
@Param(1)
|
||||
SyncType getType();
|
||||
|
||||
/**
|
||||
* Gets if a sync occurred.
|
||||
*
|
||||
* <p>For {@link SyncType} = {@link SyncType#FULL FULL}, this method always returns true.</p>
|
||||
*
|
||||
* <p>For {@link SyncType} = {@link SyncType#SPECIFIC_USER SPECIFIC_USER}, this method returns true if the
|
||||
* user in question was online/loaded in memory at the time, and false otherwise.</p>
|
||||
*
|
||||
* @return if a sync occurred
|
||||
*/
|
||||
@Param(2)
|
||||
boolean didSyncOccur();
|
||||
|
||||
/**
|
||||
* Gets the unique id of the specific user that has been synced, if applicable.
|
||||
*
|
||||
* @return the unique id of the specific user
|
||||
*/
|
||||
@Param(3)
|
||||
@Nullable UUID getSpecificUserUniqueId();
|
||||
|
||||
}
|
||||
@@ -28,10 +28,7 @@ package net.luckperms.api.event.sync;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
/**
|
||||
* Called after a full synchronisation task has been completed.
|
||||
*
|
||||
* <p>Note: this event is also called after synchronisations that were triggered over the network.
|
||||
* In other words, this event will be called in addition to {@link PostNetworkSyncEvent}.</p>
|
||||
* Called when an sync task has been completed
|
||||
*/
|
||||
public interface PostSyncEvent extends LuckPermsEvent {
|
||||
|
||||
|
||||
@@ -28,15 +28,12 @@ package net.luckperms.api.event.sync;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.type.Cancellable;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Called after a request for synchronisation has been received via the messaging service,
|
||||
* but before it has actually been completed.
|
||||
*
|
||||
* <p>Note: the generic {@link PreSyncEvent} will also be called for {@link SyncType#FULL full syncs}.</p>
|
||||
* Called before a received network sync task runs
|
||||
*/
|
||||
public interface PreNetworkSyncEvent extends LuckPermsEvent, Cancellable {
|
||||
|
||||
@@ -46,24 +43,6 @@ public interface PreNetworkSyncEvent extends LuckPermsEvent, Cancellable {
|
||||
* @return the id of the sync request
|
||||
*/
|
||||
@Param(0)
|
||||
UUID getSyncId();
|
||||
|
||||
/**
|
||||
* Gets the sync type.
|
||||
*
|
||||
* @return the sync type
|
||||
* @since 5.5
|
||||
*/
|
||||
@Param(1)
|
||||
SyncType getType();
|
||||
|
||||
/**
|
||||
* Gets the unique id of the specific user that will be synced, if applicable.
|
||||
*
|
||||
* @return the unique id of the specific user
|
||||
* @since 5.5
|
||||
*/
|
||||
@Param(2)
|
||||
@Nullable UUID getSpecificUserUniqueId();
|
||||
@NonNull UUID getSyncId();
|
||||
|
||||
}
|
||||
@@ -29,10 +29,7 @@ import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.type.Cancellable;
|
||||
|
||||
/**
|
||||
* Called just before a full synchronisation task runs.
|
||||
*
|
||||
* <p>Note: this event is also called before synchronisations that were triggered over the network.
|
||||
* In other words, this event will be called in addition to {@link PreNetworkSyncEvent}.</p>
|
||||
* Called before a sync task runs
|
||||
*/
|
||||
public interface PreSyncEvent extends LuckPermsEvent, Cancellable {
|
||||
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package net.luckperms.api.event.sync;
|
||||
|
||||
/**
|
||||
* Represents the type of synchronisation task.
|
||||
*
|
||||
* @since 5.5
|
||||
*/
|
||||
public enum SyncType {
|
||||
|
||||
/**
|
||||
* A full sync will be performed - all groups, users and tracks
|
||||
*/
|
||||
FULL,
|
||||
|
||||
/**
|
||||
* Only a specific user will be synced
|
||||
*/
|
||||
SPECIFIC_USER
|
||||
|
||||
}
|
||||
@@ -26,5 +26,4 @@
|
||||
/**
|
||||
* Events relating to {@link net.luckperms.api.LuckPerms#runUpdateTask() sync/update task}s.
|
||||
*/
|
||||
@org.jspecify.annotations.NullMarked
|
||||
package net.luckperms.api.event.sync;
|
||||
@@ -29,6 +29,7 @@ import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.cause.CreationCause;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.track.Track;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Called when a track is created
|
||||
@@ -41,7 +42,7 @@ public interface TrackCreateEvent extends LuckPermsEvent {
|
||||
* @return the new track
|
||||
*/
|
||||
@Param(0)
|
||||
Track getTrack();
|
||||
@NonNull Track getTrack();
|
||||
|
||||
/**
|
||||
* Gets the cause of the creation
|
||||
@@ -49,6 +50,6 @@ public interface TrackCreateEvent extends LuckPermsEvent {
|
||||
* @return the cause of the creation
|
||||
*/
|
||||
@Param(1)
|
||||
CreationCause getCause();
|
||||
@NonNull CreationCause getCause();
|
||||
|
||||
}
|
||||
@@ -28,6 +28,7 @@ package net.luckperms.api.event.track;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.cause.DeletionCause;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -42,7 +43,7 @@ public interface TrackDeleteEvent extends LuckPermsEvent {
|
||||
* @return the name of the deleted track
|
||||
*/
|
||||
@Param(0)
|
||||
String getTrackName();
|
||||
@NonNull String getTrackName();
|
||||
|
||||
/**
|
||||
* Gets an immutable copy of the tracks existing data
|
||||
@@ -50,7 +51,7 @@ public interface TrackDeleteEvent extends LuckPermsEvent {
|
||||
* @return a copy of the tracks existing data
|
||||
*/
|
||||
@Param(1)
|
||||
List<String> getExistingData();
|
||||
@NonNull List<String> getExistingData();
|
||||
|
||||
/**
|
||||
* Gets the cause of the deletion
|
||||
@@ -58,6 +59,6 @@ public interface TrackDeleteEvent extends LuckPermsEvent {
|
||||
* @return the cause of the deletion
|
||||
*/
|
||||
@Param(2)
|
||||
DeletionCause getCause();
|
||||
@NonNull DeletionCause getCause();
|
||||
|
||||
}
|
||||
@@ -28,11 +28,12 @@ package net.luckperms.api.event.track;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.track.Track;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Called when a track is loaded into memory from the storage.
|
||||
*
|
||||
* <p>Note that this event is not the same as {@link TrackCreateEvent}.</p>
|
||||
* Note that this event is not the same as {@link TrackCreateEvent}
|
||||
*/
|
||||
public interface TrackLoadEvent extends LuckPermsEvent {
|
||||
|
||||
@@ -42,6 +43,6 @@ public interface TrackLoadEvent extends LuckPermsEvent {
|
||||
* @return the track that was loaded
|
||||
*/
|
||||
@Param(0)
|
||||
Track getTrack();
|
||||
@NonNull Track getTrack();
|
||||
|
||||
}
|
||||
@@ -26,6 +26,7 @@
|
||||
package net.luckperms.api.event.track.mutate;
|
||||
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Called when a group is added to a track
|
||||
@@ -38,6 +39,6 @@ public interface TrackAddGroupEvent extends TrackMutateEvent {
|
||||
* @return the group that was added
|
||||
*/
|
||||
@Param(3)
|
||||
String getGroup();
|
||||
@NonNull String getGroup();
|
||||
|
||||
}
|
||||
@@ -28,6 +28,7 @@ package net.luckperms.api.event.track.mutate;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.track.Track;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
import java.util.List;
|
||||
@@ -43,7 +44,7 @@ public interface TrackMutateEvent extends LuckPermsEvent {
|
||||
* @return the track that was mutated
|
||||
*/
|
||||
@Param(0)
|
||||
Track getTrack();
|
||||
@NonNull Track getTrack();
|
||||
|
||||
/**
|
||||
* Gets an immutable copy of the tracks data before the change
|
||||
@@ -51,7 +52,7 @@ public interface TrackMutateEvent extends LuckPermsEvent {
|
||||
* @return the data before the change
|
||||
*/
|
||||
@Param(1)
|
||||
@Unmodifiable List<String> getStateBefore();
|
||||
@NonNull @Unmodifiable List<String> getStateBefore();
|
||||
|
||||
/**
|
||||
* Gets an immutable copy of the tracks data after the change
|
||||
@@ -59,6 +60,6 @@ public interface TrackMutateEvent extends LuckPermsEvent {
|
||||
* @return the data after the change
|
||||
*/
|
||||
@Param(2)
|
||||
@Unmodifiable List<String> getStateAfter();
|
||||
@NonNull @Unmodifiable List<String> getStateAfter();
|
||||
|
||||
}
|
||||
@@ -26,6 +26,7 @@
|
||||
package net.luckperms.api.event.track.mutate;
|
||||
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Called when a group is removed from a track
|
||||
@@ -38,6 +39,6 @@ public interface TrackRemoveGroupEvent extends TrackMutateEvent {
|
||||
* @return the group that was removed
|
||||
*/
|
||||
@Param(3)
|
||||
String getGroup();
|
||||
@NonNull String getGroup();
|
||||
|
||||
}
|
||||
@@ -26,5 +26,4 @@
|
||||
/**
|
||||
* Events relating to changes to a {@link net.luckperms.api.track.Track}s contents.
|
||||
*/
|
||||
@org.jspecify.annotations.NullMarked
|
||||
package net.luckperms.api.event.track.mutate;
|
||||
@@ -26,5 +26,4 @@
|
||||
/**
|
||||
* Events relating to {@link net.luckperms.api.track.Track}s.
|
||||
*/
|
||||
@org.jspecify.annotations.NullMarked
|
||||
package net.luckperms.api.event.track;
|
||||
@@ -26,6 +26,7 @@
|
||||
package net.luckperms.api.event.type;
|
||||
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
@@ -40,7 +41,7 @@ public interface Cancellable {
|
||||
* @return the cancellation
|
||||
*/
|
||||
@Param(-1)
|
||||
AtomicBoolean cancellationState();
|
||||
@NonNull AtomicBoolean cancellationState();
|
||||
|
||||
/**
|
||||
* Returns true if the event is currently cancelled.
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
package net.luckperms.api.event.type;
|
||||
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
@@ -36,7 +36,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
* @param <T> the type of the result
|
||||
* @since 5.3
|
||||
*/
|
||||
public interface ResultEvent<T extends @Nullable Object> {
|
||||
public interface ResultEvent<T> {
|
||||
|
||||
/**
|
||||
* Gets an {@link AtomicReference} containing the result.
|
||||
@@ -44,7 +44,7 @@ public interface ResultEvent<T extends @Nullable Object> {
|
||||
* @return the result
|
||||
*/
|
||||
@Param(-1)
|
||||
AtomicReference<T> result();
|
||||
@NonNull AtomicReference<T> result();
|
||||
|
||||
/**
|
||||
* Gets if a result has been set for the event.
|
||||
|
||||
@@ -27,6 +27,7 @@ package net.luckperms.api.event.type;
|
||||
|
||||
import net.luckperms.api.event.source.Source;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Represents an event with a {@link Source}.
|
||||
@@ -41,6 +42,6 @@ public interface Sourced {
|
||||
*
|
||||
* @return the source
|
||||
*/
|
||||
@Param(-1) Source getSource();
|
||||
@NonNull @Param(-1) Source getSource();
|
||||
|
||||
}
|
||||
@@ -26,5 +26,4 @@
|
||||
/**
|
||||
* Event abstract types.
|
||||
*/
|
||||
@org.jspecify.annotations.NullMarked
|
||||
package net.luckperms.api.event.type;
|
||||
@@ -29,6 +29,7 @@ import net.luckperms.api.cacheddata.CachedDataManager;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.model.user.User;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Called when a users {@link CachedDataManager} is loaded.
|
||||
@@ -41,7 +42,7 @@ public interface UserCacheLoadEvent extends LuckPermsEvent {
|
||||
* @return the user
|
||||
*/
|
||||
@Param(0)
|
||||
User getUser();
|
||||
@NonNull User getUser();
|
||||
|
||||
/**
|
||||
* Gets the data that was loaded
|
||||
@@ -49,6 +50,6 @@ public interface UserCacheLoadEvent extends LuckPermsEvent {
|
||||
* @return the loaded data
|
||||
*/
|
||||
@Param(1)
|
||||
CachedDataManager getLoadedData();
|
||||
@NonNull CachedDataManager getLoadedData();
|
||||
|
||||
}
|
||||
@@ -29,6 +29,7 @@ import net.luckperms.api.cacheddata.CachedDataManager;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.model.user.User;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Called when a users cached data is refreshed
|
||||
@@ -41,7 +42,7 @@ public interface UserDataRecalculateEvent extends LuckPermsEvent {
|
||||
* @return the user
|
||||
*/
|
||||
@Param(0)
|
||||
User getUser();
|
||||
@NonNull User getUser();
|
||||
|
||||
/**
|
||||
* Gets the data that was recalculated
|
||||
@@ -49,6 +50,6 @@ public interface UserDataRecalculateEvent extends LuckPermsEvent {
|
||||
* @return the data
|
||||
*/
|
||||
@Param(1)
|
||||
CachedDataManager getData();
|
||||
@NonNull CachedDataManager getData();
|
||||
|
||||
}
|
||||
@@ -27,6 +27,7 @@ package net.luckperms.api.event.user;
|
||||
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -46,10 +47,10 @@ public interface UserFirstLoginEvent extends LuckPermsEvent {
|
||||
/**
|
||||
* Gets the UUID of the user
|
||||
*
|
||||
* @return the UUID of the user
|
||||
* @return the uuid of the user
|
||||
*/
|
||||
@Param(0)
|
||||
UUID getUniqueId();
|
||||
@NonNull UUID getUniqueId();
|
||||
|
||||
/**
|
||||
* Gets the username of the user
|
||||
@@ -57,6 +58,6 @@ public interface UserFirstLoginEvent extends LuckPermsEvent {
|
||||
* @return the username of the user
|
||||
*/
|
||||
@Param(1)
|
||||
String getUsername();
|
||||
@NonNull String getUsername();
|
||||
|
||||
}
|
||||
@@ -28,6 +28,7 @@ package net.luckperms.api.event.user;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.model.user.User;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Called when a user is loaded into memory from the storage.
|
||||
@@ -40,6 +41,6 @@ public interface UserLoadEvent extends LuckPermsEvent {
|
||||
* @return the user that was loaded
|
||||
*/
|
||||
@Param(0)
|
||||
User getUser();
|
||||
@NonNull User getUser();
|
||||
|
||||
}
|
||||
@@ -29,6 +29,7 @@ import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.type.Cancellable;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.model.user.User;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Called when a user is about to be unloaded from memory.
|
||||
@@ -43,6 +44,6 @@ public interface UserUnloadEvent extends LuckPermsEvent, Cancellable {
|
||||
* @return the user that is being unloaded
|
||||
*/
|
||||
@Param(0)
|
||||
User getUser();
|
||||
@NonNull User getUser();
|
||||
|
||||
}
|
||||
@@ -26,5 +26,4 @@
|
||||
/**
|
||||
* Events relating to {@link net.luckperms.api.model.user.User}s.
|
||||
*/
|
||||
@org.jspecify.annotations.NullMarked
|
||||
package net.luckperms.api.event.user;
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
package net.luckperms.api.event.user.track;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Called when a user is demoted down a track.
|
||||
*
|
||||
@@ -33,7 +35,7 @@ package net.luckperms.api.event.user.track;
|
||||
public interface UserDemoteEvent extends UserTrackEvent {
|
||||
|
||||
@Override
|
||||
default TrackAction getAction() {
|
||||
default @NonNull TrackAction getAction() {
|
||||
return TrackAction.DEMOTION;
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
package net.luckperms.api.event.user.track;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Called when a user is promoted up a track.
|
||||
*
|
||||
@@ -33,7 +35,7 @@ package net.luckperms.api.event.user.track;
|
||||
public interface UserPromoteEvent extends UserTrackEvent {
|
||||
|
||||
@Override
|
||||
default TrackAction getAction() {
|
||||
default @NonNull TrackAction getAction() {
|
||||
return TrackAction.PROMOTION;
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,7 @@ import net.luckperms.api.event.type.Sourced;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.model.user.User;
|
||||
import net.luckperms.api.track.Track;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -44,7 +45,7 @@ public interface UserTrackEvent extends LuckPermsEvent, Sourced {
|
||||
* @return the track involved in the event
|
||||
*/
|
||||
@Param(0)
|
||||
Track getTrack();
|
||||
@NonNull Track getTrack();
|
||||
|
||||
/**
|
||||
* Gets the user who was promoted or demoted
|
||||
@@ -52,14 +53,14 @@ public interface UserTrackEvent extends LuckPermsEvent, Sourced {
|
||||
* @return the user involved in the event
|
||||
*/
|
||||
@Param(1)
|
||||
User getUser();
|
||||
@NonNull User getUser();
|
||||
|
||||
/**
|
||||
* Gets the action performed
|
||||
*
|
||||
* @return the action performed
|
||||
*/
|
||||
TrackAction getAction();
|
||||
@NonNull TrackAction getAction();
|
||||
|
||||
/**
|
||||
* Gets the group the user was promoted/demoted from.
|
||||
@@ -69,7 +70,7 @@ public interface UserTrackEvent extends LuckPermsEvent, Sourced {
|
||||
* @return the group the user was promoted/demoted from
|
||||
*/
|
||||
@Param(2)
|
||||
Optional<String> getGroupFrom();
|
||||
@NonNull Optional<String> getGroupFrom();
|
||||
|
||||
/**
|
||||
* Gets the group the user was promoted/demoted to
|
||||
@@ -77,6 +78,6 @@ public interface UserTrackEvent extends LuckPermsEvent, Sourced {
|
||||
* @return the group the user was promoted/demoted to
|
||||
*/
|
||||
@Param(3)
|
||||
Optional<String> getGroupTo();
|
||||
@NonNull Optional<String> getGroupTo();
|
||||
|
||||
}
|
||||
@@ -27,5 +27,4 @@
|
||||
* Events relating to a {@link net.luckperms.api.model.user.User}s movement on a
|
||||
* {@link net.luckperms.api.track.Track}.
|
||||
*/
|
||||
@org.jspecify.annotations.NullMarked
|
||||
package net.luckperms.api.event.user.track;
|
||||
@@ -26,5 +26,4 @@
|
||||
/**
|
||||
* Event utilities.
|
||||
*/
|
||||
@org.jspecify.annotations.NullMarked
|
||||
package net.luckperms.api.event.util;
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
package net.luckperms.api.extension;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -50,13 +51,13 @@ public interface ExtensionManager {
|
||||
* @return the extension
|
||||
* @throws IOException if the extension could not be loaded
|
||||
*/
|
||||
Extension loadExtension(Path path) throws IOException;
|
||||
@NonNull Extension loadExtension(Path path) throws IOException;
|
||||
|
||||
/**
|
||||
* Gets a collection of all loaded extensions.
|
||||
*
|
||||
* @return the loaded extensions
|
||||
*/
|
||||
@Unmodifiable Collection<Extension> getLoadedExtensions();
|
||||
@NonNull @Unmodifiable Collection<Extension> getLoadedExtensions();
|
||||
|
||||
}
|
||||
Loaded 100 of 780 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user