Compare commits
1381
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3006e58209 | ||
|
|
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 | ||
|
|
3bf2fab2e9 | ||
|
|
73d76d860e | ||
|
|
bcfcb64931 | ||
|
|
a19cb71394 | ||
|
|
52731fe68e | ||
|
|
7845d89f10 | ||
|
|
3d358e57ff | ||
|
|
bd9ae9dbd5 | ||
|
|
f281927578 | ||
|
|
665c53093a | ||
|
|
10fbc24f43 | ||
|
|
6631e9144e | ||
|
|
7ae532f082 | ||
|
|
1af55e3720 | ||
|
|
fe32aa2d33 | ||
|
|
f6460c2802 | ||
|
|
045c10048d | ||
|
|
308356de80 | ||
|
|
8771d4c5e5 | ||
|
|
cd25681cd3 | ||
|
|
ad6a11819d | ||
|
|
b17da055af | ||
|
|
2fd896508b | ||
|
|
99348fce53 | ||
|
|
eb0d758efc | ||
|
|
c03aca35d6 | ||
|
|
f484e87828 | ||
|
|
07b2df7c7e | ||
|
|
cab15d39c3 | ||
|
|
36335c10a4 | ||
|
|
642d14d003 | ||
|
|
175808e251 | ||
|
|
14d952a212 | ||
|
|
37e09caac5 | ||
|
|
4d7a6cb658 | ||
|
|
cc80fe5105 | ||
|
|
b79f6b0fdd | ||
|
|
83e9ac04b2 | ||
|
|
8cecfe5b7c | ||
|
|
54aed80db8 | ||
|
|
0d89fc9d28 | ||
|
|
cee34d0c31 | ||
|
|
d2e60eb5ac | ||
|
|
c71742a996 | ||
|
|
fe139f8420 | ||
|
|
bb015d0c88 | ||
|
|
94809c2a66 | ||
|
|
141d3e26ea | ||
|
|
efb958ba44 | ||
|
|
9f0fe9e0cb | ||
|
|
2028d65579 | ||
|
|
c98c60b120 | ||
|
|
6805574553 | ||
|
|
c3128dec0d | ||
|
|
b65639cd76 | ||
|
|
42e9f43443 | ||
|
|
c40ad63291 | ||
|
|
0964762217 | ||
|
|
3553a0f9fe | ||
|
|
24304a61a7 | ||
|
|
497846e5a6 | ||
|
|
0729be0f0a | ||
|
|
2adea2d3dc | ||
|
|
30d7768299 | ||
|
|
3a7fadb843 | ||
|
|
779bbb9f88 | ||
|
|
a721cc0b7c | ||
|
|
3973aa1000 | ||
|
|
ac9fe74785 | ||
|
|
46c9e3b713 | ||
|
|
05b82cdbab | ||
|
|
3086724e92 | ||
|
|
fbac03e372 | ||
|
|
2518a7c8e5 | ||
|
|
bbec0932fd | ||
|
|
bca766c20d | ||
|
|
bb3afa21a4 | ||
|
|
85451a9a20 | ||
|
|
d475ace76c | ||
|
|
9f3395f256 | ||
|
|
c6bda0875c | ||
|
|
4f63a00bad | ||
|
|
0a3141841c | ||
|
|
6fea194ef5 | ||
|
|
e66ab1be0d | ||
|
|
5ce8217cd5 | ||
|
|
2ed45c92a6 | ||
|
|
9f7d431d34 | ||
|
|
d937c9ce06 | ||
|
|
6a96d40da4 | ||
|
|
2eabe845d7 | ||
|
|
4cfee76202 | ||
|
|
446fa48d9a | ||
|
|
9546987970 | ||
|
|
7a624fb449 | ||
|
|
26de6cf86f | ||
|
|
5fe7302965 | ||
|
|
a779b31ca5 | ||
|
|
8fa629a243 | ||
|
|
0864cf756c | ||
|
|
e9d72df890 | ||
|
|
c39a44c3ac | ||
|
|
7e8402b542 | ||
|
|
a050a2604f | ||
|
|
abad672bef | ||
|
|
fe3d715f09 | ||
|
|
e151fbe298 | ||
|
|
2ccb475aa0 | ||
|
|
4c83d439af | ||
|
|
352f3bd263 | ||
|
|
b73b73e221 | ||
|
|
c454d17826 | ||
|
|
098f8d8231 | ||
|
|
c1e3660551 | ||
|
|
3ceb53aa4f | ||
|
|
a33f326cfc | ||
|
|
83883aa7e6 | ||
|
|
3fae4e5e9e | ||
|
|
4e9b11f30a | ||
|
|
46dc4e5104 | ||
|
|
9c8bdb1166 | ||
|
|
242993763c | ||
|
|
b84518e1f1 | ||
|
|
b2593d409e | ||
|
|
d3b3a8af38 | ||
|
|
ec2cb5007c | ||
|
|
ca33cee79d | ||
|
|
2d456bd346 | ||
|
|
10680668db | ||
|
|
0e64b61be4 | ||
|
|
96c53091d0 | ||
|
|
6e64f80c81 | ||
|
|
8906e4c4fc | ||
|
|
cc5d7ea873 | ||
|
|
6237d58ad6 | ||
|
|
fae5ebe226 | ||
|
|
9a92920120 | ||
|
|
dc5c6b0138 | ||
|
|
88c432496b | ||
|
|
63b890d522 | ||
|
|
cd5c8d7cdf | ||
|
|
d80017ba7b | ||
|
|
5eb8a262be | ||
|
|
7474842b45 | ||
|
|
9093385de3 | ||
|
|
bd349ac4a3 | ||
|
|
37367fe91f | ||
|
|
dce792083b | ||
|
|
06f7900318 | ||
|
|
d8ac199858 | ||
|
|
9cf21e2927 | ||
|
|
86a15b9a66 | ||
|
|
31b57df567 | ||
|
|
a07f876c85 | ||
|
|
2eb0c1e67e | ||
|
|
6325e25630 | ||
|
|
6fdd349654 | ||
|
|
01e17adf82 | ||
|
|
acdd5f3faa | ||
|
|
4d3c692402 | ||
|
|
787f691f44 | ||
|
|
500385cd3e | ||
|
|
6df64a29dc | ||
|
|
233324f6c9 | ||
|
|
da253c47da | ||
|
|
8725ace739 | ||
|
|
0d9106185c | ||
|
|
7449f6f9af | ||
|
|
2316b6806e | ||
|
|
94418d3648 | ||
|
|
479b2d026c | ||
|
|
8e9683b33f | ||
|
|
6481bac045 | ||
|
|
86aadf2cf8 | ||
|
|
95d2832884 | ||
|
|
213b2fcb44 | ||
|
|
c4bd657826 | ||
|
|
a5e15b8a29 | ||
|
|
7a37fcd792 | ||
|
|
81cbe02a9c | ||
|
|
79c10c986e | ||
|
|
c836cce59b | ||
|
|
287c0f7f7a | ||
|
|
dc52807a46 | ||
|
|
916e3dbb0b | ||
|
|
4b0574710e | ||
|
|
7764a04d46 | ||
|
|
9438df787a | ||
|
|
fd954d8293 | ||
|
|
72dec16f54 | ||
|
|
40218563e1 | ||
|
|
0251f2add9 | ||
|
|
f0e42c6db6 | ||
|
|
4b793d1f14 | ||
|
|
61e5da928a | ||
|
|
419707aa5f | ||
|
|
8b970c21fc | ||
|
|
7a31edea09 | ||
|
|
b286faa1c5 | ||
|
|
5e2f45ebd0 | ||
|
|
eff93c788b | ||
|
|
4667ffc681 | ||
|
|
bafada4f17 | ||
|
|
5b97d01363 | ||
|
|
3474c66c1c | ||
|
|
8f8c916be3 | ||
|
|
a823290d66 | ||
|
|
5577e3f590 | ||
|
|
ffe6c24b53 | ||
|
|
4e4982a98d | ||
|
|
7f4f9bb917 | ||
|
|
8d8024ba5e | ||
|
|
2e16b15b0e | ||
|
|
1ebed37297 | ||
|
|
ff37ad176b | ||
|
|
d0c5d89e91 | ||
|
|
f49446011a | ||
|
|
d762a0aaa6 | ||
|
|
2dc211a91e | ||
|
|
2c62de9658 | ||
|
|
494ab6787f | ||
|
|
b81e8a40a4 | ||
|
|
2fd2f4fedb | ||
|
|
493e5d08be | ||
|
|
62a834e145 | ||
|
|
241f13c8f1 | ||
|
|
98ea255667 | ||
|
|
420ec2bf1a | ||
|
|
364a494ac6 | ||
|
|
821d1cb8dd | ||
|
|
544ffbad19 | ||
|
|
4fa6cd2577 | ||
|
|
37d1f5efab | ||
|
|
7cd8e8bf5b | ||
|
|
8eed4558f4 | ||
|
|
62ca2d9c79 | ||
|
|
c7a0d7026c | ||
|
|
ce74813ce5 | ||
|
|
d1511e43f2 | ||
|
|
6ef749c76a | ||
|
|
8846932cb6 | ||
|
|
12b861db3f | ||
|
|
0a50df6557 | ||
|
|
3726f6de41 | ||
|
|
d1ca7684d6 | ||
|
|
512b621a7a | ||
|
|
2cf919a17a | ||
|
|
46072eb465 | ||
|
|
ae63a42c2e | ||
|
|
8773ec07ab | ||
|
|
287cc308d6 | ||
|
|
beeb4fa169 | ||
|
|
4ef3d50965 | ||
|
|
dae64fc8c4 | ||
|
|
215031a1f3 | ||
|
|
85d2f0b51f | ||
|
|
d91355e4d6 | ||
|
|
1a690dabd7 | ||
|
|
526448ce40 | ||
|
|
43d04a97f5 | ||
|
|
307614e704 | ||
|
|
f6c0794691 | ||
|
|
83db00aef8 | ||
|
|
22252fa46d | ||
|
|
7b8426977a | ||
|
|
d9912cb93f | ||
|
|
5db999f995 | ||
|
|
b744e35ad8 | ||
|
|
b6769811a2 | ||
|
|
1d9fc568e4 | ||
|
|
3c0d1ba7a1 | ||
|
|
78a74510cf | ||
|
|
d3ae3324fa | ||
|
|
4b97c9419e | ||
|
|
db830a0bef | ||
|
|
797c195424 | ||
|
|
4788290615 | ||
|
|
d0c016f6b7 | ||
|
|
9b1c73ed23 | ||
|
|
048768007d | ||
|
|
ec7a5321a6 | ||
|
|
c396323308 | ||
|
|
6fc2321fad | ||
|
|
a0d04790a5 | ||
|
|
c4154c09da | ||
|
|
8eed3131f2 | ||
|
|
e5c4b710f6 | ||
|
|
2ccffc6e6d | ||
|
|
fc69002c86 | ||
|
|
e3a6db5f97 | ||
|
|
6d8077ffd0 | ||
|
|
784161d66d | ||
|
|
115f793733 | ||
|
|
2cb5e437fd | ||
|
|
8c57c2b46d | ||
|
|
879a88a398 | ||
|
|
7e50c3c777 | ||
|
|
4b1cf51530 | ||
|
|
de24817d9c | ||
|
|
085e7af681 | ||
|
|
1aabd7610e | ||
|
|
ef31db1431 | ||
|
|
757e9d6be6 | ||
|
|
b3a028e3ca | ||
|
|
e222e4e98c | ||
|
|
1213e58240 | ||
|
|
b7ff0824b9 | ||
|
|
7b5917660c | ||
|
|
1544487e92 | ||
|
|
c19ef84116 | ||
|
|
e8c4a55dc3 | ||
|
|
97d6aaed5c | ||
|
|
fe77834cef | ||
|
|
2da6298c53 | ||
|
|
e111270aed | ||
|
|
e07f8c0fbe | ||
|
|
90246afd03 | ||
|
|
9809e591ad | ||
|
|
26973461e7 | ||
|
|
759ec5d499 | ||
|
|
58ab3c325c | ||
|
|
44c8c67803 | ||
|
|
acb56d683a | ||
|
|
5dda522a62 | ||
|
|
79091c726b | ||
|
|
e5be06e07b | ||
|
|
f63992e209 | ||
|
|
9988011308 | ||
|
|
8584a9b72c | ||
|
|
42c8cb1354 | ||
|
|
aaeaf5cfa0 | ||
|
|
45b4e1463f | ||
|
|
be92a67544 | ||
|
|
5e0b8ebdf6 | ||
|
|
9d4ccd33e1 | ||
|
|
f5c42c70e5 | ||
|
|
dcc4656e5e | ||
|
|
ee2de3cff1 | ||
|
|
f96518b8e4 | ||
|
|
dac59966aa | ||
|
|
8115fbaa98 | ||
|
|
8b97439ffc | ||
|
|
fa83986250 | ||
|
|
e1b16465f8 | ||
|
|
57619dacb1 | ||
|
|
64e54d89eb | ||
|
|
aa4139f0b7 | ||
|
|
e2f1c1e16b | ||
|
|
1e7ef15e54 | ||
|
|
1cc156d6f6 | ||
|
|
1445a3faec | ||
|
|
1cf90692cf | ||
|
|
5656bea3f9 | ||
|
|
8e344cea76 | ||
|
|
5b1229c882 | ||
|
|
834649b390 | ||
|
|
d28170cc3f | ||
|
|
04e511026d | ||
|
|
11a3ecbba0 | ||
|
|
51b7bb93e2 | ||
|
|
9fd2028d9f | ||
|
|
75f0f40d70 | ||
|
|
3941c77826 | ||
|
|
4987ca3ba2 | ||
|
|
5fa481337a | ||
|
|
dd78e0e271 | ||
|
|
3c773e6823 | ||
|
|
54a9ff9256 | ||
|
|
eca6b09b18 | ||
|
|
b7f8ca6658 | ||
|
|
ffdeadac8a | ||
|
|
9e769904bf | ||
|
|
8d79ec6b07 | ||
|
|
3a123f9fa1 | ||
|
|
f0c0328919 | ||
|
|
274286032a | ||
|
|
76517374a2 | ||
|
|
2da027f3b5 | ||
|
|
fd712f131f | ||
|
|
38613e5f03 | ||
|
|
ec9060ba80 | ||
|
|
502d57e744 | ||
|
|
c59f2ab37a | ||
|
|
066189b486 | ||
|
|
37d4f92c33 | ||
|
|
55220e9d10 | ||
|
|
bd41286076 | ||
|
|
d84484c81c | ||
|
|
fec87d4c6a | ||
|
|
68ec6e2a37 | ||
|
|
a784ad435f | ||
|
|
cc9bb34873 | ||
|
|
2ddae5a96c | ||
|
|
40ad489c56 | ||
|
|
56c55d71fe | ||
|
|
56df15caf8 | ||
|
|
03720665b3 | ||
|
|
445429b510 | ||
|
|
c698587d53 | ||
|
|
b8466beee5 | ||
|
|
efa666445f | ||
|
|
59c7d77525 | ||
|
|
553da9baf6 | ||
|
|
486ddb3d42 | ||
|
|
381922fc02 | ||
|
|
4c891f0819 | ||
|
|
4b3d11ccab | ||
|
|
b1ab465991 | ||
|
|
952e41ad3d | ||
|
|
ae3adf23c8 | ||
|
|
c3cdf387c2 | ||
|
|
054f0c2c19 | ||
|
|
2f7fce2109 | ||
|
|
07469599bc | ||
|
|
08869da96e | ||
|
|
7540a6eb70 | ||
|
|
fa2d9357b8 | ||
|
|
247a40b65f | ||
|
|
01ffe6ad5a | ||
|
|
da3c2a073a | ||
|
|
c16630c32b | ||
|
|
bf64f465a8 | ||
|
|
c1e0b874d8 | ||
|
|
c780266139 | ||
|
|
08454d58d0 | ||
|
|
ee13540d78 | ||
|
|
b4ff54ffc8 | ||
|
|
6f96d9c7d1 | ||
|
|
5b66436519 | ||
|
|
379eb00b69 | ||
|
|
2036127612 | ||
|
|
957a918bd6 | ||
|
|
6b305972ac | ||
|
|
b8c06904ab | ||
|
|
6baa472567 | ||
|
|
9c449def57 | ||
|
|
e4acc133a9 | ||
|
|
8b181b877b | ||
|
|
194790110d | ||
|
|
c0cd197bd0 | ||
|
|
30ce269873 | ||
|
|
4d7be13c16 | ||
|
|
8cf0f7da5f | ||
|
|
bcb4e5ca64 | ||
|
|
07b003c77a | ||
|
|
f4e4f727dd | ||
|
|
644c53a074 | ||
|
|
c66622bd09 | ||
|
|
adf0589184 | ||
|
|
b7de0e6901 | ||
|
|
a90e59ec97 | ||
|
|
f4882c1c14 | ||
|
|
ed3b5a3cf1 | ||
|
|
45e2b7b12f | ||
|
|
1e73986c60 | ||
|
|
20f992110d | ||
|
|
18f09f9862 | ||
|
|
a0be1c7c48 | ||
|
|
5d34661a15 | ||
|
|
1639879106 | ||
|
|
a927ca659f | ||
|
|
804c884d8b | ||
|
|
51f215b8ac | ||
|
|
64838708ab | ||
|
|
91b7af52ac | ||
|
|
d3dded8791 | ||
|
|
022b385c0a | ||
|
|
7ee9b93365 | ||
|
|
c4c98aaabf | ||
|
|
10c0efaa5d | ||
|
|
d8a7d8de4a | ||
|
|
ab8b675bae | ||
|
|
194b602fd6 | ||
|
|
7da0c58b76 | ||
|
|
2dbbea4993 | ||
|
|
55d59bb1c4 | ||
|
|
a6facf7492 | ||
|
|
b8a1871cf1 | ||
|
|
f556c75d94 | ||
|
|
58bd7de66a | ||
|
|
4547b52748 | ||
|
|
b9acb84119 | ||
|
|
e3a783c546 | ||
|
|
2e136666be | ||
|
|
7d089cb5f0 | ||
|
|
3784d904fb | ||
|
|
fef6ebf793 | ||
|
|
316e177c1d | ||
|
|
4cdff14c7c | ||
|
|
97121bc719 | ||
|
|
1312aac349 | ||
|
|
8a5c9ddef2 | ||
|
|
55382519a1 | ||
|
|
cbb562b603 | ||
|
|
ba51f803ba | ||
|
|
d73543408e | ||
|
|
7d90dba08b | ||
|
|
f11ebe6166 | ||
|
|
1b917f0901 | ||
|
|
328353d053 | ||
|
|
4e87489dc1 | ||
|
|
8e5bcdd5ea | ||
|
|
882a29029e | ||
|
|
4704c5c975 | ||
|
|
957365ab91 | ||
|
|
f8d34d7f46 | ||
|
|
cb185e4827 | ||
|
|
f5c6b9e3d4 | ||
|
|
96f0f46b3e | ||
|
|
6a5b7ce3a1 | ||
|
|
f33c540efb | ||
|
|
7684ac5d3a | ||
|
|
c13b01da01 | ||
|
|
3453f05aca | ||
|
|
c8bb85a06b | ||
|
|
2aabc9902f | ||
|
|
6dba778e60 | ||
|
|
cbeaaca7af | ||
|
|
0e69c8902d | ||
|
|
f63d6cfced | ||
|
|
72f9de6cc7 | ||
|
|
509e89b9cf | ||
|
|
90cce19baf | ||
|
|
e4e93b1af1 | ||
|
|
8f30176edd | ||
|
|
4923d10b86 | ||
|
|
bd3a4e1ad7 | ||
|
|
0f99a6c5ca | ||
|
|
0150da94a8 | ||
|
|
b8da286f64 | ||
|
|
da797f154d | ||
|
|
926195efc4 | ||
|
|
8c1c5c820c | ||
|
|
f63f652edb | ||
|
|
174ef187e8 | ||
|
|
d1e76f401a | ||
|
|
d52983c5af | ||
|
|
4773934481 | ||
|
|
dbfc524180 | ||
|
|
60aa7c6104 | ||
|
|
907d716929 | ||
|
|
1689a8abe2 | ||
|
|
5db3820df4 | ||
|
|
f969e2e52b | ||
|
|
cde2306079 | ||
|
|
f6c440c172 | ||
|
|
1b98667365 | ||
|
|
bf69d5314e | ||
|
|
6d2ea659a4 | ||
|
|
0d89840179 | ||
|
|
f93e8fdccd | ||
|
|
68e4d36f40 | ||
|
|
cd5447de38 | ||
|
|
6c0bb61cb1 | ||
|
|
d9a45b1090 | ||
|
|
7549b3eb9e | ||
|
|
8f82ef7eb4 | ||
|
|
fbe84322b5 | ||
|
|
98fb9946e4 | ||
|
|
984bc5860f | ||
|
|
a42d27f056 | ||
|
|
aa4833ed74 | ||
|
|
6704ac4b46 | ||
|
|
4e4ec8e608 | ||
|
|
4f4a387f04 | ||
|
|
d0143f9e54 | ||
|
|
b2175e885f | ||
|
|
68dd96e563 | ||
|
|
168e712324 | ||
|
|
2889c28815 | ||
|
|
966bf8bf51 | ||
|
|
63ff3c34b3 | ||
|
|
736105cc12 | ||
|
|
b1fa4263ed | ||
|
|
31d435dc2b | ||
|
|
da9977a30f | ||
|
|
9c92522564 | ||
|
|
31e436868d | ||
|
|
794455d728 | ||
|
|
0adf85746d | ||
|
|
f1047df98e | ||
|
|
765f9d2545 | ||
|
|
0b5588a7dd | ||
|
|
4fda89d5c8 | ||
|
|
b8c5c60ece | ||
|
|
a3730aceeb | ||
|
|
df5240a67c | ||
|
|
620b0c898c | ||
|
|
02ac4bc48b | ||
|
|
d14310768c | ||
|
|
63f8e8849f | ||
|
|
7e7268bb5a | ||
|
|
173286d404 | ||
|
|
fd937e3209 | ||
|
|
31df29194b | ||
|
|
a1a2e189b6 | ||
|
|
5799a26cb7 | ||
|
|
fe200ca1ec | ||
|
|
7f7116e1c7 | ||
|
|
0cc1c4e5a7 | ||
|
|
2bc56de1c3 | ||
|
|
e28d15456c | ||
|
|
54dbede130 | ||
|
|
982254ff5e | ||
|
|
e1c60fa70f | ||
|
|
6923c4e247 | ||
|
|
0eba5f1cbc | ||
|
|
4858e59b70 | ||
|
|
1f70ad978f | ||
|
|
40294b10f5 | ||
|
|
8d045be0b0 | ||
|
|
e24a482deb | ||
|
|
f18d230ff6 | ||
|
|
72d4e5cf7a | ||
|
|
4c3e28ba85 | ||
|
|
821dc4ef56 | ||
|
|
612712f015 | ||
|
|
03a93b1186 | ||
|
|
04ffd00c0e | ||
|
|
a74475d4cd | ||
|
|
05ac7e6041 | ||
|
|
5ae90f2a4b | ||
|
|
b800db03fc | ||
|
|
662b958a7f | ||
|
|
7cd5eea6d3 | ||
|
|
ed223f0e4e | ||
|
|
8a374aed04 | ||
|
|
9ceacdb739 | ||
|
|
39daed23c4 | ||
|
|
19e6d4e4c8 | ||
|
|
22006617d0 | ||
|
|
3201d10bdd | ||
|
|
ea94bd8696 | ||
|
|
f646c04d09 | ||
|
|
17ff9ac328 | ||
|
|
283516614b | ||
|
|
6c8f04f829 | ||
|
|
505a10a8b1 | ||
|
|
4fd89e6a34 | ||
|
|
7bf666b062 | ||
|
|
764665cf15 | ||
|
|
b9dfd7db54 | ||
|
|
e09c5622f7 | ||
|
|
717347273d | ||
|
|
9bb1ba12b2 | ||
|
|
bff9715e7f | ||
|
|
cfcd896c59 | ||
|
|
aaa50cacda | ||
|
|
3413adf16f | ||
|
|
3d6aa69ca1 | ||
|
|
ab115c4a6b | ||
|
|
e1e7bc8e0d | ||
|
|
6602b23f09 | ||
|
|
862fe6e2e3 | ||
|
|
5a34fa182a | ||
|
|
0b72507e2d | ||
|
|
cc3ddd51fd | ||
|
|
f793fd5010 | ||
|
|
fb92fd9357 | ||
|
|
a415a2705f | ||
|
|
765f140121 | ||
|
|
cb47f9f94b | ||
|
|
d0fb9f6aee | ||
|
|
9d424f5122 | ||
|
|
f71237ea95 | ||
|
|
fb5925e1e8 | ||
|
|
f86bdb7619 | ||
|
|
ad5299d0cd | ||
|
|
904bb90385 | ||
|
|
2e7a08c006 | ||
|
|
38e75da92f | ||
|
|
97708c2c80 | ||
|
|
e5ce64266f | ||
|
|
a765be0a6f | ||
|
|
0bec93ab1c | ||
|
|
dfb1b8f841 | ||
|
|
322b522a52 | ||
|
|
9dd4f71526 | ||
|
|
94b4e3d366 | ||
|
|
bbb2897d20 | ||
|
|
a5e41e479a | ||
|
|
2baea0ce13 | ||
|
|
90cbff885f | ||
|
|
0d9034504e | ||
|
|
800749c5ed | ||
|
|
30f27f29b4 | ||
|
|
2985cf7237 | ||
|
|
003ddc51de | ||
|
|
c369ac6b90 | ||
|
|
e2b9e37867 | ||
|
|
1e105b4135 | ||
|
|
c5c253af4e | ||
|
|
717835e5c1 | ||
|
|
e9ba62dbd9 | ||
|
|
ad5c22ecdb | ||
|
|
2e92b97f01 | ||
|
|
ae8fe0fe1e | ||
|
|
d992d7f77c | ||
|
|
a7cb7ec1af | ||
|
|
3afeb30795 | ||
|
|
26feeb125e | ||
|
|
211fb219a7 | ||
|
|
e71ef834c0 | ||
|
|
29eba93ee3 | ||
|
|
52ebfe9309 | ||
|
|
b3e78c6dc1 | ||
|
|
cd0184970a | ||
|
|
6401480874 | ||
|
|
6ca9eb13dd | ||
|
|
987ea51264 | ||
|
|
df37491199 | ||
|
|
9a420403de | ||
|
|
17da2807cf | ||
|
|
22fba0c172 | ||
|
|
14005563a3 | ||
|
|
a115ff8ce2 | ||
|
|
d75b29f51d | ||
|
|
3e8f7911af | ||
|
|
175a21c0e4 | ||
|
|
a2801bff7c | ||
|
|
f1a50f433f | ||
|
|
76bfde4d77 | ||
|
|
d393a4c9ca | ||
|
|
9ea6b0b8bb | ||
|
|
c20b91d5ea | ||
|
|
fad8a38bdf | ||
|
|
2440a38e82 | ||
|
|
b7541c43c8 | ||
|
|
0f10bb0bc9 | ||
|
|
357717886e | ||
|
|
94a4051d29 | ||
|
|
0e581cbcf3 | ||
|
|
230d9725e8 | ||
|
|
dee41b315f | ||
|
|
72e6c75433 | ||
|
|
ebe12f838c | ||
|
|
7279fdc25f | ||
|
|
af5c859385 | ||
|
|
e8896fbdf7 | ||
|
|
54695b8046 | ||
|
|
c573c755d2 | ||
|
|
b299301b69 | ||
|
|
a3a7198777 | ||
|
|
ca8cc91f37 | ||
|
|
26c813c07b | ||
|
|
f109cb684a | ||
|
|
1baefaade4 | ||
|
|
5ac0f93214 | ||
|
|
ecfbed00b1 | ||
|
|
6e429d6c78 | ||
|
|
fa4bb0447a | ||
|
|
aa0be40124 | ||
|
|
04d5310c04 | ||
|
|
74069af309 | ||
|
|
6bfeec6d16 | ||
|
|
0f4c057395 | ||
|
|
2fd74f3b7e | ||
|
|
fb171a57c2 | ||
|
|
b26fc69e73 | ||
|
|
28961b1cfa | ||
|
|
597f2f7b1b | ||
|
|
00cd8bb3f3 | ||
|
|
5732e60510 | ||
|
|
7b271e21e3 | ||
|
|
1a5f9683c2 | ||
|
|
3b74d55442 | ||
|
|
8920396360 | ||
|
|
9c505e4402 | ||
|
|
de4c6b384c | ||
|
|
6dec1ba8af | ||
|
|
9e6788de2f | ||
|
|
1bd7e5c9c4 | ||
|
|
ec75fdddb5 | ||
|
|
f98aafb97c | ||
|
|
f4d2a0daf9 | ||
|
|
de8fb8de90 | ||
|
|
44d137b8f9 | ||
|
|
777c972bdc | ||
|
|
f9efa15781 | ||
|
|
1d1cd679dd | ||
|
|
a9ed4686dd | ||
|
|
5b742eb5b2 | ||
|
|
a3d78f4d0e | ||
|
|
214929e5e5 | ||
|
|
67602b8d85 | ||
|
|
2412edaa3a | ||
|
|
b1584aa2c3 | ||
|
|
a14a416193 | ||
|
|
f3251e9407 | ||
|
|
096885d91f | ||
|
|
368700156c | ||
|
|
81cf50520b | ||
|
|
649748c2d3 | ||
|
|
bf7a708440 | ||
|
|
8faa4d137b | ||
|
|
479bd91b74 | ||
|
|
6bc7f1fca2 | ||
|
|
dadd8e2c50 | ||
|
|
03f342a21c | ||
|
|
7fe5397e21 | ||
|
|
b6e1fd179e | ||
|
|
754c7d8e3b | ||
|
|
925d3ccd1b | ||
|
|
d60d0ac9c5 | ||
|
|
e1b51dd6af | ||
|
|
fbe9d9f128 | ||
|
|
509826949d | ||
|
|
39aaa8a292 | ||
|
|
069c76c53a | ||
|
|
f45c0caa45 | ||
|
|
41b0e10709 | ||
|
|
8e8da20c13 | ||
|
|
269aa39378 | ||
|
|
ae8be97db7 | ||
|
|
f0ad40825b | ||
|
|
36d292747a | ||
|
|
b65d2262bf | ||
|
|
a7ab0c6b36 | ||
|
|
c02fcb6508 | ||
|
|
07c38de44b | ||
|
|
188d62c99b | ||
|
|
76b203ad10 | ||
|
|
909844aef5 | ||
|
|
046202719a | ||
|
|
ed15e2838d | ||
|
|
82466c2e5d | ||
|
|
c598daf350 | ||
|
|
a40421fa1f | ||
|
|
d98b464ce9 | ||
|
|
1d5e3205ac | ||
|
|
07eb17f5d5 | ||
|
|
3951725852 | ||
|
|
77956d69ad | ||
|
|
5784458d03 | ||
|
|
3d2115ff3c | ||
|
|
8618a67e2e | ||
|
|
234b9cafd7 | ||
|
|
4ecd899bac | ||
|
|
ce2c943397 | ||
|
|
51898abb71 | ||
|
|
e2f800dd63 | ||
|
|
d9e5bc9345 | ||
|
|
e42cc101cc | ||
|
|
845367e847 | ||
|
|
90afd3c3ed | ||
|
|
b4aeb04d1b | ||
|
|
65b0d45738 | ||
|
|
3c44388883 | ||
|
|
400f3a9156 | ||
|
|
ad6e837aa5 | ||
|
|
cadd7545c5 | ||
|
|
b41dea9ee1 | ||
|
|
7a6c0ab154 | ||
|
|
1bb1f5ebb3 | ||
|
|
fce5b8430d | ||
|
|
0befa6a491 | ||
|
|
b12ce943f7 | ||
|
|
d23b29aeb1 | ||
|
|
42d48c8da2 | ||
|
|
9e83a5e4d9 | ||
|
|
d2bf940105 | ||
|
|
7d4aca68cc | ||
|
|
d7094909c0 | ||
|
|
7083d55a9b | ||
|
|
770db2fee0 | ||
|
|
b8e65c4f26 | ||
|
|
5cd5186092 | ||
|
|
fa0b66c2dc | ||
|
|
1b199fd2c7 | ||
|
|
2ffbeeef8e | ||
|
|
26ce8b8ab7 | ||
|
|
8e224c4a27 | ||
|
|
cf5318b92b | ||
|
|
e50fa17f7c | ||
|
|
8766e3b408 | ||
|
|
c4c7f06d83 | ||
|
|
413e304845 | ||
|
|
046daf23d0 | ||
|
|
c57947949c | ||
|
|
0acefde805 | ||
|
|
a9e751b4b8 | ||
|
|
3df1ae8ded | ||
|
|
b4a2da0ea8 | ||
|
|
5c5d1e8d0a | ||
|
|
ff0c988a1d | ||
|
|
b9fc8f4b5f | ||
|
|
2ecaa39cb6 | ||
|
|
7b8654339c | ||
|
|
306e252c31 | ||
|
|
87c3bd6293 | ||
|
|
307beebb58 | ||
|
|
4109863aa9 | ||
|
|
0febdbe3a4 | ||
|
|
139dd5302b | ||
|
|
cc907b6530 | ||
|
|
ca1dacf2b6 | ||
|
|
abc1c164cf | ||
|
|
dc801464ef | ||
|
|
99c6fe20c2 | ||
|
|
9d780ae24a | ||
|
|
a44dec0402 | ||
|
|
a081152baa | ||
|
|
9b50d48f46 | ||
|
|
5121fc6b1f | ||
|
|
d4ac261e85 | ||
|
|
2e9561371d | ||
|
|
942fd3c4ce | ||
|
|
8cf32752e9 | ||
|
|
b240ca9939 | ||
|
|
e25d99129c | ||
|
|
1fee47e087 | ||
|
|
e835b31277 | ||
|
|
6817945e12 | ||
|
|
030fb1262e | ||
|
|
fae49096f3 | ||
|
|
afd491ecea | ||
|
|
09bc100ad9 | ||
|
|
037f18ac56 | ||
|
|
a5746dfa21 | ||
|
|
cedc5108fc | ||
|
|
65af3d0f54 | ||
|
|
6c4fa65f91 | ||
|
|
4731ad8061 | ||
|
|
7dc41e15d3 | ||
|
|
8326539d40 | ||
|
|
163e6e0f2a | ||
|
|
f56bb251e9 | ||
|
|
152ca99276 | ||
|
|
7c398d2c67 | ||
|
|
a526c942ca | ||
|
|
af8fd15929 | ||
|
|
7bfd5d4bc8 | ||
|
|
4382d5c56d | ||
|
|
f43b9c96de | ||
|
|
c64f72e394 | ||
|
|
3d54f832c5 | ||
|
|
867ba24c6c | ||
|
|
9715c5394c | ||
|
|
67b5c72520 | ||
|
|
43450f6cc7 | ||
|
|
a3737d4f35 | ||
|
|
3314e94a9a | ||
|
|
a27436b086 | ||
|
|
fe5554ffb1 | ||
|
|
f305f8d822 | ||
|
|
1f54bc41cc | ||
|
|
c82d028429 | ||
|
|
be2a8b7b07 | ||
|
|
261fc82016 | ||
|
|
37b940f3a5 | ||
|
|
0504e904a2 | ||
|
|
71bfdd9bfd | ||
|
|
c7305f6b06 | ||
|
|
4fb07ff181 | ||
|
|
4631dcf857 | ||
|
|
f6f9840eb7 | ||
|
|
4de8165c95 | ||
|
|
242672f49d | ||
|
|
c32c975a71 | ||
|
|
82e759d708 | ||
|
|
9de44d2605 | ||
|
|
132d0cf578 | ||
|
|
029dc9f8d9 | ||
|
|
5567b1dad8 | ||
|
|
ea00ec64af | ||
|
|
7259e6be0a | ||
|
|
2e40557b39 | ||
|
|
e68fc7c558 | ||
|
|
055dfb000d | ||
|
|
b997ab6e3f | ||
|
|
25f31d0bb8 | ||
|
|
4cfd8a7e2c | ||
|
|
0ec19a8fee | ||
|
|
2749563f5d | ||
|
|
e7e2e3f7e0 | ||
|
|
0a33c0aac5 | ||
|
|
24e09fd2d9 | ||
|
|
4d0499a61e | ||
|
|
ae82807139 | ||
|
|
65147e1935 | ||
|
|
8e557d122b | ||
|
|
486b19aa90 | ||
|
|
14cb34ac95 | ||
|
|
abfc23b04d | ||
|
|
ebb24aefa1 | ||
|
|
2573f46f40 | ||
|
|
5dcb8cd73a | ||
|
|
e4bfe09882 | ||
|
|
eecbfe04db | ||
|
|
671e2adc32 | ||
|
|
1137e476dd | ||
|
|
cb63b321d0 | ||
|
|
c36b0d2975 | ||
|
|
f8ad562b95 | ||
|
|
c35ab38f36 | ||
|
|
073b775566 | ||
|
|
85c7a7db8d | ||
|
|
1e134df27d | ||
|
|
bdff84885a | ||
|
|
f1a9c3722c | ||
|
|
8b402f6423 | ||
|
|
a0aec52661 | ||
|
|
407ab43dd1 | ||
|
|
c2165e0196 | ||
|
|
2e75bc3f3b | ||
|
|
e91c2ca427 | ||
|
|
965ff04bcc | ||
|
|
ac4bd418f3 | ||
|
|
e9e844c1f7 | ||
|
|
aa2941fcdb | ||
|
|
dbc909a317 | ||
|
|
11465a4ce9 | ||
|
|
f5007f94dc | ||
|
|
d18ac2e6eb | ||
|
|
b9fc5c39ae | ||
|
|
9dc2278083 | ||
|
|
281060a972 | ||
|
|
91626f079d | ||
|
|
7305c6c54b | ||
|
|
bce7fa871d | ||
|
|
a35fd80763 | ||
|
|
b383f9dfbc | ||
|
|
680ad3c145 | ||
|
|
7b712e7f90 | ||
|
|
2462eac497 | ||
|
|
bb818c8942 | ||
|
|
ddc881af11 | ||
|
|
838fba9173 | ||
|
|
0b6f326c18 | ||
|
|
00895fc7ab | ||
|
|
07f38aa283 | ||
|
|
ecf1d3790c | ||
|
|
53c9e5bb4a | ||
|
|
b20b03113a | ||
|
|
ec8273aa9f | ||
|
|
2862f0dfae | ||
|
|
fd4963c74b | ||
|
|
df99ef4481 | ||
|
|
35d1057673 | ||
|
|
e6a90a18c4 | ||
|
|
26afb69a14 | ||
|
|
e8c0c43e9d | ||
|
|
1707f333bf |
No files matched your search
@@ -0,0 +1,2 @@
|
||||
github: lucko
|
||||
patreon: luckdev
|
||||
@@ -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
|
||||
+23
-110
@@ -1,40 +1,14 @@
|
||||
# Created by https://www.gitignore.io/
|
||||
|
||||
### Intellij ###
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# User-specific stuff:
|
||||
.idea/
|
||||
*.iws
|
||||
/out/
|
||||
### Gradle & IntelliJ ###
|
||||
.gradle/
|
||||
/.idea/
|
||||
build/
|
||||
out/
|
||||
run/
|
||||
*.iml
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
|
||||
### Maven ###
|
||||
target/
|
||||
pom.xml.tag
|
||||
pom.xml.releaseBackup
|
||||
pom.xml.versionsBackup
|
||||
pom.xml.next
|
||||
release.properties
|
||||
dependency-reduced-pom.xml
|
||||
buildNumber.properties
|
||||
.mvn/timing.properties
|
||||
|
||||
|
||||
### Eclipse ###
|
||||
|
||||
.metadata
|
||||
bin/
|
||||
tmp/
|
||||
@@ -46,73 +20,29 @@ local.properties
|
||||
.settings/
|
||||
.loadpath
|
||||
.recommenders
|
||||
|
||||
# Eclipse Core
|
||||
.project
|
||||
|
||||
# External tool builders
|
||||
.externalToolBuilders/
|
||||
|
||||
# Locally stored "Eclipse launch configurations"
|
||||
*.launch
|
||||
|
||||
# PyDev specific (Python IDE for Eclipse)
|
||||
*.pydevproject
|
||||
|
||||
# CDT-specific (C/C++ Development Tooling)
|
||||
.cproject
|
||||
|
||||
# JDT-specific (Eclipse Java Development Tools)
|
||||
.classpath
|
||||
|
||||
# Java annotation processor (APT)
|
||||
.factorypath
|
||||
|
||||
# PDT-specific (PHP Development Tools)
|
||||
.buildpath
|
||||
|
||||
# sbteclipse plugin
|
||||
.target
|
||||
|
||||
# Tern plugin
|
||||
.tern-project
|
||||
|
||||
# TeXlipse plugin
|
||||
.texlipse
|
||||
|
||||
# STS (Spring Tool Suite)
|
||||
.springBeans
|
||||
|
||||
# Code Recommenders
|
||||
.recommenders/
|
||||
.apt_generated/
|
||||
.project
|
||||
.classpath
|
||||
|
||||
|
||||
### Linux ###
|
||||
*~
|
||||
|
||||
# temporary files which can be created if a process still has a handle open of a deleted file
|
||||
.fuse_hidden*
|
||||
|
||||
# KDE directory preferences
|
||||
.directory
|
||||
|
||||
# Linux trash folder which might appear on any partition or disk
|
||||
.Trash-*
|
||||
|
||||
# .nfs files are created when an open file is removed but is still being accessed
|
||||
.nfs*
|
||||
|
||||
|
||||
### macOS ###
|
||||
*.DS_Store
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
# Thumbnails
|
||||
._*
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
@@ -120,7 +50,6 @@ Icon
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
@@ -128,37 +57,21 @@ Temporary Items
|
||||
.apdisk
|
||||
|
||||
|
||||
### NetBeans ###
|
||||
nbproject/private/
|
||||
build/
|
||||
nbbuild/
|
||||
dist/
|
||||
nbdist/
|
||||
.nb-gradle/
|
||||
|
||||
|
||||
### Windows ###
|
||||
# Windows image file caches
|
||||
# Windows thumbnail cache files
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
ehthumbs_vista.db
|
||||
*.stackdump
|
||||
[Dd]esktop.ini
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
|
||||
|
||||
### Java ###
|
||||
*.class
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.ear
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
@@ -0,0 +1,26 @@
|
||||
### :speech_balloon: Looking for support?
|
||||
|
||||
Details about support for the project can be found [here, on the Wiki Homepage](https://luckperms.net/wiki/Home#support).
|
||||
|
||||
### :bug: Reporting bugs?
|
||||
|
||||
Before reporting a bug or issue, please make sure that the issue is actually being caused by or related to LuckPerms. We get a lot of reports which are caused by other software - please double check!
|
||||
|
||||
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).
|
||||
|
||||
### :pencil: Want to contribute code?
|
||||
#### Pull Requests
|
||||
If you make any changes or improvements to the plugin which you think would be beneficial to others, please consider making a pull request to merge your changes back into the upstream project. (especially if your changes are bug fixes!)
|
||||
|
||||
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 impact on the maintainability of the project, and require more consideration.
|
||||
|
||||
#### Project Layout
|
||||
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 & Fabric** - Each use the common module to implement plugins on the respective server platforms.
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
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.
|
||||
+3
-2
@@ -1,6 +1,7 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
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
|
||||
@@ -18,4 +19,4 @@ 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.
|
||||
SOFTWARE.
|
||||
@@ -1,44 +1,53 @@
|
||||

