Compare commits

...
Author SHA1 Message Date
kripypastishka b878ae92ff Fix action log comparator to include target names (#4340) 2026-11-04 20:42:18 +00:00
Aleks Kuznetsov 866086fa87 Fix Fabric placeholders throwing when resolved without a player (#4321) 2026-11-01 14:42:10 +00:00
tahodev e1ff15217a Make the first-time setup suggested command clickable to copy (#4337) 2026-11-01 14:23:57 +00:00
Luck b93a4d7b24 Update to Hytale Update 7 2026-10-20 21:28:14 +01:00
Rishabh Venu 5fc3d583c4 Update Group getWeight javadoc comment (#4325) 2026-10-04 16:51:35 +01:00
Luck aeaab669ab Fix NeoForge NoClassDefFoundError (#4327) 2026-10-04 16:49:40 +01:00
Luck 25f223317a Update to Minecraft 26.3 2026-09-19 08:23:26 +01:00
Luck a81c095f83 Fix grammar/spelling in API javadocs 2026-09-12 21:54:32 +01:00
Luck e794facb05 Use JSpecify annotations (#4312) 2026-09-12 21:26:39 +01:00
Luck 24a25458d6 Increase cleanup delay for users mid-login (#4268) 2026-09-10 19:18:23 +01:00
Luck 32494e9f0a Update to Hytale Update 6 (#4311) 2026-08-27 18:14:09 +01:00
Luck 79770b0dc1 Update InheritanceTest (#4306) 2026-08-27 18:11:25 +01:00
Drex c1c85762a1 Fabric Permission API v1 replace / with . (#4310) 2026-08-26 20:50:07 +01:00
Luck d98a3954fa Remove then add when applying Difference (#4287) 2026-08-25 22:38:55 +01:00
Luck 9b4fe67791 Fix NodeJsonSerializer on older Gson versions (#4301) 2026-08-15 20:39:06 +01:00
Luck 48c652b387 Fix issue on Bukkit with missing Player#locale method (#4295) 2026-08-15 08:33:16 +01:00
Luck 79a269a6b4 Fix shorthand parser int overflow (#4300) 2026-08-15 08:23:04 +01:00
Luck 5a9c096c66 Improve /lp applyedits chat output 2026-08-15 08:11:29 +01:00
Emir f6bcb1676e Fix page number validation in log commands (#4296) 2026-08-13 21:18:50 +01:00
AndyOctopus 2dfd387882 Fix inverted Audience check in PaperAdventureBridge (#4297) 2026-08-13 21:14:56 +01:00
BlockException_ 8fa4c24492 Prevent ClassCastException when estimating dimension-type contexts (#4294) 2026-08-05 22:15:55 +01:00
Luck 461fb34005 Use connection uri database if set for Mongo (#4289) 2026-08-05 21:52:13 +01:00
Luck 7fbb6869f5 Add extra listener for server stopped event (#4281) 2026-08-05 20:22:23 +01:00
Luck aeaf1b9c8a Ignore errors when creating Mongo indexes 2026-08-05 20:12:24 +01:00
Luck c3fd3f7eb8 Use native adventure methods on Paper (#4292) 2026-08-05 20:06:50 +01:00
Luck f25279813e Add limit to shorthand parser (#4293) 2026-08-05 17:56:40 +01:00
Luck 24894df140 Improve Mongo bulk user load implementation 2026-07-23 20:28:47 +01:00
Mason Camara c06039b0dc Add MongoDB Indexes (#4280) 2026-07-23 20:16:53 +01:00
lucko 7b8f8ccb97 Update MongoStorage to use exportChanges (#4286) 2026-07-23 20:15:39 +01:00
Warrior d07dcacab4 Add API bulk user lookup method (#4285) 2026-07-23 20:15:01 +01:00
lucko cb77ed09be Update NodeMap#setContent to avoid clear (#4284) 2026-07-22 22:14:41 +01:00
Luck f19f605650 Add some more unit tests 2026-07-17 21:49:30 +01:00
Luck cd61d05b53 Add some unit tests 2026-06-30 21:39:39 +01:00
Luck 3c1b4d53ea Add abstract listeners for autoop and command list update 2026-06-29 20:53:09 +01:00
lucko 1324c229fd Update to Minecraft 26.2 (#4277) 2026-06-18 21:54:08 +01:00
Luck 16173dd0b7 Fix Hytale maven repo 2026-06-18 21:41:06 +01:00
Luck cd0f009e0f Call ConfigurationTask callback sync (#4272) 2026-06-03 18:05:35 +01:00
Luck 3087cfc494 Fix Fabric placeholder text parsing 2026-05-29 08:15:17 +01:00
Luck 00ed0a0e77 Show logo in Hytale mod menu 2026-05-27 08:00:57 +01:00
lucko 3fb939b416 Support for Hytale Update 5 (#4247) 2026-05-26 18:02:58 +01:00
Luck d01106c6ad Fix Fabric PermissionSet mixin level handling (#4269) 2026-05-25 19:17:10 +01:00
Luck 9ea747c848 Fix Fabric perm API v1 default handling (#4269) 2026-05-23 09:08:14 +01:00
lucko fe3078e5d0 Folia support (#3615) 2026-05-21 22:16:56 +01:00
lucko a97bdba0a0 Implement fabric-permission-api v1 (#4248) 2026-05-21 21:43:28 +01:00
Luck d90b3dbf11 Add Fabric placeholder-api integration 2026-05-21 19:10:02 +01:00
lucko 417989aea1 Add common placeholders module (#4267) 2026-05-21 18:50:01 +01:00
masel.io 441ab5769f Add Redis Sentinel support for messaging (#4244) 2026-05-16 20:23:42 +01:00
Dominik 6f5a8e1cd8 Add context argument to group listmembers command (#4252) 2026-05-11 21:17:53 +01:00
Yannick Schinko 090f218e12 Add index to time column in SQL Messenger (#4255) 2026-05-11 21:17:18 +01:00
Luck 8b3e990106 Fix Fabric shadowJar config 2026-03-26 22:32:50 +00:00
Luck c0005fa070 Update to Minecraft 26.1 2026-03-26 22:12:21 +00:00
Luck cfd1aa276c Update Hytale to target 2026.03.26-89796e57b 2026-03-26 21:46:16 +00:00
Luck 5db9ecb689 Update Gradle to v9.4 2026-03-26 21:38:08 +00:00
powercas_gamer 691a87b5ea Add support for NATS token authentication (#4238) 2026-03-17 21:10:56 +00:00
Luck fc26521594 Update bytebin/bytesocks custom config settings 2026-03-13 07:59:23 +00:00
Luck b25c335b7b Add rate limit for verbose chat output 2026-02-21 09:29:14 +00:00
Luck 6292d2d3e6 Improve debug logging for Hytale login handling 2026-02-21 08:55:33 +00:00
Luck a75643c1e4 Remove Hytale chat formatter and update deps 2026-02-17 18:14:38 +00:00
Luck e148e8e9fa Fix duplicate readNode call in SqlStorage 2026-02-15 13:56:00 +00:00
Luck 053148a9c5 Add inheritance origin metadata for Hytale virtual groups 2026-02-05 20:50:21 +00:00
Luck 71035d96ea Attempt to fix slf4j classloading issue on Hytale 2026-02-05 19:37:24 +00:00
Luck 8c22dd7159 Refactor PermissionProcessors 2026-02-05 18:55:26 +00:00
Luck f944fc0770 Relocate guava and gson in Hytale jar 2026-02-03 19:06:14 +00:00
Luck 1932d0cd5d Fix yaml dependency issue in Hytale jar (#4229) 2026-01-30 18:21:06 +00:00
Luck 38a8f63d86 Add Hytale with-deps Gradle buildscript 2026-01-30 18:19:44 +00:00
Luck e7e7997750 Improve Hytale PermissionProvider compatibility 2026-01-24 21:17:14 +00:00
lucko a60d3f1a4b Hytale (#4213) 2026-01-24 12:49:30 +00:00
John 840ac52f83 Add UUID mismatch warning suppression setting (#4194) 2026-01-10 12:37:19 +00:00
Drex a6382773f0 Fix shared module context keys (#4206) 2026-01-06 08:36:47 +00:00
Luck 2f77191875 Add shared module for Fabric, NeoForge and Forge 2025-12-22 22:14:08 +00:00
lucko 2adb058e96 Update to Minecraft 1.21.11 2025-12-10 12:12:57 +00:00
Luck 61ce546a04 Fix compile/test error with HostAndPort 2025-11-09 13:13:50 +00:00
Luck 10378e882b Support IPv6 addresses (#3753) 2025-11-09 12:36:03 +00:00
Luck 2a1dfb5112 Increase User Housekeeper timeout (#4081) 2025-11-02 12:49:45 +00:00
Luck 40a39c9381 Update to Minecraft 1.21.10 2025-10-11 11:17:59 +01:00
Luck 198e2d6f4b Update Forge module to Minecraft 1.21.9 2025-10-05 10:54:02 +01:00
Luck 1058cb11e8 Update to Minecraft 1.21.9 2025-10-01 18:22:21 +01:00
蒟蒻 0b91732cd3 Prevent handleDisconnect after stopped server on Fabric (#4160) 2025-09-21 11:04:58 +01:00
An5w1r a087f14aa2 Fix classExists checks to handle NoClassDefFoundError (#4136) 2025-09-21 11:03:07 +01:00
Luck d666a2a798 Fix command rate limit for command blocks (#4094) 2025-09-21 10:58:24 +01:00
Luck 65c42b9b09 Micro-optimize temporary node audit (#4155) 2025-08-23 15:39:49 +01:00
Luck 73d710a89e Update to Minecraft 1.21.8 2025-07-21 22:08:21 +01:00
Luck ed863b275d Update to Minecraft 1.21.7 2025-06-30 19:41:56 +01:00
Luck c20776d6aa Remove Forge capability attachment 2025-06-19 19:53:09 +01:00
Luck 3aca721f96 Rollback bytebuddy dependency version upgrade 2025-06-19 19:35:04 +01:00
Luck 8d9c5bf401 Add workaround for Forge eventbus limitation 2025-06-19 19:09:40 +01:00
Luck 0af1038d81 Update to Minecraft 1.21.6 2025-06-19 18:48:44 +01:00
Luck 51fe574a51 Move config load earlier in startup process (#4083) 2025-06-14 09:31:56 +01:00
Max Barrass bac0edd90e Fix missing closing brackets in .conf files (#4109) 2025-06-14 09:24:52 +01:00
Luck 8ab9910ef8 Downgrade jedis and h2 2025-06-01 19:32:26 +01:00
Luck 9538cb9dad Upgrade dependencies and require Java 11 2025-06-01 16:41:39 +01:00
Luck 0486bc885b Release API v5.5 2025-05-25 08:59:47 +01:00
Luck 27e7551e2b Fix adventure package relocations 2025-05-23 08:10:55 +01:00
Luck b77d5759d3 Upgrade adventure dependencies for 1.21.5 support 2025-05-22 21:15:24 +01:00
Luck 96abc0d4fe Update setup-gradle GitHub action 2025-05-10 15:04:42 +01:00
lucko 1a24a6a155 Add REST storage backend (#3939) 2025-05-10 15:01:08 +01:00
𝑩𝒊𝒒𝒖𝒂𝒕𝒆𝒓𝒏𝒊𝒐𝒏𝒔 95ea491787 Support plugins that 'provide' Vault (#4075) 2025-05-10 14:47:32 +01:00
Remigio 626d08431e Add missing IllegalArgumentExceptions to Javadocs (#4015) 2025-05-10 14:33:38 +01:00
lucko 94e7e11183 Add configurable read-only mode for commands (#4031) 2025-05-10 14:32:47 +01:00
Luck f64bf04ba4 Update mod loader dependencies 2025-05-08 19:45:14 +01:00
Luck 7744913df2 Update to Minecraft 1.21.5 2025-03-27 19:46:43 +00:00
lucko 6b7283ac83 Improve context manager caching (#4050) 2025-03-20 19:20:16 +00:00
Luck 9bc8a61e2d Add file secret config adapter (#3913) 2025-02-22 15:57:44 +00:00
Luck 5e24a7068c Mark plugin msg channel as optional on Forge (#3954) 2025-02-22 15:28:18 +00:00
Luck f351369a51 Update CI action versions 2025-02-13 09:59:59 +00:00
Luck 1bf0deb5a5 Add unit tests for messaging service messages 2025-01-20 22:46:52 +00:00
Luck 5b82837b80 Update Sponge module to API 12 2025-01-05 14:38:15 +00:00
Luck 0fef481d48 Add more unit tests 2024-12-22 09:51:11 +00:00
Luck f2040ab815 Update to Minecraft 1.21.4 2024-12-07 16:21:26 +00:00
Luck b18717edef Remove NeoForge capability attachment 2024-12-04 20:39:55 +00:00
Luck 29c93fac4f Add note about shading LuckPerms API into plugin jars 2024-12-04 11:27:14 +00:00
Luck 2e67011f45 Refactor some unit tests 2024-12-04 11:25:06 +00:00
Luck a92e04f605 Recreate individual sql tables if they are missing (#3995) 2024-11-09 12:09:23 +00:00
Luck 8d65693d9a Update to Minecraft 1.21.3 2024-10-26 10:07:03 +01:00
Luck 8973abd7f1 Support older signature alg if running on Java 8 2024-10-23 23:19:05 +01:00
Luck 9420efd3ac Switch to ECDSA keys for web editor socket 2024-10-23 22:52:20 +01:00
Alex c773126a0f Simplify ExpiringSet implementation (#3969) 2024-10-21 21:09:40 +01:00
Luck 9d80de5d5c Fix MongoStorage nodeFromDoc integer cast (#3846) 2024-08-24 09:55:32 +01:00
3TUSK 9bf30fc839 Fix login configuration phase on NeoForge (#3961) 2024-08-22 22:27:29 +01:00
Luck 136a4859f3 Update to Minecraft 1.21.1 2024-08-12 19:45:38 +01:00
Jason Penilla 642f1d3019 Port to NeoForge (#3950) 2024-08-12 19:11:27 +01:00
Luck b21753f5e9 Use builtin Fabric world change event 2024-07-07 21:31:34 +01:00
Luck 9cc129466b Init VerboseHandler earlier (#3932) 2024-07-07 21:22:40 +01:00
Drex 55440cac01 Fix memory leak in Fabric MixinUser (#3931) 2024-07-07 21:15:41 +01:00
lucko 9e7a3d26e4 Improve efficiency of action log queries (#3917) 2024-06-16 21:11:23 +01:00
Luck d748817351 Update Forge to MC 1.21 2024-06-16 10:45:47 +01:00
Wolfdv1andWolfdv1 f984ebbb46 Update Fabric to MC 1.21 (#3918)
Co-authored-by: Wolfdv1 <[email protected]>
2024-06-16 10:45:09 +01:00
Luck 9805f8b2c4 Bump adventure-platform to 4.3.3 2024-06-02 22:17:12 +01:00
Luckandpowercas_gamer c3802c2a5a Fix Forge plugin msg messenger (#3894)
Co-authored-by: powercas_gamer <[email protected]>
2024-05-26 14:19:36 +01:00
Ossi Erkkilä b5400f885b Add support for Sponge API 11 (#3896) 2024-05-26 13:58:39 +01:00
bloodmc 5c1ea5633e Update Forge to MC 1.20.6 (#3883) 2024-05-08 23:09:02 +01:00
bloodmc 484b04c17b Add support for Sponge API 9+ (#3885) 2024-05-06 18:20:47 +01:00
Jason Penilla d74a4dcb7e Set mappings namespace to skip remapping on Paper 1.20.5+ (#3881) 2024-04-30 10:31:16 +01:00
Luck 2361ea43ee Update Fabric to MC 1.20.6 2024-04-29 20:05:54 +01:00
Luck f86585c3cc Update Dockerfile to use Java 21 2024-04-25 22:57:03 +01:00
Drex 7cb60f59fe Update Fabric to MC 1.20.5 (#3824) 2024-04-23 21:57:20 +01:00
Luck a43f4a11b0 Update Fabric dependencies 2024-04-17 21:25:15 +01:00
powercas_gamer 1dffd462a5 Fix mongodb secrets being logged (#3850, #3851) 2024-03-15 20:23:32 +00:00
lucko 8c6586f008 Add custom payload message to API (#3840) 2024-03-06 21:12:33 +00:00
Luck 79273a8bcc Add PostNetworkSyncEvent 2024-02-18 22:40:58 +00:00
Gilberto Garcia 7d89c97907 Don't read nodes twice in SqlStorage (#3836) 2024-02-15 20:03:02 +00:00
Emilia Kond 96008f6338 Add modifyTrack method to TrackManager (#3823) 2024-01-23 17:44:20 +00:00
powercas_gamer e6599a2662 Fix MongoDB uri showing in logs if set using system property (#3808) 2024-01-06 11:31:59 +00:00
AoElite 0703b9856f Small performance optimization in BukkitPlatformListener (#3806) 2024-01-06 11:24:44 +00:00
Luck 5f95b386cb Update adventure-platform for MC 1.20.4 support 2024-01-06 11:23:43 +00:00
Luck 754283c053 Fix Fabric command manager mixin (#3791) 2023-12-12 18:57:44 +00:00
Luck 5f87de3569 Upgrade Fabric/Forge to MC 1.20.4 2023-12-11 19:29:39 +00:00
Luck 43f4d490bb Upgrade Fabric to MC 1.20.3 2023-12-06 20:55:25 +00:00
Luck f14798b368 Upgrade gradle version 2023-12-06 20:35:01 +00:00
bloodmc 00ed76cfc0 Update Forge to 1.20.2 (#3787) 2023-12-06 08:27:08 +00:00
Misode f78e2d6c52 Update Minecraft wiki links in config file comments (#3758) 2023-11-06 22:00:47 +00:00
huanmeng_qwq f999f9f234 Fix duplicate UUID delete with Mongo storage (#3777) 2023-11-06 21:57:08 +00:00
Luck 84fce987d5 Change healthcheck details return type 2023-10-22 21:08:45 +01:00
Luck 3707d2f03c Add healthcheck functionality to API 2023-10-22 20:17:37 +01:00
Luck 822c796e1c Update adventure-platform for MC 1.20.2 support 2023-10-02 19:30:17 +01:00
Luck 331a328771 Upgrade Fabric to MC 1.20.2 2023-10-02 19:28:19 +01:00
777 changed files with 23858 additions and 7290 deletions

No files matched your search

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