Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0486bc885b | ||
|
|
27e7551e2b | ||
|
|
b77d5759d3 | ||
|
|
96abc0d4fe | ||
|
|
1a24a6a155 | ||
|
|
95ea491787 | ||
|
|
626d08431e | ||
|
|
94e7e11183 | ||
|
|
f64bf04ba4 | ||
|
|
7744913df2 | ||
|
|
6b7283ac83 | ||
|
|
9bc8a61e2d | ||
|
|
5e24a7068c | ||
|
|
f351369a51 | ||
|
|
1bf0deb5a5 | ||
|
|
5b82837b80 | ||
|
|
0fef481d48 | ||
|
|
f2040ab815 | ||
|
|
b18717edef | ||
|
|
29c93fac4f | ||
|
|
2e67011f45 | ||
|
|
a92e04f605 | ||
|
|
8d65693d9a | ||
|
|
8973abd7f1 | ||
|
|
9420efd3ac | ||
|
|
c773126a0f | ||
|
|
9d80de5d5c | ||
|
|
9bf30fc839 | ||
|
|
136a4859f3 | ||
|
|
642f1d3019 | ||
|
|
b21753f5e9 | ||
|
|
9cc129466b | ||
|
|
55440cac01 | ||
|
|
9e7a3d26e4 | ||
|
|
d748817351 | ||
|
|
f984ebbb46 | ||
|
|
9805f8b2c4 | ||
|
|
c3802c2a5a | ||
|
|
b5400f885b | ||
|
|
5c1ea5633e | ||
|
|
484b04c17b | ||
|
|
d74a4dcb7e | ||
|
|
2361ea43ee | ||
|
|
f86585c3cc | ||
|
|
7cb60f59fe | ||
|
|
a43f4a11b0 | ||
|
|
1dffd462a5 | ||
|
|
8c6586f008 | ||
|
|
79273a8bcc | ||
|
|
7d89c97907 | ||
|
|
96008f6338 | ||
|
|
e6599a2662 | ||
|
|
0703b9856f | ||
|
|
5f95b386cb | ||
|
|
754283c053 | ||
|
|
5f87de3569 | ||
|
|
43f4d490bb | ||
|
|
f14798b368 | ||
|
|
00ed76cfc0 | ||
|
|
f78e2d6c52 | ||
|
|
f999f9f234 | ||
|
|
84fce987d5 | ||
|
|
3707d2f03c | ||
|
|
822c796e1c | ||
|
|
331a328771 | ||
|
|
f12d3cd8ba | ||
|
|
71416baff2 | ||
|
|
b8d1f52d7d | ||
|
|
6d8b6bd3fe | ||
|
|
8fbd79139d | ||
|
|
9f4082ca0b | ||
|
|
77a5a7b41f | ||
|
|
f788088a69 | ||
|
|
7297fb862c | ||
|
|
35dfc2c8f5 | ||
|
|
86cc90f48a | ||
|
|
feef08a256 | ||
|
|
7a59536450 | ||
|
|
9f1e74fa7c | ||
|
|
5dd808752c | ||
|
|
3542a6cc75 | ||
|
|
acd8d6e5a1 | ||
|
|
081a4f8651 | ||
|
|
2e5a1d79a4 | ||
|
|
d859085056 | ||
|
|
da08be0b20 | ||
|
|
8048427b38 | ||
|
|
6d2a5a6317 | ||
|
|
84bd2ee52a | ||
|
|
bd08507150 | ||
|
|
6d4ed224c8 | ||
|
|
9640271260 | ||
|
|
cfe0d806a1 | ||
|
|
ef85fa8941 | ||
|
|
0ae751b533 | ||
|
|
90392511ef | ||
|
|
4068c71d5a | ||
|
|
6523e708a1 | ||
|
|
e61ac8bef6 | ||
|
|
85a49f0f44 | ||
|
|
1fb62d2616 | ||
|
|
5631a8be43 | ||
|
|
62f2fc9714 | ||
|
|
536c9183fe | ||
|
|
4037570fbb | ||
|
|
1f8b66cfe3 | ||
|
|
ce6031ad52 | ||
|
|
1bfbd27701 | ||
|
|
a5ba53d765 | ||
|
|
3ecdeacaf8 | ||
|
|
4d726f4e8b | ||
|
|
ed9dd031cb | ||
|
|
8e1553c0ed | ||
|
|
5555cdac89 | ||
|
|
0193c06f16 | ||
|
|
5ff9a12a72 | ||
|
|
dc22847fa3 | ||
|
|
e35f46798b | ||
|
|
495d951556 | ||
|
|
8bbb6994b6 | ||
|
|
44470c8843 | ||
|
|
1790c0ad47 | ||
|
|
a2e4a81e29 | ||
|
|
afc69046ad | ||
|
|
b6b3788f14 | ||
|
|
6e0e0e8ae9 | ||
|
|
b1953632c5 | ||
|
|
fe0cb2df25 | ||
|
|
8ebdbdbf0b | ||
|
|
106455a311 | ||
|
|
55d291f975 | ||
|
|
ad08b158f7 | ||
|
|
48e5f428b5 | ||
|
|
d36341c139 | ||
|
|
8b0d6fd5d2 | ||
|
|
fbc0787a1e | ||
|
|
bf93077474 | ||
|
|
016f35a6f0 | ||
|
|
9b2bbb3e53 | ||
|
|
79a08610e0 | ||
|
|
7824566ce5 | ||
|
|
a368509520 | ||
|
|
62a8891b48 | ||
|
|
6421525f3a | ||
|
|
65a4c67745 | ||
|
|
e6cc817436 | ||
|
|
c35958b88e | ||
|
|
e0ee2c3b5f | ||
|
|
b3cdf67c4f | ||
|
|
207e4aa9f8 | ||
|
|
34873914bd | ||
|
|
126631fce8 | ||
|
|
2e0a4d71a5 | ||
|
|
5647b2e5c6 | ||
|
|
eece15d415 | ||
|
|
fb56189f0a | ||
|
|
405c5c3cf9 | ||
|
|
eeec818286 | ||
|
|
138f2c1b3e | ||
|
|
f840c76e44 | ||
|
|
775f1adf36 | ||
|
|
8ed63159ce | ||
|
|
4bdcca6566 | ||
|
|
b235234633 | ||
|
|
5c8b0a604e | ||
|
|
86d2523d33 | ||
|
|
3eca6205ab | ||
|
|
99c3d68d3a | ||
|
|
59f3866e36 | ||
|
|
d45d9a295b | ||
|
|
b13a74c61e | ||
|
|
0fe85ed6ff | ||
|
|
bc15e348f5 | ||
|
|
1b3b9b5c62 | ||
|
|
fe80ba6cc4 | ||
|
|
65751cd56b | ||
|
|
ee79f53612 | ||
|
|
d3029a8467 | ||
|
|
f61d9ff9f0 | ||
|
|
a53c9fad00 | ||
|
|
4de7448394 | ||
|
|
6781c1fb51 | ||
|
|
acdc259771 | ||
|
|
d319d8dc52 | ||
|
|
419d711fb6 | ||
|
|
2d662cbab9 | ||
|
|
ae93c9768b | ||
|
|
664cad21a9 | ||
|
|
8cc126f711 | ||
|
|
9c0874162b | ||
|
|
f35a9b6a09 | ||
|
|
fa17404133 | ||
|
|
64bd8b5eaf | ||
|
|
e227d96cbf | ||
|
|
6e07d6ad36 | ||
|
|
d6c810aa71 | ||
|
|
10f698b70f | ||
|
|
594f50bee7 | ||
|
|
9204848ffb | ||
|
|
272d289d4a | ||
|
|
c9d4c7dac7 | ||
|
|
848fc353d4 | ||
|
|
f896ed723d | ||
|
|
00b62d7cd9 | ||
|
|
f84f425817 | ||
|
|
9c5a43b487 | ||
|
|
b2c76aca7d | ||
|
|
04bb035a83 | ||
|
|
2cf77db8b6 | ||
|
|
d1cb644712 | ||
|
|
4e2807cff5 | ||
|
|
5735e0ef44 | ||
|
|
9cd33d26f2 | ||
|
|
062fca3f75 | ||
|
|
a182768cfa | ||
|
|
93683c3a2f | ||
|
|
ba522597a8 | ||
|
|
b232cb94b4 | ||
|
|
ee6aa47d99 | ||
|
|
b3ebf202fd | ||
|
|
0fa3095241 | ||
|
|
433272518f | ||
|
|
26de6d3a78 | ||
|
|
5ea2aee2f4 | ||
|
|
5a377e713e | ||
|
|
cfb298f69b | ||
|
|
563b5be9b2 | ||
|
|
fb36bd0ced | ||
|
|
979c80d9ee | ||
|
|
4598435dd4 | ||
|
|
51202924af | ||
|
|
8ae70990ad | ||
|
|
a63be102cf | ||
|
|
044deccd22 | ||
|
|
ad49508b74 | ||
|
|
05c9ca5951 | ||
|
|
f5cdb98b01 | ||
|
|
228687b741 | ||
|
|
7ebbfcf0d2 | ||
|
|
49c17c4a18 | ||
|
|
7c42b9aeca | ||
|
|
1511193e58 | ||
|
|
528d668bc6 | ||
|
|
71896a75bf | ||
|
|
931d61e2ed | ||
|
|
b87b1c7123 | ||
|
|
fed5a0fd87 | ||
|
|
9d4f278117 | ||
|
|
1d465aa800 | ||
|
|
8741e8259f | ||
|
|
98adb046ee | ||
|
|
a68a5d91c4 | ||
|
|
0808392353 | ||
|
|
07f672ae1f | ||
|
|
e219237e44 | ||
|
|
c533446ab0 | ||
|
|
82488140ee | ||
|
|
327ccec02f | ||
|
|
46efe0ef93 | ||
|
|
c2231bcc2e | ||
|
|
d150bd39a5 | ||
|
|
f813122468 | ||
|
|
2e62c98c45 | ||
|
|
f0e1a8f092 | ||
|
|
2dc6902001 | ||
|
|
21f5c24847 | ||
|
|
6b2c4bca58 | ||
|
|
4564a97371 | ||
|
|
1df66255e4 | ||
|
|
1c7e2dfb8c | ||
|
|
ad1ba3c126 | ||
|
|
0f63b024e4 | ||
|
|
a17b441165 | ||
|
|
e3138eb94c | ||
|
|
53bb61f9b2 | ||
|
|
370e2aed0d | ||
|
|
b7f05a2f91 | ||
|
|
bb01c74642 | ||
|
|
ba71345cbd | ||
|
|
2c636c5ac6 | ||
|
|
0884dd7e97 | ||
|
|
c948632dfa | ||
|
|
9647b7de43 | ||
|
|
e7f2a8d713 | ||
|
|
bf0ac1a867 | ||
|
|
89894353b6 | ||
|
|
ca65e2175d | ||
|
|
84c5b818b8 | ||
|
|
843eaaed0c | ||
|
|
4ff2c75538 | ||
|
|
734b011dc7 | ||
|
|
4018493285 | ||
|
|
435e039b38 | ||
|
|
7579bbe549 | ||
|
|
16ee500054 | ||
|
|
88f040e822 | ||
|
|
a766c0e9aa | ||
|
|
40e8038604 | ||
|
|
3c4091018c | ||
|
|
75d8f00400 | ||
|
|
cb5f403043 | ||
|
|
997e3c7ef7 | ||
|
|
cb9e0899fc | ||
|
|
ab009ed110 | ||
|
|
c8b89f245e | ||
|
|
d8aefd23d3 | ||
|
|
a8dfd38fe6 | ||
|
|
b7ac05a0a5 | ||
|
|
b8e044c4e3 | ||
|
|
b708d04141 | ||
|
|
d485017744 | ||
|
|
35f5944d7b | ||
|
|
d12be01ecd | ||
|
|
8043b84dc4 | ||
|
|
284e260bc2 | ||
|
|
ec296460b2 | ||
|
|
20fee360fb | ||
|
|
cd496fdc39 | ||
|
|
f9030825fd | ||
|
|
0a92597767 | ||
|
|
6c34da6b32 | ||
|
|
d5cefac65d | ||
|
|
2a44572fb2 | ||
|
|
73230bc9b6 | ||
|
|
be1b9d45fa | ||
|
|
238a4fba75 | ||
|
|
33e412f663 | ||
|
|
c904ede972 | ||
|
|
489c09ddfc | ||
|
|
505c073c8e | ||
|
|
443ea510bb | ||
|
|
848c36928f | ||
|
|
21abb94796 | ||
|
|
0a99a96188 | ||
|
|
a8b1dc8c07 | ||
|
|
c3581c00d3 | ||
|
|
8124a17adb | ||
|
|
68167490d4 | ||
|
|
657cf2a45e | ||
|
|
d83559b949 | ||
|
|
8167fbf73f | ||
|
|
8dfeef9575 | ||
|
|
5c44333892 | ||
|
|
142cdc8e89 | ||
|
|
abb608b856 | ||
|
|
c28b1949a9 | ||
|
|
8ef871f6db | ||
|
|
fa89236e48 | ||
|
|
2d4af4c691 | ||
|
|
16fbf566f3 | ||
|
|
e6a5cb06af | ||
|
|
7bc422c83f | ||
|
|
478fddc486 | ||
|
|
97d1deec9c | ||
|
|
45188c6334 | ||
|
|
17f67f6e13 | ||
|
|
39a5ccf9a9 | ||
|
|
5fbb80f16a | ||
|
|
798a539024 | ||
|
|
645efb0e5b | ||
|
|
5bfbf26e2f | ||
|
|
7d7d40b087 | ||
|
|
e183f520d6 | ||
|
|
727c2f92c3 | ||
|
|
fdd3b117f1 | ||
|
|
8a38c5f4b7 | ||
|
|
53fb46ee85 | ||
|
|
d136359cd9 | ||
|
|
d449834767 | ||
|
|
e851234723 | ||
|
|
26f7dfcb24 | ||
|
|
d1b53f65ae | ||
|
|
c39749e526 | ||
|
|
23c7eb79d0 | ||
|
|
9af6dccd9d | ||
|
|
129a10aa60 | ||
|
|
62270bfd93 | ||
|
|
9f8b4b2404 | ||
|
|
00d4a2a1da | ||
|
|
4ce8ea21f9 | ||
|
|
93d0c54687 | ||
|
|
6564cc89f4 | ||
|
|
9796d2421f | ||
|
|
0ea0ce9d26 | ||
|
|
3f04d439b4 | ||
|
|
5bdc798237 | ||
|
|
5d0c578da1 | ||
|
|
7854de8991 | ||
|
|
4c23f93a67 | ||
|
|
7b3beae57f | ||
|
|
15d3000fc1 | ||
|
|
ad174742e9 | ||
|
|
ab0e25a56d | ||
|
|
6b05e47deb | ||
|
|
b9eb022011 | ||
|
|
7d47b31bcb | ||
|
|
f3857090fa | ||
|
|
d7fa9e08f3 | ||
|
|
2c7ff2120c | ||
|
|
703b18e51c | ||
|
|
3b779dbbd3 | ||
|
|
9af397c2bc | ||
|
|
b6e5b0bd47 | ||
|
|
6e7c49488d | ||
|
|
c5841b58a7 | ||
|
|
e8b1214219 | ||
|
|
4811129ab1 | ||
|
|
63878166db | ||
|
|
2ea43d4b2e | ||
|
|
442c7d46f9 | ||
|
|
971bb67b51 | ||
|
|
020aff66aa | ||
|
|
198b86d7c3 | ||
|
|
84e7fd4d09 | ||
|
|
4027129052 | ||
|
|
63f67ca72c | ||
|
|
2adaea2dac | ||
|
|
5e48224c78 | ||
|
|
cc1d8984da | ||
|
|
8d9b4182f4 | ||
|
|
f972113d11 | ||
|
|
4d5a24f2c4 | ||
|
|
e2b575dd24 | ||
|
|
7fae141e33 | ||
|
|
6f90e545fc | ||
|
|
ee3bb22c2c | ||
|
|
361a4d66bc | ||
|
|
e1bac438aa | ||
|
|
ac9706b83f | ||
|
|
fea757887c | ||
|
|
1eab127f50 | ||
|
|
92e008ff0a | ||
|
|
9659333d0e | ||
|
|
d8020e77fe | ||
|
|
232d17436c | ||
|
|
1461651e22 | ||
|
|
ef556f7cf7 | ||
|
|
47ca6b162b | ||
|
|
f72a5cb6b5 | ||
|
|
cd0fd80b33 | ||
|
|
0fd7f643a7 | ||
|
|
6c7c1b67b8 | ||
|
|
4514a17eaf | ||
|
|
adbd2fc81f | ||
|
|
8b506b6a95 | ||
|
|
426c8565fd | ||
|
|
bd6d3ab7c0 | ||
|
|
d12d13d6ea | ||
|
|
cc08390abe | ||
|
|
b460e282b1 | ||
|
|
005d19f2a3 | ||
|
|
8817e17d2c | ||
|
|
0f23b7a460 | ||
|
|
21ae1dbac0 | ||
|
|
6cb0f5e810 | ||
|
|
2ac7d3dfe6 | ||
|
|
bfaa543ecd | ||
|
|
f893b1c632 | ||
|
|
cb5a28f043 | ||
|
|
bd9718c5af | ||
|
|
97a0dbebcb | ||
|
|
df324de9ec | ||
|
|
6fa690a49d | ||
|
|
2bb1aa7511 | ||
|
|
0bef0902c0 | ||
|
|
f10f60e27f | ||
|
|
91337b49ea | ||
|
|
f5e41f7e7e | ||
|
|
fe0e82f285 | ||
|
|
8996cf02af | ||
|
|
e37c77a1be | ||
|
|
11998b2dd6 | ||
|
|
8754123535 | ||
|
|
91d75424f4 | ||
|
|
c5c99abd16 | ||
|
|
6c88f7629e | ||
|
|
98c71739f8 | ||
|
|
25551641fc | ||
|
|
00b701f129 | ||
|
|
ab082aa311 | ||
|
|
dc32c84bb3 | ||
|
|
0bb4161397 | ||
|
|
4a049ca732 | ||
|
|
d5ac45d230 | ||
|
|
6b3e4bdc71 | ||
|
|
5c0d82f306 | ||
|
|
5a6176def5 | ||
|
|
13ebc87b29 | ||
|
|
1ca1bcf1d1 | ||
|
|
ea5a05d770 | ||
|
|
ed85ab1bfd | ||
|
|
c09e4a1aa0 | ||
|
|
ee36fa9d81 | ||
|
|
bfa5fc43cd | ||
|
|
5d6389249a | ||
|
|
637cb0d836 | ||
|
|
bfebe6a5d0 | ||
|
|
4cbbbd390f | ||
|
|
c120fa6a4d | ||
|
|
918ea7503a | ||
|
|
dbe07827bd | ||
|
|
98eb756951 | ||
|
|
86eeeb5b94 | ||
|
|
a3e6628e11 | ||
|
|
84bc4217de | ||
|
|
b88819b9bb | ||
|
|
c7a0e59919 | ||
|
|
9984d4be42 | ||
|
|
a1c91b9007 | ||
|
|
6a256d59f5 | ||
|
|
fca2f1e6de | ||
|
|
ec7994a561 | ||
|
|
2839c36ea2 | ||
|
|
9f22bf2fbf | ||
|
|
5f0df1b167 |
No files matched your search
@@ -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
|
||||
@@ -0,0 +1,63 @@
|
||||
name: 🐛 Bug report
|
||||
description: Report an issue or problem with the way LuckPerms is functioning.
|
||||
labels: ["type: issue"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: "Before going any further, please check to see if your problem is fixed by updating to a newer version. The latest development builds can be obtained from https://luckperms.net/download"
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Description
|
||||
description: Please provide a short description of the issue in the space below.
|
||||
placeholder: Description goes here!
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: reproduction-steps
|
||||
attributes:
|
||||
label: Reproduction Steps
|
||||
description: Please provide a clear list of steps we should follow in order to reproduce your issue in the space below.
|
||||
placeholder: List reproduction steps here, please!
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: expected-behaviour
|
||||
attributes:
|
||||
label: Expected Behaviour
|
||||
description: Please provide a description of what you expected to happen.
|
||||
placeholder: Describe what you expected to happen here.
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: server-info
|
||||
attributes:
|
||||
label: Server Details
|
||||
description: Please provide a description of the server details, including type and specific version number.
|
||||
placeholder: 'git-Paper-124 (MC: 1.17.1)'
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: luckperms-version
|
||||
attributes:
|
||||
label: LuckPerms Version
|
||||
description: Please provide the specific, precise version number of LuckPerms you are using to reproduce this bug.
|
||||
placeholder: v5.3.70
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: Logs and Configs
|
||||
description: If you think it would be helpful, please also include a pastebin of any relevant config files or log output. You should use https://gist.github.com/ to upload, then include the link below.
|
||||
placeholder: https://gist.github.com/HelpfulBugReporter/ThisIsAVeryUsefulLogOutput
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: extra-info
|
||||
attributes:
|
||||
label: Extra Details
|
||||
description: Please include any other relevant details in the space below.
|
||||
placeholder: I was able to reproduce this only at the end of a rainbow.
|
||||
validations:
|
||||
required: false
|
||||
@@ -0,0 +1,5 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: 💬 Ask a question
|
||||
url: https://discord.gg/luckperms
|
||||
about: We use Discord to provide support for the project. If you have a question, need help, or aren't sure if you've found a bug or not, please come and talk to us there!
|
||||
@@ -0,0 +1,31 @@
|
||||
name: 💡 Suggestion
|
||||
description: Suggest an idea for an improvement or change to LuckPerms.
|
||||
labels: ["type: suggestion"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: "Before going any further, please check to see if your suggestion has already been added by checking the [wiki](https://luckperms.net/wiki/Home). The latest development builds can be obtained from https://luckperms.net/download"
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Description
|
||||
description: Please provide a short description of your suggestion in the space below.
|
||||
placeholder: Hello, perhaps you should...
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: proposed-behaviour
|
||||
attributes:
|
||||
label: Proposed Behaviour
|
||||
description: Please provide a short explanation of how the feature should work / be changed, and how this will affect the project.
|
||||
placeholder: It would...
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: extra-info
|
||||
attributes:
|
||||
label: Extra Details
|
||||
description: Please include any other relevant details in the space below.
|
||||
placeholder: I think this should only function at the end of a rainbow.
|
||||
validations:
|
||||
required: false
|
||||
@@ -0,0 +1,128 @@
|
||||
name: Build Gradle and Publish Docker image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
tags:
|
||||
- 'v*'
|
||||
pull_request:
|
||||
branches:
|
||||
- 'master'
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
|
||||
jobs:
|
||||
build-gradle:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '21'
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v4
|
||||
|
||||
- name: Run build and tests with Gradle wrapper
|
||||
run: ./gradlew test build -PdockerTests
|
||||
|
||||
- name: Publish test report
|
||||
uses: mikepenz/action-junit-report@v5
|
||||
if: success() || failure()
|
||||
with:
|
||||
report_paths: '**/build/test-results/test/TEST-*.xml'
|
||||
annotate_notice: true
|
||||
detailed_summary: true
|
||||
|
||||
- name: Upload all artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: jars
|
||||
path: |
|
||||
bukkit/loader/build/libs/LuckPerms-Bukkit-*.jar
|
||||
bukkit-legacy/loader/build/libs/LuckPerms-Bukkit-Legacy-*.jar
|
||||
bungee/loader/build/libs/LuckPerms-Bungee-*.jar
|
||||
sponge/loader/build/libs/LuckPerms-Sponge-*.jar
|
||||
nukkit/loader/build/libs/LuckPerms-Nukkit-*.jar
|
||||
velocity/build/libs/LuckPerms-Velocity-*.jar
|
||||
fabric/build/libs/LuckPerms-Fabric-*.jar
|
||||
forge/loader/build/libs/LuckPerms-Forge-*.jar
|
||||
standalone/loader/build/libs/LuckPerms-Standalone-*.jar
|
||||
|
||||
- name: Upload standalone artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: standalone-binary
|
||||
path: standalone/loader/build/libs/LuckPerms-Standalone-*.jar
|
||||
|
||||
|
||||
build-docker:
|
||||
needs: build-gradle
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Retrieve saved standalone jar artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: standalone-binary
|
||||
path: standalone/docker/
|
||||
|
||||
- name: Remove version number from jar artifact name
|
||||
run: mv standalone/docker/LuckPerms-Standalone-*.jar standalone/docker/luckperms-standalone.jar
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Determine the LuckPerms version
|
||||
run: |
|
||||
echo "luckperms_version=$(git describe --tags | awk -F "-" '{print $1 "." $2}')" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Extract metadata for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
flavor: |
|
||||
latest=${{ github.ref == 'refs/heads/master' }}
|
||||
tags: |
|
||||
type=schedule
|
||||
type=ref,event=branch
|
||||
type=ref,event=tag
|
||||
type=ref,event=pr
|
||||
type=raw,enable=${{ github.ref == 'refs/heads/master' }},value=${{ env.luckperms_version }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: standalone/docker/
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
@@ -1,3 +1,6 @@
|
||||
### LuckPerms Standalone ###
|
||||
standalone/loader/data/
|
||||
|
||||
### Gradle & IntelliJ ###
|
||||
.gradle/
|
||||
/.idea/
|
||||
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
### :speech_balloon: Looking for support?
|
||||
|
||||
Details about support for the project can be found [here, on the Wiki Homepage](https://github.com/lucko/LuckPerms/wiki#support).
|
||||
Details about support for the project can be found [here, on the Wiki Homepage](https://luckperms.net/wiki/Home#support).
|
||||
|
||||
### :bug: Reporting bugs?
|
||||
|
||||
@@ -8,7 +8,7 @@ Before reporting a bug or issue, please make sure that the issue is actually bei
|
||||
|
||||
If you're unsure, feel free to ask using the above resources BEFORE making a report.
|
||||
|
||||
Bugs or issues should be reported using the [GitHub Issues tab](https://github.com/lucko/LuckPerms/issues).
|
||||
Bugs or issues should be reported using the [GitHub Issues tab](https://github.com/LuckPerms/LuckPerms/issues).
|
||||
|
||||
### :pencil: Want to contribute code?
|
||||
#### Pull Requests
|
||||
@@ -16,11 +16,11 @@ If you make any changes or improvements to the plugin which you think would be b
|
||||
|
||||
LuckPerms loosely follows the [Google Java Style Guide](https://google.github.io/styleguide/javaguide.html). Generally, try to copy the style of code found in the class you're editing.
|
||||
|
||||
If you're considering submitting a substantial pull request, please open an issue so we can discuss the change before starting work on the contribution. Most pull requests are happily accepted, but larger changes may have an inpact on the maintainability of the project, and require more consideration.
|
||||
If you're considering submitting a substantial pull request, please open an issue so we can discuss the change before starting work on the contribution. Most pull requests are happily accepted, but larger changes may have an impact on the maintainability of the project, and require more consideration.
|
||||
|
||||
#### Project Layout
|
||||
The project is split up into a few seperate modules.
|
||||
The project is split up into a few separate modules.
|
||||
|
||||
* **API** - The public, semantically versioned API used by other plugins wishing to integrate with and retrieve data from LuckPerms. This module (for the most part) does not contain any implementation itself, and is provided by the plugin.
|
||||
* **Common** - The common module contains most of the code which implements the respective LuckPerms plugins. This abstract module reduces duplicated code throughout the project.
|
||||
* **Bukkit, BungeeCord, Sponge, Nukkit & Velocity** - Each use the common module to implement plugins on the respective server platforms.
|
||||
* **Bukkit, BungeeCord, Fabric, Forge, Nukkit, Sponge & Velocity** - Each use the common module to implement plugins on the respective server platforms.
|
||||
@@ -1,37 +1,46 @@
|
||||

|
||||

|
||||
# LuckPerms
|
||||
[](https://ci.lucko.me/job/LuckPerms/)
|
||||
[](https://javadoc.io/doc/net.luckperms/api)
|
||||
[](https://search.maven.org/artifact/net.luckperms/api)
|
||||
[](https://discord.gg/luckperms)
|
||||
[](https://discord.gg/luckperms)
|
||||
|
||||
LuckPerms is an advanced permissions implementation aiming to be a fast, reliable and flexible alternative to existing permission plugins. The project's main goals are centered around high performance and a wide feature set, filling the gaps of functionality and building upon existing features found in other plugins.
|
||||
LuckPerms is a permissions plugin for Minecraft servers. It allows server admins to control what features players can use by creating groups and assigning permissions.
|
||||
|
||||
LuckPerms also includes an extensive API for developers, and support for a variety of Minecraft server software & data storage options.
|
||||
The latest downloads, wiki & other useful links can be found on the project homepage at [luckperms.net](https://luckperms.net/).
|
||||
|
||||
Still not convinced? More information can be found on the wiki, under: [Why LuckPerms?](https://github.com/lucko/LuckPerms/wiki/Why-LuckPerms)
|
||||
It is:
|
||||
|
||||
## Useful Links
|
||||
* **fast** - written with performance and scalability in mind.
|
||||
* **reliable** - trusted by thousands of server admins, and the largest of server networks.
|
||||
* **easy to use** - setup permissions using commands, directly in config files, or using the web editor.
|
||||
* **flexible** - supports a variety of data storage options, and works on lots of different server types.
|
||||
* **extensive** - a plethora of customization options and settings which can be changed to suit your server.
|
||||
* **free** - available for download and usage at no cost, and permissively licensed so it can remain free forever.
|
||||
|
||||
The latest **downloads** can be found on the [project's homepage](https://luckperms.net/).
|
||||
|
||||
More information about the project & how to use the plugin can be found in the [wiki](https://github.com/lucko/LuckPerms/wiki).
|
||||
For more information, see the wiki article on [Why LuckPerms?](https://luckperms.net/wiki/Why-LuckPerms)
|
||||
|
||||
## Building
|
||||
LuckPerms uses Gradle to handle dependencies & building.
|
||||
|
||||
#### Requirements
|
||||
* Java 8 JDK or newer
|
||||
* Java 21 JDK or newer
|
||||
* Git
|
||||
|
||||
#### Compiling from source
|
||||
```sh
|
||||
git clone https://github.com/lucko/LuckPerms.git
|
||||
git clone https://github.com/LuckPerms/LuckPerms.git
|
||||
cd LuckPerms/
|
||||
./gradlew build
|
||||
```
|
||||
|
||||
You can find the output jars in the `build/libs` directories.
|
||||
You can find the output jars in the `loader/build/libs` or `build/libs` directories.
|
||||
|
||||
## Tests
|
||||
There are some automated tests which run during each build.
|
||||
|
||||
* Unit tests are defined in [`common/src/test`](https://github.com/LuckPerms/LuckPerms/tree/master/common/src/test)
|
||||
* Integration tests are defined in [`standalone/src/test`](https://github.com/LuckPerms/LuckPerms/tree/master/standalone/src/test).
|
||||
|
||||
## Contributing
|
||||
#### Pull Requests
|
||||
@@ -44,7 +53,7 @@ The project is split up into a few separate modules.
|
||||
|
||||
* **API** - The public, semantically versioned API used by other plugins wishing to integrate with and retrieve data from LuckPerms. This module (for the most part) does not contain any implementation itself, and is provided by the plugin.
|
||||
* **Common** - The common module contains most of the code which implements the respective LuckPerms plugins. This abstract module reduces duplicated code throughout the project.
|
||||
* **Bukkit, BungeeCord, Sponge, Nukkit & Velocity** - Each use the common module to implement plugins on the respective server platforms.
|
||||
* **Bukkit, BungeeCord, Fabric, Forge, Nukkit, Sponge & Velocity** - Each use the common module to implement plugins on the respective server platforms.
|
||||
|
||||
## License
|
||||
LuckPerms is licensed under the permissive MIT license. Please see [`LICENSE.txt`](https://github.com/lucko/LuckPerms/blob/master/LICENSE.txt) for more info.
|
||||
LuckPerms is licensed under the permissive MIT license. Please see [`LICENSE.txt`](https://github.com/LuckPerms/LuckPerms/blob/master/LICENSE.txt) for more info.
|
||||
+66
-59
@@ -1,8 +1,15 @@
|
||||
group = 'net.luckperms'
|
||||
project.version = '5.1'
|
||||
project.version = '5.5'
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes('Automatic-Module-Name': 'net.luckperms.api')
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly 'org.checkerframework:checker-qual:2.5.5'
|
||||
compileOnly 'org.checkerframework:checker-qual:3.49.3'
|
||||
compileOnly 'org.jetbrains:annotations:26.0.2'
|
||||
}
|
||||
|
||||
// Only used occasionally for deployment - not needed for normal builds.
|
||||
@@ -12,88 +19,88 @@ if (project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePass
|
||||
|
||||
javadoc {
|
||||
title = 'LuckPerms API (v' + project.ext.apiVersion + ')'
|
||||
options.overview = 'javadoc/overview.html'
|
||||
options.encoding = 'UTF-8'
|
||||
options.charSet = 'UTF-8'
|
||||
options.links(
|
||||
'https://docs.oracle.com/javase/8/docs/api/'
|
||||
'https://checkerframework.org/api/',
|
||||
'https://javadoc.io/static/org.jetbrains/annotations/26.0.2/'
|
||||
)
|
||||
options.addStringOption('Xdoclint:none', '-quiet')
|
||||
options.addStringOption('-since', '5.0,5.1,5.2,5.3,5.4,5.5')
|
||||
|
||||
if (JavaVersion.current() > JavaVersion.VERSION_1_8) {
|
||||
options.links.add('https://docs.oracle.com/en/java/javase/21/docs/api/')
|
||||
} else {
|
||||
options.links.add('https://docs.oracle.com/javase/8/docs/api/')
|
||||
}
|
||||
}
|
||||
|
||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||
classifier 'javadoc'
|
||||
from javadoc.destinationDir
|
||||
java {
|
||||
withJavadocJar()
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
classifier 'sources'
|
||||
from sourceSets.main.allSource
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives javadocJar
|
||||
archives sourcesJar
|
||||
}
|
||||
|
||||
signing {
|
||||
useGpgCmd()
|
||||
sign configurations.archives
|
||||
}
|
||||
|
||||
uploadArchives {
|
||||
publishing {
|
||||
repositories {
|
||||
mavenDeployer {
|
||||
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
|
||||
maven {
|
||||
def releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
|
||||
def snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots/'
|
||||
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
|
||||
|
||||
repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/') {
|
||||
authentication(userName: sonatypeUsername, password: sonatypePassword)
|
||||
credentials {
|
||||
username sonatypeUsername
|
||||
password sonatypePassword
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/') {
|
||||
authentication(userName: sonatypeUsername, password: sonatypePassword)
|
||||
}
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
artifactId = 'api'
|
||||
|
||||
from components.java
|
||||
|
||||
pom {
|
||||
project {
|
||||
name 'LuckPerms API'
|
||||
description 'An advanced permissions plugin for Bukkit/Spigot, BungeeCord, Sponge, Nukkit and Velocity.'
|
||||
url 'https://luckperms.net'
|
||||
name = 'LuckPerms API'
|
||||
description = 'A permissions manager for Minecraft servers.'
|
||||
url = 'https://luckperms.net'
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name 'MIT'
|
||||
url 'https://opensource.org/licenses/MIT'
|
||||
}
|
||||
licenses {
|
||||
license {
|
||||
name = 'MIT'
|
||||
url = 'https://opensource.org/licenses/MIT'
|
||||
}
|
||||
}
|
||||
|
||||
developers {
|
||||
developer {
|
||||
id 'lucko'
|
||||
name 'Luck'
|
||||
url 'https://lucko.me'
|
||||
email 'git@lucko.me'
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id = 'lucko'
|
||||
name = 'Luck'
|
||||
url = 'https://lucko.me'
|
||||
email = 'git@lucko.me'
|
||||
}
|
||||
}
|
||||
|
||||
scm {
|
||||
connection 'scm:git:https://github.com/lucko/LuckPerms.git'
|
||||
developerConnection 'scm:git:git@github.com:lucko/LuckPerms.git'
|
||||
url 'https://github.com/lucko/LuckPerms'
|
||||
}
|
||||
scm {
|
||||
connection = 'scm:git:https://github.com/LuckPerms/LuckPerms.git'
|
||||
developerConnection = 'scm:git:git@github.com:LuckPerms/LuckPerms.git'
|
||||
url = 'https://github.com/LuckPerms/LuckPerms'
|
||||
}
|
||||
|
||||
ciManagement {
|
||||
system 'Jenkins'
|
||||
url 'https://ci.lucko.me/job/LuckPerms'
|
||||
}
|
||||
|
||||
issueManagement {
|
||||
system 'GitHub'
|
||||
url 'https://github.com/lucko/LuckPerms/issues'
|
||||
}
|
||||
issueManagement {
|
||||
system = 'GitHub'
|
||||
url = 'https://github.com/LuckPerms/LuckPerms/issues'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
signing {
|
||||
useGpgCmd()
|
||||
sign publishing.publications.mavenJava
|
||||
required = true
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -0,0 +1,20 @@
|
||||
<body>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
<h4>Useful Links</h4>
|
||||
<ul>
|
||||
<li><a target="_top" href="https://luckperms.net">Project Website</a></li>
|
||||
<li><a target="_top" href="https://luckperms.net/wiki/Developer-API">Wiki - API Introduction</a></li>
|
||||
<li><a target="_top" href="https://luckperms.net/wiki/Developer-API-Usage">Wiki - API Usage</a></li>
|
||||
<li><a target="_top" href="https://github.com/LuckPerms/LuckPerms">Source Code</a></li>
|
||||
</ul>
|
||||
<h4>Maven</h4>
|
||||
<p>
|
||||
The API artifact is deployed to Maven Central with
|
||||
<a target="_top" href="https://search.maven.org/artifact/net.luckperms/api">
|
||||
group id: <b><code>net.luckperms</code></b>, artifact id: <b><code>api</code></b>.
|
||||
</a>
|
||||
</p>
|
||||
</body>
|
||||
@@ -26,6 +26,7 @@
|
||||
package net.luckperms.api;
|
||||
|
||||
import net.luckperms.api.actionlog.ActionLogger;
|
||||
import net.luckperms.api.actionlog.filter.ActionFilterFactory;
|
||||
import net.luckperms.api.context.ContextCalculator;
|
||||
import net.luckperms.api.context.ContextManager;
|
||||
import net.luckperms.api.event.EventBus;
|
||||
@@ -40,14 +41,15 @@ import net.luckperms.api.model.user.User;
|
||||
import net.luckperms.api.model.user.UserManager;
|
||||
import net.luckperms.api.node.NodeBuilderRegistry;
|
||||
import net.luckperms.api.node.matcher.NodeMatcherFactory;
|
||||
import net.luckperms.api.platform.Health;
|
||||
import net.luckperms.api.platform.Platform;
|
||||
import net.luckperms.api.platform.PlayerAdapter;
|
||||
import net.luckperms.api.platform.PluginMetadata;
|
||||
import net.luckperms.api.query.QueryOptionsRegistry;
|
||||
import net.luckperms.api.track.Track;
|
||||
import net.luckperms.api.track.TrackManager;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus.Internal;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -131,6 +133,7 @@ public interface LuckPerms {
|
||||
* <li>{@code org.bukkit.entity.Player}</li>
|
||||
* <li>{@code net.md_5.bungee.api.connection.ProxiedPlayer}</li>
|
||||
* <li>{@code org.spongepowered.api/entity.living.player.Player}</li>
|
||||
* <li>{@code net.minecraft.server.network.ServerPlayerEntity} (Fabric)</li>
|
||||
* <li>{@code cn.nukkit.Player}</li>
|
||||
* <li>{@code com.velocitypowered.api.proxy.Player}</li>
|
||||
* </ul>
|
||||
@@ -194,21 +197,6 @@ public interface LuckPerms {
|
||||
*/
|
||||
@NonNull ContextManager getContextManager();
|
||||
|
||||
/**
|
||||
* Gets the {@link NodeBuilderRegistry}.
|
||||
*
|
||||
* @return the node builder registry
|
||||
*/
|
||||
@NonNull NodeBuilderRegistry getNodeBuilderRegistry();
|
||||
|
||||
/**
|
||||
* Gets the {@link QueryOptionsRegistry}.
|
||||
*
|
||||
* @return the query options registry
|
||||
* @since 5.1
|
||||
*/
|
||||
@NonNull QueryOptionsRegistry getQueryOptionsRegistry();
|
||||
|
||||
/**
|
||||
* Gets the {@link MetaStackFactory}.
|
||||
*
|
||||
@@ -220,14 +208,6 @@ public interface LuckPerms {
|
||||
*/
|
||||
@NonNull MetaStackFactory getMetaStackFactory();
|
||||
|
||||
/**
|
||||
* Gets the {@link NodeMatcherFactory}.
|
||||
*
|
||||
* @return the node matcher factory
|
||||
* @since 5.1
|
||||
*/
|
||||
@NonNull NodeMatcherFactory getNodeMatcherFactory();
|
||||
|
||||
/**
|
||||
* Schedules the execution of an update task, and returns an encapsulation
|
||||
* of the task as a {@link CompletableFuture}.
|
||||
@@ -241,6 +221,17 @@ public interface LuckPerms {
|
||||
*/
|
||||
@NonNull 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
|
||||
*/
|
||||
@NonNull Health runHealthCheck();
|
||||
|
||||
/**
|
||||
* Registers a {@link MessengerProvider} for use by the platform.
|
||||
*
|
||||
@@ -251,4 +242,40 @@ public interface LuckPerms {
|
||||
*/
|
||||
void registerMessengerProvider(@NonNull MessengerProvider messengerProvider);
|
||||
|
||||
/**
|
||||
* Gets the {@link NodeBuilderRegistry}.
|
||||
*
|
||||
* @return the node builder registry
|
||||
*/
|
||||
@Internal
|
||||
@NonNull NodeBuilderRegistry getNodeBuilderRegistry();
|
||||
|
||||
/**
|
||||
* Gets the {@link QueryOptionsRegistry}.
|
||||
*
|
||||
* @return the query options registry
|
||||
* @since 5.1
|
||||
*/
|
||||
@Internal
|
||||
@NonNull QueryOptionsRegistry getQueryOptionsRegistry();
|
||||
|
||||
/**
|
||||
* Gets the {@link NodeMatcherFactory}.
|
||||
*
|
||||
* @return the node matcher factory
|
||||
* @since 5.1
|
||||
*/
|
||||
@Internal
|
||||
@NonNull NodeMatcherFactory getNodeMatcherFactory();
|
||||
|
||||
/**
|
||||
* Gets the {@link ActionFilterFactory}.
|
||||
*
|
||||
* @return the action filter factory
|
||||
* @since 5.5
|
||||
*/
|
||||
@Internal
|
||||
@NonNull
|
||||
ActionFilterFactory getActionFilterFactory();
|
||||
|
||||
}
|
||||
@@ -27,41 +27,64 @@ package net.luckperms.api;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import static org.jetbrains.annotations.ApiStatus.Internal;
|
||||
|
||||
/**
|
||||
* Provides static access to the {@link LuckPerms} service.
|
||||
* Provides static access to the {@link LuckPerms} API.
|
||||
*
|
||||
* <p>Ideally, the ServiceManager for the platform should be used to obtain an
|
||||
* instance, however, this provider can be used if you need static access.</p>
|
||||
* instance, however, this provider can be used if this is not viable.</p>
|
||||
*/
|
||||
public final class LuckPermsProvider {
|
||||
private static LuckPerms instance = null;
|
||||
|
||||
/**
|
||||
* Gets an instance of the {@link LuckPerms} service,
|
||||
* throwing {@link IllegalStateException} if an instance is not yet loaded.
|
||||
* Gets an instance of the {@link LuckPerms} API,
|
||||
* throwing {@link IllegalStateException} if the API is not loaded yet.
|
||||
*
|
||||
* <p>Will never return null.</p>
|
||||
* <p>This method will never return null.</p>
|
||||
*
|
||||
* @return an api instance
|
||||
* @throws IllegalStateException if the api is not loaded
|
||||
* @return an instance of the LuckPerms API
|
||||
* @throws IllegalStateException if the API is not loaded yet
|
||||
*/
|
||||
public static @NonNull LuckPerms get() {
|
||||
LuckPerms instance = LuckPermsProvider.instance;
|
||||
if (instance == null) {
|
||||
throw new IllegalStateException("The LuckPerms API is not loaded.");
|
||||
throw new NotLoadedException();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Internal
|
||||
static void register(LuckPerms instance) {
|
||||
LuckPermsProvider.instance = instance;
|
||||
}
|
||||
|
||||
@Internal
|
||||
static void unregister() {
|
||||
LuckPermsProvider.instance = null;
|
||||
}
|
||||
|
||||
@Internal
|
||||
private LuckPermsProvider() {
|
||||
throw new UnsupportedOperationException("This class cannot be instantiated.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Exception thrown when the API is requested before it has been loaded.
|
||||
*/
|
||||
private static final class NotLoadedException extends IllegalStateException {
|
||||
private static final String MESSAGE = "The LuckPerms API isn't loaded yet!\n" +
|
||||
"This could be because:\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" +
|
||||
" c) the plugin in the stacktrace is retrieving the API before the plugin 'enable' phase\n" +
|
||||
" (call the #get method in onEnable, not the constructor!)\n" +
|
||||
" d) the plugin in the stacktrace is incorrectly 'shading' the LuckPerms API into its jar\n";
|
||||
|
||||
NotLoadedException() {
|
||||
super(MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,9 +26,9 @@
|
||||
package net.luckperms.api.actionlog;
|
||||
|
||||
import net.luckperms.api.LuckPermsProvider;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.jetbrains.annotations.ApiStatus.NonExtendable;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Optional;
|
||||
@@ -36,7 +36,10 @@ import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Represents a logged action.
|
||||
*
|
||||
* <p>API users should not implement this interface directly.</p>
|
||||
*/
|
||||
@NonExtendable
|
||||
public interface Action extends Comparable<Action> {
|
||||
|
||||
/**
|
||||
@@ -82,6 +85,7 @@ public interface Action extends Comparable<Action> {
|
||||
/**
|
||||
* Represents the source of an action.
|
||||
*/
|
||||
@NonExtendable
|
||||
interface Source {
|
||||
|
||||
/**
|
||||
@@ -103,6 +107,7 @@ public interface Action extends Comparable<Action> {
|
||||
/**
|
||||
* Represents the target of an action.
|
||||
*/
|
||||
@NonExtendable
|
||||
interface Target {
|
||||
|
||||
/**
|
||||
@@ -127,7 +132,7 @@ public interface Action extends Comparable<Action> {
|
||||
@NonNull Type getType();
|
||||
|
||||
/**
|
||||
* Represents the type of a {@link Target}.
|
||||
* Represents the type of {@link Target}.
|
||||
*/
|
||||
enum Type {
|
||||
USER, GROUP, TRACK
|
||||
@@ -170,7 +175,7 @@ public interface Action extends Comparable<Action> {
|
||||
* @param type the type
|
||||
* @return the builder
|
||||
*/
|
||||
@NonNull Builder targetType(Action.Target.Type type);
|
||||
@NonNull Builder targetType(Target.@NonNull Type type);
|
||||
|
||||
/**
|
||||
* Sets the acted object for the entry.
|
||||
|
||||
@@ -25,7 +25,9 @@
|
||||
|
||||
package net.luckperms.api.actionlog;
|
||||
|
||||
import net.luckperms.api.actionlog.filter.ActionFilter;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
import java.util.SortedSet;
|
||||
import java.util.UUID;
|
||||
@@ -39,7 +41,11 @@ import java.util.UUID;
|
||||
* You can add to the log using the {@link ActionLogger}, and then request an updated copy.</p>
|
||||
*
|
||||
* <p>All methods are thread safe, and return immutable and thread safe collections.</p>
|
||||
*
|
||||
* @deprecated Use {@link ActionLogger#queryActions(ActionFilter)} or
|
||||
* {@link ActionLogger#queryActions(ActionFilter, int, int)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public interface ActionLog {
|
||||
|
||||
/**
|
||||
@@ -47,7 +53,7 @@ public interface ActionLog {
|
||||
*
|
||||
* @return the content
|
||||
*/
|
||||
@NonNull SortedSet<Action> getContent();
|
||||
@NonNull @Unmodifiable SortedSet<Action> getContent();
|
||||
|
||||
/**
|
||||
* Gets the entries in the log performed by the given actor.
|
||||
@@ -55,7 +61,7 @@ public interface ActionLog {
|
||||
* @param actor the uuid of the actor to filter by
|
||||
* @return the content for the given actor
|
||||
*/
|
||||
@NonNull SortedSet<Action> getContent(@NonNull UUID actor);
|
||||
@NonNull @Unmodifiable SortedSet<Action> getContent(@NonNull UUID actor);
|
||||
|
||||
/**
|
||||
* Gets the log content for a given user
|
||||
@@ -63,7 +69,7 @@ public interface ActionLog {
|
||||
* @param uniqueId the uuid to filter by
|
||||
* @return all content in this log where the user = uuid
|
||||
*/
|
||||
@NonNull SortedSet<Action> getUserHistory(@NonNull UUID uniqueId);
|
||||
@NonNull @Unmodifiable SortedSet<Action> getUserHistory(@NonNull UUID uniqueId);
|
||||
|
||||
/**
|
||||
* Gets the log content for a given group
|
||||
@@ -71,7 +77,7 @@ public interface ActionLog {
|
||||
* @param name the name to filter by
|
||||
* @return all content in this log where the group = name
|
||||
*/
|
||||
@NonNull SortedSet<Action> getGroupHistory(@NonNull String name);
|
||||
@NonNull @Unmodifiable SortedSet<Action> getGroupHistory(@NonNull String name);
|
||||
|
||||
/**
|
||||
* Gets the log content for a given track
|
||||
@@ -79,6 +85,6 @@ public interface ActionLog {
|
||||
* @param name the name to filter by
|
||||
* @return all content in this log where the track = name
|
||||
*/
|
||||
@NonNull SortedSet<Action> getTrackHistory(@NonNull String name);
|
||||
@NonNull @Unmodifiable SortedSet<Action> getTrackHistory(@NonNull String name);
|
||||
|
||||
}
|
||||
@@ -25,10 +25,11 @@
|
||||
|
||||
package net.luckperms.api.actionlog;
|
||||
|
||||
import net.luckperms.api.messaging.MessagingService;
|
||||
|
||||
import net.luckperms.api.actionlog.filter.ActionFilter;
|
||||
import net.luckperms.api.util.Page;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
@@ -47,43 +48,78 @@ public interface ActionLogger {
|
||||
* Gets a {@link ActionLog} instance from the plugin storage.
|
||||
*
|
||||
* @return a log instance
|
||||
* @deprecated Use {@link #queryActions(ActionFilter)} or {@link #queryActions(ActionFilter, int, int)} instead. These methods
|
||||
* are more efficient (they don't load the full action log into memory) and allow for pagination.
|
||||
*/
|
||||
@Deprecated
|
||||
@NonNull 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
|
||||
* it.</p>
|
||||
* <p>If the filter is {@code null}, all actions will be returned.</p>
|
||||
*
|
||||
* <p>It is therefore roughly equivalent to calling
|
||||
* {@link #submitToStorage(Action)} and {@link #broadcastAction(Action)},
|
||||
* however, using this method is preferred to making the calls individually.</p>
|
||||
* <p>Unlike {@link #queryActions(ActionFilter, int, int)}, this method does not implement any pagination and will return
|
||||
* all entries at once.</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
|
||||
*/
|
||||
@NonNull CompletableFuture<List<Action>> queryActions(@NonNull 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
|
||||
*/
|
||||
@NonNull CompletableFuture<Page<Action>> queryActions(@NonNull 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>
|
||||
*
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* 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
|
||||
* plugins {@link MessagingService}.</p>
|
||||
* <p>The broadcast is made to administrator players on the current instance
|
||||
* and to admins on other connected servers if a messaging service is configured.</p>
|
||||
*
|
||||
* <p>This method does not save the action to the plugin storage backend.</p>
|
||||
*
|
||||
* @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);
|
||||
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package net.luckperms.api.actionlog.filter;
|
||||
|
||||
import net.luckperms.api.LuckPermsProvider;
|
||||
import net.luckperms.api.actionlog.Action;
|
||||
import org.jetbrains.annotations.ApiStatus.NonExtendable;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
* A predicate filter which matches certain {@link Action}s.
|
||||
*
|
||||
* <p>API users should not implement this interface directly.</p>
|
||||
*
|
||||
* @since 5.5
|
||||
*/
|
||||
@NonExtendable
|
||||
public interface ActionFilter extends Predicate<Action> {
|
||||
|
||||
/**
|
||||
* Gets an {@link ActionFilter} which matches any action.
|
||||
*
|
||||
* @return the matcher
|
||||
*/
|
||||
static ActionFilter any() {
|
||||
return LuckPermsProvider.get().getActionFilterFactory().any();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an {@link ActionFilter} which matches actions with a specific source user.
|
||||
*
|
||||
* @param uniqueId the source user unique id
|
||||
* @return the matcher
|
||||
*/
|
||||
static ActionFilter source(UUID uniqueId) {
|
||||
return LuckPermsProvider.get().getActionFilterFactory().source(uniqueId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an {@link ActionFilter} which matches actions which target a specific user.
|
||||
*
|
||||
* @param uniqueId the target user unique id
|
||||
* @return the matcher
|
||||
*/
|
||||
static ActionFilter user(UUID uniqueId) {
|
||||
return LuckPermsProvider.get().getActionFilterFactory().user(uniqueId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an {@link ActionFilter} which matches actions which target a specific group.
|
||||
*
|
||||
* @param name the target group name
|
||||
* @return the matcher
|
||||
*/
|
||||
static ActionFilter group(String name) {
|
||||
return LuckPermsProvider.get().getActionFilterFactory().group(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an {@link ActionFilter} which matches actions which target a specific track.
|
||||
*
|
||||
* @param name the target track name
|
||||
* @return the matcher
|
||||
*/
|
||||
static ActionFilter track(String name) {
|
||||
return LuckPermsProvider.get().getActionFilterFactory().track(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an {@link ActionFilter} which matches actions which contain a specific search query in the source name,
|
||||
* target name or description.
|
||||
*
|
||||
* @param query the search query
|
||||
* @return the matcher
|
||||
*/
|
||||
static ActionFilter search(String query) {
|
||||
return LuckPermsProvider.get().getActionFilterFactory().search(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests to see if the given {@link Action} matches the filter.
|
||||
*
|
||||
* @param action the action to test
|
||||
* @return true if the action matched
|
||||
*/
|
||||
@Override
|
||||
boolean test(Action action);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package net.luckperms.api.actionlog.filter;
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus.Internal;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* A factory which creates {@link ActionFilter}s.
|
||||
*
|
||||
* @since 5.5
|
||||
*/
|
||||
@Internal
|
||||
public interface ActionFilterFactory {
|
||||
|
||||
/**
|
||||
* Gets an {@link ActionFilter} which matches any action.
|
||||
*
|
||||
* @return the matcher
|
||||
*/
|
||||
ActionFilter any();
|
||||
|
||||
/**
|
||||
* Gets an {@link ActionFilter} which matches actions with a specific source user.
|
||||
*
|
||||
* @param uniqueId the source user unique id
|
||||
* @return the matcher
|
||||
*/
|
||||
ActionFilter source(UUID uniqueId);
|
||||
|
||||
/**
|
||||
* Gets an {@link ActionFilter} which matches actions which target a specific user.
|
||||
*
|
||||
* @param uniqueId the target user unique id
|
||||
* @return the matcher
|
||||
*/
|
||||
ActionFilter user(UUID uniqueId);
|
||||
|
||||
/**
|
||||
* Gets an {@link ActionFilter} which matches actions which target a specific group.
|
||||
*
|
||||
* @param name the target group name
|
||||
* @return the matcher
|
||||
*/
|
||||
ActionFilter group(String name);
|
||||
|
||||
/**
|
||||
* Gets an {@link ActionFilter} which matches actions which target a specific track.
|
||||
*
|
||||
* @param name the target track name
|
||||
* @return the matcher
|
||||
*/
|
||||
ActionFilter track(String name);
|
||||
|
||||
/**
|
||||
* Gets an {@link ActionFilter} which matches actions which contain a specific search query in the source name,
|
||||
* target name or description.
|
||||
*
|
||||
* @param query the search query
|
||||
* @return the matcher
|
||||
*/
|
||||
ActionFilter search(String query);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* {@link net.luckperms.api.actionlog.Action} filters.
|
||||
*/
|
||||
package net.luckperms.api.actionlog.filter;
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* {@link net.luckperms.api.actionlog.ActionLog} related functionality.
|
||||
*/
|
||||
package net.luckperms.api.actionlog;
|
||||
@@ -26,11 +26,14 @@
|
||||
package net.luckperms.api.cacheddata;
|
||||
|
||||
import net.luckperms.api.query.QueryOptions;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Holds cached lookup data for a given set of query options.
|
||||
*
|
||||
* <p>All calls will account for inheritance, as well as any default data
|
||||
* provided by the platform. These calls are heavily cached and are therefore
|
||||
* fast.</p>
|
||||
*/
|
||||
public interface CachedData {
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ import net.luckperms.api.model.PermissionHolder;
|
||||
import net.luckperms.api.model.group.Group;
|
||||
import net.luckperms.api.model.user.User;
|
||||
import net.luckperms.api.query.QueryOptions;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -39,7 +38,7 @@ import java.util.concurrent.CompletableFuture;
|
||||
* Holds cached permission and meta lookup data for a {@link PermissionHolder}.
|
||||
*
|
||||
* <p>All calls will account for inheritance, as well as any default data
|
||||
* provided by the platform. This calls are heavily cached and are therefore
|
||||
* provided by the platform. These calls are heavily cached and are therefore
|
||||
* fast.</p>
|
||||
*/
|
||||
public interface CachedDataManager {
|
||||
@@ -81,11 +80,10 @@ public interface CachedDataManager {
|
||||
* <p>For {@link User}s, the most appropriate query options will be their
|
||||
* {@link ContextManager#getQueryOptions(User) current active query options} if the
|
||||
* corresponding player is online, and otherwise, will fallback to
|
||||
* {@link ContextManager#getStaticQueryOptions() the current static query options}
|
||||
* if they are offline.</p>
|
||||
* {@link ContextManager#getStaticQueryOptions() the current static query options}.</p>
|
||||
*
|
||||
* <p>For {@link Group}s, the most appropriate query options will always be
|
||||
* {@link ContextManager#getStaticQueryOptions()} the current static query options.</p>
|
||||
* {@link ContextManager#getStaticQueryOptions() the current static query options}.</p>
|
||||
*
|
||||
* @return a permission data instance
|
||||
* @since 5.1
|
||||
@@ -99,11 +97,10 @@ public interface CachedDataManager {
|
||||
* <p>For {@link User}s, the most appropriate query options will be their
|
||||
* {@link ContextManager#getQueryOptions(User) current active query options} if the
|
||||
* corresponding player is online, and otherwise, will fallback to
|
||||
* {@link ContextManager#getStaticQueryOptions() the current static query options}
|
||||
* if they are offline.</p>
|
||||
* {@link ContextManager#getStaticQueryOptions() the current static query options}.</p>
|
||||
*
|
||||
* <p>For {@link Group}s, the most appropriate query options will always be
|
||||
* {@link ContextManager#getStaticQueryOptions()} the current static query options.</p>
|
||||
* {@link ContextManager#getStaticQueryOptions() the current static query options}.</p>
|
||||
*
|
||||
* @return a meta data instance
|
||||
* @since 5.1
|
||||
@@ -118,7 +115,7 @@ public interface CachedDataManager {
|
||||
void invalidate();
|
||||
|
||||
/**
|
||||
* Invalidates all of the underlying Permission calculators.
|
||||
* Invalidates all underlying permission calculators.
|
||||
*
|
||||
* <p>Can be called to allow for an update in defaults.</p>
|
||||
*/
|
||||
|
||||
@@ -26,63 +26,207 @@
|
||||
package net.luckperms.api.cacheddata;
|
||||
|
||||
import net.luckperms.api.metastacking.MetaStackDefinition;
|
||||
|
||||
import net.luckperms.api.node.types.MetaNode;
|
||||
import net.luckperms.api.node.types.PrefixNode;
|
||||
import net.luckperms.api.node.types.SuffixNode;
|
||||
import net.luckperms.api.node.types.WeightNode;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.SortedMap;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* Holds cached meta lookup data for a specific set of contexts.
|
||||
*
|
||||
* <p>Meta data refers to {@link PrefixNode prefixes}, {@link SuffixNode suffixes} and
|
||||
* {@link MetaNode meta (options)} held by a permission holder.</p>
|
||||
*
|
||||
* <p>All calls will account for inheritance, as well as any default data
|
||||
* provided by the platform. These calls are heavily cached and are therefore
|
||||
* fast.</p>
|
||||
*/
|
||||
public interface CachedMetaData extends CachedData {
|
||||
|
||||
/**
|
||||
* Query a meta value for the given {@code key}.
|
||||
*
|
||||
* <p>This method will always return a {@link Result}, but the
|
||||
* {@link Result#result() inner result} {@link String} will be null if a value
|
||||
* for the given key was not found.</p>
|
||||
*
|
||||
* @param key the key
|
||||
* @return a result containing the value
|
||||
* @since 5.4
|
||||
*/
|
||||
@NonNull Result<String, MetaNode> queryMetaValue(@NonNull String key);
|
||||
|
||||
/**
|
||||
* Gets a value for the given meta key.
|
||||
*
|
||||
* <p>If no such meta value exists for the given key, {@code null} is returned.</p>
|
||||
*
|
||||
* @param key the key
|
||||
* @return the value
|
||||
*/
|
||||
@Nullable String getMetaValue(String key);
|
||||
default @Nullable String getMetaValue(@NonNull String key) {
|
||||
return queryMetaValue(key).result();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the holder's highest priority prefix, or null if the holder has no prefixes
|
||||
* Gets a value for the given meta key, and runs it through the given {@code transformer}.
|
||||
*
|
||||
* <p>If no such meta value exists, an {@link Optional#empty() empty optional} is returned.
|
||||
* (the transformer will never be passed a null argument)</p>
|
||||
*
|
||||
* <p>The transformer is allowed to throw {@link IllegalArgumentException} or return null. This
|
||||
* will also result in an {@link Optional#empty() empty optional} being returned.</p>
|
||||
*
|
||||
* <p>For example, to parse and return an integer meta value, use:</p>
|
||||
* <p><blockquote><pre>
|
||||
* getMetaValue("my-int-val", Integer::parseInt).orElse(0);
|
||||
* </pre></blockquote>
|
||||
*
|
||||
* @param key the key
|
||||
* @param valueTransformer the transformer used to transform the value
|
||||
* @param <T> the type of the transformed result
|
||||
* @return the meta value
|
||||
* @since 5.3
|
||||
*/
|
||||
default <T> @NonNull Optional<T> getMetaValue(@NonNull String key, @NonNull Function<String, ? extends T> valueTransformer) {
|
||||
return Optional.ofNullable(getMetaValue(key)).map(value -> {
|
||||
try {
|
||||
return valueTransformer.apply(value);
|
||||
} catch (IllegalArgumentException e) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Query for a prefix.
|
||||
*
|
||||
* <p>This method uses the rules defined by the {@link #getPrefixStackDefinition() prefix stack}
|
||||
* to produce a {@link String} output.</p>
|
||||
*
|
||||
* <p>Assuming the default configuration is used, this will usually be the value of the
|
||||
* holder's highest priority prefix node.</p>
|
||||
*
|
||||
* <p>This method will always return a {@link Result}, but the
|
||||
* {@link Result#result() inner result} {@link String} will be null if
|
||||
* a the resultant prefix stack contained no elements.</p>
|
||||
*
|
||||
* @return a result containing the prefix
|
||||
* @since 5.4
|
||||
*/
|
||||
@NonNull Result<String, PrefixNode> queryPrefix();
|
||||
|
||||
/**
|
||||
* Gets the prefix.
|
||||
*
|
||||
* <p>This method uses the rules defined by the {@link #getPrefixStackDefinition() prefix stack}
|
||||
* to produce a {@link String} output.</p>
|
||||
*
|
||||
* <p>Assuming the default configuration is used, this will usually be the value of the
|
||||
* holder's highest priority prefix node.</p>
|
||||
*
|
||||
* <p>If the resultant prefix stack contained no elements, {@code null} is returned.</p>
|
||||
*
|
||||
* @return a prefix string, or null
|
||||
*/
|
||||
@Nullable String getPrefix();
|
||||
default @Nullable String getPrefix() {
|
||||
return queryPrefix().result();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the holder's highest priority suffix, or null if the holder has no suffixes
|
||||
* Query for a suffix.
|
||||
*
|
||||
* <p>This method uses the rules defined by the {@link #getSuffixStackDefinition() suffix stack}
|
||||
* to produce a {@link String} output.</p>
|
||||
*
|
||||
* <p>Assuming the default configuration is used, this will usually be the value of the
|
||||
* holder's highest priority suffix node.</p>
|
||||
*
|
||||
* <p>This method will always return a {@link Result}, but the
|
||||
* {@link Result#result() inner result} {@link String} will be null if
|
||||
* a the resultant suffix stack contained no elements.</p>
|
||||
*
|
||||
* @return a result containing the suffix
|
||||
* @since 5.4
|
||||
*/
|
||||
@NonNull Result<String, SuffixNode> querySuffix();
|
||||
|
||||
/**
|
||||
* Gets the suffix.
|
||||
*
|
||||
* <p>This method uses the rules defined by the {@link #getSuffixStackDefinition() suffix stack}
|
||||
* to produce a {@link String} output.</p>
|
||||
*
|
||||
* <p>Assuming the default configuration is used, this will usually be the value of the
|
||||
* holder's highest priority suffix node.</p>
|
||||
*
|
||||
* <p>If the resultant suffix stack contained no elements, {@code null} is returned.</p>
|
||||
*
|
||||
* @return a suffix string, or null
|
||||
*/
|
||||
@Nullable String getSuffix();
|
||||
default @Nullable String getSuffix() {
|
||||
return querySuffix().result();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an immutable copy of the meta this holder has.
|
||||
* Query for a weight.
|
||||
*
|
||||
* @return an immutable map of meta
|
||||
* <p>This method will always return a {@link Result}, and the
|
||||
* {@link Result#result() inner result} {@link Integer} will never be null.
|
||||
* A value of {@code 0} is equivalent to null.</p>
|
||||
*
|
||||
* @return a result containing the weight
|
||||
* @since 5.5
|
||||
*/
|
||||
@NonNull Map<String, List<String>> getMeta();
|
||||
@NonNull Result<Integer, WeightNode> queryWeight();
|
||||
|
||||
/**
|
||||
* Gets an immutable sorted map of all of the prefixes the holder has, whereby the first
|
||||
* value is the highest priority prefix.
|
||||
* Gets the weight.
|
||||
*
|
||||
* <p>If the there is no defined weight, {@code 0} is returned.</p>
|
||||
*
|
||||
* @return the weight
|
||||
* @since 5.5
|
||||
*/
|
||||
default int getWeight() {
|
||||
return queryWeight().result();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a map of all accumulated {@link MetaNode meta}.
|
||||
*
|
||||
* <p>Prefer using the {@link #getMetaValue(String)} method for querying values.</p>
|
||||
*
|
||||
* @return a map of meta
|
||||
*/
|
||||
@NonNull @Unmodifiable Map<String, List<String>> getMeta();
|
||||
|
||||
/**
|
||||
* Gets a sorted map of all accumulated {@link PrefixNode prefixes}.
|
||||
*
|
||||
* <p>Prefer using the {@link #getPrefix()} method for querying.</p>
|
||||
*
|
||||
* @return a sorted map of prefixes
|
||||
*/
|
||||
@NonNull SortedMap<Integer, String> getPrefixes();
|
||||
@NonNull @Unmodifiable SortedMap<Integer, String> getPrefixes();
|
||||
|
||||
/**
|
||||
* Gets an immutable sorted map of all of the suffixes the holder has, whereby the first
|
||||
* value is the highest priority suffix.
|
||||
* Gets a sorted map of all accumulated {@link SuffixNode suffixes}.
|
||||
*
|
||||
* <p>Prefer using the {@link #getSuffix()} method for querying.</p>
|
||||
*
|
||||
* @return a sorted map of suffixes
|
||||
*/
|
||||
@NonNull SortedMap<Integer, String> getSuffixes();
|
||||
@NonNull @Unmodifiable SortedMap<Integer, String> getSuffixes();
|
||||
|
||||
/**
|
||||
* Gets the name of the holders primary group.
|
||||
@@ -95,14 +239,14 @@ public interface CachedMetaData extends CachedData {
|
||||
@Nullable String getPrimaryGroup();
|
||||
|
||||
/**
|
||||
* Gets the definition used for the prefix stack
|
||||
* Gets the definition used for the prefix stack.
|
||||
*
|
||||
* @return the definition used for the prefix stack
|
||||
*/
|
||||
@NonNull 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
|
||||
*/
|
||||
|
||||
@@ -25,25 +25,48 @@
|
||||
|
||||
package net.luckperms.api.cacheddata;
|
||||
|
||||
import net.luckperms.api.node.Node;
|
||||
import net.luckperms.api.util.Tristate;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Holds cached permission lookup data for a specific set of contexts.
|
||||
*
|
||||
* <p>All calls will account for inheritance, as well as any default data
|
||||
* provided by the platform. These calls are heavily cached and are therefore
|
||||
* fast.</p>
|
||||
*/
|
||||
public interface CachedPermissionData extends CachedData {
|
||||
|
||||
/**
|
||||
* Gets a permission check result for the given permission node.
|
||||
* Performs a permission check for the given {@code permission} node.
|
||||
*
|
||||
* <p>This check is equivalent to the "hasPermission" method call on most platforms.
|
||||
* You can use {@link Tristate#asBoolean()} if you need a truthy result.</p>
|
||||
*
|
||||
* @param permission the permission node
|
||||
* @return a result containing the tristate
|
||||
* @throws NullPointerException if permission is null
|
||||
* @since 5.4
|
||||
*/
|
||||
@NonNull Result<Tristate, Node> queryPermission(@NonNull String permission);
|
||||
|
||||
/**
|
||||
* Performs a permission check for the given {@code permission} node.
|
||||
*
|
||||
* <p>This check is equivalent to the "hasPermission" method call on most platforms.
|
||||
* You can use {@link Tristate#asBoolean()} if you need a truthy result.</p>
|
||||
*
|
||||
* @param permission the permission node
|
||||
* @return a tristate result
|
||||
* @throws NullPointerException if permission is null
|
||||
*/
|
||||
@NonNull Tristate checkPermission(@NonNull String permission);
|
||||
default @NonNull Tristate checkPermission(@NonNull String permission) {
|
||||
return queryPermission(permission).result();
|
||||
}
|
||||
|
||||
/**
|
||||
* Invalidates the underlying permission calculator cache.
|
||||
@@ -57,6 +80,6 @@ public interface CachedPermissionData extends CachedData {
|
||||
*
|
||||
* @return an immutable set of permissions
|
||||
*/
|
||||
@NonNull Map<String, Boolean> getPermissionMap();
|
||||
@NonNull @Unmodifiable Map<String, Boolean> getPermissionMap();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package net.luckperms.api.cacheddata;
|
||||
|
||||
import net.luckperms.api.node.Node;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
/**
|
||||
* Represents the result of a cached data lookup.
|
||||
*
|
||||
* <p>You can find "the holder that has the node that caused this result"
|
||||
* using the following code:</p>
|
||||
* <p></p>
|
||||
* <blockquote>
|
||||
* <pre>
|
||||
* public static {@link net.luckperms.api.model.PermissionHolder.Identifier} holderThatHasTheNodeThatCausedTheResult(Result<?, ?> result) {
|
||||
* {@link Node} node = result.node();
|
||||
* if (node == null) {
|
||||
* return null;
|
||||
* }
|
||||
* {@link net.luckperms.api.node.metadata.types.InheritanceOriginMetadata} origin = node.getMetadata(InheritanceOriginMetadata.KEY).orElse(null);
|
||||
* if (origin == null) {
|
||||
* return null;
|
||||
* }
|
||||
* return origin.getOrigin();
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* <p>Combined with the node itself, this is all the information needed to determine
|
||||
* the root cause of the result.</p>
|
||||
* </blockquote>
|
||||
*
|
||||
* <p>The nullability of {@link #result()} is purposely undefined to allow the
|
||||
* flexibility for methods using {@link Result} to declare it. In general, if the {@code T} type
|
||||
* has a nullable/undefined value, then the return of {@link #result()} will be non-null,
|
||||
* and if not, it will be nullable.</p>
|
||||
*
|
||||
* @param <T> the result type
|
||||
* @param <N> the node type
|
||||
* @since 5.4
|
||||
*/
|
||||
public interface Result<T, N extends Node> {
|
||||
|
||||
/**
|
||||
* Gets the underlying result.
|
||||
*
|
||||
* @return the underlying result
|
||||
*/
|
||||
T result();
|
||||
|
||||
/**
|
||||
* Gets the node that caused the result.
|
||||
*
|
||||
* @return the causing node
|
||||
*/
|
||||
@Nullable N node();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Caches permission checks and meta lookups for {@link net.luckperms.api.model.user.User}s and
|
||||
* {@link net.luckperms.api.model.group.Group}s.
|
||||
*/
|
||||
package net.luckperms.api.cacheddata;
|
||||
@@ -34,6 +34,8 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
* <p>Context keys and values may not be null or empty. A key/value will be
|
||||
* deemed empty if it's length is zero, or if it consists of only space
|
||||
* characters.</p>
|
||||
*
|
||||
* @see ContextSet
|
||||
*/
|
||||
public interface Context {
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ public interface ContextCalculator<T> {
|
||||
*
|
||||
* @return a set of potential contexts
|
||||
*/
|
||||
default ContextSet estimatePotentialContexts() {
|
||||
default @NonNull ContextSet estimatePotentialContexts() {
|
||||
return ImmutableContextSet.empty();
|
||||
}
|
||||
|
||||
|
||||
@@ -28,8 +28,8 @@ package net.luckperms.api.context;
|
||||
import net.luckperms.api.model.user.User;
|
||||
import net.luckperms.api.query.QueryMode;
|
||||
import net.luckperms.api.query.QueryOptions;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus.Internal;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -48,6 +48,7 @@ import java.util.Optional;
|
||||
* <li>{@code org.bukkit.entity.Player}</li>
|
||||
* <li>{@code net.md_5.bungee.api.connection.ProxiedPlayer}</li>
|
||||
* <li>{@code org.spongepowered.api.service.permission.Subject}</li>
|
||||
* <li>{@code net.minecraft.server.network.ServerPlayerEntity} (Fabric)</li>
|
||||
* <li>{@code cn.nukkit.Player}</li>
|
||||
* <li>{@code com.velocitypowered.api.proxy.Player}</li>
|
||||
* </ul>
|
||||
@@ -138,19 +139,36 @@ public interface ContextManager {
|
||||
*/
|
||||
void unregisterCalculator(@NonNull ContextCalculator<?> calculator);
|
||||
|
||||
/**
|
||||
* Signal to the {@link ContextManager} that a {@code subject}s
|
||||
* current contexts have changed.
|
||||
*
|
||||
* <p>It is not strictly necessary to make a call to this method every time a context
|
||||
* changes.</p>
|
||||
*
|
||||
* @param subject the subject
|
||||
* @since 5.2
|
||||
*/
|
||||
void signalContextUpdate(@NonNull Object subject);
|
||||
|
||||
/**
|
||||
* Gets the {@link ContextSetFactory}, responsible for creating
|
||||
* {@link ContextSet} instances.
|
||||
*
|
||||
* @return the context set factory
|
||||
*/
|
||||
@Internal
|
||||
@NonNull ContextSetFactory getContextSetFactory();
|
||||
|
||||
/**
|
||||
* Invalidates the lookup cache for a given subject
|
||||
*
|
||||
* @param subject the subject
|
||||
* @deprecated Use {@link #signalContextUpdate(Object)} instead
|
||||
*/
|
||||
void invalidateCache(@NonNull Object subject);
|
||||
@Deprecated
|
||||
default void invalidateCache(@NonNull Object subject) {
|
||||
signalContextUpdate(subject);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package net.luckperms.api.context;
|
||||
|
||||
import net.luckperms.api.query.OptionKey;
|
||||
|
||||
/**
|
||||
* Mode for determining whether a {@link ContextSet} satisfies another.
|
||||
*
|
||||
* @since 5.2
|
||||
* @see ContextSet#isSatisfiedBy(ContextSet, ContextSatisfyMode)
|
||||
*/
|
||||
public enum ContextSatisfyMode {
|
||||
|
||||
/**
|
||||
* Mode where a {@link ContextSet} A will be satisfied by another set B, if at least one of the
|
||||
* key-value entries per key in A are also in B.
|
||||
*
|
||||
* <p>For example, given <code>A = {server=survival, world=overworld, world=nether}</code>,
|
||||
* another set {@code X} will satisfy {@code A} if {@code X} contains
|
||||
* <code>server=survival AND (world=overworld OR world=nether)</code>.</p>
|
||||
*/
|
||||
AT_LEAST_ONE_VALUE_PER_KEY,
|
||||
|
||||
/**
|
||||
* Mode where a {@link ContextSet} A will be satisfied by another set B, if all key-value
|
||||
* entries in A are also in B.
|
||||
*
|
||||
* <p>For example, given <code>A = {server=survival, world=overworld, world=nether}</code>,
|
||||
* another set {@code X} will satisfy {@code A} if {@code X} contains
|
||||
* <code>server=survival AND world=overworld AND world=nether</code>.</p>
|
||||
*/
|
||||
ALL_VALUES_PER_KEY;
|
||||
|
||||
/**
|
||||
* The {@link OptionKey} for {@link ContextSatisfyMode}.
|
||||
*/
|
||||
public static final OptionKey<ContextSatisfyMode> KEY = OptionKey.of("contextsatisfymode", ContextSatisfyMode.class);
|
||||
|
||||
}
|
||||
@@ -26,6 +26,7 @@
|
||||
package net.luckperms.api.context;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
@@ -40,19 +41,33 @@ import java.util.Set;
|
||||
* something will apply.</p>
|
||||
*
|
||||
* <p>A single "context" consists of a key and a value, both strings. The key
|
||||
* represents the type of context, and the value represents the setting of the
|
||||
* context key.</p>
|
||||
* describes the type of the context, and the value represents what the key is
|
||||
* set to.</p>
|
||||
*
|
||||
* <p>For example, a context with {@code key=world} and {@code value=world_nether}
|
||||
* describes that a subject is in the "world_nether" world.</p>
|
||||
*
|
||||
* <p>Contexts are exposed to end users and manipulated when managing permissions.
|
||||
* For this reason, context keys should strike a balance between being descriptive
|
||||
* and succinct.</p>
|
||||
*
|
||||
* <p>Context keys and values are case-insensitive, and will be automatically
|
||||
* converted to {@link String#toLowerCase() lowercase} when added to a
|
||||
* context set. Keys and values cannot be null or empty (len=0 or consisting of
|
||||
* only whitespace).</p>
|
||||
*
|
||||
* <p>If a context key is formed of more than one word, the parts should be
|
||||
* separated by the '{@code -}' character. (e.g. "{@code server-type}")</p>
|
||||
*
|
||||
* <p>If a context key is likely to conflict with another plugin, it should be
|
||||
* appropriately namespaced using the name of the plugin providing the context.
|
||||
* The namespace should be at the start of the context key, and separated using
|
||||
* the '{@code :}' character. (e.g. "{@code worldguard:region}" for WorldGuard
|
||||
* regions)</p>
|
||||
*
|
||||
* <p>Contexts can be combined with each other to form so called
|
||||
* "context sets" - simply a collection of context pairs.</p>
|
||||
*
|
||||
* <p>Context keys and values are case-insensitive, and will be converted to
|
||||
* {@link String#toLowerCase() lowercase} by all implementations.</p>
|
||||
*
|
||||
* <p>Context keys and values may not be null or empty. A key/value will be
|
||||
* deemed empty if it's length is zero, or if it consists of only space
|
||||
* characters.</p>
|
||||
*
|
||||
* <p>Two default ContextSet implementations are provided.
|
||||
* {@link MutableContextSet} allows the addition and removal of context keys
|
||||
* after construction, and {@link ImmutableContextSet} does not.</p>
|
||||
@@ -97,7 +112,7 @@ public interface ContextSet extends Iterable<Context> {
|
||||
*
|
||||
* @return an immutable set
|
||||
*/
|
||||
@NonNull Set<Context> toSet();
|
||||
@NonNull @Unmodifiable Set<Context> toSet();
|
||||
|
||||
/**
|
||||
* Returns a {@link Map} representing the current state of this
|
||||
@@ -108,7 +123,7 @@ public interface ContextSet extends Iterable<Context> {
|
||||
*
|
||||
* @return a map
|
||||
*/
|
||||
@NonNull Map<String, Set<String>> toMap();
|
||||
@NonNull @Unmodifiable Map<String, Set<String>> toMap();
|
||||
|
||||
/**
|
||||
* Returns a {@link Map} <b>loosely</b> representing the current state of
|
||||
@@ -121,10 +136,10 @@ public interface ContextSet extends Iterable<Context> {
|
||||
* may not be a true representation of the set.</p>
|
||||
*
|
||||
* @return an immutable map
|
||||
* @deprecated because the resultant map may not contain all data in the ContextSet
|
||||
* @deprecated Deprecated because the returned map may not contain all data in the ContextSet
|
||||
*/
|
||||
@Deprecated
|
||||
@NonNull Map<String, String> toFlattenedMap();
|
||||
@NonNull @Unmodifiable Map<String, String> toFlattenedMap();
|
||||
|
||||
/**
|
||||
* Returns an {@link Iterator} over each of the context pairs in this set.
|
||||
@@ -137,7 +152,7 @@ public interface ContextSet extends Iterable<Context> {
|
||||
* @return an iterator
|
||||
*/
|
||||
@Override
|
||||
@NonNull Iterator<Context> iterator();
|
||||
@NonNull @Unmodifiable Iterator<Context> iterator();
|
||||
|
||||
/**
|
||||
* Returns if the {@link ContextSet} contains at least one value for the
|
||||
@@ -159,7 +174,7 @@ public interface ContextSet extends Iterable<Context> {
|
||||
* @return a set of values
|
||||
* @throws NullPointerException if the key is null
|
||||
*/
|
||||
@NonNull Set<String> getValues(@NonNull String key);
|
||||
@NonNull @Unmodifiable Set<String> getValues(@NonNull String key);
|
||||
|
||||
/**
|
||||
* Returns any value from this {@link ContextSet} matching the key, if present.
|
||||
@@ -197,17 +212,47 @@ public interface ContextSet extends Iterable<Context> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this {@link ContextSet} is fully "satisfied" by another set.
|
||||
* Returns if the {@link ContextSet} contains any of the given context pairings.
|
||||
*
|
||||
* <p>For a context set to "satisfy" another, it must itself contain all of
|
||||
* the context pairings in the other set.</p>
|
||||
*
|
||||
* <p>Mathematically, this method returns true if this set is a <b>subset</b> of the other.</p>
|
||||
*
|
||||
* @param other the other set to check
|
||||
* @return true if all entries in this set are also in the other set
|
||||
* @param key the key to look for
|
||||
* @param values the values to look for
|
||||
* @return true if the set contains any of the pairs
|
||||
* @since 5.2
|
||||
*/
|
||||
boolean isSatisfiedBy(@NonNull ContextSet other);
|
||||
default boolean containsAny(@NonNull String key, @NonNull Iterable<String> values) {
|
||||
Objects.requireNonNull(key, "key");
|
||||
Objects.requireNonNull(values, "values");
|
||||
|
||||
for (String value : values) {
|
||||
if (contains(key, value)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this {@link ContextSet} is "satisfied" by another set.
|
||||
*
|
||||
* <p>{@link ContextSatisfyMode#AT_LEAST_ONE_VALUE_PER_KEY} is the mode used by this method.</p>
|
||||
*
|
||||
* @param other the other set
|
||||
* @return true if this context set is satisfied by the other
|
||||
*/
|
||||
default boolean isSatisfiedBy(@NonNull ContextSet other) {
|
||||
return isSatisfiedBy(other, ContextSatisfyMode.AT_LEAST_ONE_VALUE_PER_KEY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if this {@link ContextSet} is "satisfied" by another set, according to the given
|
||||
* {@code mode}.
|
||||
*
|
||||
* @param other the other set
|
||||
* @param mode the mode to use
|
||||
* @return true if this context set is satisfied by the other
|
||||
* @since 5.2
|
||||
*/
|
||||
boolean isSatisfiedBy(@NonNull ContextSet other, @NonNull ContextSatisfyMode mode);
|
||||
|
||||
/**
|
||||
* Returns if the {@link ContextSet} is empty.
|
||||
|
||||
@@ -26,18 +26,49 @@
|
||||
package net.luckperms.api.context;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus.Internal;
|
||||
|
||||
/**
|
||||
* A factory for creating {@link ContextSet}s.
|
||||
*
|
||||
* <p>Prefer using the static methods on {@link ImmutableContextSet} or {@link MutableContextSet}
|
||||
* instead of this interface.</p>
|
||||
*/
|
||||
@Internal
|
||||
public interface ContextSetFactory {
|
||||
|
||||
/**
|
||||
* Prefer using {@link ImmutableContextSet#builder()}.
|
||||
*
|
||||
* @return a immutable context set builder
|
||||
* @see ImmutableContextSet#builder()
|
||||
*/
|
||||
ImmutableContextSet.@NonNull Builder immutableBuilder();
|
||||
|
||||
/**
|
||||
* Prefer using {@link ImmutableContextSet#of(String, String)}.
|
||||
*
|
||||
* @param key the key
|
||||
* @param value the value
|
||||
* @return an immutable context set
|
||||
* @see ImmutableContextSet#of(String, String)
|
||||
*/
|
||||
@NonNull ImmutableContextSet immutableOf(@NonNull String key, @NonNull String value);
|
||||
|
||||
/**
|
||||
* Prefer using {@link ImmutableContextSet#empty()}.
|
||||
*
|
||||
* @return an empty immutable context set
|
||||
* @see ImmutableContextSet#empty()
|
||||
*/
|
||||
@NonNull ImmutableContextSet immutableEmpty();
|
||||
|
||||
/**
|
||||
* Prefer using {@link MutableContextSet#create()}.
|
||||
*
|
||||
* @return a new mutable context set
|
||||
* @see MutableContextSet#create()
|
||||
*/
|
||||
@NonNull MutableContextSet mutable();
|
||||
|
||||
}
|
||||
@@ -34,13 +34,31 @@ public final class DefaultContextKeys {
|
||||
}
|
||||
|
||||
/**
|
||||
* The context key used to denote the subjects server.
|
||||
* The context key used to denote the name of the subjects server.
|
||||
*/
|
||||
public static final String SERVER_KEY = "server";
|
||||
|
||||
/**
|
||||
* The context key used to denote the subjects world.
|
||||
* The context key used to denote the name of the subjects world.
|
||||
*/
|
||||
public static final String WORLD_KEY = "world";
|
||||
|
||||
/**
|
||||
* The context key used to denote the dimension type of the subjects world.
|
||||
*
|
||||
* <p>Possible values: overworld, the_nether, the_end</p>
|
||||
*
|
||||
* @since 5.3
|
||||
*/
|
||||
public static final String DIMENSION_TYPE_KEY = "dimension-type";
|
||||
|
||||
/**
|
||||
* The context key used to denote the subjects gamemode.
|
||||
*
|
||||
* <p>Possible values: survival, creative, adventure, spectator</p>
|
||||
*
|
||||
* @since 5.3
|
||||
*/
|
||||
public static final String GAMEMODE_KEY = "gamemode";
|
||||
|
||||
}
|
||||
@@ -26,7 +26,6 @@
|
||||
package net.luckperms.api.context;
|
||||
|
||||
import net.luckperms.api.LuckPermsProvider;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Objects;
|
||||
@@ -67,7 +66,7 @@ public interface ImmutableContextSet extends ContextSet {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Already immutable!
|
||||
* @deprecated This context set is already immutable!
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
@@ -119,7 +118,7 @@ public interface ImmutableContextSet extends ContextSet {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds of of the contexts in another {@link ContextSet} to the set.
|
||||
* Adds all the contexts in another {@link ContextSet} to the set.
|
||||
*
|
||||
* @param contextSet the set to add from
|
||||
* @return the builder
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
package net.luckperms.api.context;
|
||||
|
||||
import net.luckperms.api.LuckPermsProvider;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Objects;
|
||||
@@ -94,7 +93,7 @@ public interface MutableContextSet extends ContextSet {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds of of the contexts in another {@link ContextSet} to this set.
|
||||
* Adds all the contexts in another {@link ContextSet} to this set.
|
||||
*
|
||||
* @param contextSet the set to add from
|
||||
* @throws NullPointerException if the contextSet is null
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Context functionality, including {@link net.luckperms.api.context.ContextSet}s and
|
||||
* {@link net.luckperms.api.context.ContextCalculator}s.
|
||||
*/
|
||||
package net.luckperms.api.context;
|
||||
@@ -26,6 +26,7 @@
|
||||
package net.luckperms.api.event;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
@@ -49,7 +50,7 @@ public interface EventBus {
|
||||
* @param <T> the event class
|
||||
* @return an event handler instance representing this subscription
|
||||
*/
|
||||
@NonNull <T extends LuckPermsEvent> EventSubscription<T> subscribe(@NonNull Class<T> eventClass, @NonNull Consumer<? super T> handler);
|
||||
<T extends LuckPermsEvent> @NonNull EventSubscription<T> subscribe(@NonNull Class<T> eventClass, @NonNull Consumer<? super T> handler);
|
||||
|
||||
/**
|
||||
* Registers a new subscription to the given event.
|
||||
@@ -69,7 +70,7 @@ public interface EventBus {
|
||||
* @param handler the event handler
|
||||
* @return an event handler instance representing this subscription
|
||||
*/
|
||||
@NonNull <T extends LuckPermsEvent> EventSubscription<T> subscribe(Object plugin, @NonNull Class<T> eventClass, @NonNull Consumer<? super T> handler);
|
||||
<T extends LuckPermsEvent> @NonNull EventSubscription<T> subscribe(Object plugin, @NonNull Class<T> eventClass, @NonNull Consumer<? super T> handler);
|
||||
|
||||
/**
|
||||
* Gets a set of all registered handlers for a given event.
|
||||
@@ -78,6 +79,6 @@ public interface EventBus {
|
||||
* @param <T> the event class
|
||||
* @return an immutable set of event handlers
|
||||
*/
|
||||
@NonNull <T extends LuckPermsEvent> Set<EventSubscription<T>> getSubscriptions(@NonNull Class<T> eventClass);
|
||||
<T extends LuckPermsEvent> @NonNull @Unmodifiable Set<EventSubscription<T>> getSubscriptions(@NonNull Class<T> eventClass);
|
||||
|
||||
}
|
||||
@@ -26,7 +26,6 @@
|
||||
package net.luckperms.api.event;
|
||||
|
||||
import net.luckperms.api.LuckPerms;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,6 +35,12 @@ public enum DeletionCause {
|
||||
*/
|
||||
COMMAND,
|
||||
|
||||
/**
|
||||
* The deletion was caused by the web editor
|
||||
* @since 5.3
|
||||
*/
|
||||
WEB_EDITOR,
|
||||
|
||||
/**
|
||||
* The deletion was caused by an API call
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Event causes.
|
||||
*/
|
||||
package net.luckperms.api.event.cause;
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package net.luckperms.api.event.context;
|
||||
|
||||
import net.luckperms.api.context.ContextManager;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Called when a subject's current/active contexts are updated.
|
||||
*
|
||||
* <p>There are no guarantees that this event will be called for every update. It is merely to be
|
||||
* used as a "hint" for plugins which depend on the current active contexts for a player.</p>
|
||||
*
|
||||
* <p>It will always be fired following a call to
|
||||
* {@link ContextManager#signalContextUpdate(Object)}.</p>
|
||||
*
|
||||
* <p>The {@link #getSubject() subject} is always an instance of the platform's subject type. See
|
||||
* {@link ContextManager} for details.</p>
|
||||
*
|
||||
* <p>Unlike most other LuckPerms events, this event is not fired asynchronously. Care should be
|
||||
* taken to ensure listeners are lightweight. Additionally, listeners should ensure they do not
|
||||
* cause further updates to player context, thus possibly causing a stack overflow.</p>
|
||||
*
|
||||
* @since 5.2
|
||||
*/
|
||||
public interface ContextUpdateEvent extends LuckPermsEvent {
|
||||
|
||||
/**
|
||||
* Gets the subject whose contexts were updated.
|
||||
*
|
||||
* @return the subject
|
||||
*/
|
||||
@Param(0)
|
||||
@NonNull Object getSubject();
|
||||
|
||||
/**
|
||||
* Gets the subject whose contexts were updated, casted to a given type.
|
||||
*
|
||||
* @param subjectClass the type to cast to
|
||||
* @param <T> the subject type
|
||||
* @return the casted subject
|
||||
*/
|
||||
default <T> @NonNull Optional<T> getSubject(@NonNull Class<T> subjectClass) {
|
||||
Object subject = getSubject();
|
||||
return subjectClass.isInstance(subject) ? Optional.of(subjectClass.cast(subject)) : Optional.empty();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Events relating to {@link net.luckperms.api.context.Context}s.
|
||||
*/
|
||||
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.util.Param;
|
||||
import net.luckperms.api.extension.Extension;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Events relating to {@link net.luckperms.api.extension.Extension}s.
|
||||
*/
|
||||
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.util.Param;
|
||||
import net.luckperms.api.model.group.Group;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,7 +29,6 @@ import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.cause.CreationCause;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.model.group.Group;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,7 +29,6 @@ import net.luckperms.api.cacheddata.CachedDataManager;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.model.group.Group;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,7 +29,6 @@ import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.cause.DeletionCause;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.node.Node;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@@ -28,7 +28,6 @@ package net.luckperms.api.event.group;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.model.group.Group;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Events relating to {@link net.luckperms.api.model.group.Group}s.
|
||||
*/
|
||||
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.type.Cancellable;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,7 +29,6 @@ import net.luckperms.api.actionlog.Action;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.type.Cancellable;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -30,7 +30,6 @@ import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.type.Cancellable;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.platform.PlatformEntity;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,7 +29,6 @@ import net.luckperms.api.actionlog.Action;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.type.Cancellable;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,13 +28,16 @@ package net.luckperms.api.event.log;
|
||||
import net.luckperms.api.actionlog.Action;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Called when a log entry is received via the MessagingService
|
||||
* 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 {
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Events relating to the {@link net.luckperms.api.actionlog.ActionLog}.
|
||||
*/
|
||||
package net.luckperms.api.event.log;
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package net.luckperms.api.event.messaging;
|
||||
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.messaging.MessagingService;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* 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)
|
||||
@NonNull String getChannelId();
|
||||
|
||||
/**
|
||||
* Gets the custom payload that was sent.
|
||||
*
|
||||
* @return the custom payload
|
||||
*/
|
||||
@Param(1)
|
||||
@NonNull String getPayload();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Events relating to the {@link net.luckperms.api.messaging.MessagingService}.
|
||||
*/
|
||||
package net.luckperms.api.event.messaging;
|
||||
@@ -27,8 +27,12 @@ package net.luckperms.api.event.node;
|
||||
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.node.Node;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Called when a node is added to a holder
|
||||
@@ -40,7 +44,14 @@ public interface NodeAddEvent extends NodeMutateEvent {
|
||||
*
|
||||
* @return the node that was added
|
||||
*/
|
||||
@Param(4)
|
||||
@Param(3)
|
||||
@NonNull Node getNode();
|
||||
|
||||
@Override
|
||||
default @NonNull @Unmodifiable Set<Node> getDataBefore() {
|
||||
// Get data after, then reverse the action
|
||||
Set<Node> nodes = new HashSet<>(this.getDataAfter());
|
||||
nodes.remove(this.getNode());
|
||||
return Collections.unmodifiableSet(nodes);
|
||||
}
|
||||
}
|
||||
@@ -25,9 +25,34 @@
|
||||
|
||||
package net.luckperms.api.event.node;
|
||||
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.node.Node;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Called when a holder has their nodes cleared
|
||||
*/
|
||||
public interface NodeClearEvent extends NodeMutateEvent {
|
||||
|
||||
/**
|
||||
* Gets the nodes that were cleared
|
||||
*
|
||||
* @return the nodes that were removed
|
||||
* @since 5.3
|
||||
*/
|
||||
@Param(3)
|
||||
@NonNull @Unmodifiable Set<Node> getNodes();
|
||||
|
||||
@Override
|
||||
default @NonNull @Unmodifiable Set<Node> getDataBefore() {
|
||||
// Get data after, then reverse the action
|
||||
Set<Node> nodes = new HashSet<>(this.getDataAfter());
|
||||
nodes.addAll(this.getNodes());
|
||||
return Collections.unmodifiableSet(nodes);
|
||||
}
|
||||
}
|
||||
@@ -32,8 +32,8 @@ import net.luckperms.api.model.data.DataType;
|
||||
import net.luckperms.api.model.group.Group;
|
||||
import net.luckperms.api.model.user.User;
|
||||
import net.luckperms.api.node.Node;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@@ -63,16 +63,15 @@ public interface NodeMutateEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the data before the change
|
||||
*/
|
||||
@Param(2)
|
||||
@NonNull Set<Node> getDataBefore();
|
||||
@NonNull @Unmodifiable Set<Node> getDataBefore();
|
||||
|
||||
/**
|
||||
* Gets an immutable copy of the holders data after the change
|
||||
*
|
||||
* @return the data after the change
|
||||
*/
|
||||
@Param(3)
|
||||
@NonNull Set<Node> getDataAfter();
|
||||
@Param(2)
|
||||
@NonNull @Unmodifiable Set<Node> getDataAfter();
|
||||
|
||||
/**
|
||||
* Gets whether the target of this event is a {@link User}
|
||||
|
||||
@@ -27,8 +27,12 @@ package net.luckperms.api.event.node;
|
||||
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.node.Node;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Called when a node is removed from a holder
|
||||
@@ -40,7 +44,15 @@ public interface NodeRemoveEvent extends NodeMutateEvent {
|
||||
*
|
||||
* @return the node that was removed
|
||||
*/
|
||||
@Param(4)
|
||||
@Param(3)
|
||||
@NonNull Node getNode();
|
||||
|
||||
@Override
|
||||
default @NonNull @Unmodifiable Set<Node> getDataBefore() {
|
||||
// Get data after, then reverse the action
|
||||
Set<Node> nodes = new HashSet<>(this.getDataAfter());
|
||||
nodes.add(this.getNode());
|
||||
return Collections.unmodifiableSet(nodes);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Events relating to 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}.
|
||||
*/
|
||||
package net.luckperms.api.event.node;
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Main events package.
|
||||
*/
|
||||
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.model.PlayerSaveResult;
|
||||
import net.luckperms.api.model.user.UserManager;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -29,7 +29,6 @@ import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.model.user.User;
|
||||
import net.luckperms.api.util.Result;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package net.luckperms.api.event.player.lookup;
|
||||
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.type.ResultEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Called when the platform needs to determine the type of a player's {@link UUID unique id}.
|
||||
*
|
||||
* @since 5.3
|
||||
*/
|
||||
public interface UniqueIdDetermineTypeEvent extends LuckPermsEvent, ResultEvent<String> {
|
||||
|
||||
/**
|
||||
* The players UUID has been obtained by authenticating with the Mojang session servers.
|
||||
*
|
||||
* <p>Usually indicated by the UUID being {@link UUID#version() version} 4.</p>
|
||||
*/
|
||||
String TYPE_AUTHENTICATED = "authenticated";
|
||||
|
||||
/**
|
||||
* The players UUID has not been obtained through authentication, and instead is likely based
|
||||
* on the username they connected with.
|
||||
*
|
||||
* <p>Usually indicated by the UUID being {@link UUID#version() version} 3.</p>
|
||||
*/
|
||||
String TYPE_UNAUTHENTICATED = "unauthenticated";
|
||||
|
||||
/**
|
||||
* The players UUID most likely belongs to a NPC (non-player character).
|
||||
*
|
||||
* <p>Usually indicated by the UUID being {@link UUID#version() version} 2.</p>
|
||||
*
|
||||
* @since 5.4
|
||||
*/
|
||||
String TYPE_NPC = "npc";
|
||||
|
||||
/**
|
||||
* Unknown UUID type.
|
||||
*
|
||||
* @since 5.4
|
||||
*/
|
||||
String TYPE_UNKNOWN = "unknown";
|
||||
|
||||
/**
|
||||
* Gets the {@link UUID unique id} being queried.
|
||||
*
|
||||
* @return the unique id
|
||||
*/
|
||||
@Param(0)
|
||||
@NonNull UUID getUniqueId();
|
||||
|
||||
/**
|
||||
* Gets the current result unique id type.
|
||||
*
|
||||
* @return the type
|
||||
*/
|
||||
default @NonNull String getType() {
|
||||
return result().get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the result unique id type.
|
||||
*
|
||||
* @param type the type
|
||||
*/
|
||||
default void setType(@NonNull String type) {
|
||||
Objects.requireNonNull(type, "type");
|
||||
result().set(type);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package net.luckperms.api.event.player.lookup;
|
||||
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.type.ResultEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Called when the platform needs a unique id for a given username.
|
||||
*
|
||||
* @since 5.3
|
||||
*/
|
||||
public interface UniqueIdLookupEvent extends LuckPermsEvent, ResultEvent<UUID> {
|
||||
|
||||
/**
|
||||
* Gets the username being looked up.
|
||||
*
|
||||
* @return the username
|
||||
*/
|
||||
@Param(0)
|
||||
@NonNull String getUsername();
|
||||
|
||||
/**
|
||||
* Sets the result unique id.
|
||||
*
|
||||
* @param uniqueId the unique id
|
||||
*/
|
||||
default void setUniqueId(@Nullable UUID uniqueId) {
|
||||
result().set(uniqueId);
|
||||
}
|
||||
|
||||
}
|
||||
+26
-24
@@ -23,36 +23,38 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.common.cache;
|
||||
package net.luckperms.api.event.player.lookup;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.type.ResultEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Implementation of a most-recently-used cache with a mod counter, to prevent race conditions
|
||||
* occurring when the cache is cleared whilst a calculation is taking place.
|
||||
* Called when the platform needs a username for a given unique id.
|
||||
*
|
||||
* @param <T> the cached type
|
||||
* @since 5.3
|
||||
*/
|
||||
public abstract class MRUCache<T> {
|
||||
private volatile T recent;
|
||||
private final AtomicInteger modCount = new AtomicInteger();
|
||||
public interface UsernameLookupEvent extends LuckPermsEvent, ResultEvent<String> {
|
||||
|
||||
protected int modCount() {
|
||||
return this.modCount.get();
|
||||
/**
|
||||
* Gets the {@link UUID unique id} being looked up.
|
||||
*
|
||||
* @return the unique id
|
||||
*/
|
||||
@Param(0)
|
||||
@NonNull UUID getUniqueId();
|
||||
|
||||
/**
|
||||
* Sets the result username.
|
||||
*
|
||||
* @param username the username
|
||||
*/
|
||||
default void setUsername(@Nullable String username) {
|
||||
result().set(username);
|
||||
}
|
||||
|
||||
protected T getRecent() {
|
||||
return this.recent;
|
||||
}
|
||||
|
||||
protected void offerRecent(int validAt, T offer) {
|
||||
if (validAt == this.modCount.get()) {
|
||||
this.recent = offer;
|
||||
}
|
||||
}
|
||||
|
||||
protected void clearRecent() {
|
||||
this.recent = null;
|
||||
this.modCount.incrementAndGet();
|
||||
}
|
||||
}
|
||||
+27
-22
@@ -23,48 +23,53 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.common.metastacking;
|
||||
package net.luckperms.api.event.player.lookup;
|
||||
|
||||
import net.luckperms.api.metastacking.MetaStackDefinition;
|
||||
import net.luckperms.api.node.ChatMetaType;
|
||||
import net.luckperms.api.node.types.ChatMetaNode;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
/**
|
||||
* A live stack of {@link MetaStackEntry} instances, formed from a
|
||||
* {@link MetaStackDefinition}.
|
||||
* Called when the validity of a username is being tested.
|
||||
*
|
||||
* This class is used to construct a formatted string, by accumulating
|
||||
* nodes to each element.
|
||||
* @since 5.3
|
||||
*/
|
||||
public interface MetaStack {
|
||||
public interface UsernameValidityCheckEvent extends LuckPermsEvent {
|
||||
|
||||
/**
|
||||
* Gets the definition this stack is based upon
|
||||
* Gets the username being tested.
|
||||
*
|
||||
* @return the definition of the stack
|
||||
* @return the username
|
||||
*/
|
||||
MetaStackDefinition getDefinition();
|
||||
@Param(0)
|
||||
@NonNull String getUsername();
|
||||
|
||||
/**
|
||||
* Gets the target of this stack
|
||||
* Gets the current validity state for the username.
|
||||
*
|
||||
* @return the stack target
|
||||
* @return the validity state
|
||||
*/
|
||||
ChatMetaType getTargetType();
|
||||
@Param(1)
|
||||
@NonNull AtomicBoolean validityState();
|
||||
|
||||
/**
|
||||
* Returns a formatted string, as defined by the {@link MetaStackDefinition},
|
||||
* using the accumulated elements in the stack.
|
||||
* Gets if the username is currently considered to be valid.
|
||||
*
|
||||
* @return the string output
|
||||
* @return if the username is valid
|
||||
*/
|
||||
String toFormattedString();
|
||||
default boolean isValid() {
|
||||
return validityState().get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to accumulate the given node to all elements in the stack.
|
||||
* Sets if the username should be considered valid or not.
|
||||
*
|
||||
* @param node the node to accumulate
|
||||
* @param valid whether the username is valid
|
||||
*/
|
||||
void accumulateToAll(ChatMetaNode<?, ?> node);
|
||||
default void setValid(boolean valid) {
|
||||
validityState().set(valid);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Events relating to a player {@link java.util.UUID unique id} or username lookup.
|
||||
*/
|
||||
package net.luckperms.api.event.player.lookup;
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Events relating to a player.
|
||||
*/
|
||||
package net.luckperms.api.event.player;
|
||||
@@ -26,7 +26,6 @@
|
||||
package net.luckperms.api.event.source;
|
||||
|
||||
import net.luckperms.api.platform.PlatformEntity;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
package net.luckperms.api.event.source;
|
||||
|
||||
import net.luckperms.api.platform.PlatformEntity;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Event sources.
|
||||
*/
|
||||
package net.luckperms.api.event.source;
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package net.luckperms.api.event.sync;
|
||||
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.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)
|
||||
@NonNull UUID getSyncId();
|
||||
|
||||
/**
|
||||
* Gets the sync type.
|
||||
*
|
||||
* @return the sync type
|
||||
*/
|
||||
@Param(1)
|
||||
@NonNull 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;
|
||||
|
||||
/**
|
||||
* 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 {
|
||||
|
||||
|
||||
@@ -28,13 +28,16 @@ package net.luckperms.api.event.sync;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.type.Cancellable;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
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 {
|
||||
|
||||
@@ -46,4 +49,22 @@ public interface PreNetworkSyncEvent extends LuckPermsEvent, Cancellable {
|
||||
@Param(0)
|
||||
@NonNull UUID getSyncId();
|
||||
|
||||
/**
|
||||
* Gets the sync type.
|
||||
*
|
||||
* @return the sync type
|
||||
* @since 5.5
|
||||
*/
|
||||
@Param(1)
|
||||
@NonNull 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;
|
||||
|
||||
/**
|
||||
* 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 {
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package net.luckperms.api.event.sync;
|
||||
|
||||
/**
|
||||
* Represents the type of synchronisation task.
|
||||
*
|
||||
* @since 5.5
|
||||
*/
|
||||
public enum SyncType {
|
||||
|
||||
/**
|
||||
* A full sync will be performed - all groups, users and tracks
|
||||
*/
|
||||
FULL,
|
||||
|
||||
/**
|
||||
* Only a specific user will be synced
|
||||
*/
|
||||
SPECIFIC_USER
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Events relating to {@link net.luckperms.api.LuckPerms#runUpdateTask() sync/update task}s.
|
||||
*/
|
||||
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.util.Param;
|
||||
import net.luckperms.api.track.Track;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,7 +28,6 @@ package net.luckperms.api.event.track;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.cause.DeletionCause;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -28,7 +28,6 @@ package net.luckperms.api.event.track;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.track.Track;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
package net.luckperms.api.event.track.mutate;
|
||||
|
||||
import net.luckperms.api.event.util.Param;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,8 +28,8 @@ package net.luckperms.api.event.track.mutate;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.track.Track;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -52,7 +52,7 @@ public interface TrackMutateEvent extends LuckPermsEvent {
|
||||
* @return the data before the change
|
||||
*/
|
||||
@Param(1)
|
||||
@NonNull List<String> getStateBefore();
|
||||
@NonNull @Unmodifiable List<String> getStateBefore();
|
||||
|
||||
/**
|
||||
* Gets an immutable copy of the tracks data after the change
|
||||
@@ -60,6 +60,6 @@ public interface TrackMutateEvent extends LuckPermsEvent {
|
||||
* @return the data after the change
|
||||
*/
|
||||
@Param(2)
|
||||
@NonNull List<String> getStateAfter();
|
||||
@NonNull @Unmodifiable List<String> getStateAfter();
|
||||
|
||||
}
|
||||
@@ -26,7 +26,6 @@
|
||||
package net.luckperms.api.event.track.mutate;
|
||||
|
||||
import net.luckperms.api.event.util.Param;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Events relating to changes to a {@link net.luckperms.api.track.Track}s contents.
|
||||
*/
|
||||
package net.luckperms.api.event.track.mutate;
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Events relating to {@link net.luckperms.api.track.Track}s.
|
||||
*/
|
||||
package net.luckperms.api.event.track;
|
||||
@@ -26,7 +26,6 @@
|
||||
package net.luckperms.api.event.type;
|
||||
|
||||
import net.luckperms.api.event.util.Param;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package net.luckperms.api.event.type;
|
||||
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
/**
|
||||
* Represents an event that has a result.
|
||||
*
|
||||
* @param <T> the type of the result
|
||||
* @since 5.3
|
||||
*/
|
||||
public interface ResultEvent<T> {
|
||||
|
||||
/**
|
||||
* Gets an {@link AtomicReference} containing the result.
|
||||
*
|
||||
* @return the result
|
||||
*/
|
||||
@Param(-1)
|
||||
@NonNull AtomicReference<T> result();
|
||||
|
||||
/**
|
||||
* Gets if a result has been set for the event.
|
||||
*
|
||||
* @return if there is a result
|
||||
*/
|
||||
default boolean hasResult() {
|
||||
return result().get() != null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,7 +27,6 @@ package net.luckperms.api.event.type;
|
||||
|
||||
import net.luckperms.api.event.source.Source;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Event abstract types.
|
||||
*/
|
||||
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.util.Param;
|
||||
import net.luckperms.api.model.user.User;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,7 +29,6 @@ import net.luckperms.api.cacheddata.CachedDataManager;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.model.user.User;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,7 +27,6 @@ package net.luckperms.api.event.user;
|
||||
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -28,7 +28,6 @@ package net.luckperms.api.event.user;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.model.user.User;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package net.luckperms.api.event.user;
|
||||
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.type.Cancellable;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.model.user.User;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Called when a user is about to be unloaded from memory.
|
||||
*
|
||||
* @since 5.3
|
||||
*/
|
||||
public interface UserUnloadEvent extends LuckPermsEvent, Cancellable {
|
||||
|
||||
/**
|
||||
* Gets the user that is being unloaded
|
||||
*
|
||||
* @return the user that is being unloaded
|
||||
*/
|
||||
@Param(0)
|
||||
@NonNull User getUser();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Events relating to {@link net.luckperms.api.model.user.User}s.
|
||||
*/
|
||||
package net.luckperms.api.event.user;
|
||||
@@ -30,7 +30,6 @@ import net.luckperms.api.event.type.Sourced;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.model.user.User;
|
||||
import net.luckperms.api.track.Track;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Events relating to a {@link net.luckperms.api.model.user.User}s movement on a
|
||||
* {@link net.luckperms.api.track.Track}.
|
||||
*/
|
||||
package net.luckperms.api.event.user.track;
|
||||
Loaded 100 of 1084 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user