|
||||
# LuckPerms [](https://ci.lucko.me/job/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
|
||||
[](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)
|
||||
|
||||
LuckPerms also includes an extensive API for developers, and support for a variety of Minecraft server software & data storage options.
|
||||
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.
|
||||
|
||||
[See the charts below](https://github.com/lucko/LuckPerms#luckperms-vs-other-plugins) for a partial list of features & comparison with other providers.
|
||||
The latest downloads, wiki & other useful links can be found on the project homepage at [luckperms.net](https://luckperms.net/).
|
||||
|
||||
* [Spigot Plugin Release Page](https://www.spigotmc.org/resources/luckperms-an-advanced-permissions-system.28140/ "Spigot Plugin Page")
|
||||
* [Sponge Plugin Release Page](https://forums.spongepowered.org/t/luckperms-an-advanced-permissions-system/14274 "Sponge Plugin Page")
|
||||
It is:
|
||||
|
||||
## Useful Links
|
||||
* **Development Builds** - <https://ci.lucko.me/job/LuckPerms>
|
||||
* **Javadocs** - <https://jd.lucko.me/LuckPerms>
|
||||
* **Wiki** - <https://github.com/lucko/LuckPerms/wiki>
|
||||
* **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.
|
||||
|
||||
For more information, see the wiki article on [Why LuckPerms?](https://luckperms.net/wiki/Why-LuckPerms)
|
||||
|
||||
## Building
|
||||
LuckPerms uses Maven to handle dependencies.
|
||||
LuckPerms uses Gradle to handle dependencies & building.
|
||||
|
||||
#### Requirements
|
||||
* Maven 3.3.x (the older versions will not work.)
|
||||
* Java 8 JDK or newer
|
||||
* Git
|
||||
|
||||
#### Then run
|
||||
#### Compiling from source
|
||||
```sh
|
||||
git clone https://github.com/lucko/LuckPerms.git
|
||||
mvn clean package
|
||||
cd LuckPerms/
|
||||
./gradlew build
|
||||
```
|
||||
|
||||
You can find the output jars in the `loader/build/libs` or `build/libs` directories.
|
||||
|
||||
## Contributing
|
||||
#### Pull Requests
|
||||
If you make any changes or improvements to the plugin which you think would be beneficial to others, please consider making a pull request to merge your changes back into the upstream project. (especially if your changes are bug fixes!)
|
||||
|
||||
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.
|
||||
|
||||
#### Project Layout
|
||||
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, Fabric, Nukkit & 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 vs Other Plugins
|
||||
### Bukkit
|
||||

|
||||
###### _Features checked on 23rd Aug 2016. If you find any inaccuracies, please let me know._
|
||||
### Sponge
|
||||

|
||||
###### _Features checked on 8th Oct 2016. If you find any inaccuracies, please let me know._
|
||||
|
||||
## Thanks
|
||||
[](http://www.ej-technologies.com/products/jprofiler/overview.html)
|
||||
|
||||
Thanks to ej-technologies for granting LuckPerms an open source licence to their [Java Profiling Software](http://www.ej-technologies.com/products/jprofiler/overview.html "Java Profiler").
|
||||
@@ -0,0 +1,116 @@
|
||||
group = 'net.luckperms'
|
||||
project.version = '5.3'
|
||||
|
||||
dependencies {
|
||||
compileOnly 'org.checkerframework:checker-qual:3.12.0'
|
||||
compileOnly 'org.jetbrains:annotations:20.1.0'
|
||||
}
|
||||
|
||||
// Only used occasionally for deployment - not needed for normal builds.
|
||||
/*
|
||||
if (project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePassword')) {
|
||||
apply plugin: 'signing'
|
||||
|
||||
javadoc {
|
||||
title = 'LuckPerms API (v' + project.ext.apiVersion + ')'
|
||||
options.overview = 'javadoc/overview.html'
|
||||
options.encoding = 'UTF-8'
|
||||
options.charSet = 'UTF-8'
|
||||
options.links(
|
||||
'https://checkerframework.org/api/',
|
||||
'https://javadoc.io/static/org.jetbrains/annotations/20.1.0/'
|
||||
)
|
||||
options.addStringOption('Xdoclint:none', '-quiet')
|
||||
|
||||
if (JavaVersion.current() > JavaVersion.VERSION_1_8) {
|
||||
options.addBooleanOption('-no-module-directories', true)
|
||||
options.links.add('https://docs.oracle.com/en/java/javase/11/docs/api/')
|
||||
} else {
|
||||
options.links.add('https://docs.oracle.com/javase/8/docs/api/')
|
||||
}
|
||||
}
|
||||
|
||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||
classifier 'javadoc'
|
||||
from javadoc.destinationDir
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
classifier 'sources'
|
||||
from sourceSets.main.allSource
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives javadocJar
|
||||
archives sourcesJar
|
||||
}
|
||||
|
||||
signing {
|
||||
useGpgCmd()
|
||||
sign configurations.archives
|
||||
}
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
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
|
||||
|
||||
credentials {
|
||||
username sonatypeUsername
|
||||
password sonatypePassword
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
artifactId = 'api'
|
||||
|
||||
from components.java
|
||||
artifact sourcesJar
|
||||
artifact javadocJar
|
||||
|
||||
pom {
|
||||
name 'LuckPerms API'
|
||||
description 'A permissions plugin for Minecraft servers.'
|
||||
url 'https://luckperms.net'
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name 'MIT'
|
||||
url 'https://opensource.org/licenses/MIT'
|
||||
}
|
||||
}
|
||||
|
||||
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'
|
||||
}
|
||||
|
||||
ciManagement {
|
||||
system 'Jenkins'
|
||||
url 'https://ci.lucko.me/job/LuckPerms'
|
||||
}
|
||||
|
||||
issueManagement {
|
||||
system 'GitHub'
|
||||
url 'https://github.com/lucko/LuckPerms/issues'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -0,0 +1,19 @@
|
||||
<body>
|
||||
<p>
|
||||
LuckPerms is a permissions plugin for Minecraft servers. It allows server admins to control what
|
||||
features players can use by creating groups and assigning permissions.
|
||||
</p>
|
||||
<h4>Useful Links</h4>
|
||||
<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>
|
||||
</ul>
|
||||
<h4>Maven</h4>
|
||||
<p>
|
||||
The API artifact is deployed to Maven Central under
|
||||
<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>
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>luckperms</artifactId>
|
||||
<groupId>me.lucko.luckperms</groupId>
|
||||
<version>3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>luckperms-api</artifactId>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<!-- guava -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>19.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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 me.lucko.luckperms;
|
||||
|
||||
import me.lucko.luckperms.api.LuckPermsApi;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Singleton for the {@link LuckPermsApi}.
|
||||
*
|
||||
* <p> Ideally, the ServiceManager for the platform should be used to obtain and cache an instance, however, this can be
|
||||
* used if you need static access.
|
||||
*/
|
||||
public final class LuckPerms {
|
||||
private static LuckPermsApi api = null;
|
||||
|
||||
/**
|
||||
* Gets an instance of {@link LuckPermsApi}, throwing {@link IllegalStateException} if the API is not loaded.
|
||||
*
|
||||
* @return an api instance
|
||||
* @throws IllegalStateException if the api is not loaded
|
||||
*/
|
||||
public static LuckPermsApi getApi() {
|
||||
if (api == null) {
|
||||
throw new IllegalStateException("API is not loaded.");
|
||||
}
|
||||
return api;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an instance of {@link LuckPermsApi} safely.
|
||||
*
|
||||
* <p> Unlike {@link LuckPerms#getApi}, this method will not throw an {@link IllegalStateException} if the API is
|
||||
* not loaded, rather return an empty {@link Optional}.
|
||||
*
|
||||
* @return an optional api instance
|
||||
*/
|
||||
public static Optional<LuckPermsApi> getApiSafe() {
|
||||
return Optional.ofNullable(api);
|
||||
}
|
||||
|
||||
static void registerProvider(LuckPermsApi luckPermsApi) {
|
||||
api = luckPermsApi;
|
||||
}
|
||||
|
||||
static void unregisterProvider() {
|
||||
api = null;
|
||||
}
|
||||
|
||||
private LuckPerms() {
|
||||
throw new UnsupportedOperationException("This class cannot be instantiated.");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,227 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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 me.lucko.luckperms.api;
|
||||
|
||||
import me.lucko.luckperms.api.context.ContextSet;
|
||||
|
||||
/**
|
||||
* Context and options for a permission lookup.
|
||||
*
|
||||
* <p> All values are immutable.
|
||||
*
|
||||
* @since 2.11
|
||||
*/
|
||||
public class Contexts {
|
||||
public static final String SERVER_KEY = "server";
|
||||
public static final String WORLD_KEY = "world";
|
||||
private static final Contexts ALLOW_ALL = new Contexts(ContextSet.empty(), true, true, true, true, true, true);
|
||||
|
||||
/**
|
||||
* Gets a context that will allow all nodes
|
||||
*
|
||||
* @return a context that will not apply any filters
|
||||
*/
|
||||
public static Contexts allowAll() {
|
||||
return ALLOW_ALL;
|
||||
}
|
||||
|
||||
public static Contexts of(ContextSet context, boolean includeGlobal, boolean includeGlobalWorld, boolean applyGroups, boolean applyGlobalGroups, boolean applyGlobalWorldGroups, boolean op) {
|
||||
return new Contexts(context, includeGlobal, includeGlobalWorld, applyGroups, applyGlobalGroups, applyGlobalWorldGroups, op);
|
||||
}
|
||||
|
||||
/**
|
||||
* The contexts that apply for this lookup
|
||||
* The keys for servers and worlds are defined as static values.
|
||||
*/
|
||||
private final ContextSet context;
|
||||
|
||||
/**
|
||||
* The mode to parse defaults on Bukkit
|
||||
*
|
||||
* @since 2.12
|
||||
*/
|
||||
private final boolean op;
|
||||
|
||||
/**
|
||||
* If global or non server specific nodes should be applied
|
||||
*/
|
||||
private final boolean includeGlobal;
|
||||
|
||||
/**
|
||||
* If global or non world specific nodes should be applied
|
||||
*/
|
||||
private final boolean includeGlobalWorld;
|
||||
|
||||
/**
|
||||
* If parent groups should be applied
|
||||
*/
|
||||
private final boolean applyGroups;
|
||||
|
||||
/**
|
||||
* If global or non server specific group memberships should be applied
|
||||
*/
|
||||
private final boolean applyGlobalGroups;
|
||||
|
||||
/**
|
||||
* If global or non world specific group memberships should be applied
|
||||
*/
|
||||
private final boolean applyGlobalWorldGroups;
|
||||
|
||||
public Contexts(ContextSet context, boolean includeGlobal, boolean includeGlobalWorld, boolean applyGroups, boolean applyGlobalGroups, boolean applyGlobalWorldGroups, boolean op) {
|
||||
if (context == null) {
|
||||
throw new NullPointerException("context");
|
||||
}
|
||||
|
||||
this.context = context.makeImmutable();
|
||||
this.includeGlobal = includeGlobal;
|
||||
this.includeGlobalWorld = includeGlobalWorld;
|
||||
this.applyGroups = applyGroups;
|
||||
this.applyGlobalGroups = applyGlobalGroups;
|
||||
this.applyGlobalWorldGroups = applyGlobalWorldGroups;
|
||||
this.op = op;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the contexts that apply for this lookup
|
||||
*
|
||||
* @return an immutable set of context key value pairs
|
||||
* @since 2.13
|
||||
*/
|
||||
public ContextSet getContexts() {
|
||||
return this.context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets if OP defaults should be included
|
||||
*
|
||||
* @return true if op defaults should be included
|
||||
*/
|
||||
public boolean isOp() {
|
||||
return this.op;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets if global or non server specific nodes should be applied
|
||||
*
|
||||
* @return true if global or non server specific nodes should be applied
|
||||
*/
|
||||
public boolean isIncludeGlobal() {
|
||||
return this.includeGlobal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets if global or non world specific nodes should be applied
|
||||
*
|
||||
* @return true if global or non world specific nodes should be applied
|
||||
*/
|
||||
public boolean isIncludeGlobalWorld() {
|
||||
return this.includeGlobalWorld;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets if parent groups should be applied
|
||||
*
|
||||
* @return true if parent groups should be applied
|
||||
*/
|
||||
public boolean isApplyGroups() {
|
||||
return this.applyGroups;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets if global or non server specific group memberships should be applied
|
||||
*
|
||||
* @return true if global or non server specific group memberships should be applied
|
||||
*/
|
||||
public boolean isApplyGlobalGroups() {
|
||||
return this.applyGlobalGroups;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets if global or non world specific group memberships should be applied
|
||||
*
|
||||
* @return true if global or non world specific group memberships should be applied
|
||||
*/
|
||||
public boolean isApplyGlobalWorldGroups() {
|
||||
return this.applyGlobalWorldGroups;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Contexts(" +
|
||||
"context=" + this.getContexts() + ", " +
|
||||
"op=" + this.isOp() + ", " +
|
||||
"includeGlobal=" + this.isIncludeGlobal() + ", " +
|
||||
"includeGlobalWorld=" + this.isIncludeGlobalWorld() + ", " +
|
||||
"applyGroups=" + this.isApplyGroups() + ", " +
|
||||
"applyGlobalGroups=" + this.isApplyGlobalGroups() + ", " +
|
||||
"applyGlobalWorldGroups=" + this.isApplyGlobalWorldGroups() +
|
||||
")";
|
||||
}
|
||||
|
||||
/*
|
||||
* Ugly auto-generated lombok code
|
||||
*/
|
||||
|
||||
/**
|
||||
* Check for equality
|
||||
*
|
||||
* @param o the other
|
||||
* @return true if equal
|
||||
* @since 2.12
|
||||
*/
|
||||
public boolean equals(Object o) {
|
||||
if (o == this) return true;
|
||||
if (!(o instanceof Contexts)) return false;
|
||||
final Contexts other = (Contexts) o;
|
||||
final Object this$context = this.getContexts();
|
||||
final Object other$context = other.getContexts();
|
||||
if (this$context == null ? other$context != null : !this$context.equals(other$context)) return false;
|
||||
if (this.isOp() != other.isOp()) return false;
|
||||
if (this.isIncludeGlobal() != other.isIncludeGlobal()) return false;
|
||||
if (this.isIncludeGlobalWorld() != other.isIncludeGlobalWorld()) return false;
|
||||
if (this.isApplyGroups() != other.isApplyGroups()) return false;
|
||||
if (this.isApplyGlobalGroups() != other.isApplyGlobalGroups()) return false;
|
||||
if (this.isApplyGlobalWorldGroups() != other.isApplyGlobalWorldGroups()) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hashcode
|
||||
*
|
||||
* @return the hashcode
|
||||
* @since 2.12
|
||||
*/
|
||||
public int hashCode() {
|
||||
final int PRIME = 59;
|
||||
int result = 1;
|
||||
final Object $context = this.getContexts();
|
||||
result = result * PRIME + ($context == null ? 43 : $context.hashCode());
|
||||
result = result * PRIME + (this.isOp() ? 79 : 97);
|
||||
result = result * PRIME + (this.isIncludeGlobal() ? 79 : 97);
|
||||
result = result * PRIME + (this.isIncludeGlobalWorld() ? 79 : 97);
|
||||
result = result * PRIME + (this.isApplyGroups() ? 79 : 97);
|
||||
result = result * PRIME + (this.isApplyGlobalGroups() ? 79 : 97);
|
||||
result = result * PRIME + (this.isApplyGlobalWorldGroups() ? 79 : 97);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,262 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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 me.lucko.luckperms.api;
|
||||
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.OptionalInt;
|
||||
|
||||
/**
|
||||
* A group which holds permission data.
|
||||
*/
|
||||
public interface Group extends PermissionHolder {
|
||||
|
||||
/**
|
||||
* Get the name of the group
|
||||
*
|
||||
* @return the name of the group
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Check to see if a group inherits a group
|
||||
*
|
||||
* @param group The group to check membership of
|
||||
* @return true if the group inherits the other group
|
||||
* @throws NullPointerException if the group is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
*/
|
||||
boolean inheritsGroup(Group group);
|
||||
|
||||
/**
|
||||
* Check to see if the group inherits a group on a specific server
|
||||
*
|
||||
* @param group The group to check membership of
|
||||
* @param server The server to check on
|
||||
* @return true if the group inherits the group on the server
|
||||
* @throws NullPointerException if the group or server is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
* @throws IllegalArgumentException if the server is invalid
|
||||
*/
|
||||
boolean inheritsGroup(Group group, String server);
|
||||
|
||||
/**
|
||||
* Check to see if the group inherits a group on a specific server and world
|
||||
*
|
||||
* @param group The group to check membership of
|
||||
* @param server The server to check on
|
||||
* @param world The world to check on
|
||||
* @return true if the group inherits the group on the server and world
|
||||
* @throws NullPointerException if the group, server or world is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
* @throws IllegalArgumentException if the server or world is invalid
|
||||
*/
|
||||
boolean inheritsGroup(Group group, String server, String world);
|
||||
|
||||
/**
|
||||
* Make this group inherit another group
|
||||
*
|
||||
* @param group the group to be inherited
|
||||
* @throws ObjectAlreadyHasException if the group already inherits the group
|
||||
* @throws NullPointerException if the group is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
*/
|
||||
void setInheritGroup(Group group) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Make this group inherit another group on a specific server
|
||||
*
|
||||
* @param group the group to be inherited
|
||||
* @param server The server to inherit the group on
|
||||
* @throws ObjectAlreadyHasException if the group already inherits the group on that server
|
||||
* @throws NullPointerException if the group or server is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
* @throws IllegalArgumentException if the server is invalid
|
||||
*/
|
||||
void setInheritGroup(Group group, String server) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Make this group inherit another group on a specific server and world
|
||||
*
|
||||
* @param group the group to be inherited
|
||||
* @param server The server to inherit the group on
|
||||
* @param world The world to inherit the group on
|
||||
* @throws ObjectAlreadyHasException if the group already inherits the group on that server and world
|
||||
* @throws NullPointerException if the group, server or world is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
* @throws IllegalArgumentException if the server or world is invalid
|
||||
*/
|
||||
void setInheritGroup(Group group, String server, String world) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Make this group inherit another group temporarily
|
||||
*
|
||||
* @param group the group to be inherited
|
||||
* @param expireAt the unix time when the group should expire
|
||||
* @throws ObjectAlreadyHasException if the group already inherits the group temporarily
|
||||
* @throws NullPointerException if the group is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
* @throws IllegalArgumentException if the expiry time is in the past
|
||||
*/
|
||||
void setInheritGroup(Group group, long expireAt) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Make this group inherit another group on a specific server temporarily
|
||||
*
|
||||
* @param group the group to be inherited
|
||||
* @param server The server inherit add the group on
|
||||
* @param expireAt when the group should expire
|
||||
* @throws ObjectAlreadyHasException if the group already inherits the group on that server temporarily
|
||||
* @throws NullPointerException if the group or server is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
* @throws IllegalArgumentException if the expiry time is in the past or the server is invalid
|
||||
*/
|
||||
void setInheritGroup(Group group, String server, long expireAt) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Make this group inherit another group on a specific server and world temporarily
|
||||
*
|
||||
* @param group the group to be inherited
|
||||
* @param server The server to inherit the group on
|
||||
* @param world The world to inherit the group on
|
||||
* @param expireAt when the group should expire
|
||||
* @throws ObjectAlreadyHasException if the group already inherits the group on that server and world temporarily
|
||||
* @throws NullPointerException if the group, server or world is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
* @throws IllegalArgumentException if the expiry time is in the past or the server/world is invalid
|
||||
*/
|
||||
void setInheritGroup(Group group, String server, String world, long expireAt) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Remove a previously set inheritance rule
|
||||
*
|
||||
* @param group the group to uninherit
|
||||
* @throws ObjectLacksException if the group does not already inherit the group
|
||||
* @throws NullPointerException if the group is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
*/
|
||||
void unsetInheritGroup(Group group) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Remove a previously set inheritance rule
|
||||
*
|
||||
* @param group the group to uninherit
|
||||
* @param temporary if the group being removed is temporary
|
||||
* @throws ObjectLacksException if the group does not already inherit the group
|
||||
* @throws NullPointerException if the group is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
*/
|
||||
void unsetInheritGroup(Group group, boolean temporary) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Remove a previously set inheritance rule on a specific server
|
||||
*
|
||||
* @param group the group to uninherit
|
||||
* @param server The server to remove the group on
|
||||
* @throws ObjectLacksException if the group does not already inherit the group on that server
|
||||
* @throws NullPointerException if the group or server is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
* @throws IllegalArgumentException if the server is invalid
|
||||
*/
|
||||
void unsetInheritGroup(Group group, String server) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Remove a previously set inheritance rule on a specific server and world
|
||||
*
|
||||
* @param group the group to uninherit
|
||||
* @param server The server to remove the group on
|
||||
* @param world The world to remove the group on
|
||||
* @throws ObjectLacksException if the group does not already inherit the group
|
||||
* @throws NullPointerException if the group, server or world is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
* @throws IllegalArgumentException if the server or world is invalid
|
||||
*/
|
||||
void unsetInheritGroup(Group group, String server, String world) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Remove a previously set inheritance rule on a specific server
|
||||
*
|
||||
* @param group the group to uninherit
|
||||
* @param server The server to remove the group on
|
||||
* @param temporary if the group being removed is temporary
|
||||
* @throws ObjectLacksException if the group does not already inherit the group
|
||||
* @throws NullPointerException if the group or server is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
* @throws IllegalArgumentException if the expiry time is in the past or the server is invalid
|
||||
*/
|
||||
void unsetInheritGroup(Group group, String server, boolean temporary) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Remove a previously set inheritance rule on a specific server and world
|
||||
*
|
||||
* @param group the group to uninherit
|
||||
* @param server The server to remove the group on
|
||||
* @param world The world to remove the group on
|
||||
* @param temporary if the group being removed was set temporarily
|
||||
* @throws ObjectLacksException if the group does not already inherit the group
|
||||
* @throws NullPointerException if the group, server or world is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
* @throws IllegalArgumentException if the expiry time is in the past or the server/world is invalid
|
||||
*/
|
||||
void unsetInheritGroup(Group group, String server, String world, boolean temporary) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Get a {@link List} of all of the groups the group inherits, on all servers
|
||||
*
|
||||
* @return a {@link List} of group names
|
||||
*/
|
||||
List<String> getGroupNames();
|
||||
|
||||
/**
|
||||
* Get a {@link List} of the groups the group inherits on a specific server
|
||||
*
|
||||
* @param server the server to check
|
||||
* @return a {@link List} of group names
|
||||
* @throws NullPointerException if the server is null
|
||||
* @throws IllegalArgumentException if the server is invalid
|
||||
*/
|
||||
List<String> getLocalGroups(String server);
|
||||
|
||||
|
||||
/**
|
||||
* Get a {@link List} of the groups the group inherits on a specific server and world
|
||||
*
|
||||
* @param server the server to check
|
||||
* @param world the world to check
|
||||
* @return a {@link List} of group names
|
||||
* @throws NullPointerException if the server or world is null
|
||||
* @throws IllegalArgumentException if the server or world is invalid
|
||||
*/
|
||||
List<String> getLocalGroups(String server, String world);
|
||||
|
||||
/**
|
||||
* Gets the weight of this group, is present.
|
||||
*
|
||||
* @return the group weight
|
||||
* @since 2.17
|
||||
*/
|
||||
OptionalInt getWeight();
|
||||
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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 me.lucko.luckperms.api;
|
||||
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.OptionalLong;
|
||||
|
||||
/**
|
||||
* A relationship between a Holder and a permission
|
||||
*
|
||||
* @param <T> the identifier type of the holder
|
||||
* @since 2.17
|
||||
*/
|
||||
public interface HeldPermission<T> {
|
||||
|
||||
/**
|
||||
* Gets the holder of the permission
|
||||
*
|
||||
* @return the holder
|
||||
*/
|
||||
T getHolder();
|
||||
|
||||
/**
|
||||
* Gets the permission being held
|
||||
*
|
||||
* @return the permission
|
||||
*/
|
||||
String getPermission();
|
||||
|
||||
/**
|
||||
* Gets the value of the permission
|
||||
*
|
||||
* @return the value
|
||||
*/
|
||||
boolean getValue();
|
||||
|
||||
/**
|
||||
* Gets the server where the permission is held
|
||||
*
|
||||
* @return the server
|
||||
*/
|
||||
Optional<String> getServer();
|
||||
|
||||
/**
|
||||
* Gets the world where the permission is held
|
||||
*
|
||||
* @return the world
|
||||
*/
|
||||
Optional<String> getWorld();
|
||||
|
||||
/**
|
||||
* Gets the time in unix time when the permission will expire
|
||||
*
|
||||
* @return the expiry time
|
||||
*/
|
||||
OptionalLong getExpiry();
|
||||
|
||||
/**
|
||||
* Gets the context for the permission.
|
||||
*
|
||||
* @return the context
|
||||
*/
|
||||
Multimap<String, String> getContext();
|
||||
|
||||
/**
|
||||
* Converts this permission into a Node
|
||||
*
|
||||
* @return a Node copy of this permission
|
||||
*/
|
||||
Node asNode();
|
||||
|
||||
}
|
||||
@@ -1,166 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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 me.lucko.luckperms.api;
|
||||
|
||||
import me.lucko.luckperms.api.data.DatastoreConfiguration;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Read-only access to the LuckPerms configuration settings
|
||||
*/
|
||||
public interface LPConfiguration {
|
||||
|
||||
/**
|
||||
* Returns the name of this server
|
||||
* @return the name of this server
|
||||
*/
|
||||
String getServer();
|
||||
|
||||
/**
|
||||
* Returns how often a sync task will run in minutes
|
||||
* @return how often a sync task will run in minutes
|
||||
*/
|
||||
int getSyncTime();
|
||||
|
||||
/**
|
||||
* Returns if the users on this server will have their global permissions applied
|
||||
* @return if the users on this server will have their global permissions applied
|
||||
*/
|
||||
boolean getIncludeGlobalPerms();
|
||||
|
||||
/**
|
||||
* Returns if the users on this server will have their global world permissions applied
|
||||
* @return if the users on this server will have their global world permissions applied
|
||||
* @since 2.9
|
||||
*/
|
||||
boolean getIncludeGlobalWorldPerms();
|
||||
|
||||
/**
|
||||
* Returns true if the platform is applying global groups
|
||||
* @return true if the platform is applying global groups
|
||||
* @since 2.9
|
||||
*/
|
||||
boolean getApplyGlobalGroups();
|
||||
|
||||
/**
|
||||
* Returns true if the platform is applying global world groups
|
||||
* @return true if the platform is applying global world groups
|
||||
* @since 2.9
|
||||
*/
|
||||
boolean getApplyGlobalWorldGroups();
|
||||
|
||||
/**
|
||||
* Returns the online mode setting
|
||||
* @return the online mode setting
|
||||
*/
|
||||
boolean getOnlineMode();
|
||||
|
||||
/**
|
||||
* Returns if LuckPerms is applying wildcard permissions
|
||||
* @return if LuckPerms is applying wildcard permissions
|
||||
*/
|
||||
boolean getApplyWildcards();
|
||||
|
||||
/**
|
||||
* Returns if LuckPerms is resolving and applying regex permissions
|
||||
* @return if LuckPerms is resolving and applying regex permissions
|
||||
*/
|
||||
boolean getApplyRegex();
|
||||
|
||||
/**
|
||||
* Returns if LuckPerms is expanding shorthand permissions
|
||||
* @return if LuckPerms is expanding shorthand permissions
|
||||
*/
|
||||
boolean getApplyShorthand();
|
||||
|
||||
/**
|
||||
* Returns if LuckPerms will send notifications to users when permissions are modified
|
||||
* @return if LuckPerms will send notifications to users when permissions are modified
|
||||
* @since 2.7
|
||||
*/
|
||||
boolean getLogNotify();
|
||||
|
||||
/**
|
||||
* Returns true if the vanilla op system is enabled
|
||||
* @return true if the vanilla op system is enabled
|
||||
* @since 2.8
|
||||
*/
|
||||
boolean getEnableOps();
|
||||
|
||||
/**
|
||||
* Returns true if opped players are allowed to use LuckPerms commands
|
||||
* @return true if opped players are allowed to use LuckPerms commands
|
||||
* @since 2.8
|
||||
*/
|
||||
boolean getCommandsAllowOp();
|
||||
|
||||
/**
|
||||
* Returns true if auto op is enabled
|
||||
* @return true if auto op is enabled
|
||||
* @since 2.9
|
||||
*/
|
||||
boolean getAutoOp();
|
||||
|
||||
/**
|
||||
* Returns the name of the server used within Vault operations
|
||||
* @return the name of the server used within Vault operations
|
||||
* @since 2.7
|
||||
*/
|
||||
String getVaultServer();
|
||||
|
||||
/**
|
||||
* Returns true if global permissions should be considered when retrieving meta or player groups
|
||||
* @return true if global permissions should be considered when retrieving meta or player groups
|
||||
* @since 2.7
|
||||
*/
|
||||
boolean getVaultIncludeGlobal();
|
||||
|
||||
/**
|
||||
* Returns the values set for data storage in the configuration
|
||||
* @return the values set for data storage in the configuration
|
||||
*/
|
||||
DatastoreConfiguration getDatastoreConfig();
|
||||
|
||||
/**
|
||||
* Returns the storage method string from the configuration
|
||||
* @return the storage method string from the configuration
|
||||
*/
|
||||
String getStorageMethod();
|
||||
|
||||
/**
|
||||
* Returns true if split storage is enabled
|
||||
* @return true if split storage is enabled
|
||||
* @since 2.7
|
||||
*/
|
||||
boolean getSplitStorage();
|
||||
|
||||
/**
|
||||
* Returns a map of split storage options
|
||||
* @return a map of split storage options, where the key is the storage section, and the value is the storage
|
||||
* method. For example: key = user, value = json
|
||||
* @since 2.7
|
||||
*/
|
||||
Map<String, String> getSplitStorageOptions();
|
||||
|
||||
}
|
||||
@@ -1,181 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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 me.lucko.luckperms.api;
|
||||
|
||||
import java.util.SortedMap;
|
||||
import java.util.SortedSet;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Represents the internal LuckPerms log.
|
||||
*
|
||||
* <p> The returned instance provides a copy of the data at the time of retrieval. Any changes made to log entries will
|
||||
* only apply to this instance of the log. You can add to the log using the {@link Storage}, and then request an updated copy.
|
||||
*/
|
||||
public interface Log {
|
||||
|
||||
/**
|
||||
* @return a {@link SortedSet} of all of the {@link LogEntry} objects in this {@link Log}
|
||||
*/
|
||||
SortedSet<LogEntry> getContent();
|
||||
|
||||
/**
|
||||
* @return all content in this log
|
||||
*/
|
||||
SortedSet<LogEntry> getRecent();
|
||||
|
||||
/**
|
||||
* Gets the recent content separated by page
|
||||
*
|
||||
* @param pageNo the page number
|
||||
* @return the page content
|
||||
* @throws IllegalArgumentException if the pageNo is less than 1
|
||||
* @throws IllegalStateException if the log doesn't contain enough entries to populate the page. See {@link #getRecentMaxPages()}}
|
||||
*/
|
||||
SortedMap<Integer, LogEntry> getRecent(int pageNo);
|
||||
|
||||
/**
|
||||
* @return the max page number allowed in the {@link #getRecent(int)} method
|
||||
*/
|
||||
int getRecentMaxPages();
|
||||
|
||||
|
||||
/**
|
||||
* @param actor the uuid of the actor to filter by
|
||||
* @return all content in this log where is actor = uuid
|
||||
*/
|
||||
SortedSet<LogEntry> getRecent(UUID actor);
|
||||
|
||||
/**
|
||||
* Gets the recent content for the uuid, separated into pages
|
||||
*
|
||||
* @param pageNo the page number
|
||||
* @param actor the uuid of the actor to filter by
|
||||
* @return the page content
|
||||
* @throws IllegalArgumentException if the pageNo is less than 1
|
||||
* @throws IllegalStateException if the log doesn't contain enough entries to populate the page. See {@link #getRecentMaxPages(UUID)}}
|
||||
*/
|
||||
SortedMap<Integer, LogEntry> getRecent(int pageNo, UUID actor);
|
||||
|
||||
/**
|
||||
* @param actor the actor to filter by
|
||||
* @return the max page number allowed in the {@link #getRecent(int, UUID)} method
|
||||
*/
|
||||
int getRecentMaxPages(UUID actor);
|
||||
|
||||
|
||||
/**
|
||||
* @param uuid the uuid to filter by
|
||||
* @return all content in this log where the user = uuid
|
||||
*/
|
||||
SortedSet<LogEntry> getUserHistory(UUID uuid);
|
||||
|
||||
/**
|
||||
* Gets the user history content, separated by pages
|
||||
*
|
||||
* @param pageNo the page number
|
||||
* @param uuid the uuid of the acted user to filter by
|
||||
* @return the page content
|
||||
* @throws IllegalArgumentException if the pageNo is less than 1
|
||||
* @throws IllegalStateException if the log doesn't contain enough entries to populate the page. See {@link #getUserHistoryMaxPages(UUID)}}
|
||||
*/
|
||||
SortedMap<Integer, LogEntry> getUserHistory(int pageNo, UUID uuid);
|
||||
|
||||
/**
|
||||
* @param uuid the uuid to filter by
|
||||
* @return the max page number allowed in the {@link #getUserHistory(int, UUID)} method
|
||||
*/
|
||||
int getUserHistoryMaxPages(UUID uuid);
|
||||
|
||||
|
||||
/**
|
||||
* @param name the name to filter by
|
||||
* @return all content in this log where the group = name
|
||||
*/
|
||||
SortedSet<LogEntry> getGroupHistory(String name);
|
||||
|
||||
/**
|
||||
* Gets the group history content, separated by pages
|
||||
*
|
||||
* @param pageNo the page number
|
||||
* @param name the name of the acted group to filter by
|
||||
* @return the page content
|
||||
* @throws IllegalArgumentException if the pageNo is less than 1
|
||||
* @throws IllegalStateException if the log doesn't contain enough entries to populate the page. See {@link #getGroupHistoryMaxPages(String)}}
|
||||
*/
|
||||
SortedMap<Integer, LogEntry> getGroupHistory(int pageNo, String name);
|
||||
|
||||
/**
|
||||
* @param name the name to filter by
|
||||
* @return the max page number allowed in the {@link #getGroupHistory(int, String)} method
|
||||
*/
|
||||
int getGroupHistoryMaxPages(String name);
|
||||
|
||||
|
||||
/**
|
||||
* @param name the name to filter by
|
||||
* @return all content in this log where the track = name
|
||||
*/
|
||||
SortedSet<LogEntry> getTrackHistory(String name);
|
||||
|
||||
/**
|
||||
* Gets the track history content, separated by pages
|
||||
*
|
||||
* @param pageNo the page number
|
||||
* @param name the name of the acted track to filter by
|
||||
* @return the page content
|
||||
*/
|
||||
SortedMap<Integer, LogEntry> getTrackHistory(int pageNo, String name);
|
||||
|
||||
/**
|
||||
* @param name the name to filter by
|
||||
* @return the max page number allowed in the {@link #getTrackHistory(int, String)} method
|
||||
* @throws IllegalArgumentException if the pageNo is less than 1
|
||||
* @throws IllegalStateException if the log doesn't contain enough entries to populate the page. See {@link #getTrackHistoryMaxPages(String)}}
|
||||
*/
|
||||
int getTrackHistoryMaxPages(String name);
|
||||
|
||||
|
||||
/**
|
||||
* @param query the query to filter by
|
||||
* @return all content in this log where the content matches query
|
||||
*/
|
||||
SortedSet<LogEntry> getSearch(String query);
|
||||
|
||||
/**
|
||||
* Gets the search content, separated by pages
|
||||
*
|
||||
* @param pageNo the page number
|
||||
* @param query the query to filter by
|
||||
* @return the page content
|
||||
* @throws IllegalArgumentException if the pageNo is less than 1
|
||||
* @throws IllegalStateException if the log doesn't contain enough entries to populate the page. See {@link #getSearchMaxPages(String)}}
|
||||
*/
|
||||
SortedMap<Integer, LogEntry> getSearch(int pageNo, String query);
|
||||
|
||||
/**
|
||||
* @param query the query to filter by
|
||||
* @return the max page number allowed in the {@link #getSearch(int, String)} method
|
||||
*/
|
||||
int getSearchMaxPages(String query);
|
||||
}
|
||||
@@ -1,318 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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 me.lucko.luckperms.api;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* A single entry in the log
|
||||
*
|
||||
* <p> Implements {@link Comparable} ordering based upon the timestamp of the entry.
|
||||
*/
|
||||
public class LogEntry implements Comparable<LogEntry> {
|
||||
private static final String FORMAT = "&8(&e%s&8) [&a%s&8] (&b%s&8) &7--> &f%s";
|
||||
|
||||
public static LogEntryBuilder builder() {
|
||||
return new LogEntryBuilder();
|
||||
}
|
||||
|
||||
private long timestamp;
|
||||
private UUID actor;
|
||||
private String actorName;
|
||||
private char type;
|
||||
private UUID acted;
|
||||
private String actedName;
|
||||
private String action;
|
||||
|
||||
public LogEntry(long timestamp, UUID actor, String actorName, char type, UUID acted, String actedName, String action) {
|
||||
if (actor == null) {
|
||||
throw new NullPointerException("actor");
|
||||
}
|
||||
if (actorName == null) {
|
||||
throw new NullPointerException("actorName");
|
||||
}
|
||||
if (actedName == null) {
|
||||
throw new NullPointerException("actedName");
|
||||
}
|
||||
if (action == null) {
|
||||
throw new NullPointerException("action");
|
||||
}
|
||||
|
||||
this.timestamp = timestamp;
|
||||
this.actor = actor;
|
||||
this.actorName = actorName;
|
||||
this.type = type;
|
||||
this.acted = acted;
|
||||
this.actedName = actedName;
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
protected LogEntry() {
|
||||
this.timestamp = 0L;
|
||||
this.actor = null;
|
||||
this.actorName = null;
|
||||
this.type = Character.MIN_VALUE;
|
||||
this.acted = null;
|
||||
this.actedName = null;
|
||||
this.action = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(LogEntry o) {
|
||||
return equals(o) ? 0 : (Long.compare(timestamp, o.getTimestamp()) == 0 ? 1 : Long.compare(timestamp, o.getTimestamp()));
|
||||
}
|
||||
|
||||
public boolean matchesSearch(String query) {
|
||||
query = query.toLowerCase();
|
||||
return actorName.toLowerCase().contains(query) || actedName.toLowerCase().contains(query)
|
||||
|| action.toLowerCase().contains(query);
|
||||
}
|
||||
|
||||
public String getFormatted() {
|
||||
return String.format(FORMAT,
|
||||
actorName,
|
||||
Character.toString(type),
|
||||
actedName,
|
||||
action
|
||||
);
|
||||
}
|
||||
|
||||
public long getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
void setTimestamp(long timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
public UUID getActor() {
|
||||
return actor;
|
||||
}
|
||||
|
||||
void setActor(UUID actor) {
|
||||
this.actor = actor;
|
||||
}
|
||||
|
||||
public String getActorName() {
|
||||
return actorName;
|
||||
}
|
||||
|
||||
void setActorName(String actorName) {
|
||||
this.actorName = actorName;
|
||||
}
|
||||
|
||||
public char getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
void setType(char type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public UUID getActed() {
|
||||
return acted;
|
||||
}
|
||||
|
||||
void setActed(UUID acted) {
|
||||
this.acted = acted;
|
||||
}
|
||||
|
||||
public String getActedName() {
|
||||
return actedName;
|
||||
}
|
||||
|
||||
void setActedName(String actedName) {
|
||||
this.actedName = actedName;
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LogEntry(" +
|
||||
"timestamp=" + this.getTimestamp() + ", " +
|
||||
"actor=" + this.getActor() + ", " +
|
||||
"actorName=" + this.getActorName() + ", " +
|
||||
"type=" + this.getType() + ", " +
|
||||
"acted=" + this.getActed() + ", " +
|
||||
"actedName=" + this.getActedName() + ", " +
|
||||
"action=" + this.getAction() +
|
||||
")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o == this) return true;
|
||||
if (!(o instanceof LogEntry)) return false;
|
||||
final LogEntry other = (LogEntry) o;
|
||||
if (this.getTimestamp() != other.getTimestamp()) return false;
|
||||
if (this.getActor() == null ? other.getActor() != null : !this.getActor().equals(other.getActor())) return false;
|
||||
if (this.getActorName() == null ? other.getActorName() != null : !this.getActorName().equals(other.getActorName())) return false;
|
||||
if (this.getType() != other.getType()) return false;
|
||||
if (this.getActed() == null ? other.getActed() != null : !this.getActed().equals(other.getActed())) return false;
|
||||
if (this.getActedName() == null ? other.getActedName() != null : !this.getActedName().equals(other.getActedName())) return false;
|
||||
return this.getAction() == null ? other.getAction() == null : this.getAction().equals(other.getAction());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int PRIME = 59;
|
||||
int result = 1;
|
||||
result = result * PRIME + (int) (this.getTimestamp() >>> 32 ^ this.getTimestamp());
|
||||
result = result * PRIME + (this.getActor() == null ? 43 : this.getActor().hashCode());
|
||||
result = result * PRIME + (this.getActorName() == null ? 43 : this.getActorName().hashCode());
|
||||
result = result * PRIME + this.getType();
|
||||
result = result * PRIME + (this.getActed() == null ? 43 : this.getActed().hashCode());
|
||||
result = result * PRIME + (this.getActedName() == null ? 43 : this.getActedName().hashCode());
|
||||
result = result * PRIME + (this.getAction() == null ? 43 : this.getAction().hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
public static class LogEntryBuilder extends AbstractLogEntryBuilder<LogEntry, LogEntry.LogEntryBuilder> {
|
||||
|
||||
@Override
|
||||
protected LogEntry createObj() {
|
||||
return new LogEntry();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LogEntryBuilder getThis() {
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static abstract class AbstractLogEntryBuilder<T extends LogEntry, B extends AbstractLogEntryBuilder<T, B>> {
|
||||
private T obj;
|
||||
private B thisObj;
|
||||
|
||||
public AbstractLogEntryBuilder() {
|
||||
obj = createObj();
|
||||
thisObj = getThis();
|
||||
}
|
||||
|
||||
protected abstract T createObj();
|
||||
|
||||
protected abstract B getThis();
|
||||
|
||||
public long getTimestamp() {
|
||||
return obj.getTimestamp();
|
||||
}
|
||||
|
||||
public UUID getActor() {
|
||||
return obj.getActor();
|
||||
}
|
||||
|
||||
public String getActorName() {
|
||||
return obj.getActorName();
|
||||
}
|
||||
|
||||
public char getType() {
|
||||
return obj.getType();
|
||||
}
|
||||
|
||||
public UUID getActed() {
|
||||
return obj.getActed();
|
||||
}
|
||||
|
||||
public String getActedName() {
|
||||
return obj.getActedName();
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return obj.getAction();
|
||||
}
|
||||
|
||||
public B timestamp(long timestamp) {
|
||||
obj.setTimestamp(timestamp);
|
||||
return thisObj;
|
||||
}
|
||||
|
||||
public B actor(UUID actor) {
|
||||
obj.setActor(actor);
|
||||
return thisObj;
|
||||
}
|
||||
|
||||
public B actorName(String actorName) {
|
||||
obj.setActorName(actorName);
|
||||
return thisObj;
|
||||
}
|
||||
|
||||
public B type(char type) {
|
||||
obj.setType(type);
|
||||
return thisObj;
|
||||
}
|
||||
|
||||
public B acted(UUID acted) {
|
||||
obj.setActed(acted);
|
||||
return thisObj;
|
||||
}
|
||||
|
||||
public B actedName(String actedName) {
|
||||
obj.setActedName(actedName);
|
||||
return thisObj;
|
||||
}
|
||||
|
||||
public B action(String action) {
|
||||
obj.setAction(action);
|
||||
return thisObj;
|
||||
}
|
||||
|
||||
public T build() {
|
||||
if (getActor() == null) {
|
||||
throw new NullPointerException("actor");
|
||||
}
|
||||
if (getActorName() == null) {
|
||||
throw new NullPointerException("actorName");
|
||||
}
|
||||
if (getActedName() == null) {
|
||||
throw new NullPointerException("actedName");
|
||||
}
|
||||
if (getAction() == null) {
|
||||
throw new NullPointerException("action");
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LogEntry.LogEntryBuilder(" +
|
||||
"timestamp=" + this.getTimestamp() + ", " +
|
||||
"actor=" + this.getActor() + ", " +
|
||||
"actorName=" + this.getActorName() + ", " +
|
||||
"type=" + this.getType() + ", " +
|
||||
"acted=" + this.getActed() + ", " +
|
||||
"actedName=" + this.getActedName() + ", " +
|
||||
"action=" + this.getAction() +
|
||||
")";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,281 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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 me.lucko.luckperms.api;
|
||||
|
||||
import me.lucko.luckperms.api.context.ContextCalculator;
|
||||
import me.lucko.luckperms.api.context.ContextSet;
|
||||
import me.lucko.luckperms.api.event.EventBus;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* The root API interface for LuckPerms
|
||||
*/
|
||||
public interface LuckPermsApi {
|
||||
|
||||
/**
|
||||
* Schedules an update task to run
|
||||
*/
|
||||
void runUpdateTask();
|
||||
|
||||
/**
|
||||
* Gets the API version
|
||||
* @return the version of the API running on the platform
|
||||
* @since 2.6
|
||||
*/
|
||||
double getApiVersion();
|
||||
|
||||
/**
|
||||
* Gets the plugin version
|
||||
* @return the version of the plugin running on the platform
|
||||
*/
|
||||
String getVersion();
|
||||
|
||||
/**
|
||||
* Gets the platform LuckPerms is running on
|
||||
* @return the platform LuckPerms is running on
|
||||
* @since 2.7
|
||||
*/
|
||||
PlatformType getPlatformType();
|
||||
|
||||
/**
|
||||
* Gets the event bus, used for subscribing to events
|
||||
* @return the event bus
|
||||
* @since 3.0
|
||||
*/
|
||||
EventBus getEventBus();
|
||||
|
||||
/**
|
||||
* Gets a wrapped {@link LPConfiguration} instance, with read only access
|
||||
*
|
||||
* @return a configuration instance
|
||||
*/
|
||||
LPConfiguration getConfiguration();
|
||||
|
||||
/**
|
||||
* Gets a wrapped {@link Storage} instance.
|
||||
*
|
||||
* @return a storage instance
|
||||
* @since 2.14
|
||||
*/
|
||||
Storage getStorage();
|
||||
|
||||
/**
|
||||
* Gets the messaging service in use on the platform, if present.
|
||||
*
|
||||
* @return an optional that may contain a messaging service instance.
|
||||
*/
|
||||
Optional<MessagingService> getMessagingService();
|
||||
|
||||
/**
|
||||
* Gets the {@link Logger} wrapping used by the platform
|
||||
*
|
||||
* @return the logger instance
|
||||
*/
|
||||
Logger getLogger();
|
||||
|
||||
/**
|
||||
* Gets a wrapped {@link UuidCache} instance, providing read access to the LuckPerms internal uuid caching system
|
||||
*
|
||||
* @return a uuid cache instance
|
||||
*/
|
||||
UuidCache getUuidCache();
|
||||
|
||||
/**
|
||||
* Gets a wrapped user object from the user storage
|
||||
*
|
||||
* @param uuid the uuid of the user to get
|
||||
* @return a {@link User} object, if one matching the uuid is loaded, or null if not
|
||||
* @throws NullPointerException if the uuid is null
|
||||
*/
|
||||
User getUser(UUID uuid);
|
||||
|
||||
/**
|
||||
* Gets a wrapped user object from the user storage. This method does not return null, unlike {@link #getUser(UUID)}
|
||||
*
|
||||
* @param uuid the uuid of the user to get
|
||||
* @return an optional {@link User} object
|
||||
* @throws NullPointerException if the uuid is null
|
||||
*/
|
||||
Optional<User> getUserSafe(UUID uuid);
|
||||
|
||||
/**
|
||||
* Gets a wrapped user object from the user storage
|
||||
*
|
||||
* @param name the username of the user to get
|
||||
* @return a {@link User} object, if one matching the uuid is loaded, or null if not
|
||||
* @throws NullPointerException if the name is null
|
||||
*/
|
||||
User getUser(String name);
|
||||
|
||||
/**
|
||||
* Gets a wrapped user object from the user storage. This method does not return null, unlike {@link
|
||||
* #getUser(String)}
|
||||
*
|
||||
* @param name the username of the user to get
|
||||
* @return an optional {@link User} object
|
||||
* @throws NullPointerException if the name is null
|
||||
*/
|
||||
Optional<User> getUserSafe(String name);
|
||||
|
||||
/**
|
||||
* Gets a set of all loaded users.
|
||||
*
|
||||
* @return a {@link Set} of {@link User} objects
|
||||
*/
|
||||
Set<User> getUsers();
|
||||
|
||||
/**
|
||||
* Check if a user is loaded in memory
|
||||
*
|
||||
* @param uuid the uuid to check for
|
||||
* @return true if the user is loaded
|
||||
* @throws NullPointerException if the uuid is null
|
||||
*/
|
||||
boolean isUserLoaded(UUID uuid);
|
||||
|
||||
/**
|
||||
* Unload a user from the internal storage, if they're not currently online.
|
||||
*
|
||||
* @param user the user to unload
|
||||
* @throws NullPointerException if the user is null
|
||||
* @since 2.6
|
||||
*/
|
||||
void cleanupUser(User user);
|
||||
|
||||
/**
|
||||
* Gets a wrapped group object from the group storage
|
||||
*
|
||||
* @param name the name of the group to get
|
||||
* @return a {@link Group} object, if one matching the name exists, or null if not
|
||||
* @throws NullPointerException if the name is null
|
||||
*/
|
||||
Group getGroup(String name);
|
||||
|
||||
/**
|
||||
* Gets a wrapped group object from the group storage. This method does not return null, unlike {@link #getGroup}
|
||||
*
|
||||
* @param name the name of the group to get
|
||||
* @return an optional {@link Group} object
|
||||
* @throws NullPointerException if the name is null
|
||||
*/
|
||||
Optional<Group> getGroupSafe(String name);
|
||||
|
||||
/**
|
||||
* Gets a set of all loaded groups.
|
||||
*
|
||||
* @return a {@link Set} of {@link Group} objects
|
||||
*/
|
||||
Set<Group> getGroups();
|
||||
|
||||
/**
|
||||
* Check if a group is loaded in memory
|
||||
*
|
||||
* @param name the name to check for
|
||||
* @return true if the group is loaded
|
||||
* @throws NullPointerException if the name is null
|
||||
*/
|
||||
boolean isGroupLoaded(String name);
|
||||
|
||||
/**
|
||||
* Gets a wrapped track object from the track storage
|
||||
*
|
||||
* @param name the name of the track to get
|
||||
* @return a {@link Track} object, if one matching the name exists, or null if not
|
||||
* @throws NullPointerException if the name is null
|
||||
*/
|
||||
Track getTrack(String name);
|
||||
|
||||
/**
|
||||
* Gets a wrapped track object from the track storage. This method does not return null, unlike {@link #getTrack}
|
||||
*
|
||||
* @param name the name of the track to get
|
||||
* @return an optional {@link Track} object
|
||||
* @throws NullPointerException if the name is null
|
||||
*/
|
||||
Optional<Track> getTrackSafe(String name);
|
||||
|
||||
/**
|
||||
* Gets a set of all loaded tracks.
|
||||
*
|
||||
* @return a {@link Set} of {@link Track} objects
|
||||
*/
|
||||
Set<Track> getTracks();
|
||||
|
||||
/**
|
||||
* Check if a track is loaded in memory
|
||||
*
|
||||
* @param name the name to check for
|
||||
* @return true if the track is loaded
|
||||
* @throws NullPointerException if the name is null
|
||||
*/
|
||||
boolean isTrackLoaded(String name);
|
||||
|
||||
/**
|
||||
* Gets the node factory instance for the platform
|
||||
*
|
||||
* @return the node factory
|
||||
*/
|
||||
NodeFactory getNodeFactory();
|
||||
|
||||
/**
|
||||
* Returns a permission builder instance
|
||||
*
|
||||
* @param permission the main permission node to build
|
||||
* @return a {@link Node.Builder} instance
|
||||
* @throws IllegalArgumentException if the permission is invalid
|
||||
* @throws NullPointerException if the permission is null
|
||||
* @since 2.6
|
||||
*/
|
||||
Node.Builder buildNode(String permission) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Register a custom context calculator to the server
|
||||
*
|
||||
* @param contextCalculator the context calculator to register. The type MUST be the player class of the platform.
|
||||
* @throws ClassCastException if the type is not the player class of the platform.
|
||||
*/
|
||||
void registerContextCalculator(ContextCalculator<?> contextCalculator);
|
||||
|
||||
/**
|
||||
* Gets a calculated context instance for the user using the rules of the platform.
|
||||
*
|
||||
* <p> These values are calculated using the options in the configuration, and the provided calculators.
|
||||
*
|
||||
* @param user the user to get contexts for
|
||||
* @return an optional containing contexts. Will return empty if the user is not online.
|
||||
*/
|
||||
Optional<Contexts> getContextForUser(User user);
|
||||
|
||||
/**
|
||||
* Gets set of contexts applicable to a player using the platforms {@link ContextCalculator}s.
|
||||
*
|
||||
* @param player the player to calculate for. Must be the player instance for the platform.
|
||||
* @return a set of contexts.
|
||||
* @since 2.17
|
||||
*/
|
||||
ContextSet getContextForPlayer(Object player);
|
||||
|
||||
}
|
||||
@@ -1,340 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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 me.lucko.luckperms.api;
|
||||
|
||||
import me.lucko.luckperms.LuckPerms;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* A collection of utilities to help retrieve meta values for {@link PermissionHolder}s
|
||||
*
|
||||
* @since 2.7
|
||||
*/
|
||||
public class MetaUtils {
|
||||
|
||||
private static String escapeDelimiters(String s, String... delims) {
|
||||
for (String delim : delims) {
|
||||
s = s.replace(delim, "\\" + delim);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
private static String unescapeDelimiters(String s, String... delims) {
|
||||
for (String delim : delims) {
|
||||
s = s.replace("\\" + delim, delim);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes special characters used within LuckPerms, so the string can be saved without issues
|
||||
*
|
||||
* @param s the string to escape
|
||||
* @return an escaped string
|
||||
* @throws NullPointerException if the string is null
|
||||
*/
|
||||
public static String escapeCharacters(String s) {
|
||||
if (s == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
||||
return escapeDelimiters(s, ".", "/", "-", "$");
|
||||
}
|
||||
|
||||
/**
|
||||
* Unescapes special characters used within LuckPerms, the inverse of {@link #escapeCharacters(String)}
|
||||
*
|
||||
* @param s the string to unescape
|
||||
* @return an unescaped string
|
||||
* @throws NullPointerException if the string is null
|
||||
*/
|
||||
public static String unescapeCharacters(String s) {
|
||||
if (s == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
||||
s = s.replace("{SEP}", ".");
|
||||
s = s.replace("{FSEP}", "/");
|
||||
s = s.replace("{DSEP}", "$");
|
||||
s = unescapeDelimiters(s, ".", "/", "-", "$");
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a meta value on a holder
|
||||
*
|
||||
* @param holder the holder to apply the meta node to
|
||||
* @param server the server to apply the meta on, can be null
|
||||
* @param world the world to apply the meta on, can be null
|
||||
* @param node the meta node
|
||||
* @param value the meta value
|
||||
* @throws NullPointerException if the holder, node or value is null
|
||||
* @throws IllegalArgumentException if the node or value is empty
|
||||
*/
|
||||
public static void setMeta(PermissionHolder holder, String server, String world, String node, String value) {
|
||||
if (holder == null) {
|
||||
throw new NullPointerException("holder");
|
||||
}
|
||||
|
||||
if (node == null) {
|
||||
throw new NullPointerException("node");
|
||||
}
|
||||
|
||||
if (value == null) {
|
||||
throw new NullPointerException("value");
|
||||
}
|
||||
|
||||
if (node.equals("")) {
|
||||
throw new IllegalArgumentException("node is empty");
|
||||
}
|
||||
|
||||
if (value.equals("")) {
|
||||
throw new IllegalArgumentException("value is empty");
|
||||
}
|
||||
|
||||
if (server == null || server.equals("")) {
|
||||
server = "global";
|
||||
}
|
||||
|
||||
node = escapeCharacters(node);
|
||||
value = escapeCharacters(value);
|
||||
|
||||
Set<Node> toRemove = new HashSet<>();
|
||||
for (Node n : holder.getEnduringPermissions()) {
|
||||
if (n.isMeta() && n.getMeta().getKey().equals(node)) {
|
||||
toRemove.add(n);
|
||||
}
|
||||
}
|
||||
|
||||
for (Node n : toRemove) {
|
||||
try {
|
||||
holder.unsetPermission(n);
|
||||
} catch (ObjectLacksException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
Node.Builder metaNode = LuckPerms.getApi().buildNode("meta." + node + "." + value).setValue(true);
|
||||
if (!server.equalsIgnoreCase("global")) {
|
||||
metaNode.setServer(server);
|
||||
}
|
||||
if (world != null && !world.equals("")) {
|
||||
metaNode.setServer(server).setWorld(world);
|
||||
}
|
||||
|
||||
try {
|
||||
holder.setPermission(metaNode.build());
|
||||
} catch (ObjectAlreadyHasException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a meta value for the holder
|
||||
*
|
||||
* @param holder the holder to get the meta from
|
||||
* @param server the server to retrieve the meta on, can be null
|
||||
* @param world the world to retrieve the meta on, can be null
|
||||
* @param node the node to get
|
||||
* @param defaultValue the default value to return if the node is not set
|
||||
* @param includeGlobal if global nodes should be considered when retrieving the meta
|
||||
* @return a meta string, or the default value if the user does not have the meta node
|
||||
* @throws NullPointerException if the holder or node is null
|
||||
* @throws IllegalArgumentException if the node is empty
|
||||
*/
|
||||
public static String getMeta(PermissionHolder holder, String server, String world, String node, String defaultValue, boolean includeGlobal) {
|
||||
if (holder == null) {
|
||||
throw new NullPointerException("holder");
|
||||
}
|
||||
|
||||
if (server == null || server.equals("")) {
|
||||
server = "global";
|
||||
}
|
||||
|
||||
if (node == null) {
|
||||
throw new NullPointerException("node");
|
||||
}
|
||||
|
||||
if (node.equals("")) {
|
||||
throw new IllegalArgumentException("node is empty");
|
||||
}
|
||||
|
||||
node = escapeCharacters(node);
|
||||
|
||||
for (Node n : holder.getPermissions()) {
|
||||
if (!n.getValue()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!n.isMeta()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!server.equalsIgnoreCase("global")) {
|
||||
if (!n.shouldApplyOnServer(server, includeGlobal, false)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (!n.shouldApplyOnWorld(world, includeGlobal, false)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Map.Entry<String, String> meta = n.getMeta();
|
||||
if (meta.getKey().equalsIgnoreCase(node)) {
|
||||
return unescapeCharacters(meta.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
private static void setChatMeta(boolean prefix, PermissionHolder holder, String value, int priority, String server, String world) {
|
||||
if (holder == null) {
|
||||
throw new NullPointerException("holder");
|
||||
}
|
||||
|
||||
if (value == null || value.equals("")) {
|
||||
throw new IllegalArgumentException("value is null/empty");
|
||||
}
|
||||
|
||||
Node.Builder node = LuckPerms.getApi().buildNode(prefix ? "prefix" : "suffix" + "." + priority + "." + escapeCharacters(value));
|
||||
node.setValue(true);
|
||||
if (!server.equalsIgnoreCase("global")) {
|
||||
node.setServer(server);
|
||||
}
|
||||
if (world != null && !world.equals("")) {
|
||||
node.setServer(server).setWorld(world);
|
||||
}
|
||||
|
||||
try {
|
||||
holder.setPermission(node.build());
|
||||
} catch (ObjectAlreadyHasException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a prefix to a holder on a specific server and world
|
||||
*
|
||||
* @param holder the holder to set the prefix for
|
||||
* @param prefix the prefix value
|
||||
* @param priority the priority to set the prefix at
|
||||
* @param server the server to set the prefix on, can be null
|
||||
* @param world the world to set the prefix on, can be null
|
||||
* @throws NullPointerException if the holder is null
|
||||
* @throws IllegalArgumentException if the prefix is null or empty
|
||||
*/
|
||||
public static void setPrefix(PermissionHolder holder, String prefix, int priority, String server, String world) {
|
||||
setChatMeta(true, holder, prefix, priority, server, world);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a suffix to a holder on a specific server and world
|
||||
*
|
||||
* @param holder the holder to set the suffix for
|
||||
* @param suffix the suffix value
|
||||
* @param priority the priority to set the suffix at
|
||||
* @param server the server to set the suffix on, can be null
|
||||
* @param world the world to set the suffix on, can be null
|
||||
* @throws NullPointerException if the holder is null
|
||||
* @throws IllegalArgumentException if the suffix is null or empty
|
||||
*/
|
||||
public static void setSuffix(PermissionHolder holder, String suffix, int priority, String server, String world) {
|
||||
setChatMeta(false, holder, suffix, priority, server, world);
|
||||
}
|
||||
|
||||
private static String getChatMeta(boolean prefix, PermissionHolder holder, String server, String world, boolean includeGlobal) {
|
||||
if (holder == null) {
|
||||
throw new NullPointerException("holder");
|
||||
}
|
||||
if (server == null) {
|
||||
server = "global";
|
||||
}
|
||||
|
||||
int priority = Integer.MIN_VALUE;
|
||||
String meta = null;
|
||||
for (Node n : holder.getAllNodes(Contexts.allowAll())) {
|
||||
if (!n.getValue()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!server.equalsIgnoreCase("global")) {
|
||||
if (!n.shouldApplyOnServer(server, includeGlobal, false)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (!n.shouldApplyOnWorld(world, includeGlobal, false)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (prefix ? !n.isPrefix() : !n.isSuffix()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Map.Entry<Integer, String> value = prefix ? n.getPrefix() : n.getSuffix();
|
||||
if (value.getKey() > priority) {
|
||||
meta = value.getValue();
|
||||
priority = value.getKey();
|
||||
}
|
||||
}
|
||||
|
||||
return meta == null ? "" : unescapeCharacters(meta);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a holders highest priority prefix, if they have one
|
||||
*
|
||||
* @param holder the holder
|
||||
* @param server the server to retrieve the prefix on
|
||||
* @param world the world to retrieve the prefix on
|
||||
* @param includeGlobal if global nodes should be considered when retrieving the prefix
|
||||
* @return a prefix string, if the holder has one, or an empty string if not.
|
||||
* @throws NullPointerException if the holder is null
|
||||
*/
|
||||
public static String getPrefix(PermissionHolder holder, String server, String world, boolean includeGlobal) {
|
||||
return getChatMeta(true, holder, server, world, includeGlobal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a holders highest priority suffix, if they have one
|
||||
*
|
||||
* @param holder the holder
|
||||
* @param server the server to retrieve the suffix on
|
||||
* @param world the world to retrieve the suffix on
|
||||
* @param includeGlobal if global nodes should be considered when retrieving the suffix
|
||||
* @return a suffix string, if the holder has one, or an empty string if not.
|
||||
* @throws NullPointerException if the holder is null
|
||||
*/
|
||||
public static String getSuffix(PermissionHolder holder, String server, String world, boolean includeGlobal) {
|
||||
return getChatMeta(false, holder, server, world, includeGlobal);
|
||||
}
|
||||
|
||||
private MetaUtils() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,348 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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 me.lucko.luckperms.api;
|
||||
|
||||
import me.lucko.luckperms.api.context.ContextSet;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* An immutable permission node
|
||||
*
|
||||
* <p> Use {@link LuckPermsApi#buildNode(String)} to get an instance.
|
||||
*
|
||||
* @since 2.6
|
||||
*/
|
||||
public interface Node extends Map.Entry<String, Boolean> {
|
||||
|
||||
/**
|
||||
* @return the actual permission node
|
||||
*/
|
||||
String getPermission();
|
||||
|
||||
/**
|
||||
* Get what value the permission is set to. A negated node would return <code>false</code>.
|
||||
*
|
||||
* @return the permission's value
|
||||
*/
|
||||
@Override
|
||||
Boolean getValue();
|
||||
|
||||
/**
|
||||
* @return the value of this node as a Tristate
|
||||
*/
|
||||
Tristate getTristate();
|
||||
|
||||
/**
|
||||
* @return true if the node is negated
|
||||
*/
|
||||
boolean isNegated();
|
||||
|
||||
/**
|
||||
* If this node is set to override explicitly.
|
||||
* This value does not persist across saves, and is therefore only useful for transient nodes
|
||||
*
|
||||
* @return true if this node is set to override explicitly
|
||||
*/
|
||||
boolean isOverride();
|
||||
|
||||
/**
|
||||
* Gets the server this node applies on, if the node is server specific
|
||||
*
|
||||
* @return an {@link Optional} containing the server, if one is defined
|
||||
*/
|
||||
Optional<String> getServer();
|
||||
|
||||
/**
|
||||
* Gets the world this node applies on, if the node is world specific
|
||||
*
|
||||
* @return an {@link Optional} containing the world, if one is defined
|
||||
*/
|
||||
Optional<String> getWorld();
|
||||
|
||||
/**
|
||||
* @return true if this node is server specific
|
||||
*/
|
||||
boolean isServerSpecific();
|
||||
|
||||
/**
|
||||
* @return true if this node is server specific
|
||||
*/
|
||||
boolean isWorldSpecific();
|
||||
|
||||
/**
|
||||
* If this node should apply on a specific server
|
||||
*
|
||||
* @param server the name of the server
|
||||
* @param includeGlobal if global permissions should apply
|
||||
* @param applyRegex if regex should be applied
|
||||
* @return true if the node should apply
|
||||
*/
|
||||
boolean shouldApplyOnServer(String server, boolean includeGlobal, boolean applyRegex);
|
||||
|
||||
/**
|
||||
* If this node should apply on a specific world
|
||||
*
|
||||
* @param world the name of the world
|
||||
* @param includeGlobal if global permissions should apply
|
||||
* @param applyRegex if regex should be applied
|
||||
* @return true if the node should apply
|
||||
*/
|
||||
boolean shouldApplyOnWorld(String world, boolean includeGlobal, boolean applyRegex);
|
||||
|
||||
/**
|
||||
* If this node should apply in the given context
|
||||
*
|
||||
* @param context the context key value pairs
|
||||
* @param worldAndServer if world and server contexts should be checked
|
||||
* @return true if the node should apply
|
||||
* @since 2.13
|
||||
*/
|
||||
boolean shouldApplyWithContext(ContextSet context, boolean worldAndServer);
|
||||
|
||||
/**
|
||||
* If this node should apply in the given context
|
||||
*
|
||||
* @param context the context key value pairs
|
||||
* @return true if the node should apply
|
||||
* @since 2.13
|
||||
*/
|
||||
boolean shouldApplyWithContext(ContextSet context);
|
||||
|
||||
/**
|
||||
* Similar to {@link #shouldApplyOnServer(String, boolean, boolean)}, except this method accepts a List
|
||||
*
|
||||
* @param servers the list of servers
|
||||
* @param includeGlobal if global permissions should apply
|
||||
* @return true if the node should apply
|
||||
*/
|
||||
boolean shouldApplyOnAnyServers(List<String> servers, boolean includeGlobal);
|
||||
|
||||
/**
|
||||
* Similar to {@link #shouldApplyOnWorld(String, boolean, boolean)}, except this method accepts a List
|
||||
*
|
||||
* @param worlds the list of world
|
||||
* @param includeGlobal if global permissions should apply
|
||||
* @return true if the node should apply
|
||||
*/
|
||||
boolean shouldApplyOnAnyWorlds(List<String> worlds, boolean includeGlobal);
|
||||
|
||||
/**
|
||||
* Resolves a list of wildcards that match this node
|
||||
*
|
||||
* @param possibleNodes a list of possible permission nodes
|
||||
* @return a list of permissions that match this wildcard
|
||||
*/
|
||||
List<String> resolveWildcard(List<String> possibleNodes);
|
||||
|
||||
/**
|
||||
* Resolves any shorthand parts of this node and returns the full list
|
||||
*
|
||||
* @return a list of full nodes
|
||||
*/
|
||||
List<String> resolveShorthand();
|
||||
|
||||
/**
|
||||
* @return true if this node will expire in the future
|
||||
*/
|
||||
boolean isTemporary();
|
||||
|
||||
/**
|
||||
* @return true if this node will not expire
|
||||
*/
|
||||
boolean isPermanent();
|
||||
|
||||
/**
|
||||
* @return the time in Unix time when this node will expire
|
||||
* @throws IllegalStateException if the node is not temporary
|
||||
*/
|
||||
long getExpiryUnixTime();
|
||||
|
||||
/**
|
||||
* @return the {@link Date} when this node will expire
|
||||
* @throws IllegalStateException if the node is not temporary
|
||||
*/
|
||||
Date getExpiry();
|
||||
|
||||
/**
|
||||
* @return the number of seconds until this permission will expire
|
||||
* @throws IllegalStateException if the node is not temporary
|
||||
*/
|
||||
long getSecondsTilExpiry();
|
||||
|
||||
/**
|
||||
* Return true if the node has expired.
|
||||
* This also returns false if the node is not temporary
|
||||
*
|
||||
* @return true if this node has expired
|
||||
*/
|
||||
boolean hasExpired();
|
||||
|
||||
/**
|
||||
* @return the extra contexts required for this node to apply
|
||||
* @since 2.13
|
||||
*/
|
||||
ContextSet getContexts();
|
||||
|
||||
/**
|
||||
* Converts this node into a serialized form
|
||||
*
|
||||
* @return a serialized node string
|
||||
*/
|
||||
String toSerializedNode();
|
||||
|
||||
/**
|
||||
* @return true if this is a group node
|
||||
*/
|
||||
boolean isGroupNode();
|
||||
|
||||
/**
|
||||
* @return the name of the group
|
||||
* @throws IllegalStateException if this is not a group node. See {@link #isGroupNode()}
|
||||
*/
|
||||
String getGroupName();
|
||||
|
||||
/**
|
||||
* @return true is this node is a wildcard node
|
||||
*/
|
||||
boolean isWildcard();
|
||||
|
||||
/**
|
||||
* Gets the level of this wildcard, higher is more specific
|
||||
*
|
||||
* @return the wildcard level
|
||||
* @throws IllegalStateException if this is not a wildcard
|
||||
*/
|
||||
int getWildcardLevel();
|
||||
|
||||
/**
|
||||
* @return true if this node is a meta node
|
||||
*/
|
||||
boolean isMeta();
|
||||
|
||||
/**
|
||||
* Gets the meta value from this node
|
||||
*
|
||||
* @return the meta value
|
||||
* @throws IllegalStateException if this node is not a meta node
|
||||
*/
|
||||
Map.Entry<String, String> getMeta();
|
||||
|
||||
/**
|
||||
* @return true if this node is a prefix node
|
||||
*/
|
||||
boolean isPrefix();
|
||||
|
||||
/**
|
||||
* Gets the prefix value from this node
|
||||
*
|
||||
* @return the prefix value
|
||||
* @throws IllegalStateException if this node is a not a prefix node
|
||||
*/
|
||||
Map.Entry<Integer, String> getPrefix();
|
||||
|
||||
/**
|
||||
* @return true if this node is a suffix node
|
||||
*/
|
||||
boolean isSuffix();
|
||||
|
||||
/**
|
||||
* Gets the suffix value from this node
|
||||
*
|
||||
* @return the suffix value
|
||||
* @throws IllegalStateException if this node is a not a suffix node
|
||||
*/
|
||||
Map.Entry<Integer, String> getSuffix();
|
||||
|
||||
/**
|
||||
* Checks if this Node is equal to another node
|
||||
*
|
||||
* @param obj the other node
|
||||
* @return true if this node is equal to the other provided
|
||||
* @see #equalsIgnoringValue(Node) for a less strict implementation of this method
|
||||
*/
|
||||
boolean equals(Object obj);
|
||||
|
||||
/**
|
||||
* Similar to {@link Node#equals(Object)}, except doesn't take note of the value
|
||||
*
|
||||
* @param other the other node
|
||||
* @return true if the two nodes are almost equal
|
||||
*/
|
||||
boolean equalsIgnoringValue(Node other);
|
||||
|
||||
/**
|
||||
* Similar to {@link Node#equals(Object)}, except doesn't take note of the expiry time or value
|
||||
*
|
||||
* @param other the other node
|
||||
* @return true if the two nodes are almost equal
|
||||
*/
|
||||
boolean almostEquals(Node other);
|
||||
|
||||
/**
|
||||
* Similar to {@link Node#equals(Object)}, except doesn't take note of the value or if the node is temporary
|
||||
*
|
||||
* @param other the other node
|
||||
* @return true if the two nodes are almost equal
|
||||
* @since 2.8
|
||||
*/
|
||||
boolean equalsIgnoringValueOrTemp(Node other);
|
||||
|
||||
/**
|
||||
* Builds a Node instance
|
||||
*/
|
||||
interface Builder {
|
||||
Builder setNegated(boolean negated);
|
||||
|
||||
Builder setValue(boolean value);
|
||||
|
||||
/**
|
||||
* Warning: this value does not persist, and disappears when the holder is re-loaded.
|
||||
* It is therefore only useful for transient nodes.
|
||||
*/
|
||||
Builder setOverride(boolean override);
|
||||
|
||||
Builder setExpiry(long expireAt);
|
||||
|
||||
Builder setWorld(String world);
|
||||
|
||||
Builder setServer(String server) throws IllegalArgumentException;
|
||||
|
||||
Builder withExtraContext(String key, String value);
|
||||
|
||||
Builder withExtraContext(Map<String, String> map);
|
||||
|
||||
Builder withExtraContext(Set<Map.Entry<String, String>> context);
|
||||
|
||||
Builder withExtraContext(Map.Entry<String, String> entry);
|
||||
|
||||
Builder withExtraContext(ContextSet set);
|
||||
|
||||
Node build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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 me.lucko.luckperms.api;
|
||||
|
||||
/**
|
||||
* Builds {@link Node} instances
|
||||
*
|
||||
* @since 2.17
|
||||
*/
|
||||
public interface NodeFactory {
|
||||
|
||||
/**
|
||||
* Creates a node from a serialised node string
|
||||
*
|
||||
* @param serialisedPermission the serialised permission string
|
||||
* @param value the value of the node
|
||||
* @return a node instance
|
||||
* @throws NullPointerException if the permission is null
|
||||
*/
|
||||
Node fromSerialisedNode(String serialisedPermission, boolean value);
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new node builder from a given base permission string
|
||||
*
|
||||
* @param permission the permission
|
||||
* @return a node builder instance
|
||||
* @throws NullPointerException if the permission is null
|
||||
*/
|
||||
Node.Builder newBuilder(String permission);
|
||||
|
||||
/**
|
||||
* Creates a node builder instance from an existing node
|
||||
*
|
||||
* @param other the other node
|
||||
* @return a node builder instance
|
||||
* @throws NullPointerException if the other node is null
|
||||
*/
|
||||
Node.Builder newBuilderFromExisting(Node other);
|
||||
|
||||
/**
|
||||
* Creates a node builder from a serialised node string
|
||||
* @param serialisedPermission the serialised permission string
|
||||
* @param value the value of the node
|
||||
* @return a node builder instance
|
||||
* @throws NullPointerException if the permission is null
|
||||
*/
|
||||
Node.Builder newBuilderFromSerialisedNode(String serialisedPermission, boolean value);
|
||||
|
||||
|
||||
/**
|
||||
* Creates a node builder from a key value pair
|
||||
*
|
||||
* @param key the key
|
||||
* @param value the value
|
||||
* @return a node builder instance
|
||||
* @throws NullPointerException if the key or value is null
|
||||
*/
|
||||
Node.Builder makeMetaNode(String key, String value);
|
||||
|
||||
/**
|
||||
* Creates a node builder from a prefix string and priority
|
||||
*
|
||||
* @param priority the priority
|
||||
* @param prefix the prefix string
|
||||
* @return a node builder instance
|
||||
* @throws NullPointerException if the prefix is null
|
||||
*/
|
||||
Node.Builder makePrefixNode(int priority, String prefix);
|
||||
|
||||
/**
|
||||
* Creates a node builder from a prefix string and priority
|
||||
*
|
||||
* @param priority the priority
|
||||
* @param suffix the suffix string
|
||||
* @return a node builder instance
|
||||
* @throws NullPointerException if the suffix is null
|
||||
*/
|
||||
Node.Builder makeSuffixNode(int priority, String suffix);
|
||||
|
||||
}
|
||||
@@ -1,613 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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 me.lucko.luckperms.api;
|
||||
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
|
||||
/**
|
||||
* An object capable of holding permissions
|
||||
*
|
||||
* <p> Any changes made will be lost unless the instance is saved back to the {@link Storage}.
|
||||
*/
|
||||
public interface PermissionHolder {
|
||||
|
||||
/**
|
||||
* Gets the objects name
|
||||
*
|
||||
* <p> {@link User#getUuid()}, {@link User#getName()} or {@link Group#getName()} should normally be used instead of
|
||||
* this method.
|
||||
*
|
||||
* @return the identifier for this object. Either a uuid string or name.
|
||||
*/
|
||||
String getObjectName();
|
||||
|
||||
/**
|
||||
* Gets a sorted set of all held permissions.
|
||||
*
|
||||
* @return an immutable set of permissions in priority order
|
||||
* @since 2.6
|
||||
*/
|
||||
SortedSet<? extends Node> getPermissions();
|
||||
|
||||
/**
|
||||
* Similar to {@link #getPermissions()}, except without transient permissions
|
||||
*
|
||||
* @return a set of nodes
|
||||
* @since 2.6
|
||||
*/
|
||||
Set<? extends Node> getEnduringPermissions();
|
||||
|
||||
/**
|
||||
* Gets an immutable set of all transiently held permissions.
|
||||
*
|
||||
* <p> Transient permissions only exist for the duration of the session.
|
||||
*
|
||||
* @return a set of nodes
|
||||
* @since 2.6
|
||||
*/
|
||||
Set<? extends Node> getTransientPermissions();
|
||||
|
||||
/**
|
||||
* Gets a mutable sorted set of the nodes that this object has and inherits, filtered by context
|
||||
* Unlike {@link #getAllNodesFiltered(Contexts)}, this method will not filter individual nodes. The context is only
|
||||
* used to determine which groups should apply.
|
||||
* Nodes are sorted into priority order.
|
||||
*
|
||||
* @param contexts the context for the lookup,
|
||||
* @return a mutable sorted set of permissions
|
||||
* @throws NullPointerException if the context is null
|
||||
* @since 2.11
|
||||
*/
|
||||
SortedSet<LocalizedNode> getAllNodes(Contexts contexts);
|
||||
|
||||
/**
|
||||
* Gets a mutable set of the nodes that this object has and inherits, filtered by context.
|
||||
* Unlike {@link #getAllNodes(Contexts)}, this method WILL filter individual nodes, and only return ones that fully
|
||||
* meet the context provided.
|
||||
*
|
||||
* @param contexts the context for the lookup
|
||||
* @return a mutable set of permissions
|
||||
* @throws NullPointerException if the context is null
|
||||
* @since 2.11
|
||||
*/
|
||||
Set<LocalizedNode> getAllNodesFiltered(Contexts contexts);
|
||||
|
||||
/**
|
||||
* Converts the output of {@link #getAllNodesFiltered(Contexts)}, and expands shorthand permissions.
|
||||
* @param contexts the context for the lookup
|
||||
* @param lowerCase if the keys should be made lowercase whilst being exported
|
||||
* @return a mutable map of permissions
|
||||
*/
|
||||
Map<String, Boolean> exportNodes(Contexts contexts, boolean lowerCase);
|
||||
|
||||
/**
|
||||
* Removes temporary permissions that have expired
|
||||
*/
|
||||
void auditTemporaryPermissions();
|
||||
|
||||
/**
|
||||
* Checks to see if the object has a certain permission
|
||||
*
|
||||
* @param node the node to check for
|
||||
* @return a Tristate for the holders permission status for the node
|
||||
* @throws NullPointerException if the node is null
|
||||
* @since 2.6
|
||||
*/
|
||||
Tristate hasPermission(Node node);
|
||||
|
||||
/**
|
||||
* Checks to see if the object has a certain permission
|
||||
*
|
||||
* @param node the node to check for
|
||||
* @return a Tristate for the holders permission status for the node
|
||||
* @throws NullPointerException if the node is null
|
||||
* @since 2.6
|
||||
*/
|
||||
Tristate hasTransientPermission(Node node);
|
||||
|
||||
/**
|
||||
* Checks to see if the object has a certain permission
|
||||
*
|
||||
* @param node The permission node
|
||||
* @param b If the node is true/false(negated)
|
||||
* @return true if the object has the permission
|
||||
* @throws NullPointerException if the node is null
|
||||
* @throws IllegalArgumentException if the node is invalid
|
||||
*/
|
||||
boolean hasPermission(String node, boolean b);
|
||||
|
||||
/**
|
||||
* Checks to see the the object has a permission on a certain server
|
||||
*
|
||||
* @param node The permission node
|
||||
* @param b If the node is true/false(negated)
|
||||
* @param server The server
|
||||
* @return true if the object has the permission
|
||||
* @throws NullPointerException if the node or server is null
|
||||
* @throws IllegalArgumentException if the node or server is invalid
|
||||
*/
|
||||
boolean hasPermission(String node, boolean b, String server);
|
||||
|
||||
/**
|
||||
* Checks to see the the object has a permission on a certain server and world
|
||||
*
|
||||
* @param node The permission node
|
||||
* @param b If the node is true/false(negated)
|
||||
* @param server The server
|
||||
* @param world The world
|
||||
* @return true if the object has the permission
|
||||
* @throws NullPointerException if the node, server or world is null
|
||||
* @throws IllegalArgumentException if the node, server or world is invalid
|
||||
*/
|
||||
boolean hasPermission(String node, boolean b, String server, String world);
|
||||
|
||||
/**
|
||||
* Checks to see the the object has a permission
|
||||
*
|
||||
* @param node The permission node
|
||||
* @param b If the node is true/false(negated)
|
||||
* @param temporary if the permission is temporary
|
||||
* @return true if the object has the permission
|
||||
* @throws NullPointerException if the node is null
|
||||
* @throws IllegalArgumentException if the node is invalid
|
||||
*/
|
||||
boolean hasPermission(String node, boolean b, boolean temporary);
|
||||
|
||||
/**
|
||||
* Checks to see the the object has a permission on a certain server
|
||||
*
|
||||
* @param node The permission node
|
||||
* @param b If the node is true/false(negated)
|
||||
* @param server The server to check on
|
||||
* @param temporary if the permission is temporary
|
||||
* @return true if the object has the permission
|
||||
* @throws NullPointerException if the node or server is null
|
||||
* @throws IllegalArgumentException if the node or server is invalid
|
||||
*/
|
||||
boolean hasPermission(String node, boolean b, String server, boolean temporary);
|
||||
|
||||
/**
|
||||
* Checks to see the the object has a permission on a certain server and world
|
||||
*
|
||||
* @param node The permission node
|
||||
* @param b If the node is true/false(negated)
|
||||
* @param server The server to check on
|
||||
* @param world The world to check on
|
||||
* @param temporary if the permission is temporary
|
||||
* @return true if the object has the permission
|
||||
* @throws NullPointerException if the node, server or world is null
|
||||
* @throws IllegalArgumentException if the node, server or world is invalid
|
||||
*/
|
||||
boolean hasPermission(String node, boolean b, String server, String world, boolean temporary);
|
||||
|
||||
/**
|
||||
* Cheks to see if the object inherits a certain permission
|
||||
*
|
||||
* @param node the node to check for
|
||||
* @return a Tristate for the holders inheritance status for the node
|
||||
* @throws NullPointerException if the node is null
|
||||
* @since 2.6
|
||||
*/
|
||||
Tristate inheritsPermission(Node node);
|
||||
|
||||
/**
|
||||
* Checks to see if the object inherits a certain permission
|
||||
*
|
||||
* @param node The permission node
|
||||
* @param b If the node is true/false(negated)
|
||||
* @return true if the object inherits the permission
|
||||
* @throws NullPointerException if the node is null
|
||||
* @throws IllegalArgumentException if the node is invalid
|
||||
*/
|
||||
boolean inheritsPermission(String node, boolean b);
|
||||
|
||||
/**
|
||||
* Checks to see the the object inherits a permission on a certain server
|
||||
*
|
||||
* @param node The permission node
|
||||
* @param b If the node is true/false(negated)
|
||||
* @param server The server
|
||||
* @return true if the object inherits the permission
|
||||
* @throws NullPointerException if the node or server is null
|
||||
* @throws IllegalArgumentException if the node or server is invalid
|
||||
*/
|
||||
boolean inheritsPermission(String node, boolean b, String server);
|
||||
|
||||
/**
|
||||
* Checks to see the the object inherits a permission on a certain server and world
|
||||
*
|
||||
* @param node The permission node
|
||||
* @param b If the node is true/false(negated)
|
||||
* @param server The server
|
||||
* @param world The world
|
||||
* @return true if the object inherits the permission
|
||||
* @throws NullPointerException if the node, server or world is null
|
||||
* @throws IllegalArgumentException if the node server or world is invalid
|
||||
*/
|
||||
boolean inheritsPermission(String node, boolean b, String server, String world);
|
||||
|
||||
/**
|
||||
* Checks to see if the object inherits a permission
|
||||
*
|
||||
* @param node The permission node
|
||||
* @param b If the node is true/false(negated)
|
||||
* @param temporary if the permission is temporary
|
||||
* @return true if the object inherits the permission
|
||||
* @throws NullPointerException if the node is null
|
||||
* @throws IllegalArgumentException if the node is invalid
|
||||
*/
|
||||
boolean inheritsPermission(String node, boolean b, boolean temporary);
|
||||
|
||||
/**
|
||||
* Checks to see if the object inherits a permission on a certain server
|
||||
*
|
||||
* @param node The permission node
|
||||
* @param b If the node is true/false(negated)
|
||||
* @param server The server
|
||||
* @param temporary if the permission is temporary
|
||||
* @return true if the object inherits the permission
|
||||
* @throws NullPointerException if the node or server is null
|
||||
* @throws IllegalArgumentException if the node or server is invalid
|
||||
*/
|
||||
boolean inheritsPermission(String node, boolean b, String server, boolean temporary);
|
||||
|
||||
/**
|
||||
* Checks to see if the object inherits a permission on a certain server and world
|
||||
*
|
||||
* @param node The permission node
|
||||
* @param b If the node is true/false(negated)
|
||||
* @param server The server
|
||||
* @param world The world
|
||||
* @param temporary if the permission is temporary
|
||||
* @return true if the object inherits the permission
|
||||
* @throws NullPointerException if the node, server or world is null
|
||||
* @throws IllegalArgumentException if the node, server or world if invalid
|
||||
*/
|
||||
boolean inheritsPermission(String node, boolean b, String server, String world, boolean temporary);
|
||||
|
||||
/**
|
||||
* Sets a permission for the object
|
||||
*
|
||||
* @param node The node to be set
|
||||
* @throws ObjectAlreadyHasException if the object already has the permission
|
||||
* @throws NullPointerException if the node is null
|
||||
* @since 2.6
|
||||
*/
|
||||
void setPermission(Node node) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Sets a transient permission for the object
|
||||
*
|
||||
* <p> A transient node is a permission that does not persist.
|
||||
* Whenever a user logs out of the server, or the server restarts, this permission will disappear.
|
||||
* It is never saved to the datastore, and therefore will not apply on other servers.
|
||||
*
|
||||
* <p> This is useful if you want to temporarily set a permission for a user while they're online, but don't
|
||||
* want it to persist, and have to worry about removing it when they log out.
|
||||
*
|
||||
* <p> For unsetting a transient permission, see {@link #unsetTransientPermission(Node)}
|
||||
*
|
||||
* @param node The node to be set
|
||||
* @throws ObjectAlreadyHasException if the object already has the permission
|
||||
* @throws NullPointerException if the node is null
|
||||
* @since 2.6
|
||||
*/
|
||||
void setTransientPermission(Node node) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Sets a permission for the object
|
||||
*
|
||||
* @param node The node to be set
|
||||
* @param value What to set the node to - true/false(negated)
|
||||
* @throws ObjectAlreadyHasException if the object already has the permission
|
||||
* @throws NullPointerException if the node is null
|
||||
* @throws IllegalArgumentException if the node is invalid
|
||||
* @deprecated in favour of {@link #setPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
void setPermission(String node, boolean value) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Sets a permission for the object on a specific server
|
||||
*
|
||||
* @param node The node to set
|
||||
* @param value What to set the node to - true/false(negated)
|
||||
* @param server The server to set the permission on
|
||||
* @throws ObjectAlreadyHasException if the object already has the permission
|
||||
* @throws NullPointerException if the node or server is null
|
||||
* @throws IllegalArgumentException if the node or server is invalid
|
||||
* @deprecated in favour of {@link #setPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
void setPermission(String node, boolean value, String server) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Sets a permission for the object on a specific server and world
|
||||
*
|
||||
* @param node The node to set
|
||||
* @param value What to set the node to - true/false(negated)
|
||||
* @param server The server to set the permission on
|
||||
* @param world The world to set the permission on
|
||||
* @throws ObjectAlreadyHasException if the object already has the permission
|
||||
* @throws NullPointerException if the node, server or world is null
|
||||
* @throws IllegalArgumentException if the node, server or world is invalid
|
||||
* @deprecated in favour of {@link #setPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
void setPermission(String node, boolean value, String server, String world) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Sets a temporary permission for the object
|
||||
*
|
||||
* @param node The node to set
|
||||
* @param value What to set the node to - true/false(negated)
|
||||
* @param expireAt The time in unixtime when the permission will expire
|
||||
* @throws ObjectAlreadyHasException if the object already has the permission
|
||||
* @throws NullPointerException if the node is null
|
||||
* @throws IllegalArgumentException if the node is invalid or if the expiry time is in the past
|
||||
* @deprecated in favour of {@link #setPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
void setPermission(String node, boolean value, long expireAt) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Sets a temporary permission for the object on a specific server
|
||||
*
|
||||
* @param node The node to set
|
||||
* @param value What to set the node to - true/false(negated)
|
||||
* @param server The server to set the permission on
|
||||
* @param expireAt The time in unixtime when the permission will expire
|
||||
* @throws ObjectAlreadyHasException if the object already has the permission
|
||||
* @throws NullPointerException if the node or server is null
|
||||
* @throws IllegalArgumentException if the node/server is invalid or if the expiry time is in the past
|
||||
* @deprecated in favour of {@link #setPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
void setPermission(String node, boolean value, String server, long expireAt) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Sets a temporary permission for the object on a specific server and world
|
||||
*
|
||||
* @param node The node to set
|
||||
* @param value What to set the node to - true/false(negated)
|
||||
* @param server The server to set the permission on
|
||||
* @param world The world to set the permission on
|
||||
* @param expireAt The time in unixtime when the permission will expire
|
||||
* @throws ObjectAlreadyHasException if the object already has the permission
|
||||
* @throws NullPointerException if the node, server or world is null
|
||||
* @throws IllegalArgumentException if the node/server/world is invalid, or if the expiry time is in the past
|
||||
* @deprecated in favour of {@link #setPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
void setPermission(String node, boolean value, String server, String world, long expireAt) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Unsets a permission for the object
|
||||
*
|
||||
* @param node The node to be unset
|
||||
* @throws ObjectLacksException if the node wasn't already set
|
||||
* @throws NullPointerException if the node is null
|
||||
* @since 2.6
|
||||
*/
|
||||
void unsetPermission(Node node) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Unsets a transient permission for the object
|
||||
*
|
||||
* @param node The node to be unset
|
||||
* @throws ObjectLacksException if the node wasn't already set
|
||||
* @throws NullPointerException if the node is null
|
||||
* @since 2.6
|
||||
*/
|
||||
void unsetTransientPermission(Node node) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Unsets a permission for the object
|
||||
*
|
||||
* @param node The node to be unset
|
||||
* @param temporary if the permission being removed is temporary
|
||||
* @throws ObjectLacksException if the node wasn't already set
|
||||
* @throws NullPointerException if the node is null
|
||||
* @throws IllegalArgumentException if the node is invalid
|
||||
* @deprecated in favour of {@link #unsetPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
void unsetPermission(String node, boolean temporary) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Unsets a permission for the object
|
||||
*
|
||||
* @param node The node to be unset
|
||||
* @throws ObjectLacksException if the node wasn't already set
|
||||
* @throws NullPointerException if the node is null
|
||||
* @throws IllegalArgumentException if the node is invalid
|
||||
* @deprecated in favour of {@link #unsetPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
void unsetPermission(String node) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Unsets a permission for the object on a specific server
|
||||
*
|
||||
* @param node The node to be unset
|
||||
* @param server The server to unset the node on
|
||||
* @throws ObjectLacksException if the node wasn't already set
|
||||
* @throws NullPointerException if the node or server is null
|
||||
* @throws IllegalArgumentException if the node or server is invalid
|
||||
* @deprecated in favour of {@link #unsetPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
void unsetPermission(String node, String server) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Unsets a permission for the object on a specific server and world
|
||||
*
|
||||
* @param node The node to be unset
|
||||
* @param server The server to unset the node on
|
||||
* @param world The world to unset the node on
|
||||
* @throws ObjectLacksException if the node wasn't already set
|
||||
* @throws NullPointerException if the node, server or world is null
|
||||
* @throws IllegalArgumentException if the node, server or world is invalid
|
||||
* @deprecated in favour of {@link #unsetPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
void unsetPermission(String node, String server, String world) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Unsets a permission for the object on a specific server
|
||||
*
|
||||
* @param node The node to be unset
|
||||
* @param server The server to unset the node on
|
||||
* @param temporary if the permission being unset is temporary
|
||||
* @throws ObjectLacksException if the node wasn't already set
|
||||
* @throws NullPointerException if the node or server is null
|
||||
* @throws IllegalArgumentException if the node or server is invalid
|
||||
* @deprecated in favour of {@link #unsetPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
void unsetPermission(String node, String server, boolean temporary) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Unsets a permission for the object on a specific server and world
|
||||
*
|
||||
* @param node The node to be unset
|
||||
* @param server The server to unset the node on
|
||||
* @param world The world to unset the node on
|
||||
* @param temporary if the permission being unset is temporary
|
||||
* @throws ObjectLacksException if the node wasn't already set
|
||||
* @throws NullPointerException if the node, server or world is null
|
||||
* @throws IllegalArgumentException if the node, server or world is invalid
|
||||
* @deprecated in favour of {@link #unsetPermission(Node)}
|
||||
*/
|
||||
@Deprecated
|
||||
void unsetPermission(String node, String server, String world, boolean temporary) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Clears all nodes held by the object
|
||||
*
|
||||
* @since 2.17
|
||||
*/
|
||||
void clearNodes();
|
||||
|
||||
/**
|
||||
* Clears all nodes held by the object on a specific server
|
||||
*
|
||||
* @param server the server to filter by, can be null
|
||||
* @since 2.17
|
||||
*/
|
||||
void clearNodes(String server);
|
||||
|
||||
/**
|
||||
* Clears all nodes held by the object on a specific server and world
|
||||
*
|
||||
* @param server the server to filter by, can be null
|
||||
* @param world the world to filter by, can be null
|
||||
* @since 2.17
|
||||
*/
|
||||
void clearNodes(String server, String world);
|
||||
|
||||
/**
|
||||
* Clears all parent groups
|
||||
*
|
||||
* @since 2.17
|
||||
*/
|
||||
void clearParents();
|
||||
|
||||
/**
|
||||
* Clears all parents on a specific server
|
||||
*
|
||||
* @param server the server to filter by, can be null
|
||||
* @since 2.17
|
||||
*/
|
||||
void clearParents(String server);
|
||||
|
||||
/**
|
||||
* Clears all parents on a specific server and world
|
||||
*
|
||||
* @param server the server to filter by, can be null
|
||||
* @param world the world to filter by, can be null
|
||||
* @since 2.17
|
||||
*/
|
||||
void clearParents(String server, String world);
|
||||
|
||||
/**
|
||||
* Clears all meta held by the object
|
||||
*
|
||||
* @since 2.17
|
||||
*/
|
||||
void clearMeta();
|
||||
|
||||
/**
|
||||
* Clears all meta held by the object on a specific server
|
||||
*
|
||||
* @param server the server to filter by, can be null
|
||||
* @since 2.17
|
||||
*/
|
||||
void clearMeta(String server);
|
||||
|
||||
/**
|
||||
* Clears all meta held by the object on a specific server and world
|
||||
*
|
||||
* @param server the server to filter by, can be null
|
||||
* @param world the world to filter by, can be null
|
||||
* @since 2.17
|
||||
*/
|
||||
void clearMeta(String server, String world);
|
||||
|
||||
/**
|
||||
* Clears all meta for a given key.
|
||||
*
|
||||
* @param key the meta key
|
||||
* @param server the server to filter by, can be null
|
||||
* @param world the world to filter by, can be null
|
||||
* @param temporary whether the query is for temporary nodes or not.
|
||||
*/
|
||||
void clearMetaKeys(String key, String server, String world, boolean temporary);
|
||||
|
||||
/**
|
||||
* Clears all transient permissions the holder has.
|
||||
*/
|
||||
void clearTransientNodes();
|
||||
|
||||
/**
|
||||
* Processes the nodes and returns the non-temporary ones.
|
||||
*
|
||||
* @return a set of permanent nodes
|
||||
* @since 2.6
|
||||
*/
|
||||
Set<Node> getPermanentPermissionNodes();
|
||||
|
||||
/**
|
||||
* Processes the nodes and returns the temporary ones.
|
||||
*
|
||||
* @return a set of temporary nodes
|
||||
* @since 2.6
|
||||
*/
|
||||
Set<Node> getTemporaryPermissionNodes();
|
||||
|
||||
}
|
||||
@@ -1,273 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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 me.lucko.luckperms.api;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* A means of loading and saving data to/from the Storage provider.
|
||||
*
|
||||
* <p>All methods return {@link CompletableFuture}s, which will be populated with the result once the data has been
|
||||
* loaded asynchronously. Care should be taken when using the methods to ensure that the main server thread is not
|
||||
* blocked.
|
||||
*
|
||||
* <p>Methods such as {@link CompletableFuture#get()} and equivalent should <strong>not</strong> be called on the main
|
||||
* server thread. If you need to use the result of these operations on the main server thread, please register a
|
||||
* callback using {@link CompletableFuture#thenAcceptAsync(Consumer, Executor)} and {@link #getSyncExecutor()}.
|
||||
*
|
||||
* @since 2.14
|
||||
*/
|
||||
public interface Storage {
|
||||
|
||||
/**
|
||||
* Get the name of the storage implementation.
|
||||
*
|
||||
* @return the name of the implementation
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Return whether the storage instance is allowing logins on the platform.
|
||||
*
|
||||
* @return true if logins are enabled
|
||||
*/
|
||||
boolean isAcceptingLogins();
|
||||
|
||||
/**
|
||||
* Returns an executor which will run all passed runnables on the main server thread.
|
||||
*
|
||||
* @return an executor instance
|
||||
*/
|
||||
Executor getSyncExecutor();
|
||||
|
||||
/**
|
||||
* Returns an executor which will run all passed runnables asynchronously using the platforms scheduler and thread
|
||||
* pools.
|
||||
*
|
||||
* @return an executor instance
|
||||
*/
|
||||
Executor getAsyncExecutor();
|
||||
|
||||
/**
|
||||
* Saves an action to storage
|
||||
*
|
||||
* @param entry the log entry to be saved
|
||||
* @return true if the operation completed successfully.
|
||||
* @throws NullPointerException if entry is null
|
||||
*/
|
||||
CompletableFuture<Boolean> logAction(LogEntry entry);
|
||||
|
||||
/**
|
||||
* Loads and returns the entire log from storage
|
||||
*
|
||||
* @return a log instance, could be null if loading failed
|
||||
*/
|
||||
CompletableFuture<Log> getLog();
|
||||
|
||||
/**
|
||||
* Loads a user's data from the main storage into the plugins local storage.
|
||||
*
|
||||
* @param uuid the uuid of the user to load
|
||||
* @param username the users username. (if you want to specify <code>null</code> here, just input "null" as a
|
||||
* string.)
|
||||
* @return if the operation completed successfully
|
||||
* @throws NullPointerException if uuid or username is null
|
||||
*/
|
||||
CompletableFuture<Boolean> loadUser(UUID uuid, String username);
|
||||
|
||||
/**
|
||||
* Saves a user object back to storage. You should call this after you make any changes to a user.
|
||||
*
|
||||
* @param user the user to save
|
||||
* @return true if the operation completed successfully.
|
||||
* @throws NullPointerException if user is null
|
||||
* @throws IllegalStateException if the user instance was not obtained from LuckPerms.
|
||||
*/
|
||||
CompletableFuture<Boolean> saveUser(User user);
|
||||
|
||||
/**
|
||||
* Removes users from the main storage who are "default". This is called every time the plugin loads.
|
||||
*
|
||||
* @return true if the operation completed successfully
|
||||
*/
|
||||
CompletableFuture<Boolean> cleanupUsers();
|
||||
|
||||
/**
|
||||
* Gets a set all "unique" user UUIDs.
|
||||
* "Unique" meaning the user isn't just a member of the "default" group.
|
||||
*
|
||||
* @return a set of uuids, or null if the operation failed.
|
||||
*/
|
||||
CompletableFuture<Set<UUID>> getUniqueUsers();
|
||||
|
||||
/**
|
||||
* Searches for a list of users with a given permission.
|
||||
*
|
||||
* @param permission the permission to search for
|
||||
* @return a list of held permissions, or null if the operation failed
|
||||
* @throws NullPointerException if the permission is null
|
||||
* @since 2.17
|
||||
*/
|
||||
CompletableFuture<List<HeldPermission<UUID>>> getUsersWithPermission(String permission);
|
||||
|
||||
/**
|
||||
* Creates and loads a group into the plugins local storage
|
||||
*
|
||||
* @param name the name of the group
|
||||
* @return true if the operation completed successfully
|
||||
* @throws NullPointerException if name is null
|
||||
* @throws IllegalArgumentException if the name is invalid
|
||||
*/
|
||||
CompletableFuture<Boolean> createAndLoadGroup(String name);
|
||||
|
||||
/**
|
||||
* Loads a group into the plugins local storage.
|
||||
*
|
||||
* @param name the name of the group
|
||||
* @return true if the operation completed successfully
|
||||
* @throws NullPointerException if name is null
|
||||
* @throws IllegalArgumentException if the name is invalid
|
||||
*/
|
||||
CompletableFuture<Boolean> loadGroup(String name);
|
||||
|
||||
/**
|
||||
* Loads all groups from the storage into memory
|
||||
*
|
||||
* @return true if the operation completed successfully.
|
||||
*/
|
||||
CompletableFuture<Boolean> loadAllGroups();
|
||||
|
||||
/**
|
||||
* Saves a group back to storage. You should call this after you make any changes to a group.
|
||||
*
|
||||
* @param group the group to save
|
||||
* @return true if the operation completed successfully.
|
||||
* @throws NullPointerException if group is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
*/
|
||||
CompletableFuture<Boolean> saveGroup(Group group);
|
||||
|
||||
/**
|
||||
* Permanently deletes a group from storage.
|
||||
*
|
||||
* @param group the group to delete
|
||||
* @return true if the operation completed successfully.
|
||||
* @throws NullPointerException if group is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
*/
|
||||
CompletableFuture<Boolean> deleteGroup(Group group);
|
||||
|
||||
/**
|
||||
* Searches for a list of groups with a given permission.
|
||||
*
|
||||
* @param permission the permission to search for
|
||||
* @return a list of held permissions, or null if the operation failed
|
||||
* @throws NullPointerException if the permission is null
|
||||
* @since 2.17
|
||||
*/
|
||||
CompletableFuture<List<HeldPermission<String>>> getGroupsWithPermission(String permission);
|
||||
|
||||
/**
|
||||
* Creates and loads a track into the plugins local storage
|
||||
*
|
||||
* @param name the name of the track
|
||||
* @return true if the operation completed successfully
|
||||
* @throws NullPointerException if name is null
|
||||
* @throws IllegalArgumentException if the name is invalid
|
||||
*/
|
||||
CompletableFuture<Boolean> createAndLoadTrack(String name);
|
||||
|
||||
/**
|
||||
* Loads a track into the plugins local storage.
|
||||
*
|
||||
* @param name the name of the track
|
||||
* @return true if the operation completed successfully
|
||||
* @throws NullPointerException if name is null
|
||||
* @throws IllegalArgumentException if the name is invalid
|
||||
*/
|
||||
CompletableFuture<Boolean> loadTrack(String name);
|
||||
|
||||
/**
|
||||
* Loads all tracks from the storage into memory
|
||||
*
|
||||
* @return true if the operation completed successfully.
|
||||
*/
|
||||
CompletableFuture<Boolean> loadAllTracks();
|
||||
|
||||
/**
|
||||
* Saves a track back to storage. You should call this after you make any changes to a track.
|
||||
*
|
||||
* @param track the track to save
|
||||
* @return true if the operation completed successfully.
|
||||
* @throws NullPointerException if track is null
|
||||
* @throws IllegalStateException if the track instance was not obtained from LuckPerms.
|
||||
*/
|
||||
CompletableFuture<Boolean> saveTrack(Track track);
|
||||
|
||||
/**
|
||||
* Permanently deletes a track from storage
|
||||
*
|
||||
* @param track the track to delete
|
||||
* @return true if the operation completed successfully.
|
||||
* @throws NullPointerException if track is null
|
||||
* @throws IllegalStateException if the track instance was not obtained from LuckPerms.
|
||||
*/
|
||||
CompletableFuture<Boolean> deleteTrack(Track track);
|
||||
|
||||
/**
|
||||
* Saves UUID caching data to the global cache
|
||||
*
|
||||
* @param username the users username
|
||||
* @param uuid the users mojang unique id
|
||||
* @return true if the operation completed successfully.
|
||||
* @throws NullPointerException if either parameters are null
|
||||
* @throws IllegalArgumentException if the username is invalid
|
||||
*/
|
||||
CompletableFuture<Boolean> saveUUIDData(String username, UUID uuid);
|
||||
|
||||
/**
|
||||
* Gets a UUID from a username
|
||||
*
|
||||
* @param username the corresponding username
|
||||
* @return a uuid object, could be null
|
||||
* @throws NullPointerException if either parameters are null
|
||||
* @throws IllegalArgumentException if the username is invalid
|
||||
*/
|
||||
CompletableFuture<UUID> getUUID(String username);
|
||||
|
||||
/**
|
||||
* Gets a username from a UUID
|
||||
*
|
||||
* @param uuid the corresponding uuid
|
||||
* @return a name string, could be null
|
||||
* @throws NullPointerException if either parameters are null
|
||||
* @since 2.17
|
||||
*/
|
||||
CompletableFuture<String> getName(UUID uuid);
|
||||
|
||||
}
|
||||
@@ -1,299 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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 me.lucko.luckperms.api;
|
||||
|
||||
import me.lucko.luckperms.api.caching.UserData;
|
||||
import me.lucko.luckperms.exceptions.ObjectAlreadyHasException;
|
||||
import me.lucko.luckperms.exceptions.ObjectLacksException;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* A player holding permission data
|
||||
*/
|
||||
public interface User extends PermissionHolder {
|
||||
|
||||
/**
|
||||
* Gets the users unique ID
|
||||
*
|
||||
* @return the users Mojang assigned unique id
|
||||
*/
|
||||
UUID getUuid();
|
||||
|
||||
/**
|
||||
* Gets the users username
|
||||
*
|
||||
* @return the Users Username
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Gets the users primary group
|
||||
*
|
||||
* @return the users primary group
|
||||
*/
|
||||
String getPrimaryGroup();
|
||||
|
||||
/**
|
||||
* Sets a users primary group
|
||||
*
|
||||
* @param group the new primary group
|
||||
* @throws ObjectAlreadyHasException if the user already has this set as their primary group
|
||||
* @throws IllegalStateException if the user is not a member of that group
|
||||
* @throws NullPointerException if the group is null
|
||||
*/
|
||||
void setPrimaryGroup(String group) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Refresh and re-assign the users permissions.
|
||||
*
|
||||
* <p> This request is not buffered, and the refresh call will be ran directly. This should ideally be called on
|
||||
* an asynchronous thread.
|
||||
*/
|
||||
void refreshPermissions();
|
||||
|
||||
/**
|
||||
* Gets the user's {@link UserData} cache, if they have one setup.
|
||||
*
|
||||
* @return an optional, possibly containing the user's cached lookup data.
|
||||
* @since 2.13
|
||||
*/
|
||||
Optional<UserData> getUserDataCache();
|
||||
|
||||
/**
|
||||
* Sets up the users data cache, if the don't have one setup already.
|
||||
*
|
||||
* @since 2.17
|
||||
*/
|
||||
void setupDataCache();
|
||||
|
||||
/**
|
||||
* Check to see if the user is a member of a group
|
||||
*
|
||||
* @param group The group to check membership of
|
||||
* @return true if the user is a member of the group
|
||||
* @throws NullPointerException if the group is null
|
||||
*/
|
||||
boolean isInGroup(Group group);
|
||||
|
||||
/**
|
||||
* Check to see if a user is a member of a group on a specific server
|
||||
*
|
||||
* @param group The group to check membership of
|
||||
* @param server The server to check on
|
||||
* @return true if the user is a member of the group
|
||||
* @throws NullPointerException if the group or server is null
|
||||
* @throws IllegalArgumentException if the server is invalid
|
||||
*/
|
||||
boolean isInGroup(Group group, String server);
|
||||
|
||||
/**
|
||||
* Check to see if a user is a member of a group on a specific server and world
|
||||
*
|
||||
* @param group The group to check membership of
|
||||
* @param server The server to check on
|
||||
* @param world The world to check on
|
||||
* @return true if the user is a member of the group
|
||||
* @throws NullPointerException if the group, server or world is null
|
||||
* @throws IllegalArgumentException if the server or world is invalid
|
||||
*/
|
||||
boolean isInGroup(Group group, String server, String world);
|
||||
|
||||
/**
|
||||
* Add a user to a group
|
||||
*
|
||||
* @param group The group to add the user to
|
||||
* @throws ObjectAlreadyHasException if the user is already a member of the group
|
||||
* @throws NullPointerException if the group is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
*/
|
||||
void addGroup(Group group) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Add a user to a group on a specific server
|
||||
*
|
||||
* @param group The group to add the user to
|
||||
* @param server The server to add the group on
|
||||
* @throws ObjectAlreadyHasException if the user is already a member of the group on that server
|
||||
* @throws NullPointerException if the group or server is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
* @throws IllegalArgumentException if the server is invalid
|
||||
*/
|
||||
void addGroup(Group group, String server) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Add a user to a group on a specific server and world
|
||||
*
|
||||
* @param group The group to add the user to
|
||||
* @param server The server to add the group on
|
||||
* @param world The world to add the group on
|
||||
* @throws ObjectAlreadyHasException if the user is already a member of the group on that server
|
||||
* @throws NullPointerException if the group, server or world is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
* @throws IllegalArgumentException if the server or world is invalid
|
||||
*/
|
||||
void addGroup(Group group, String server, String world) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Add a user to a group temporarily on a specific server
|
||||
*
|
||||
* @param group The group to add the user to
|
||||
* @param expireAt when the group should expire
|
||||
* @throws ObjectAlreadyHasException if the user is already a member of the group on that server
|
||||
* @throws NullPointerException if the group is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
* @throws IllegalArgumentException if the expiry time is in the past
|
||||
*/
|
||||
void addGroup(Group group, long expireAt) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Add a user to a group temporarily on a specific server
|
||||
*
|
||||
* @param group The group to add the user to
|
||||
* @param server The server to add the group on
|
||||
* @param expireAt when the group should expire
|
||||
* @throws ObjectAlreadyHasException if the user is already a member of the group on that server
|
||||
* @throws NullPointerException if the group or server is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
* @throws IllegalArgumentException if the expiry time is in the past or the server is invalid
|
||||
*/
|
||||
void addGroup(Group group, String server, long expireAt) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Add a user to a group temporarily on a specific server and world
|
||||
*
|
||||
* @param group The group to add the user to
|
||||
* @param server The server to add the group on
|
||||
* @param world The world to add the group on
|
||||
* @param expireAt when the group should expire
|
||||
* @throws ObjectAlreadyHasException if the user is already a member of the group on that server
|
||||
* @throws NullPointerException if the group, server or world is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
* @throws IllegalArgumentException if the expiry time is in the past or the server/world is invalid
|
||||
*/
|
||||
void addGroup(Group group, String server, String world, long expireAt) throws ObjectAlreadyHasException;
|
||||
|
||||
/**
|
||||
* Remove the user from a group
|
||||
*
|
||||
* @param group the group to remove the user from
|
||||
* @throws ObjectLacksException if the user isn't a member of the group
|
||||
* @throws NullPointerException if the group is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
*/
|
||||
void removeGroup(Group group) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Remove the user from a group
|
||||
*
|
||||
* @param group the group to remove the user from
|
||||
* @param temporary if the group being removed is temporary
|
||||
* @throws ObjectLacksException if the user isn't a member of the group
|
||||
* @throws NullPointerException if the group is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
*/
|
||||
void removeGroup(Group group, boolean temporary) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Remove the user from a group on a specific server
|
||||
*
|
||||
* @param group The group to remove the user from
|
||||
* @param server The server to remove the group on
|
||||
* @throws ObjectLacksException if the user isn't a member of the group
|
||||
* @throws NullPointerException if the group or server is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
* @throws IllegalArgumentException if the server is invalid
|
||||
*/
|
||||
void removeGroup(Group group, String server) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Remove the user from a group on a specific server and world
|
||||
*
|
||||
* @param group The group to remove the user from
|
||||
* @param server The server to remove the group on
|
||||
* @param world The world to remove the group on
|
||||
* @throws ObjectLacksException if the user isn't a member of the group
|
||||
* @throws NullPointerException if the group, server or world is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
* @throws IllegalArgumentException if the server or world is invalid
|
||||
*/
|
||||
void removeGroup(Group group, String server, String world) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Remove the user from a group on a specific server
|
||||
*
|
||||
* @param group The group to remove the user from
|
||||
* @param server The server to remove the group on
|
||||
* @param temporary if the group being removed is temporary
|
||||
* @throws ObjectLacksException if the user isn't a member of the group
|
||||
* @throws NullPointerException if the group or server is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
* @throws IllegalArgumentException if the expiry time is in the past or the server is invalid
|
||||
*/
|
||||
void removeGroup(Group group, String server, boolean temporary) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Remove the user from a group on a specific server and world
|
||||
*
|
||||
* @param group The group to remove the user from
|
||||
* @param server The server to remove the group on
|
||||
* @param world The world to remove the group on
|
||||
* @param temporary if the group being removed is temporary
|
||||
* @throws ObjectLacksException if the user isn't a member of the group
|
||||
* @throws NullPointerException if the group, server or world is null
|
||||
* @throws IllegalStateException if the group instance was not obtained from LuckPerms.
|
||||
* @throws IllegalArgumentException if the expiry time is in the past or the server/world is invalid
|
||||
*/
|
||||
void removeGroup(Group group, String server, String world, boolean temporary) throws ObjectLacksException;
|
||||
|
||||
/**
|
||||
* Get a {@link List} of all of the groups the user is a member of, on all servers
|
||||
*
|
||||
* @return a {@link List} of group names
|
||||
*/
|
||||
List<String> getGroupNames();
|
||||
|
||||
/**
|
||||
* Get a {@link List} of the groups the user is a member of on a specific server
|
||||
*
|
||||
* @param server the server to check
|
||||
* @param world the world to check
|
||||
* @return a {@link List} of group names
|
||||
* @throws NullPointerException if the server or world is null
|
||||
* @throws IllegalArgumentException if the server or world is invalid
|
||||
*/
|
||||
List<String> getLocalGroups(String server, String world);
|
||||
|
||||
/**
|
||||
* Get a {@link List} of the groups the user is a member of on a specific server
|
||||
*
|
||||
* @param server the server to check
|
||||
* @return a {@link List} of group names
|
||||
* @throws NullPointerException if the server is null
|
||||
* @throws IllegalArgumentException if the server is invalid
|
||||
*/
|
||||
List<String> getLocalGroups(String server);
|
||||
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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 me.lucko.luckperms.api;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* A UUID cache for online users, between external Mojang UUIDs, and internal LuckPerms UUIDs.
|
||||
*
|
||||
* <p> This UuidCache is a means of allowing users to have the same internal UUID across a network of offline mode
|
||||
* servers or mixed offline mode and online mode servers. Platforms running in offline mode generate a UUID for a
|
||||
* user when they first join the server, but this UUID will then not be consistent across the network. LuckPerms will
|
||||
* instead check the datastore cache, to get a UUID for a user that is consistent across an entire network.
|
||||
*
|
||||
* <p> If you want to get a user object from the Storage using the api on a server in offline mode, you will need to use
|
||||
* this cache, OR use Storage#getUUID, for users that are not online.
|
||||
*
|
||||
* <p> THIS IS ONLY EFFECTIVE FOR ONLINE PLAYERS. USE THE DATASTORE METHODS FOR OFFLINE PLAYERS.
|
||||
*/
|
||||
public interface UuidCache {
|
||||
|
||||
/**
|
||||
* Gets a users internal "LuckPerms" UUID, from the one given by the server.
|
||||
*
|
||||
* @param external the UUID assigned by the server, through Player#getUniqueId or ProxiedPlayer#getUniqueId
|
||||
* @return the corresponding internal UUID
|
||||
*/
|
||||
UUID getUUID(UUID external);
|
||||
|
||||
/**
|
||||
* Gets a users external, server assigned or Mojang assigned unique id, from the internal one used within LuckPerms.
|
||||
*
|
||||
* @param internal the UUID used within LuckPerms, through User#getUuid
|
||||
* @return the corresponding external UUID
|
||||
*/
|
||||
UUID getExternalUUID(UUID internal);
|
||||
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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 me.lucko.luckperms.api.caching;
|
||||
|
||||
import me.lucko.luckperms.api.Contexts;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Holds cached permission and meta lookup data for a {@link me.lucko.luckperms.api.User}.
|
||||
*
|
||||
* <p>Data is only likely to be available for online users. All calls will account for inheritance, as well as any
|
||||
* default data provided by the platform. This calls are heavily cached and are therefore fast.
|
||||
*
|
||||
* @since 2.13
|
||||
*/
|
||||
public interface UserData {
|
||||
|
||||
/**
|
||||
* Gets PermissionData from the cache, given a specified context.
|
||||
*
|
||||
* <p> If the data is not cached, it is calculated. Therefore, this call could be costly.
|
||||
*
|
||||
* @param contexts the contexts to get the permission data in
|
||||
* @return a permission data instance
|
||||
* @throws NullPointerException if contexts is null
|
||||
*/
|
||||
PermissionData getPermissionData(Contexts contexts);
|
||||
|
||||
/**
|
||||
* Gets MetaData from the cache, given a specified context.
|
||||
*
|
||||
* <p> If the data is not cached, it is calculated. Therefore, this call could be costly.
|
||||
*
|
||||
* @param contexts the contexts to get the permission data in
|
||||
* @return a meta data instance
|
||||
* @throws NullPointerException if contexts is null
|
||||
*/
|
||||
MetaData getMetaData(Contexts contexts);
|
||||
|
||||
/**
|
||||
* Calculates permission data, bypassing the cache.
|
||||
*
|
||||
* @param contexts the contexts to get permission data in
|
||||
* @return a permission data instance
|
||||
* @throws NullPointerException if contexts is null
|
||||
*/
|
||||
PermissionData calculatePermissions(Contexts contexts);
|
||||
|
||||
/**
|
||||
* Calculates meta data, bypassing the cache.
|
||||
*
|
||||
* @param contexts the contexts to get meta data in
|
||||
* @return a meta data instance
|
||||
* @throws NullPointerException if contexts is null
|
||||
*/
|
||||
MetaData calculateMeta(Contexts contexts);
|
||||
|
||||
/**
|
||||
* Calculates permission data and stores it in the cache.
|
||||
*
|
||||
* <p> If there is already data cached for the given contexts, and if the resultant output is different,
|
||||
* the cached value is updated.
|
||||
*
|
||||
* @param contexts the contexts to recalculate in.
|
||||
* @throws NullPointerException if contexts is null
|
||||
*/
|
||||
void recalculatePermissions(Contexts contexts);
|
||||
|
||||
/**
|
||||
* Calculates meta data and stores it in the cache.
|
||||
*
|
||||
* <p> If there is already data cached for the given contexts, and if the resultant output is different,
|
||||
* the cached value is updated.
|
||||
*
|
||||
* @param contexts the contexts to recalculate in.
|
||||
* @throws NullPointerException if contexts is null
|
||||
*/
|
||||
void recalculateMeta(Contexts contexts);
|
||||
|
||||
/**
|
||||
* Calls {@link #recalculatePermissions(Contexts)} for all current loaded contexts
|
||||
*/
|
||||
void recalculatePermissions();
|
||||
|
||||
/**
|
||||
* Calls {@link #recalculateMeta(Contexts)} for all current loaded contexts
|
||||
*/
|
||||
void recalculateMeta();
|
||||
|
||||
/**
|
||||
* Calls {@link #preCalculate(Contexts)} for the given contexts
|
||||
*
|
||||
* @param contexts a set of contexts
|
||||
* @throws NullPointerException if contexts is null
|
||||
*/
|
||||
void preCalculate(Set<Contexts> contexts);
|
||||
|
||||
/**
|
||||
* Ensures that PermissionData and MetaData is cached for a context.
|
||||
*
|
||||
* <p> If the cache does not contain any data for the context, it will be calculated and saved.
|
||||
*
|
||||
* @param contexts the contexts to pre-calculate for
|
||||
* @throws NullPointerException if contexts is null
|
||||
*/
|
||||
void preCalculate(Contexts contexts);
|
||||
|
||||
/**
|
||||
* Invalidates all of the underlying Permission calculators.
|
||||
* Can be called to allow for an update in defaults.
|
||||
*/
|
||||
void invalidatePermissionCalculators();
|
||||
|
||||
}
|
||||
@@ -1,204 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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 me.lucko.luckperms.api.context;
|
||||
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Holds contexts.
|
||||
* Implementations may be either mutable or immutable.
|
||||
*
|
||||
* @since 2.13
|
||||
*/
|
||||
public interface ContextSet {
|
||||
|
||||
/**
|
||||
* Make a singleton ImmutableContextSet from a context pair
|
||||
*
|
||||
* @param key the key
|
||||
* @param value the value
|
||||
* @return a new ImmutableContextSet containing one KV pair
|
||||
* @throws NullPointerException if key or value is null
|
||||
*/
|
||||
static ImmutableContextSet singleton(String key, String value) {
|
||||
return ImmutableContextSet.singleton(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a ImmutableContextSet from an existing map
|
||||
*
|
||||
* @param map the map to copy from
|
||||
* @return a new ImmutableContextSet representing the pairs from the map
|
||||
* @throws NullPointerException if the map is null
|
||||
*/
|
||||
static ImmutableContextSet fromMap(Map<String, String> map) {
|
||||
return ImmutableContextSet.fromMap(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a ImmutableContextSet from an existing iterable of Map Entries
|
||||
*
|
||||
* @param iterable the iterable to copy from
|
||||
* @return a new ImmutableContextSet representing the pairs in the iterable
|
||||
* @throws NullPointerException if the iterable is null
|
||||
*/
|
||||
static ImmutableContextSet fromEntries(Iterable<? extends Map.Entry<String, String>> iterable) {
|
||||
return ImmutableContextSet.fromEntries(iterable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a ImmutableContextSet from an existing multimap
|
||||
*
|
||||
* @param multimap the multimap to copy from
|
||||
* @return a new ImmutableContextSet representing the pairs in the multimap
|
||||
* @throws NullPointerException if the multimap is null
|
||||
* @since 2.16
|
||||
*/
|
||||
static ImmutableContextSet fromMultimap(Multimap<String, String> multimap) {
|
||||
return ImmutableContextSet.fromMultimap(multimap);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new ImmutableContextSet from an existing set.
|
||||
* Only really useful for converting between mutable and immutable types.
|
||||
*
|
||||
* @param contextSet the context set to copy from
|
||||
* @return a new ImmutableContextSet with the same content and the one provided
|
||||
* @throws NullPointerException if contextSet is null
|
||||
*/
|
||||
static ImmutableContextSet fromSet(ContextSet contextSet) {
|
||||
return ImmutableContextSet.fromSet(contextSet);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new empty ImmutableContextSet.
|
||||
*
|
||||
* @return a new ImmutableContextSet
|
||||
*/
|
||||
static ImmutableContextSet empty() {
|
||||
return ImmutableContextSet.empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if this set is in an immutable form
|
||||
*
|
||||
* @return true if the set is immutable
|
||||
*/
|
||||
boolean isImmutable();
|
||||
|
||||
/**
|
||||
* If the set is mutable, this method will return an immutable copy. Otherwise just returns itself.
|
||||
*
|
||||
* @return an immutable ContextSet
|
||||
*/
|
||||
ImmutableContextSet makeImmutable();
|
||||
|
||||
/**
|
||||
* Creates a mutable copy of this set.
|
||||
*
|
||||
* @return a mutable ContextSet
|
||||
* @since 2.16
|
||||
*/
|
||||
MutableContextSet mutableCopy();
|
||||
|
||||
/**
|
||||
* Converts this ContextSet to an immutable {@link Set} of {@link Map.Entry}s.
|
||||
*
|
||||
* @return an immutable set
|
||||
*/
|
||||
Set<Map.Entry<String, String>> toSet();
|
||||
|
||||
/**
|
||||
* Converts this ContextSet to an immutable {@link Map}
|
||||
*
|
||||
* <b>NOTE: Use of this method may result in data being lost. ContextSets can contain lots of different values for
|
||||
* one key.</b>
|
||||
*
|
||||
* @return an immutable map
|
||||
*/
|
||||
Map<String, String> toMap();
|
||||
|
||||
/**
|
||||
* Converts this ContextSet to an immutable {@link Multimap}
|
||||
*
|
||||
* @return a multimap
|
||||
* @since 2.16
|
||||
*/
|
||||
Multimap<String, String> toMultimap();
|
||||
|
||||
/**
|
||||
* Check if the set contains at least one value for the given key.
|
||||
*
|
||||
* @param key the key to check for
|
||||
* @return true if the set contains a value for the key
|
||||
* @throws NullPointerException if the key is null
|
||||
*/
|
||||
boolean containsKey(String key);
|
||||
|
||||
/**
|
||||
* Gets a set of all of the values mapped to the given key
|
||||
*
|
||||
* @param key the key to find values for
|
||||
* @return a set of values
|
||||
* @throws NullPointerException if the key is null
|
||||
*/
|
||||
Set<String> getValues(String key);
|
||||
|
||||
/**
|
||||
* Check if thr set contains a given key mapped to a given value
|
||||
*
|
||||
* @param key the key to look for
|
||||
* @param value the value to look for (case sensitive)
|
||||
* @return true if the set contains the KV pair
|
||||
* @throws NullPointerException if the key or value is null
|
||||
*/
|
||||
boolean has(String key, String value);
|
||||
|
||||
/**
|
||||
* Same as {@link #has(String, String)}, except ignores the case of the value.
|
||||
*
|
||||
* @param key the key to look for
|
||||
* @param value the value to look for
|
||||
* @return true if the set contains the KV pair
|
||||
* @throws NullPointerException if the key or value is null
|
||||
*/
|
||||
boolean hasIgnoreCase(String key, String value);
|
||||
|
||||
/**
|
||||
* Check if the set is empty
|
||||
*
|
||||
* @return true if the set is empty
|
||||
*/
|
||||
boolean isEmpty();
|
||||
|
||||
/**
|
||||
* Gets the number of key-value context pairs in the set
|
||||
*
|
||||
* @return the size of the set
|
||||
*/
|
||||
int size();
|
||||
|
||||
}
|
||||
@@ -1,257 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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 me.lucko.luckperms.api.context;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableMultimap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* An immutable implementation of {@link ContextSet}.
|
||||
*
|
||||
* @since 2.16
|
||||
*/
|
||||
public final class ImmutableContextSet implements ContextSet {
|
||||
private static final ImmutableContextSet EMPTY = new ImmutableContextSet(ImmutableMultimap.of());
|
||||
|
||||
/**
|
||||
* Make a singleton ImmutableContextSet from a context pair
|
||||
*
|
||||
* @param key the key
|
||||
* @param value the value
|
||||
* @return a new ImmutableContextSet containing one KV pair
|
||||
* @throws NullPointerException if key or value is null
|
||||
*/
|
||||
public static ImmutableContextSet singleton(String key, String value) {
|
||||
if (key == null) {
|
||||
throw new NullPointerException("key");
|
||||
}
|
||||
if (value == null) {
|
||||
throw new NullPointerException("value");
|
||||
}
|
||||
|
||||
return new ImmutableContextSet(ImmutableMultimap.of(key.toLowerCase(), value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a ImmutableContextSet from an existing map
|
||||
*
|
||||
* @param map the map to copy from
|
||||
* @return a new ImmutableContextSet representing the pairs from the map
|
||||
* @throws NullPointerException if the map is null
|
||||
*/
|
||||
public static ImmutableContextSet fromMap(Map<String, String> map) {
|
||||
if (map == null) {
|
||||
throw new NullPointerException("map");
|
||||
}
|
||||
|
||||
ImmutableMultimap.Builder<String, String> b = ImmutableMultimap.builder();
|
||||
for (Map.Entry<String, String> e : map.entrySet()) {
|
||||
b.put(e.getKey(), e.getValue());
|
||||
}
|
||||
|
||||
return new ImmutableContextSet(b.build());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a ImmutableContextSet from an existing iterable of Map Entries
|
||||
*
|
||||
* @param iterable the iterable to copy from
|
||||
* @return a new ImmutableContextSet representing the pairs in the iterable
|
||||
* @throws NullPointerException if the iterable is null
|
||||
*/
|
||||
public static ImmutableContextSet fromEntries(Iterable<? extends Map.Entry<String, String>> iterable) {
|
||||
if (iterable == null) {
|
||||
throw new NullPointerException("iterable");
|
||||
}
|
||||
|
||||
return MutableContextSet.fromEntries(iterable).makeImmutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a ImmutableContextSet from an existing multimap
|
||||
*
|
||||
* @param multimap the multimap to copy from
|
||||
* @return a new ImmutableContextSet representing the pairs in the multimap
|
||||
* @throws NullPointerException if the multimap is null
|
||||
*/
|
||||
public static ImmutableContextSet fromMultimap(Multimap<String, String> multimap) {
|
||||
if (multimap == null) {
|
||||
throw new NullPointerException("multimap");
|
||||
}
|
||||
|
||||
return MutableContextSet.fromMultimap(multimap).makeImmutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new ImmutableContextSet from an existing set.
|
||||
* Only really useful for converting between mutable and immutable types.
|
||||
*
|
||||
* @param contextSet the context set to copy from
|
||||
* @return a new ImmutableContextSet with the same content and the one provided
|
||||
* @throws NullPointerException if contextSet is null
|
||||
*/
|
||||
public static ImmutableContextSet fromSet(ContextSet contextSet) {
|
||||
return contextSet.makeImmutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new empty ContextSet.
|
||||
*
|
||||
* @return a new ContextSet
|
||||
*/
|
||||
public static ImmutableContextSet empty() {
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
private final Multimap<String, String> map;
|
||||
|
||||
ImmutableContextSet(Multimap<String, String> contexts) {
|
||||
this.map = ImmutableMultimap.copyOf(contexts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isImmutable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated // This set is already immutable!
|
||||
public ImmutableContextSet makeImmutable() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MutableContextSet mutableCopy() {
|
||||
return MutableContextSet.fromSet(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Map.Entry<String, String>> toSet() {
|
||||
return ImmutableSet.copyOf(map.entries());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> toMap() {
|
||||
ImmutableMap.Builder<String, String> m = ImmutableMap.builder();
|
||||
for (Map.Entry<String, String> e : map.entries()) {
|
||||
m.put(e.getKey(), e.getValue());
|
||||
}
|
||||
|
||||
return m.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Multimap<String, String> toMultimap() {
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsKey(String key) {
|
||||
if (key == null) {
|
||||
throw new NullPointerException("key");
|
||||
}
|
||||
|
||||
return map.containsKey(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getValues(String key) {
|
||||
if (key == null) {
|
||||
throw new NullPointerException("key");
|
||||
}
|
||||
|
||||
Collection<String> c = map.get(key);
|
||||
return c != null && !c.isEmpty() ? ImmutableSet.copyOf(c) : ImmutableSet.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean has(String key, String value) {
|
||||
if (key == null) {
|
||||
throw new NullPointerException("key");
|
||||
}
|
||||
if (value == null) {
|
||||
throw new NullPointerException("value");
|
||||
}
|
||||
|
||||
return map.containsEntry(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasIgnoreCase(String key, String value) {
|
||||
if (key == null) {
|
||||
throw new NullPointerException("key");
|
||||
}
|
||||
if (value == null) {
|
||||
throw new NullPointerException("value");
|
||||
}
|
||||
|
||||
Collection<String> c = map.get(key);
|
||||
if (c == null || c.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (String val : c) {
|
||||
if (val.equalsIgnoreCase(value)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return map.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return map.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o == this) return true;
|
||||
if (!(o instanceof ContextSet)) return false;
|
||||
final ContextSet other = (ContextSet) o;
|
||||
|
||||
final Multimap<String, String> thisContexts = this.toMultimap();
|
||||
final Multimap<String, String> otherContexts = other.toMultimap();
|
||||
return thisContexts == null ? otherContexts == null : thisContexts.equals(otherContexts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 59 + (this.map == null ? 43 : this.map.hashCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ImmutableContextSet(contexts=" + this.map + ")";
|
||||
}
|
||||
}
|
||||
@@ -1,399 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
*
|
||||
* 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 me.lucko.luckperms.api.context;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.collect.Multimaps;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* A mutable implementation of {@link ContextSet}.
|
||||
*
|
||||
* @since 2.16
|
||||
*/
|
||||
public final class MutableContextSet implements ContextSet {
|
||||
|
||||
/**
|
||||
* Make a singleton MutableContextSet from a context pair
|
||||
*
|
||||
* @param key the key
|
||||
* @param value the value
|
||||
* @return a new MutableContextSet containing one KV pair
|
||||
* @throws NullPointerException if key or value is null
|
||||
*/
|
||||
public static MutableContextSet singleton(String key, String value) {
|
||||
if (key == null) {
|
||||
throw new NullPointerException("key");
|
||||
}
|
||||
if (value == null) {
|
||||
throw new NullPointerException("value");
|
||||
}
|
||||
|
||||
MutableContextSet set = new MutableContextSet();
|
||||
set.add(key, value);
|
||||
return set;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a MutableContextSet from an existing map
|
||||
*
|
||||
* @param map the map to copy from
|
||||
* @return a new MutableContextSet representing the pairs from the map
|
||||
* @throws NullPointerException if the map is null
|
||||
*/
|
||||
public static MutableContextSet fromMap(Map<String, String> map) {
|
||||
if (map == null) {
|
||||
throw new NullPointerException("map");
|
||||
}
|
||||
|
||||
MutableContextSet set = new MutableContextSet();
|
||||
set.addAll(map);
|
||||
return set;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a MutableContextSet from an existing iterable of Map Entries
|
||||
*
|
||||
* @param iterable the iterable to copy from
|
||||
* @return a new MutableContextSet representing the pairs in the iterable
|
||||
* @throws NullPointerException if the iterable is null
|
||||
*/
|
||||
public static MutableContextSet fromEntries(Iterable<? extends Map.Entry<String, String>> iterable) {
|
||||
if (iterable == null) {
|
||||
throw new NullPointerException("iterable");
|
||||
}
|
||||
|
||||
MutableContextSet set = new MutableContextSet();
|
||||
set.addAll(iterable);
|
||||
return set;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a MutableContextSet from an existing multimap
|
||||
*
|
||||
* @param multimap the multimap to copy from
|
||||
* @return a new MutableContextSet representing the pairs in the multimap
|
||||
* @throws NullPointerException if the multimap is null
|
||||
*/
|
||||
public static MutableContextSet fromMultimap(Multimap<String, String> multimap) {
|
||||
if (multimap == null) {
|
||||
throw new NullPointerException("multimap");
|
||||
}
|
||||
|
||||
return fromEntries(multimap.entries());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new MutableContextSet from an existing set.
|
||||
* Only really useful for converting between mutable and immutable types.
|
||||
*
|
||||
* @param contextSet the context set to copy from
|
||||
* @return a new MutableContextSet with the same content and the one provided
|
||||
* @throws NullPointerException if contextSet is null
|
||||
*/
|
||||
public static MutableContextSet fromSet(ContextSet contextSet) {
|
||||
if (contextSet == null) {
|
||||
throw new NullPointerException("contextSet");
|
||||
}
|
||||
|
||||
MutableContextSet set = new MutableContextSet();
|
||||
set.addAll(contextSet.toSet());
|
||||
return set;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new empty MutableContextSet.
|
||||
*
|
||||
* @return a new MutableContextSet
|
||||
*/
|
||||
public static MutableContextSet create() {
|
||||
return new MutableContextSet();
|
||||
}
|
||||
|
||||
private final Multimap<String, String> map;
|
||||
|
||||
public MutableContextSet() {
|
||||
this.map = Multimaps.synchronizedMultimap(HashMultimap.create());
|
||||
}
|
||||
|
||||
private MutableContextSet(Multimap<String, String> contexts) {
|
||||
this.map = Multimaps.synchronizedMultimap(HashMultimap.create(contexts));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isImmutable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableContextSet makeImmutable() {
|
||||
return new ImmutableContextSet(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MutableContextSet mutableCopy() {
|
||||
return new MutableContextSet(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Map.Entry<String, String>> toSet() {
|
||||
return ImmutableSet.copyOf(map.entries());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> toMap() {
|
||||
ImmutableMap.Builder<String, String> m = ImmutableMap.builder();
|
||||
for (Map.Entry<String, String> e : map.entries()) {
|
||||
m.put(e.getKey(), e.getValue());
|
||||
}
|
||||
|
||||
return m.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Multimap<String, String> toMultimap() {
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsKey(String key) {
|
||||
if (key == null) {
|
||||
throw new NullPointerException("key");
|
||||
}
|
||||
|
||||
return map.containsKey(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getValues(String key) {
|
||||
if (key == null) {
|
||||
throw new NullPointerException("key");
|
||||
}
|
||||
|
||||
Collection<String> c = map.get(key);
|
||||
return c != null && !c.isEmpty() ? ImmutableSet.copyOf(c) : ImmutableSet.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean has(String key, String value) {
|
||||
if (key == null) {
|
||||
throw new NullPointerException("key");
|
||||
}
|
||||
if (value == null) {
|
||||
throw new NullPointerException("value");
|
||||
}
|
||||
|
||||
return map.containsEntry(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasIgnoreCase(String key, String value) {
|
||||
if (key == null) {
|
||||
throw new NullPointerException("key");
|
||||
}
|
||||
if (value == null) {
|
||||
throw new NullPointerException("value");
|
||||
}
|
||||
|
||||
Collection<String> c = map.get(key);
|
||||
if (c == null || c.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (String val : c) {
|
||||
if (val.equalsIgnoreCase(value)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return map.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return map.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new key value pair to the set
|
||||
*
|
||||
* @param key the key to add
|
||||
* @param value the value to add
|
||||
* @throws NullPointerException if the key or value is null
|
||||
*/
|
||||
public void add(String key, String value) {
|
||||
if (key == null) {
|
||||
throw new NullPointerException("key");
|
||||
}
|
||||
if (value == null) {
|
||||
throw new NullPointerException("value");
|
||||
}
|
||||
|
||||
map.put(key.toLowerCase(), value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new key value pair to the set
|
||||
*
|
||||
* @param entry the entry to add
|
||||
* @throws NullPointerException if the entry is null
|
||||
*/
|
||||
public void add(Map.Entry<String, String> entry) {
|
||||
if (entry == null) {
|
||||
throw new NullPointerException("context");
|
||||
}
|
||||
|
||||
map.put(entry.getKey().toLowerCase(), entry.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an iterable containing contexts to the set
|
||||
*
|
||||
* @param iterable an iterable of key value context pairs
|
||||
* @throws NullPointerException if iterable is null
|
||||
*/
|
||||
public void addAll(Iterable<? extends Map.Entry<String, String>> iterable) {
|
||||
if (iterable == null) {
|
||||
throw new NullPointerException("contexts");
|
||||
}
|
||||
|
||||
for (Map.Entry<String, String> e : iterable) {
|
||||
this.map.put(e.getKey().toLowerCase(), e.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the entry set of a map to the set
|
||||
*
|
||||
* @param map the map to add from
|
||||
* @throws NullPointerException if the map is null
|
||||
*/
|
||||
public void addAll(Map<String, String> map) {
|
||||
if (map == null) {
|
||||
throw new NullPointerException("contexts");
|
||||
}
|
||||
addAll(map.entrySet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds of of the values in another ContextSet to this set
|
||||
*
|
||||
* @param contextSet the set to add from
|
||||
* @throws NullPointerException if the contextSet is null
|
||||
*/
|
||||
public void addAll(ContextSet contextSet) {
|
||||
if (contextSet == null) {
|
||||
throw new NullPointerException("contextSet");
|
||||
}
|
||||
|
||||
this.map.putAll(contextSet.toMultimap());
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a key value pair from this set
|
||||
*
|
||||
* @param key the key to remove
|
||||
* @param value the value to remove (case sensitive)
|
||||
* @throws NullPointerException if the key or value is null
|
||||
*/
|
||||
public void remove(String key, String value) {
|
||||
if (key == null) {
|
||||
throw new NullPointerException("key");
|
||||
}
|
||||
if (value == null) {
|
||||
throw new NullPointerException("value");
|
||||
}
|
||||
|
||||
map.entries().removeIf(entry -> entry.getKey().equalsIgnoreCase(key) && entry.getValue().equals(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Same as {@link #remove(String, String)}, except ignores the case of the value
|
||||
*
|
||||
* @param key the key to remove
|
||||
* @param value the value to remove
|
||||
* @throws NullPointerException if the key or value is null
|
||||
*/
|
||||
public void removeIgnoreCase(String key, String value) {
|
||||
if (key == null) {
|
||||
throw new NullPointerException("key");
|
||||
}
|
||||
if (value == null) {
|
||||
throw new NullPointerException("value");
|
||||
}
|
||||
|
||||
map.entries().removeIf(e -> e.getKey().equalsIgnoreCase(key) && e.getValue().equalsIgnoreCase(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all pairs with the given key
|
||||
*
|
||||
* @param key the key to remove
|
||||
* @throws NullPointerException if the key is null
|
||||
*/
|
||||
public void removeAll(String key) {
|
||||
if (key == null) {
|
||||
throw new NullPointerException("key");
|
||||
}
|
||||
|
||||
map.removeAll(key.toLowerCase());
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the set
|
||||
*/
|
||||
public void clear() {
|
||||
map.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o == this) return true;
|
||||
if (!(o instanceof ContextSet)) return false;
|
||||
final ContextSet other = (ContextSet) o;
|
||||
|
||||
final Multimap<String, String> thisContexts = this.toMultimap();
|
||||
final Multimap<String, String> otherContexts = other.toMultimap();
|
||||
return thisContexts == null ? otherContexts == null : thisContexts.equals(otherContexts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 59 + (this.map == null ? 43 : this.map.hashCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MutableContextSet(contexts=" + this.map + ")";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,259 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import net.luckperms.api.actionlog.ActionLogger;
|
||||
import net.luckperms.api.context.ContextCalculator;
|
||||
import net.luckperms.api.context.ContextManager;
|
||||
import net.luckperms.api.event.EventBus;
|
||||
import net.luckperms.api.messaging.MessagingService;
|
||||
import net.luckperms.api.messenger.MessengerProvider;
|
||||
import net.luckperms.api.metastacking.MetaStackDefinition;
|
||||
import net.luckperms.api.metastacking.MetaStackElement;
|
||||
import net.luckperms.api.metastacking.MetaStackFactory;
|
||||
import net.luckperms.api.model.group.Group;
|
||||
import net.luckperms.api.model.group.GroupManager;
|
||||
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.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;
|
||||
|
||||
/**
|
||||
* The LuckPerms API.
|
||||
*
|
||||
* <p>The API allows other plugins on the server to read and modify LuckPerms
|
||||
* data, change behaviour of the plugin, listen to certain events, and integrate
|
||||
* LuckPerms into other plugins and systems.</p>
|
||||
*
|
||||
* <p>This interface represents the base of the API package. All functions are
|
||||
* accessed via this interface.</p>
|
||||
*
|
||||
* <p>To start using the API, you need to obtain an instance of this interface.
|
||||
* These are registered by the LuckPerms plugin to the platforms Services
|
||||
* Manager. This is the preferred method for obtaining an instance.</p>
|
||||
*
|
||||
* <p>For ease of use, and for platforms without a Service Manager, an instance
|
||||
* can also be obtained from the static singleton accessor in
|
||||
* {@link LuckPermsProvider}.</p>
|
||||
*/
|
||||
public interface LuckPerms {
|
||||
|
||||
/**
|
||||
* Gets the name of this server.
|
||||
*
|
||||
* <p>This is defined in the LuckPerms configuration file, and is used for
|
||||
* server specific permission handling.</p>
|
||||
*
|
||||
* <p>The default server name is "global".</p>
|
||||
*
|
||||
* @return the server name
|
||||
*/
|
||||
@NonNull String getServerName();
|
||||
|
||||
/**
|
||||
* Gets the {@link UserManager}, responsible for managing
|
||||
* {@link User} instances.
|
||||
*
|
||||
* <p>This manager can be used to retrieve instances of {@link User} by uuid
|
||||
* or name, or query all loaded users.</p>
|
||||
*
|
||||
* @return the user manager
|
||||
*/
|
||||
@NonNull UserManager getUserManager();
|
||||
|
||||
/**
|
||||
* Gets the {@link GroupManager}, responsible for managing
|
||||
* {@link Group} instances.
|
||||
*
|
||||
* <p>This manager can be used to retrieve instances of {@link Group} by
|
||||
* name, or query all loaded groups.</p>
|
||||
*
|
||||
* @return the group manager
|
||||
*/
|
||||
@NonNull GroupManager getGroupManager();
|
||||
|
||||
/**
|
||||
* Gets the {@link TrackManager}, responsible for managing
|
||||
* {@link Track} instances.
|
||||
*
|
||||
* <p>This manager can be used to retrieve instances of {@link Track} by
|
||||
* name, or query all loaded tracks.</p>
|
||||
*
|
||||
* @return the track manager
|
||||
*/
|
||||
@NonNull TrackManager getTrackManager();
|
||||
|
||||
/**
|
||||
* Gets the {@link PlayerAdapter} instance, a utility class for adapting platform Player
|
||||
* instances to {@link User}s.
|
||||
*
|
||||
* <p>The {@code playerClass} parameter must be equal to the class or interface used by the
|
||||
* server platform to represent players.</p>
|
||||
*
|
||||
* <p>Specifically:</p>
|
||||
*
|
||||
* <p></p>
|
||||
* <ul>
|
||||
* <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>
|
||||
*
|
||||
* @param playerClass the class used by the platform to represent players
|
||||
* @param <T> the player class type
|
||||
* @return the player adapter
|
||||
* @throws IllegalArgumentException if the player class is not correct
|
||||
* @since 5.1
|
||||
*/
|
||||
<T> @NonNull PlayerAdapter<T> getPlayerAdapter(@NonNull Class<T> playerClass);
|
||||
|
||||
/**
|
||||
* Gets the {@link Platform}, which represents the server platform the
|
||||
* plugin is running on.
|
||||
*
|
||||
* @return the platform
|
||||
*/
|
||||
@NonNull Platform getPlatform();
|
||||
|
||||
/**
|
||||
* Gets the {@link PluginMetadata}, responsible for providing metadata about
|
||||
* the LuckPerms plugin currently running.
|
||||
*
|
||||
* @return the plugin metadata
|
||||
*/
|
||||
@NonNull PluginMetadata getPluginMetadata();
|
||||
|
||||
/**
|
||||
* Gets the {@link EventBus}, used for subscribing to internal LuckPerms
|
||||
* events.
|
||||
*
|
||||
* @return the event bus
|
||||
*/
|
||||
@NonNull EventBus getEventBus();
|
||||
|
||||
/**
|
||||
* Gets the {@link MessagingService}, used to dispatch updates throughout a
|
||||
* network of servers running the plugin.
|
||||
*
|
||||
* <p>Not all instances of LuckPerms will have a messaging service setup and
|
||||
* configured.</p>
|
||||
*
|
||||
* @return the messaging service instance, if present.
|
||||
*/
|
||||
@NonNull Optional<MessagingService> getMessagingService();
|
||||
|
||||
/**
|
||||
* Gets the {@link ActionLogger}, responsible for saving and broadcasting
|
||||
* defined actions occurring on the platform.
|
||||
*
|
||||
* @return the action logger
|
||||
*/
|
||||
@NonNull ActionLogger getActionLogger();
|
||||
|
||||
/**
|
||||
* Gets the {@link ContextManager}, responsible for managing
|
||||
* {@link ContextCalculator}s, and calculating applicable contexts.
|
||||
*
|
||||
* @return the context manager
|
||||
*/
|
||||
@NonNull ContextManager getContextManager();
|
||||
|
||||
/**
|
||||
* Gets the {@link MetaStackFactory}.
|
||||
*
|
||||
* <p>The metastack factory provides methods for retrieving
|
||||
* {@link MetaStackElement}s and constructing
|
||||
* {@link MetaStackDefinition}s.</p>
|
||||
*
|
||||
* @return the meta stack factory
|
||||
*/
|
||||
@NonNull MetaStackFactory getMetaStackFactory();
|
||||
|
||||
/**
|
||||
* Schedules the execution of an update task, and returns an encapsulation
|
||||
* of the task as a {@link CompletableFuture}.
|
||||
*
|
||||
* <p>The exact actions performed in an update task remains an
|
||||
* implementation detail of the plugin, however, as a minimum, it is
|
||||
* expected to perform a full reload of user, group and track data, and
|
||||
* ensure that any changes are fully applied and propagated.</p>
|
||||
*
|
||||
* @return a future
|
||||
*/
|
||||
@NonNull CompletableFuture<Void> runUpdateTask();
|
||||
|
||||
/**
|
||||
* Registers a {@link MessengerProvider} for use by the platform.
|
||||
*
|
||||
* <p>Note that the mere action of registering a provider doesn't
|
||||
* necessarily mean that it will be used.</p>
|
||||
*
|
||||
* @param messengerProvider the messenger provider.
|
||||
*/
|
||||
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();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import static org.jetbrains.annotations.ApiStatus.Internal;
|
||||
|
||||
/**
|
||||
* 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 this is not viable.</p>
|
||||
*/
|
||||
public final class LuckPermsProvider {
|
||||
private static LuckPerms instance = null;
|
||||
|
||||
/**
|
||||
* Gets an instance of the {@link LuckPerms} API,
|
||||
* throwing {@link IllegalStateException} if the API is not loaded yet.
|
||||
*
|
||||
* <p>This method will never return null.</p>
|
||||
*
|
||||
* @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 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";
|
||||
|
||||
NotLoadedException() {
|
||||
super(MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import net.luckperms.api.LuckPermsProvider;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Represents a logged action.
|
||||
*/
|
||||
public interface Action extends Comparable<Action> {
|
||||
|
||||
/**
|
||||
* Gets a {@link Action.Builder}
|
||||
*
|
||||
* @return a new builder
|
||||
*/
|
||||
static @NonNull Builder builder() {
|
||||
return LuckPermsProvider.get().getActionLogger().actionBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the time when the action occurred.
|
||||
*
|
||||
* @return the timestamp
|
||||
*/
|
||||
@NonNull Instant getTimestamp();
|
||||
|
||||
/**
|
||||
* Gets the source of the action.
|
||||
*
|
||||
* @return the source
|
||||
*/
|
||||
@NonNull Source getSource();
|
||||
|
||||
/**
|
||||
* Gets the target of the action.
|
||||
*
|
||||
* @return the target
|
||||
*/
|
||||
@NonNull Target getTarget();
|
||||
|
||||
/**
|
||||
* Returns a string describing the action which took place.
|
||||
*
|
||||
* <p>In most instances, this returns a variation of the command string which caused
|
||||
* the change.</p>
|
||||
*
|
||||
* @return the action
|
||||
*/
|
||||
@NonNull String getDescription();
|
||||
|
||||
/**
|
||||
* Represents the source of an action.
|
||||
*/
|
||||
interface Source {
|
||||
|
||||
/**
|
||||
* Gets the source unique id.
|
||||
*
|
||||
* @return the source unique id
|
||||
*/
|
||||
@NonNull UUID getUniqueId();
|
||||
|
||||
/**
|
||||
* Gets the source name.
|
||||
*
|
||||
* @return the source name
|
||||
*/
|
||||
@NonNull String getName();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the target of an action.
|
||||
*/
|
||||
interface Target {
|
||||
|
||||
/**
|
||||
* Gets the target unique id.
|
||||
*
|
||||
* @return the target unique id
|
||||
*/
|
||||
@NonNull Optional<UUID> getUniqueId();
|
||||
|
||||
/**
|
||||
* Gets the target name.
|
||||
*
|
||||
* @return the target name
|
||||
*/
|
||||
@NonNull String getName();
|
||||
|
||||
/**
|
||||
* Gets the target type.
|
||||
*
|
||||
* @return the target type
|
||||
*/
|
||||
@NonNull Type getType();
|
||||
|
||||
/**
|
||||
* Represents the type of a {@link Target}.
|
||||
*/
|
||||
enum Type {
|
||||
USER, GROUP, TRACK
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds an {@link Action} instance
|
||||
*/
|
||||
interface Builder {
|
||||
|
||||
/**
|
||||
* Sets the timestamp of the entry.
|
||||
*
|
||||
* @param timestamp the timestamp
|
||||
* @return the builder
|
||||
* @see Action#getTimestamp()
|
||||
*/
|
||||
@NonNull Builder timestamp(@NonNull Instant timestamp);
|
||||
|
||||
/**
|
||||
* Sets the actor of the entry.
|
||||
*
|
||||
* @param actor the actor
|
||||
* @return the builder
|
||||
*/
|
||||
@NonNull Builder source(@NonNull UUID actor);
|
||||
|
||||
/**
|
||||
* Sets the actor name of the entry.
|
||||
*
|
||||
* @param actorName the actor name
|
||||
* @return the builder
|
||||
*/
|
||||
@NonNull Builder sourceName(@NonNull String actorName);
|
||||
|
||||
/**
|
||||
* Sets the type of the entry.
|
||||
*
|
||||
* @param type the type
|
||||
* @return the builder
|
||||
*/
|
||||
@NonNull Builder targetType(Target.@NonNull Type type);
|
||||
|
||||
/**
|
||||
* Sets the acted object for the entry.
|
||||
*
|
||||
* @param acted the acted object
|
||||
* @return the builder
|
||||
*/
|
||||
@NonNull Builder target(@Nullable UUID acted);
|
||||
|
||||
/**
|
||||
* Sets the acted name for the entry.
|
||||
*
|
||||
* @param actedName the acted name
|
||||
* @return the builder
|
||||
*/
|
||||
@NonNull Builder targetName(@NonNull String actedName);
|
||||
|
||||
/**
|
||||
* Sets the action of the entry.
|
||||
*
|
||||
* @param action the action
|
||||
* @return the builder
|
||||
*/
|
||||
@NonNull Builder description(@NonNull String action);
|
||||
|
||||
/**
|
||||
* Creates a {@link Action} instance from the builder.
|
||||
*
|
||||
* @return a new log entry instance
|
||||
*/
|
||||
@NonNull Action build();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
import java.util.SortedSet;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Represents the internal LuckPerms log.
|
||||
*
|
||||
* <p>The returned instance provides a copy of the data at the time of retrieval.</p>
|
||||
*
|
||||
* <p>Any changes made to log entries will only apply to this instance of the log.
|
||||
* 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>
|
||||
*/
|
||||
public interface ActionLog {
|
||||
|
||||
/**
|
||||
* Gets the {@link Action}s that make up this log.
|
||||
*
|
||||
* @return the content
|
||||
*/
|
||||
@NonNull @Unmodifiable SortedSet<Action> getContent();
|
||||
|
||||
/**
|
||||
* Gets the entries in the log performed by the given actor.
|
||||
*
|
||||
* @param actor the uuid of the actor to filter by
|
||||
* @return the content for the given actor
|
||||
*/
|
||||
@NonNull @Unmodifiable SortedSet<Action> getContent(@NonNull UUID actor);
|
||||
|
||||
/**
|
||||
* Gets the log content for a given user
|
||||
*
|
||||
* @param uniqueId the uuid to filter by
|
||||
* @return all content in this log where the user = uuid
|
||||
*/
|
||||
@NonNull @Unmodifiable SortedSet<Action> getUserHistory(@NonNull UUID uniqueId);
|
||||
|
||||
/**
|
||||
* Gets the log content for a given group
|
||||
*
|
||||
* @param name the name to filter by
|
||||
* @return all content in this log where the group = name
|
||||
*/
|
||||
@NonNull @Unmodifiable SortedSet<Action> getGroupHistory(@NonNull String name);
|
||||
|
||||
/**
|
||||
* Gets the log content for a given track
|
||||
*
|
||||
* @param name the name to filter by
|
||||
* @return all content in this log where the track = name
|
||||
*/
|
||||
@NonNull @Unmodifiable SortedSet<Action> getTrackHistory(@NonNull String name);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import net.luckperms.api.messaging.MessagingService;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
* Represents the object responsible for handling action logging.
|
||||
*/
|
||||
public interface ActionLogger {
|
||||
|
||||
/**
|
||||
* Returns a new {@link Action.Builder} instance
|
||||
*
|
||||
* @return a new builder
|
||||
*/
|
||||
Action.@NonNull Builder actionBuilder();
|
||||
|
||||
/**
|
||||
* Gets a {@link ActionLog} instance from the plugin storage.
|
||||
*
|
||||
* @return a log instance
|
||||
*/
|
||||
@NonNull CompletableFuture<ActionLog> getLog();
|
||||
|
||||
/**
|
||||
* Submits a log entry to the plugin to be handled.
|
||||
*
|
||||
* <p>This method submits the log to the storage provider and broadcasts
|
||||
* it.</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>If you want to submit a log entry but don't know which method to pick,
|
||||
* use this one.</p>
|
||||
*
|
||||
* @param entry the entry to submit
|
||||
* @return a future which will complete when the action is done
|
||||
*/
|
||||
@NonNull CompletableFuture<Void> submit(@NonNull Action entry);
|
||||
|
||||
/**
|
||||
* Submits a log entry to the plugins storage handler.
|
||||
*
|
||||
* @param entry the entry to submit
|
||||
* @return a future which will complete when the action is done
|
||||
*/
|
||||
@NonNull CompletableFuture<Void> submitToStorage(@NonNull Action entry);
|
||||
|
||||
/**
|
||||
* Submits a log entry to the plugins log broadcasting handler.
|
||||
*
|
||||
* <p>If enabled, this method will also dispatch the log entry via the
|
||||
* plugins {@link MessagingService}.</p>
|
||||
*
|
||||
* @param entry the entry to submit
|
||||
* @return a future which will complete when the action is done
|
||||
*/
|
||||
@NonNull CompletableFuture<Void> broadcastAction(@NonNull Action entry);
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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.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 {
|
||||
|
||||
/**
|
||||
* Gets the query options this container is holding data for.
|
||||
*
|
||||
* @return the query options this container is caching
|
||||
*/
|
||||
@NonNull QueryOptions getQueryOptions();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,248 @@
|
||||
/*
|
||||
* 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.context.ContextManager;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 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. These calls are heavily cached and are therefore
|
||||
* fast.</p>
|
||||
*/
|
||||
public interface CachedDataManager {
|
||||
|
||||
/**
|
||||
* Gets the manager for {@link CachedPermissionData}.
|
||||
*
|
||||
* @return the permission data manager
|
||||
*/
|
||||
@NonNull Container<CachedPermissionData> permissionData();
|
||||
|
||||
/**
|
||||
* Gets the manager for {@link CachedMetaData}.
|
||||
*
|
||||
* @return the meta data manager
|
||||
*/
|
||||
@NonNull Container<CachedMetaData> metaData();
|
||||
|
||||
/**
|
||||
* Gets PermissionData from the cache, using the given query options.
|
||||
*
|
||||
* @param queryOptions the query options
|
||||
* @return a permission data instance
|
||||
*/
|
||||
@NonNull CachedPermissionData getPermissionData(@NonNull QueryOptions queryOptions);
|
||||
|
||||
/**
|
||||
* Gets MetaData from the cache, using the given query options.
|
||||
*
|
||||
* @param queryOptions the query options
|
||||
* @return a meta data instance
|
||||
*/
|
||||
@NonNull CachedMetaData getMetaData(@NonNull QueryOptions queryOptions);
|
||||
|
||||
/**
|
||||
* Gets PermissionData from the cache, using the most appropriate query options
|
||||
* available at the time.
|
||||
*
|
||||
* <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}.</p>
|
||||
*
|
||||
* <p>For {@link Group}s, the most appropriate query options will always be
|
||||
* {@link ContextManager#getStaticQueryOptions() the current static query options}.</p>
|
||||
*
|
||||
* @return a permission data instance
|
||||
* @since 5.1
|
||||
*/
|
||||
@NonNull CachedPermissionData getPermissionData();
|
||||
|
||||
/**
|
||||
* Gets MetaData from the cache, using the most appropriate query options
|
||||
* available at the time.
|
||||
*
|
||||
* <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}.</p>
|
||||
*
|
||||
* <p>For {@link Group}s, the most appropriate query options will always be
|
||||
* {@link ContextManager#getStaticQueryOptions() the current static query options}.</p>
|
||||
*
|
||||
* @return a meta data instance
|
||||
* @since 5.1
|
||||
* @see PermissionHolder#getQueryOptions()
|
||||
*/
|
||||
@NonNull CachedMetaData getMetaData();
|
||||
|
||||
/**
|
||||
* Invalidates all cached {@link CachedPermissionData} and {@link CachedMetaData}
|
||||
* instances.
|
||||
*/
|
||||
void invalidate();
|
||||
|
||||
/**
|
||||
* Invalidates all underlying permission calculators.
|
||||
*
|
||||
* <p>Can be called to allow for an update in defaults.</p>
|
||||
*/
|
||||
void invalidatePermissionCalculators();
|
||||
|
||||
/**
|
||||
* Manages a specific type of {@link CachedData cached data} within
|
||||
* a {@link CachedDataManager} instance.
|
||||
*
|
||||
* @param <T> the data type
|
||||
*/
|
||||
interface Container<T extends CachedData> {
|
||||
|
||||
/**
|
||||
* Gets {@link T data} from the cache.
|
||||
*
|
||||
* @param queryOptions the query options
|
||||
* @return a data instance
|
||||
* @throws NullPointerException if contexts is null
|
||||
*/
|
||||
@NonNull T get(@NonNull QueryOptions queryOptions);
|
||||
|
||||
/**
|
||||
* Calculates {@link T data}, bypassing the cache.
|
||||
*
|
||||
* <p>The result of this operation is calculated each time the method is called.
|
||||
* The result is not added to the internal cache.</p>
|
||||
*
|
||||
* <p>It is therefore highly recommended to use {@link #get(QueryOptions)} instead.</p>
|
||||
*
|
||||
* <p>The use cases of this method are more around constructing one-time
|
||||
* instances of {@link T data}, without adding the result to the cache.</p>
|
||||
*
|
||||
* @param queryOptions the query options
|
||||
* @return a data instance
|
||||
* @throws NullPointerException if contexts is null
|
||||
*/
|
||||
@NonNull T calculate(@NonNull QueryOptions queryOptions);
|
||||
|
||||
/**
|
||||
* (Re)calculates data for a given context.
|
||||
*
|
||||
* <p>This method returns immediately in all cases. The (re)calculation is
|
||||
* performed asynchronously and applied to the cache in the background.</p>
|
||||
*
|
||||
* <p>If there was a previous data instance associated with
|
||||
* the given {@link QueryOptions}, then that instance will continue to be returned by
|
||||
* {@link #get(QueryOptions)} until the recalculation is completed.</p>
|
||||
*
|
||||
* <p>If there was no value calculated and cached prior to the call of this
|
||||
* method, then one will be calculated.</p>
|
||||
*
|
||||
* @param queryOptions the query options
|
||||
* @throws NullPointerException if contexts is null
|
||||
*/
|
||||
void recalculate(@NonNull QueryOptions queryOptions);
|
||||
|
||||
/**
|
||||
* (Re)loads permission data for a given context.
|
||||
*
|
||||
* <p>Unlike {@link #recalculate(QueryOptions)}, this method immediately
|
||||
* invalidates any previous data values contained within the cache,
|
||||
* and then schedules a task to reload a new data instance to
|
||||
* replace the one which was invalidated.</p>
|
||||
*
|
||||
* <p>The invalidation happens immediately during the execution of this method.
|
||||
* The result of the re-computation encapsulated by the future.</p>
|
||||
*
|
||||
* <p>Subsequent calls to {@link #get(QueryOptions)} will block until
|
||||
* the result of this operation is complete.</p>
|
||||
*
|
||||
* <p>If there was no value calculated and cached prior to the call of this
|
||||
* method, then one will be calculated.</p>
|
||||
*
|
||||
* <p>This method returns a Future so users can optionally choose to wait
|
||||
* until the recalculation has been performed.</p>
|
||||
*
|
||||
* @param queryOptions the query options.
|
||||
* @return a future
|
||||
* @throws NullPointerException if contexts is null
|
||||
*/
|
||||
@NonNull CompletableFuture<? extends T> reload(@NonNull QueryOptions queryOptions);
|
||||
|
||||
/**
|
||||
* Recalculates data for all known contexts.
|
||||
*
|
||||
* <p>This method returns immediately. The recalculation is performed
|
||||
* asynchronously and applied to the cache in the background.</p>
|
||||
*
|
||||
* <p>The previous data instances will continue to be returned
|
||||
* by {@link #get(QueryOptions)} until the recalculation is completed.</p>
|
||||
*/
|
||||
void recalculate();
|
||||
|
||||
/**
|
||||
* Reloads permission data for all known contexts.
|
||||
*
|
||||
* <p>Unlike {@link #recalculate()}, this method immediately
|
||||
* invalidates all previous data values contained within the cache,
|
||||
* and then schedules a task to reload new data instances to
|
||||
* replace the ones which were invalidated.</p>
|
||||
*
|
||||
* <p>The invalidation happens immediately during the execution of this method.
|
||||
* The result of the re-computation encapsulated by the future.</p>
|
||||
*
|
||||
* <p>Subsequent calls to {@link #get(QueryOptions)} will block until
|
||||
* the result of this operation is complete.</p>
|
||||
*
|
||||
* <p>This method returns a Future so users can optionally choose to wait
|
||||
* until the recalculation has been performed.</p>
|
||||
*
|
||||
* @return a future
|
||||
*/
|
||||
@NonNull CompletableFuture<Void> reload();
|
||||
|
||||
/**
|
||||
* Invalidates any cached data instances mapped to the given context.
|
||||
*
|
||||
* @param queryOptions the queryOptions to invalidate for
|
||||
*/
|
||||
void invalidate(@NonNull QueryOptions queryOptions);
|
||||
|
||||
/**
|
||||
* Invalidates all cached data instances.
|
||||
*/
|
||||
void invalidate();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,231 @@
|
||||
/*
|
||||
* 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.metastacking.MetaStackDefinition;
|
||||
import net.luckperms.api.node.types.MetaNode;
|
||||
import net.luckperms.api.node.types.PrefixNode;
|
||||
import net.luckperms.api.node.types.SuffixNode;
|
||||
|
||||
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
|
||||
*/
|
||||
default @Nullable String getMetaValue(@NonNull String key) {
|
||||
return queryMetaValue(key).result();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
default @Nullable String getPrefix() {
|
||||
return queryPrefix().result();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
default @Nullable String getSuffix() {
|
||||
return querySuffix().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 @Unmodifiable SortedMap<Integer, String> getPrefixes();
|
||||
|
||||
/**
|
||||
* 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 @Unmodifiable SortedMap<Integer, String> getSuffixes();
|
||||
|
||||
/**
|
||||
* Gets the name of the holders primary group.
|
||||
*
|
||||
* <p>Will return {@code null} for Group holder types.</p>
|
||||
*
|
||||
* @return the name of the primary group
|
||||
* @since 5.1
|
||||
*/
|
||||
@Nullable String getPrimaryGroup();
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @return the definition used for the suffix stack
|
||||
*/
|
||||
@NonNull MetaStackDefinition getSuffixStackDefinition();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* 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 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 {
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
default @NonNull Tristate checkPermission(@NonNull String permission) {
|
||||
return queryPermission(permission).result();
|
||||
}
|
||||
|
||||
/**
|
||||
* Invalidates the underlying permission calculator cache.
|
||||
*
|
||||
* <p>Can be called to allow for an update in defaults.</p>
|
||||
*/
|
||||
void invalidateCache();
|
||||
|
||||
/**
|
||||
* Gets an immutable copy of the permission map backing the permission calculator
|
||||
*
|
||||
* @return an immutable set of permissions
|
||||
*/
|
||||
@NonNull @Unmodifiable Map<String, Boolean> getPermissionMap();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* 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;
|
||||
@@ -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.context;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
/**
|
||||
* Represents an individual context pair.
|
||||
*
|
||||
* <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 {
|
||||
|
||||
/**
|
||||
* Tests whether {@code key} is valid.
|
||||
*
|
||||
* <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>An exception is thrown when an invalid key is added to a {@link ContextSet}.</p>
|
||||
*
|
||||
* @param key the key to test
|
||||
* @return true if valid, false otherwise.
|
||||
* @since 5.1
|
||||
*/
|
||||
static boolean isValidKey(@Nullable String key) {
|
||||
if (key == null || key.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// look for a non-whitespace character
|
||||
for (int i = 0, n = key.length(); i < n; i++) {
|
||||
if (key.charAt(i) != ' ') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests whether {@code value} is valid.
|
||||
*
|
||||
* <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>An exception is thrown when an invalid value is added to a {@link ContextSet}.</p>
|
||||
*
|
||||
* @param value the value to test
|
||||
* @return true if valid, false otherwise.
|
||||
* @since 5.1
|
||||
*/
|
||||
static boolean isValidValue(@Nullable String value) {
|
||||
return isValidKey(value); // the same for now...
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the context key.
|
||||
*
|
||||
* @return the key
|
||||
*/
|
||||
@NonNull String getKey();
|
||||
|
||||
/**
|
||||
* Gets the context value
|
||||
*
|
||||
* @return the value
|
||||
*/
|
||||
@NonNull String getValue();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* 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 org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* Calculates the contexts applicable for a contextual subject.
|
||||
*
|
||||
* <p>Implementations of this interface should satisfy the following
|
||||
* requirements:</p>
|
||||
* <ul>
|
||||
* <li>Context lookups should be <i>fast</i>: lookup methods are likely to
|
||||
* be invoked frequently, and should therefore be fast to execute. If
|
||||
* determining the current contexts involves a particularly time consuming
|
||||
* lookup (database queries, network requests, etc), then such results
|
||||
* should be cached ahead of time.</li>
|
||||
*
|
||||
* <li>Context lookups should be <i>thread-safe</i>: lookups will sometimes
|
||||
* be performed from "async" threads, and therefore should not access any
|
||||
* part of the server only safe for access from a sync context. If
|
||||
* necessary, such results should be determined ahead of time and stored in
|
||||
* a thread-safe collection for retrieval later.</li>
|
||||
*
|
||||
* <li>Context lookups should <i>not query active contexts</i>: doing so is
|
||||
* likely to result in a stack overflow, or thread deadlock. Care should be
|
||||
* taken to avoid (indirect) calls to the same calculator.</li>
|
||||
* </ul>
|
||||
* <p></p>
|
||||
*
|
||||
* <p>Calculators should be registered using
|
||||
* {@link ContextManager#registerCalculator(ContextCalculator)}.</p>
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface ContextCalculator<T> {
|
||||
|
||||
/**
|
||||
* Creates a new {@link ContextCalculator} that provides a single context.
|
||||
*
|
||||
* @param key the key of the context provided by the calculator
|
||||
* @param valueFunction the function used to compute the corresponding value
|
||||
* for each query. A context will not be "accumulated"
|
||||
* if the value returned is null.
|
||||
* @param <T> the contextual type
|
||||
* @return the resultant calculator
|
||||
*/
|
||||
static <T> @NonNull ContextCalculator<T> forSingleContext(@NonNull String key, @NonNull Function<T, String> valueFunction) {
|
||||
Objects.requireNonNull(key, "key");
|
||||
Objects.requireNonNull(valueFunction, "valueFunction");
|
||||
return (target, consumer) -> {
|
||||
String value = valueFunction.apply(target);
|
||||
if (value != null) {
|
||||
consumer.accept(key, value);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Submits any contexts this calculator determines to be applicable to
|
||||
* the {@code target} contextual subject.
|
||||
*
|
||||
* <p>Care should be taken to ensure implementations of this method meet the
|
||||
* general requirements for {@link ContextCalculator}, defined in the class
|
||||
* doc.</p>
|
||||
*
|
||||
* @param target the target contextual subject for this operation
|
||||
* @param consumer the {@link ContextConsumer} to submit contexts to
|
||||
*/
|
||||
void calculate(@NonNull T target, @NonNull ContextConsumer consumer);
|
||||
|
||||
/**
|
||||
* Gets a {@link ContextSet}, containing some/all of the contexts this
|
||||
* calculator could potentially submit.
|
||||
*
|
||||
* <p>The result of this call is primarily intended on providing
|
||||
* suggestions to end users when defining permissions.</p>
|
||||
*
|
||||
* @return a set of potential contexts
|
||||
*/
|
||||
default @NonNull ContextSet estimatePotentialContexts() {
|
||||
return ImmutableContextSet.empty();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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 org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Functional interface that accepts context key value pairs.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface ContextConsumer {
|
||||
|
||||
/**
|
||||
* Accepts a context pair.
|
||||
*
|
||||
* @param key the key
|
||||
* @param value the value
|
||||
*/
|
||||
void accept(@NonNull String key, @NonNull String value);
|
||||
|
||||
/**
|
||||
* Accepts a context pair.
|
||||
*
|
||||
* @param context the context
|
||||
*/
|
||||
default void accept(@NonNull Context context) {
|
||||
accept(context.getKey(), context.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Accepts a context set.
|
||||
*
|
||||
* @param contextSet the context set
|
||||
*/
|
||||
default void accept(@NonNull ContextSet contextSet) {
|
||||
for (Context entry : contextSet) {
|
||||
accept(entry);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
/*
|
||||
* 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.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;
|
||||
|
||||
/**
|
||||
* Manages {@link ContextCalculator}s, and calculates applicable contexts for a
|
||||
* given type.
|
||||
*
|
||||
* <p>This interface accepts {@link Object} types as a parameter to avoid having to depend
|
||||
* on specific server implementations. In all cases, the "player" or "subject" type for
|
||||
* the platform must be used.</p>
|
||||
*
|
||||
* <p>Specifically:</p>
|
||||
*
|
||||
* <p></p>
|
||||
* <ul>
|
||||
* <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>
|
||||
*/
|
||||
public interface ContextManager {
|
||||
|
||||
/**
|
||||
* Queries the ContextManager for current context values for the subject.
|
||||
*
|
||||
* @param subject the subject
|
||||
* @return the applicable context for the subject
|
||||
*/
|
||||
@NonNull ImmutableContextSet getContext(@NonNull Object subject);
|
||||
|
||||
/**
|
||||
* Queries the ContextManager for current context values for the given User.
|
||||
*
|
||||
* <p>This will only return a value if the player corresponding to the
|
||||
* {@link User} is online.</p>
|
||||
*
|
||||
* <p>If you need to obtain a {@link ImmutableContextSet} instance
|
||||
* regardless, you should initially try this method, and then fallback on
|
||||
* {@link #getStaticContext()}.</p>
|
||||
*
|
||||
* @param user the user
|
||||
* @return the applicable context for the subject
|
||||
*/
|
||||
@NonNull Optional<ImmutableContextSet> getContext(@NonNull User user);
|
||||
|
||||
/**
|
||||
* Gets the contexts from the static calculators in this manager.
|
||||
*
|
||||
* <p>Static calculators provide the same context for all subjects, and are
|
||||
* marked as such when registered.</p>
|
||||
*
|
||||
* @return the current active static contexts
|
||||
*/
|
||||
@NonNull ImmutableContextSet getStaticContext();
|
||||
|
||||
/**
|
||||
* Creates a new {@link QueryOptions.Builder}.
|
||||
*
|
||||
* @param mode the mode
|
||||
* @return a new query options builder
|
||||
*/
|
||||
QueryOptions.@NonNull Builder queryOptionsBuilder(@NonNull QueryMode mode);
|
||||
|
||||
/**
|
||||
* Obtains current {@link QueryOptions} for the subject.
|
||||
*
|
||||
* @param subject the subject
|
||||
* @return the query options for the subject
|
||||
*/
|
||||
@NonNull QueryOptions getQueryOptions(@NonNull Object subject);
|
||||
|
||||
/**
|
||||
* Obtains current {@link QueryOptions} for the given User.
|
||||
*
|
||||
* <p>This will only return a value if the player corresponding to the
|
||||
* {@link User} is online.</p>
|
||||
*
|
||||
* <p>If you need to obtain a {@link QueryOptions} instance regardless, you should
|
||||
* initially try this method, and then fallback on {@link #getStaticQueryOptions()}.</p>
|
||||
*
|
||||
* @param user the user
|
||||
* @return the query options for the subject
|
||||
*/
|
||||
@NonNull Optional<QueryOptions> getQueryOptions(@NonNull User user);
|
||||
|
||||
/**
|
||||
* Gets the static query options, using the registered static context calculators.
|
||||
*
|
||||
* @return the current static query options
|
||||
*/
|
||||
@NonNull QueryOptions getStaticQueryOptions();
|
||||
|
||||
/**
|
||||
* Registers a context calculator with the manager.
|
||||
*
|
||||
* @param calculator the calculator
|
||||
*/
|
||||
void registerCalculator(@NonNull ContextCalculator<?> calculator);
|
||||
|
||||
/**
|
||||
* Unregisters a context calculator with the manager.
|
||||
*
|
||||
* @param calculator the calculator
|
||||
*/
|
||||
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
|
||||
*/
|
||||
@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);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,271 @@
|
||||
/*
|
||||
* 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 org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* A set of contexts.
|
||||
*
|
||||
* <p>Context in the most basic sense simply means the circumstances where
|
||||
* something will apply.</p>
|
||||
*
|
||||
* <p>A single "context" consists of a key and a value, both strings. The key
|
||||
* 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>Two default ContextSet implementations are provided.
|
||||
* {@link MutableContextSet} allows the addition and removal of context keys
|
||||
* after construction, and {@link ImmutableContextSet} does not.</p>
|
||||
*/
|
||||
public interface ContextSet extends Iterable<Context> {
|
||||
|
||||
/**
|
||||
* Gets if this {@link ContextSet} is immutable.
|
||||
*
|
||||
* <p>The state of immutable instances will never change.</p>
|
||||
*
|
||||
* @return true if the set is immutable
|
||||
*/
|
||||
boolean isImmutable();
|
||||
|
||||
/**
|
||||
* Returns an immutable representation of this {@link ContextSet}.
|
||||
*
|
||||
* <p>If the set is already immutable, the same object will be returned.
|
||||
* If the set is mutable, an immutable copy will be made.</p>
|
||||
*
|
||||
* @return an immutable representation of this set
|
||||
*/
|
||||
@NonNull ImmutableContextSet immutableCopy();
|
||||
|
||||
/**
|
||||
* Creates a mutable copy of this {@link ContextSet}.
|
||||
*
|
||||
* <p>A new copy is returned regardless of the
|
||||
* {@link #isImmutable() mutability} of this set.</p>
|
||||
*
|
||||
* @return a mutable ContextSet
|
||||
*/
|
||||
@NonNull MutableContextSet mutableCopy();
|
||||
|
||||
/**
|
||||
* Returns a {@link Set} of {@link Context}s representing the current
|
||||
* state of this {@link ContextSet}.
|
||||
*
|
||||
* <p>The returned set is immutable, and is a copy of the current set.
|
||||
* (will not update live)</p>
|
||||
*
|
||||
* @return an immutable set
|
||||
*/
|
||||
@NonNull @Unmodifiable Set<Context> toSet();
|
||||
|
||||
/**
|
||||
* Returns a {@link Map} representing the current state of this
|
||||
* {@link ContextSet}.
|
||||
*
|
||||
* <p>The returned set is immutable, and is a copy of the current set.
|
||||
* (will not update live)</p>
|
||||
*
|
||||
* @return a map
|
||||
*/
|
||||
@NonNull @Unmodifiable Map<String, Set<String>> toMap();
|
||||
|
||||
/**
|
||||
* Returns a {@link Map} <b>loosely</b> representing the current state of
|
||||
* this {@link ContextSet}.
|
||||
*
|
||||
* <p>The returned map is immutable, and is a copy of the current set.
|
||||
* (will not update live)</p>
|
||||
*
|
||||
* <p>As a single context key can be mapped to multiple values, this method
|
||||
* may not be a true representation of the set.</p>
|
||||
*
|
||||
* @return an immutable map
|
||||
* @deprecated Deprecated because the returned map may not contain all data in the ContextSet
|
||||
*/
|
||||
@Deprecated
|
||||
@NonNull @Unmodifiable Map<String, String> toFlattenedMap();
|
||||
|
||||
/**
|
||||
* Returns an {@link Iterator} over each of the context pairs in this set.
|
||||
*
|
||||
* <p>The returned iterator represents the state of the set at the time of creation. It is not
|
||||
* updated as the set changes.</p>
|
||||
*
|
||||
* <p>The iterator does not support {@link Iterator#remove()} calls.</p>
|
||||
*
|
||||
* @return an iterator
|
||||
*/
|
||||
@Override
|
||||
@NonNull @Unmodifiable Iterator<Context> iterator();
|
||||
|
||||
/**
|
||||
* Returns if the {@link ContextSet} contains at least one value for the
|
||||
* given key.
|
||||
*
|
||||
* @param key the key to check for
|
||||
* @return true if the set contains a value for the key
|
||||
* @throws NullPointerException if the key is null
|
||||
*/
|
||||
boolean containsKey(@NonNull String key);
|
||||
|
||||
/**
|
||||
* Returns a {@link Set} of the values mapped to the given key.
|
||||
*
|
||||
* <p>The returned set is immutable, and only represents the current state
|
||||
* of the {@link ContextSet}. (will not update live)</p>
|
||||
*
|
||||
* @param key the key to get values for
|
||||
* @return a set of values
|
||||
* @throws NullPointerException if the key is null
|
||||
*/
|
||||
@NonNull @Unmodifiable Set<String> getValues(@NonNull String key);
|
||||
|
||||
/**
|
||||
* Returns any value from this {@link ContextSet} matching the key, if present.
|
||||
*
|
||||
* <p>Note that context keys can be mapped to multiple values.
|
||||
* Use {@link #getValues(String)} to retrieve all associated values.</p>
|
||||
*
|
||||
* @param key the key to find values for
|
||||
* @return an optional containing any match
|
||||
*/
|
||||
default @NonNull Optional<String> getAnyValue(@NonNull String key) {
|
||||
return getValues(key).stream().findAny();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if the {@link ContextSet} contains a given context pairing.
|
||||
*
|
||||
* @param key the key to look for
|
||||
* @param value the value to look for
|
||||
* @return true if the set contains the context pair
|
||||
* @throws NullPointerException if the key or value is null
|
||||
*/
|
||||
boolean contains(@NonNull String key, @NonNull String value);
|
||||
|
||||
/**
|
||||
* Returns if the {@link ContextSet} contains a given context pairing.
|
||||
*
|
||||
* @param entry the entry to look for
|
||||
* @return true if the set contains the context pair
|
||||
* @throws NullPointerException if the key or value is null
|
||||
*/
|
||||
default boolean contains(@NonNull Context entry) {
|
||||
Objects.requireNonNull(entry, "entry");
|
||||
return contains(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if the {@link ContextSet} contains any of the given context pairings.
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @return true if the set is empty
|
||||
*/
|
||||
boolean isEmpty();
|
||||
|
||||
/**
|
||||
* Gets the number of context pairs in the {@link ContextSet}.
|
||||
*
|
||||
* @return the size of the set
|
||||
*/
|
||||
int size();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* 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 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();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* Some default context keys used by the plugin.
|
||||
*/
|
||||
public final class DefaultContextKeys {
|
||||
private DefaultContextKeys() {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
/**
|
||||
* The context key used to denote the name of the subjects server.
|
||||
*/
|
||||
public static final String SERVER_KEY = "server";
|
||||
|
||||
/**
|
||||
* The context key used to denote the name of the 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";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* 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.LuckPermsProvider;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* An immutable implementation of {@link ContextSet}.
|
||||
*/
|
||||
public interface ImmutableContextSet extends ContextSet {
|
||||
|
||||
/**
|
||||
* Creates an {@link ImmutableContextSet.Builder}.
|
||||
*
|
||||
* @return a new ImmutableContextSet builder
|
||||
*/
|
||||
static @NonNull Builder builder() {
|
||||
return LuckPermsProvider.get().getContextManager().getContextSetFactory().immutableBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an empty {@link ImmutableContextSet}.
|
||||
*
|
||||
* @return an empty ImmutableContextSet
|
||||
*/
|
||||
static @NonNull ImmutableContextSet empty() {
|
||||
return LuckPermsProvider.get().getContextManager().getContextSetFactory().immutableEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an {@link ImmutableContextSet} from a context pair.
|
||||
*
|
||||
* @param key the key
|
||||
* @param value the value
|
||||
* @return a new ImmutableContextSet containing one context pair
|
||||
* @throws NullPointerException if key or value is null
|
||||
*/
|
||||
static @NonNull ImmutableContextSet of(@NonNull String key, @NonNull String value) {
|
||||
return LuckPermsProvider.get().getContextManager().getContextSetFactory().immutableOf(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated This context set is already immutable!
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
@NonNull ImmutableContextSet immutableCopy();
|
||||
|
||||
/**
|
||||
* A builder for {@link ImmutableContextSet}.
|
||||
*/
|
||||
interface Builder {
|
||||
|
||||
/**
|
||||
* Adds a context to the set.
|
||||
*
|
||||
* @param key the key to add
|
||||
* @param value the value to add
|
||||
* @return the builder
|
||||
* @throws NullPointerException if the key or value is null
|
||||
* @see MutableContextSet#add(String, String)
|
||||
*/
|
||||
@NonNull Builder add(@NonNull String key, @NonNull String value);
|
||||
|
||||
/**
|
||||
* Adds a context to the set.
|
||||
*
|
||||
* @param entry the entry to add
|
||||
* @return the builder
|
||||
* @throws NullPointerException if the entry is null
|
||||
* @see MutableContextSet#add(Context)
|
||||
*/
|
||||
default @NonNull Builder add(@NonNull Context entry) {
|
||||
Objects.requireNonNull(entry, "entry");
|
||||
add(entry.getKey(), entry.getValue());
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the contexts contained in the given {@link Iterable} to the set.
|
||||
*
|
||||
* @param iterable an iterable of key value context pairs
|
||||
* @return the builder
|
||||
* @throws NullPointerException if iterable is null
|
||||
* @see MutableContextSet#addAll(Iterable)
|
||||
*/
|
||||
default @NonNull Builder addAll(@NonNull Iterable<Context> iterable) {
|
||||
for (Context e : Objects.requireNonNull(iterable, "iterable")) {
|
||||
add(e);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds all the contexts in another {@link ContextSet} to the set.
|
||||
*
|
||||
* @param contextSet the set to add from
|
||||
* @return the builder
|
||||
* @throws NullPointerException if the contextSet is null
|
||||
* @see MutableContextSet#addAll(ContextSet)
|
||||
*/
|
||||
@NonNull Builder addAll(@NonNull ContextSet contextSet);
|
||||
|
||||
/**
|
||||
* Creates a {@link ImmutableContextSet} from the values previously
|
||||
* added to the builder.
|
||||
*
|
||||
* @return an {@link ImmutableContextSet} from the builder
|
||||
*/
|
||||
@NonNull ImmutableContextSet build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* 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.LuckPermsProvider;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* A mutable implementation of {@link ContextSet}.
|
||||
*/
|
||||
public interface MutableContextSet extends ContextSet {
|
||||
|
||||
/**
|
||||
* Creates a new empty MutableContextSet.
|
||||
*
|
||||
* @return a new MutableContextSet
|
||||
*/
|
||||
static @NonNull MutableContextSet create() {
|
||||
return LuckPermsProvider.get().getContextManager().getContextSetFactory().mutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link MutableContextSet} from a context pair.
|
||||
*
|
||||
* @param key the key
|
||||
* @param value the value
|
||||
* @return a new MutableContextSet containing one context pair
|
||||
* @throws NullPointerException if key or value is null
|
||||
*/
|
||||
static @NonNull MutableContextSet of(@NonNull String key, @NonNull String value) {
|
||||
Objects.requireNonNull(key, "key");
|
||||
Objects.requireNonNull(value, "value");
|
||||
MutableContextSet set = create();
|
||||
set.add(key, value);
|
||||
return set;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a context to this set.
|
||||
*
|
||||
* @param key the key to add
|
||||
* @param value the value to add
|
||||
* @throws NullPointerException if the key or value is null
|
||||
*/
|
||||
void add(@NonNull String key, @NonNull String value);
|
||||
|
||||
/**
|
||||
* Adds a context to this set.
|
||||
*
|
||||
* @param entry the entry to add
|
||||
* @throws NullPointerException if the entry is null
|
||||
*/
|
||||
default void add(@NonNull Context entry) {
|
||||
Objects.requireNonNull(entry, "entry");
|
||||
add(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the contexts contained in the given {@link Iterable} to this set.
|
||||
*
|
||||
* @param iterable an iterable of key value context pairs
|
||||
* @throws NullPointerException if iterable is null
|
||||
*/
|
||||
default void addAll(@NonNull Iterable<Context> iterable) {
|
||||
for (Context e : Objects.requireNonNull(iterable, "iterable")) {
|
||||
add(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
void addAll(@NonNull ContextSet contextSet);
|
||||
|
||||
/**
|
||||
* Removes a context from this set.
|
||||
*
|
||||
* @param key the key to remove
|
||||
* @param value the value to remove
|
||||
* @throws NullPointerException if the key or value is null
|
||||
*/
|
||||
void remove(@NonNull String key, @NonNull String value);
|
||||
|
||||
/**
|
||||
* Removes all contexts from this set with the given key.
|
||||
*
|
||||
* @param key the key to remove
|
||||
* @throws NullPointerException if the key is null
|
||||
*/
|
||||
void removeAll(@NonNull String key);
|
||||
|
||||
/**
|
||||
* Removes all contexts from the set.
|
||||
*/
|
||||
void clear();
|
||||
|
||||
}
|
||||
@@ -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.context;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* Extension of {@link ContextCalculator} which provides the same context
|
||||
* regardless of the subject.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface StaticContextCalculator extends ContextCalculator<Object> {
|
||||
|
||||
/**
|
||||
* Creates a new {@link StaticContextCalculator} that provides a single context.
|
||||
*
|
||||
* @param key the key of the context provided by the calculator
|
||||
* @param valueFunction the function used to compute the corresponding value
|
||||
* for each query. A context will not be "accumulated"
|
||||
* if the value returned is null.
|
||||
* @return the resultant calculator
|
||||
*/
|
||||
static StaticContextCalculator forSingleContext(String key, Supplier<String> valueFunction) {
|
||||
Objects.requireNonNull(key, "key");
|
||||
Objects.requireNonNull(valueFunction, "valueFunction");
|
||||
return consumer -> {
|
||||
String value = valueFunction.get();
|
||||
if (value != null) {
|
||||
consumer.accept(key, value);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Submits any contexts this calculator determines to be applicable.
|
||||
*
|
||||
* <p>Care should be taken to ensure implementations of this method meet the
|
||||
* general requirements for {@link ContextCalculator}, defined in the class
|
||||
* doc.</p>
|
||||
*
|
||||
* @param consumer the {@link ContextConsumer} to submit contexts to
|
||||
*/
|
||||
void calculate(@NonNull ContextConsumer consumer);
|
||||
|
||||
@Override
|
||||
default void calculate(@NonNull Object target, @NonNull ContextConsumer consumer) {
|
||||
calculate(consumer);
|
||||
}
|
||||
}
|
||||
+7
-7
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* 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
|
||||
@@ -20,11 +23,8 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.exceptions;
|
||||
|
||||
/**
|
||||
* Thrown when a permission holding object already has a permission, is already a member of a group, or when a track
|
||||
* already contains a group.
|
||||
* Context functionality, including {@link net.luckperms.api.context.ContextSet}s and
|
||||
* {@link net.luckperms.api.context.ContextCalculator}s.
|
||||
*/
|
||||
public class ObjectAlreadyHasException extends MembershipException {
|
||||
}
|
||||
package net.luckperms.api.context;
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* The LuckPerms event bus.
|
||||
*
|
||||
* <p>Used to subscribe (or "listen") to LuckPerms events.</p>
|
||||
*/
|
||||
public interface EventBus {
|
||||
|
||||
/**
|
||||
* Registers a new subscription to the given event.
|
||||
*
|
||||
* <p>The returned {@link EventSubscription} instance encapsulates the subscription state. It has
|
||||
* methods which can be used to terminate the subscription, or view stats about the nature of
|
||||
* the subscription.</p>
|
||||
*
|
||||
* @param eventClass the event class
|
||||
* @param handler the event handler
|
||||
* @param <T> the event class
|
||||
* @return an event handler instance representing this subscription
|
||||
*/
|
||||
<T extends LuckPermsEvent> @NonNull EventSubscription<T> subscribe(@NonNull Class<T> eventClass, @NonNull Consumer<? super T> handler);
|
||||
|
||||
/**
|
||||
* Registers a new subscription to the given event.
|
||||
*
|
||||
* <p>The returned {@link EventSubscription} instance encapsulates the subscription state. It has
|
||||
* methods which can be used to terminate the subscription, or view stats about the nature of
|
||||
* the subscription.</p>
|
||||
*
|
||||
* <p>Unlike {@link #subscribe(Class, Consumer)}, this method accepts an additional parameter
|
||||
* for {@code plugin}. This object must be a "plugin" instance on the platform, and is used to
|
||||
* automatically {@link EventSubscription#close() unregister} the subscription when the
|
||||
* corresponding plugin is disabled.</p>
|
||||
*
|
||||
* @param <T> the event class
|
||||
* @param plugin a plugin instance to bind the subscription to.
|
||||
* @param eventClass the event class
|
||||
* @param handler the event handler
|
||||
* @return an event handler instance representing this subscription
|
||||
*/
|
||||
<T extends LuckPermsEvent> @NonNull EventSubscription<T> subscribe(Object plugin, @NonNull Class<T> eventClass, @NonNull Consumer<? super T> handler);
|
||||
|
||||
/**
|
||||
* Gets a set of all registered handlers for a given event.
|
||||
*
|
||||
* @param eventClass the event to find handlers for
|
||||
* @param <T> the event class
|
||||
* @return an immutable set of event handlers
|
||||
*/
|
||||
<T extends LuckPermsEvent> @NonNull @Unmodifiable Set<EventSubscription<T>> getSubscriptions(@NonNull Class<T> eventClass);
|
||||
|
||||
}
|
||||
+14
-18
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* 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
|
||||
@@ -20,23 +23,25 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.event;
|
||||
package net.luckperms.api.event;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* Represents a handler for a LuckPerms event
|
||||
* Represents a subscription to a {@link LuckPermsEvent}.
|
||||
*
|
||||
* @param <T> the event class
|
||||
*/
|
||||
public interface EventHandler<T extends LuckPermsEvent> {
|
||||
public interface EventSubscription<T extends LuckPermsEvent> extends AutoCloseable {
|
||||
|
||||
/**
|
||||
* Gets the class this handler is listening to
|
||||
*
|
||||
* @return the event class
|
||||
*/
|
||||
Class<T> getEventClass();
|
||||
@NonNull Class<T> getEventClass();
|
||||
|
||||
/**
|
||||
* Returns true if this handler is active
|
||||
@@ -46,24 +51,15 @@ public interface EventHandler<T extends LuckPermsEvent> {
|
||||
boolean isActive();
|
||||
|
||||
/**
|
||||
* Unregisters this handler from the event bus
|
||||
*
|
||||
* @return true if the handler wasn't already unregistered
|
||||
* Unregisters this handler from the event bus.
|
||||
*/
|
||||
boolean unregister();
|
||||
@Override
|
||||
void close();
|
||||
|
||||
/**
|
||||
* Gets the event consumer responsible for handling the event
|
||||
*
|
||||
* @return the event consumer
|
||||
*/
|
||||
Consumer<T> getConsumer();
|
||||
|
||||
/**
|
||||
* Gets the number of times this handler has been called
|
||||
*
|
||||
* @return the number of times this handler has been called
|
||||
*/
|
||||
int getCallCount();
|
||||
|
||||
@NonNull Consumer<? super T> getHandler();
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import net.luckperms.api.LuckPerms;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* A superinterface for all LuckPerms events.
|
||||
*/
|
||||
public interface LuckPermsEvent {
|
||||
|
||||
/**
|
||||
* Get the API instance this event was dispatched from
|
||||
*
|
||||
* @return the api instance
|
||||
*/
|
||||
@NonNull LuckPerms getLuckPerms();
|
||||
|
||||
/**
|
||||
* Gets the type of the event.
|
||||
*
|
||||
* @return the type of the event
|
||||
*/
|
||||
@NonNull Class<? extends LuckPermsEvent> getEventType();
|
||||
|
||||
}
|
||||
+11
-3
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* 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
|
||||
@@ -20,7 +23,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.event.cause;
|
||||
package net.luckperms.api.event.cause;
|
||||
|
||||
/**
|
||||
* The cause of a group/track creation
|
||||
@@ -32,6 +35,11 @@ public enum CreationCause {
|
||||
*/
|
||||
COMMAND,
|
||||
|
||||
/**
|
||||
* The creation was caused by the web editor
|
||||
*/
|
||||
WEB_EDITOR,
|
||||
|
||||
/**
|
||||
* The creation was caused by an API call
|
||||
*/
|
||||
@@ -40,6 +48,6 @@ public enum CreationCause {
|
||||
/**
|
||||
* The creation was caused by a LuckPerms internal
|
||||
*/
|
||||
INTERNAL;
|
||||
INTERNAL
|
||||
|
||||
}
|
||||
+12
-3
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* 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
|
||||
@@ -20,7 +23,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.event.cause;
|
||||
package net.luckperms.api.event.cause;
|
||||
|
||||
/**
|
||||
* The cause of a group/track deletion
|
||||
@@ -32,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
|
||||
*/
|
||||
@@ -40,6 +49,6 @@ public enum DeletionCause {
|
||||
/**
|
||||
* The deletion was caused by a LuckPerms internal
|
||||
*/
|
||||
INTERNAL;
|
||||
INTERNAL
|
||||
|
||||
}
|
||||
+6
-7
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* 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
|
||||
@@ -20,11 +23,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.event.node;
|
||||
|
||||
/**
|
||||
* Called when a holder has their nodes cleared
|
||||
* Event causes.
|
||||
*/
|
||||
public interface NodeClearEvent extends NodeMutateEvent {
|
||||
|
||||
}
|
||||
package net.luckperms.api.event.cause;
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 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;
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* 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.extension;
|
||||
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.extension.Extension;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Called when an {@link Extension} is loaded.
|
||||
*/
|
||||
public interface ExtensionLoadEvent extends LuckPermsEvent {
|
||||
|
||||
/**
|
||||
* Gets the extension that was loaded.
|
||||
*
|
||||
* @return the extension
|
||||
*/
|
||||
@Param(0)
|
||||
@NonNull Extension getExtension();
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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.group;
|
||||
|
||||
import net.luckperms.api.cacheddata.CachedDataManager;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.model.group.Group;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Called when a groups {@link CachedDataManager} is loaded.
|
||||
*/
|
||||
public interface GroupCacheLoadEvent extends LuckPermsEvent {
|
||||
|
||||
/**
|
||||
* Gets the group whose data was loaded
|
||||
*
|
||||
* @return the group
|
||||
*/
|
||||
@Param(0)
|
||||
@NonNull Group getGroup();
|
||||
|
||||
/**
|
||||
* Gets the data that was loaded
|
||||
*
|
||||
* @return the loaded data
|
||||
*/
|
||||
@Param(1)
|
||||
@NonNull CachedDataManager getLoadedData();
|
||||
|
||||
}
|
||||
+15
-7
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* 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
|
||||
@@ -20,11 +23,14 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.event.group;
|
||||
package net.luckperms.api.event.group;
|
||||
|
||||
import me.lucko.luckperms.api.Group;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
import me.lucko.luckperms.api.event.cause.CreationCause;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.cause.CreationCause;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.model.group.Group;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Called when a group is created
|
||||
@@ -36,13 +42,15 @@ public interface GroupCreateEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the new group
|
||||
*/
|
||||
Group getGroup();
|
||||
@Param(0)
|
||||
@NonNull Group getGroup();
|
||||
|
||||
/**
|
||||
* Gets the cause of the creation
|
||||
*
|
||||
* @return the cause of the creation
|
||||
*/
|
||||
CreationCause getCause();
|
||||
@Param(1)
|
||||
@NonNull CreationCause getCause();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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.group;
|
||||
|
||||
import net.luckperms.api.cacheddata.CachedDataManager;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.model.group.Group;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Called when a groups cached data is refreshed
|
||||
*/
|
||||
public interface GroupDataRecalculateEvent extends LuckPermsEvent {
|
||||
|
||||
/**
|
||||
* Gets the group whose data was recalculated
|
||||
*
|
||||
* @return the group
|
||||
*/
|
||||
@Param(0)
|
||||
@NonNull Group getGroup();
|
||||
|
||||
/**
|
||||
* Gets the data that was recalculated
|
||||
*
|
||||
* @return the data
|
||||
*/
|
||||
@Param(1)
|
||||
@NonNull CachedDataManager getData();
|
||||
|
||||
}
|
||||
+17
-8
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* 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
|
||||
@@ -20,11 +23,14 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.event.group;
|
||||
package net.luckperms.api.event.group;
|
||||
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
import me.lucko.luckperms.api.event.cause.DeletionCause;
|
||||
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;
|
||||
|
||||
@@ -38,20 +44,23 @@ public interface GroupDeleteEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the name of the deleted group
|
||||
*/
|
||||
String getGroupName();
|
||||
@Param(0)
|
||||
@NonNull String getGroupName();
|
||||
|
||||
/**
|
||||
* Gets an immutable copy of the groups existing data
|
||||
*
|
||||
* @return a copy of the groups existing data
|
||||
*/
|
||||
Set<Node> getExistingData();
|
||||
@Param(1)
|
||||
@NonNull Set<Node> getExistingData();
|
||||
|
||||
/**
|
||||
* Gets the cause of the deletion
|
||||
*
|
||||
* @return the cause of the deletion
|
||||
*/
|
||||
DeletionCause getCause();
|
||||
@Param(2)
|
||||
@NonNull DeletionCause getCause();
|
||||
|
||||
}
|
||||
+6
-3
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* 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
|
||||
@@ -20,9 +23,9 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.event.group;
|
||||
package net.luckperms.api.event.group;
|
||||
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
/**
|
||||
* Called when all groups have been loaded in from storage.
|
||||
+12
-5
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* 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
|
||||
@@ -20,10 +23,13 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.event.group;
|
||||
package net.luckperms.api.event.group;
|
||||
|
||||
import me.lucko.luckperms.api.Group;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.model.group.Group;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Called when a group is loaded into memory from the storage.
|
||||
@@ -37,6 +43,7 @@ public interface GroupLoadEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the group that was loaded
|
||||
*/
|
||||
Group getGroup();
|
||||
@Param(0)
|
||||
@NonNull Group getGroup();
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
+42
-6
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* 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
|
||||
@@ -20,11 +23,14 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.event.log;
|
||||
package net.luckperms.api.event.log;
|
||||
|
||||
import me.lucko.luckperms.api.LogEntry;
|
||||
import me.lucko.luckperms.api.event.Cancellable;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.actionlog.Action;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.type.Cancellable;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Called when a log entry is about to be sent to notifiable players on the platform
|
||||
@@ -36,6 +42,36 @@ public interface LogBroadcastEvent extends LuckPermsEvent, Cancellable {
|
||||
*
|
||||
* @return the log entry to be broadcasted
|
||||
*/
|
||||
LogEntry getEntry();
|
||||
@Param(0)
|
||||
@NonNull Action getEntry();
|
||||
|
||||
/**
|
||||
* Gets where the log entry originated from.
|
||||
*
|
||||
* @return the origin of the log
|
||||
*/
|
||||
@Param(1)
|
||||
@NonNull Origin getOrigin();
|
||||
|
||||
/**
|
||||
* Represents where a log entry is from
|
||||
*/
|
||||
enum Origin {
|
||||
|
||||
/**
|
||||
* Marks a log entry which originated from the current server instance
|
||||
*/
|
||||
LOCAL,
|
||||
|
||||
/**
|
||||
* Marks a log entry which originated from an API call on the current server instance
|
||||
*/
|
||||
LOCAL_API,
|
||||
|
||||
/**
|
||||
* Marks a log entry which was sent to this server via the messaging service
|
||||
*/
|
||||
REMOTE
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.log;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Called when a log is about to be published to the network via the MessagingService
|
||||
*/
|
||||
public interface LogNetworkPublishEvent extends LuckPermsEvent, Cancellable {
|
||||
|
||||
/**
|
||||
* Gets the ID of the log entry being published
|
||||
*
|
||||
* @return the id of the log entry being published
|
||||
*/
|
||||
@Param(0)
|
||||
@NonNull UUID getLogId();
|
||||
|
||||
/**
|
||||
* Gets the log entry to be published
|
||||
*
|
||||
* @return the log entry to be published
|
||||
*/
|
||||
@Param(1)
|
||||
@NonNull Action getEntry();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* 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.log;
|
||||
|
||||
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 net.luckperms.api.platform.PlatformEntity;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Called when a log entry is about to be sent to specific notifiable object on
|
||||
* the platform.
|
||||
*
|
||||
* <p>This event is not called for players without the notify permission,
|
||||
* but is called for objects which are ignoring log notifications (called with
|
||||
* the cancelled flag set to true).</p>
|
||||
*/
|
||||
public interface LogNotifyEvent extends LuckPermsEvent, Cancellable {
|
||||
|
||||
/**
|
||||
* Gets the log entry to be sent
|
||||
*
|
||||
* @return the log entry to be sent
|
||||
*/
|
||||
@Param(0)
|
||||
@NonNull Action getEntry();
|
||||
|
||||
/**
|
||||
* Gets where the log entry originated from.
|
||||
*
|
||||
* @return the origin of the log
|
||||
*/
|
||||
@Param(1)
|
||||
@NonNull Origin getOrigin();
|
||||
|
||||
/**
|
||||
* Gets the object to be notified.
|
||||
*
|
||||
* @return the object to notify
|
||||
*/
|
||||
@Param(2)
|
||||
@NonNull PlatformEntity getNotifiable();
|
||||
|
||||
/**
|
||||
* Represents where a log entry is from
|
||||
*/
|
||||
enum Origin {
|
||||
|
||||
/**
|
||||
* Marks a log entry which originated from the current server instance
|
||||
*/
|
||||
LOCAL,
|
||||
|
||||
/**
|
||||
* Marks a log entry which originated from an API call on the current server instance
|
||||
*/
|
||||
LOCAL_API,
|
||||
|
||||
/**
|
||||
* Marks a log entry which was sent to this server via the messaging service
|
||||
*/
|
||||
REMOTE
|
||||
}
|
||||
|
||||
}
|
||||
+13
-6
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* 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
|
||||
@@ -20,11 +23,14 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.event.log;
|
||||
package net.luckperms.api.event.log;
|
||||
|
||||
import me.lucko.luckperms.api.LogEntry;
|
||||
import me.lucko.luckperms.api.event.Cancellable;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.actionlog.Action;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.type.Cancellable;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Called when a log is about to be published to the storage file/table
|
||||
@@ -36,6 +42,7 @@ public interface LogPublishEvent extends LuckPermsEvent, Cancellable {
|
||||
*
|
||||
* @return the log entry to be published
|
||||
*/
|
||||
LogEntry getEntry();
|
||||
@Param(0)
|
||||
@NonNull Action getEntry();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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.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
|
||||
*/
|
||||
public interface LogReceiveEvent extends LuckPermsEvent {
|
||||
|
||||
/**
|
||||
* Gets the ID of the log entry being received
|
||||
*
|
||||
* @return the id of the log entry being received
|
||||
*/
|
||||
@Param(0)
|
||||
@NonNull UUID getLogId();
|
||||
|
||||
/**
|
||||
* Gets the log entry being received
|
||||
*
|
||||
* @return the log entry being received
|
||||
*/
|
||||
@Param(1)
|
||||
@NonNull Action getEntry();
|
||||
|
||||
}
|
||||
@@ -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,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.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
|
||||
*/
|
||||
public interface NodeAddEvent extends NodeMutateEvent {
|
||||
|
||||
/**
|
||||
* Gets the node that was added
|
||||
*
|
||||
* @return the node that was added
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
}
|
||||
@@ -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.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);
|
||||
}
|
||||
}
|
||||
+36
-12
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* 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
|
||||
@@ -20,11 +23,18 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.event.node;
|
||||
package net.luckperms.api.event.node;
|
||||
|
||||
import me.lucko.luckperms.api.Node;
|
||||
import me.lucko.luckperms.api.PermissionHolder;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.util.Param;
|
||||
import net.luckperms.api.model.PermissionHolder;
|
||||
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;
|
||||
|
||||
@@ -38,38 +48,52 @@ public interface NodeMutateEvent extends LuckPermsEvent {
|
||||
*
|
||||
* @return the event target
|
||||
*/
|
||||
PermissionHolder getTarget();
|
||||
@Param(0)
|
||||
@NonNull PermissionHolder getTarget();
|
||||
|
||||
/**
|
||||
* Gets the data type that was mutated.
|
||||
*
|
||||
* @return the data type
|
||||
*/
|
||||
@Param(1)
|
||||
@NonNull DataType getDataType();
|
||||
|
||||
/**
|
||||
* Gets an immutable copy of the holders data before the change
|
||||
*
|
||||
* @return the data before the change
|
||||
*/
|
||||
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
|
||||
*/
|
||||
Set<Node> getDataAfter();
|
||||
@Param(2)
|
||||
@NonNull @Unmodifiable Set<Node> getDataAfter();
|
||||
|
||||
/**
|
||||
* Gets whether the target of this event is a {@link me.lucko.luckperms.api.User}
|
||||
* Gets whether the target of this event is a {@link User}
|
||||
*
|
||||
* <p>This is equivalent to checking if getTarget() instanceof User</p>
|
||||
*
|
||||
* @return if the event is targeting a user
|
||||
*/
|
||||
boolean isUser();
|
||||
default boolean isUser() {
|
||||
return getTarget() instanceof User;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether the target of this event is a {@link me.lucko.luckperms.api.Group}
|
||||
* Gets whether the target of this event is a {@link Group}
|
||||
*
|
||||
* <p>This is equivalent to checking if getTarget() instanceof Group</p>
|
||||
*
|
||||
* @return if the event is targeting a group
|
||||
*/
|
||||
boolean isGroup();
|
||||
default boolean isGroup() {
|
||||
return getTarget() instanceof Group;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.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
|
||||
*/
|
||||
public interface NodeRemoveEvent extends NodeMutateEvent {
|
||||
|
||||
/**
|
||||
* Gets the node that was removed
|
||||
*
|
||||
* @return the node that was removed
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
|
||||
}
|
||||
+7
-18
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* 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
|
||||
@@ -20,22 +23,8 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.event;
|
||||
|
||||
import me.lucko.luckperms.api.LuckPermsApi;
|
||||
|
||||
/**
|
||||
* The base event interface
|
||||
*
|
||||
* @since 3.0
|
||||
* 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}.
|
||||
*/
|
||||
public interface LuckPermsEvent {
|
||||
|
||||
/**
|
||||
* Get the API instance this event was dispatched from
|
||||
*
|
||||
* @return the api instance
|
||||
*/
|
||||
LuckPermsApi getApi();
|
||||
|
||||
}
|
||||
package net.luckperms.api.event.node;
|
||||
+8
-8
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* 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
|
||||
@@ -20,10 +23,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.sponge.utils;
|
||||
|
||||
public class VersionData {
|
||||
|
||||
public static final String VERSION = "${release.version}.${patch.version}";
|
||||
|
||||
}
|
||||
/**
|
||||
* Main events package.
|
||||
*/
|
||||
package net.luckperms.api.event;
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Called when player data is saved to the storage.
|
||||
*
|
||||
* <p>Data can be saved using {@link UserManager#savePlayerData(UUID, String)}.</p>
|
||||
*/
|
||||
public interface PlayerDataSaveEvent extends LuckPermsEvent {
|
||||
|
||||
/**
|
||||
* Gets the unique ID that was saved.
|
||||
*
|
||||
* @return the uuid
|
||||
*/
|
||||
@Param(0)
|
||||
@NonNull UUID getUniqueId();
|
||||
|
||||
/**
|
||||
* Gets the username that was saved.
|
||||
*
|
||||
* @return the username
|
||||
*/
|
||||
@Param(1)
|
||||
@NonNull String getUsername();
|
||||
|
||||
/**
|
||||
* Gets the result of the operation.
|
||||
*
|
||||
* @return the result
|
||||
*/
|
||||
@Param(2)
|
||||
@NonNull PlayerSaveResult getResult();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
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;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Called when LuckPerms has finished processing a Player's initial connection.
|
||||
*
|
||||
* <p>This event will always execute during the platforms async connection
|
||||
* event. The LuckPerms platform listener processing the connection will block
|
||||
* while this event is posted.</p>
|
||||
*
|
||||
* <p>This, among other things, allows you to wait until permission data is
|
||||
* loaded for a User during the BungeeCord 'LoginEvent', as event priorities are
|
||||
* ignored by the current implementation.</p>
|
||||
*
|
||||
* <p>The implementation will make an attempt to ensure this event is called
|
||||
* for all connections, even if the operation to load User data was not
|
||||
* successful. Note that LuckPerms will usually cancel the platform connection
|
||||
* event if data could not be loaded.</p>
|
||||
*/
|
||||
public interface PlayerLoginProcessEvent extends LuckPermsEvent, Result {
|
||||
|
||||
/**
|
||||
* Gets the UUID of the connection which was processed
|
||||
*
|
||||
* @return the uuid of the connection which was processed
|
||||
*/
|
||||
@Param(0)
|
||||
@NonNull UUID getUniqueId();
|
||||
|
||||
/**
|
||||
* Gets the username of the connection which was processed
|
||||
*
|
||||
* @return the username of the connection which was processed
|
||||
*/
|
||||
@Param(1)
|
||||
@NonNull String getUsername();
|
||||
|
||||
/**
|
||||
* Gets if the login was processed successfully.
|
||||
*
|
||||
* @return true if the login was successful
|
||||
*/
|
||||
@Override
|
||||
default boolean wasSuccessful() {
|
||||
return getUser() != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the resultant User instance which was loaded.
|
||||
*
|
||||
* <p>Returns {@code null} if the login was not processed
|
||||
* {@link #wasSuccessful() successfully.}</p>
|
||||
*
|
||||
* @return the user instance
|
||||
*/
|
||||
@Param(2)
|
||||
@Nullable User getUser();
|
||||
|
||||
}
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
|
||||
}
|
||||
+25
-18
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* 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
|
||||
@@ -20,35 +23,39 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.event;
|
||||
package net.luckperms.api.event.player.lookup;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
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;
|
||||
|
||||
/**
|
||||
* The LuckPerms event bus. Used for subscribing (or registering listeners) to events.
|
||||
* Called when the platform needs a unique id for a given username.
|
||||
*
|
||||
* @since 3.0
|
||||
* @since 5.3
|
||||
*/
|
||||
public interface EventBus {
|
||||
public interface UniqueIdLookupEvent extends LuckPermsEvent, ResultEvent<UUID> {
|
||||
|
||||
/**
|
||||
* Subscribe to an event
|
||||
* Gets the username being looked up.
|
||||
*
|
||||
* @param eventClass the event class
|
||||
* @param handler the event handler
|
||||
* @param <T> the event class
|
||||
* @return an event handler instance representing this subscription
|
||||
* @return the username
|
||||
*/
|
||||
<T extends LuckPermsEvent> EventHandler<T> subscribe(Class<T> eventClass, Consumer<T> handler);
|
||||
@Param(0)
|
||||
@NonNull String getUsername();
|
||||
|
||||
/**
|
||||
* Gets a set of all registered handlers for a given event
|
||||
* Sets the result unique id.
|
||||
*
|
||||
* @param eventClass the event to find handlers for
|
||||
* @param <T> the event class
|
||||
* @return an immutable set of event handlers
|
||||
* @param uniqueId the unique id
|
||||
*/
|
||||
<T extends LuckPermsEvent> Set<EventHandler<T>> getHandlers(Class<T> eventClass);
|
||||
default void setUniqueId(@Nullable UUID uniqueId) {
|
||||
result().set(uniqueId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* 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 username for a given unique id.
|
||||
*
|
||||
* @since 5.3
|
||||
*/
|
||||
public interface UsernameLookupEvent extends LuckPermsEvent, ResultEvent<String> {
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 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.util.Param;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
/**
|
||||
* Called when the validity of a username is being tested.
|
||||
*
|
||||
* @since 5.3
|
||||
*/
|
||||
public interface UsernameValidityCheckEvent extends LuckPermsEvent {
|
||||
|
||||
/**
|
||||
* Gets the username being tested.
|
||||
*
|
||||
* @return the username
|
||||
*/
|
||||
@Param(0)
|
||||
@NonNull String getUsername();
|
||||
|
||||
/**
|
||||
* Gets the current validity state for the username.
|
||||
*
|
||||
* @return the validity state
|
||||
*/
|
||||
@Param(1)
|
||||
@NonNull AtomicBoolean validityState();
|
||||
|
||||
/**
|
||||
* Gets if the username is currently considered to be valid.
|
||||
*
|
||||
* @return if the username is valid
|
||||
*/
|
||||
default boolean isValid() {
|
||||
return validityState().get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets if the username should be considered valid or not.
|
||||
*
|
||||
* @param valid whether the username is valid
|
||||
*/
|
||||
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;
|
||||
+14
-10
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* 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
|
||||
@@ -20,21 +23,22 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api;
|
||||
package net.luckperms.api.event.source;
|
||||
|
||||
import net.luckperms.api.platform.PlatformEntity;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* A means to push changes to other servers using the platforms networking
|
||||
*
|
||||
* @since 2.14
|
||||
* Represents an {@link PlatformEntity} which was the {@link Source} of something.
|
||||
*/
|
||||
public interface MessagingService {
|
||||
public interface EntitySource extends Source {
|
||||
|
||||
/**
|
||||
* Uses the messaging service to inform other servers about changes.
|
||||
* Gets the entity.
|
||||
*
|
||||
* <p> This will push the update asynchronously, and this method will return immediately. Calling this method is
|
||||
* equivalent to running "/lp networksync", except will not sync this server.
|
||||
* @return the entity
|
||||
*/
|
||||
void pushUpdate();
|
||||
@NonNull PlatformEntity getEntity();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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.source;
|
||||
|
||||
import net.luckperms.api.platform.PlatformEntity;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Represents the source of an event.
|
||||
*
|
||||
* <p>Could also be described as the "thing" that caused an event to occur.</p>
|
||||
*/
|
||||
public interface Source {
|
||||
|
||||
/**
|
||||
* Gets the source type
|
||||
*
|
||||
* @return the type
|
||||
*/
|
||||
@NonNull Type getType();
|
||||
|
||||
/**
|
||||
* Represents a type of source
|
||||
*/
|
||||
enum Type {
|
||||
|
||||
/**
|
||||
* Represents an {@link PlatformEntity} source
|
||||
*
|
||||
* @see EntitySource
|
||||
*/
|
||||
ENTITY,
|
||||
|
||||
/**
|
||||
* Represents an unknown source
|
||||
*/
|
||||
UNKNOWN
|
||||
}
|
||||
|
||||
}
|
||||
+8
-8
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* 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
|
||||
@@ -20,10 +23,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.common.config;
|
||||
|
||||
public interface ConfigKey<T> {
|
||||
|
||||
T get(LuckPermsConfiguration config);
|
||||
|
||||
}
|
||||
/**
|
||||
* Event sources.
|
||||
*/
|
||||
package net.luckperms.api.event.source;
|
||||
+6
-3
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* 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
|
||||
@@ -20,9 +23,9 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.event.sync;
|
||||
package net.luckperms.api.event.sync;
|
||||
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
/**
|
||||
* Called when the configuration is reloaded
|
||||
+6
-3
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* 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
|
||||
@@ -20,9 +23,9 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.event.sync;
|
||||
package net.luckperms.api.event.sync;
|
||||
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
|
||||
/**
|
||||
* Called when an sync task has been completed
|
||||
+13
-6
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* 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
|
||||
@@ -20,15 +23,18 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.event.sync;
|
||||
package net.luckperms.api.event.sync;
|
||||
|
||||
import me.lucko.luckperms.api.event.Cancellable;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Called before a network sync task runs
|
||||
* Called before a received network sync task runs
|
||||
*/
|
||||
public interface PreNetworkSyncEvent extends LuckPermsEvent, Cancellable {
|
||||
|
||||
@@ -37,6 +43,7 @@ public interface PreNetworkSyncEvent extends LuckPermsEvent, Cancellable {
|
||||
*
|
||||
* @return the id of the sync request
|
||||
*/
|
||||
UUID getSyncId();
|
||||
@Param(0)
|
||||
@NonNull UUID getSyncId();
|
||||
|
||||
}
|
||||
+7
-4
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Lucko (Luck) <luck@lucko.me>
|
||||
* 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
|
||||
@@ -20,10 +23,10 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.api.event.sync;
|
||||
package net.luckperms.api.event.sync;
|
||||
|
||||
import me.lucko.luckperms.api.event.Cancellable;
|
||||
import me.lucko.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.LuckPermsEvent;
|
||||
import net.luckperms.api.event.type.Cancellable;
|
||||
|
||||
/**
|
||||
* Called before a sync task runs
|
||||
@@ -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;
|
||||
Loaded 100 of 1121 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user