Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5bd9c51962
|
||
|
|
b3d2ba55d1
|
||
|
|
d1d36fa75a | ||
|
|
8b4cca3bc9 | ||
|
|
c92e752c33 | ||
|
|
5fd3b45fb6 | ||
|
|
8ad167e00e | ||
|
|
f203a5d878 | ||
|
|
27039be7e1 | ||
|
|
751044b085 | ||
|
|
0d4a0e6e37 | ||
|
|
9826b1f2b7 | ||
|
|
786ce322ab | ||
|
|
9a8f722b50 | ||
|
|
bbfd821fde | ||
|
|
0ee698ce4b | ||
|
|
0eeee292c8 | ||
|
|
ae5e3976e7 | ||
|
|
d94ddaf26a | ||
|
|
84104be626 | ||
|
|
548c9278db | ||
|
|
5255161106 | ||
|
|
f21ba94070 | ||
|
|
b4515d69c3 | ||
|
|
ddf431a5d6 | ||
|
|
9dda0b8477 | ||
|
|
becd6cd9fa | ||
|
|
92c6b59224 | ||
|
|
520934ead7 | ||
|
|
428ddfb78d | ||
|
|
56bd8be247 | ||
|
|
f7b2aa281e | ||
|
|
0599d504af | ||
|
|
471e0b100f | ||
|
|
52d842b27a | ||
|
|
dfc6ba91eb | ||
|
|
54d59d7b03 | ||
|
|
a4931199af | ||
|
|
02469e977c | ||
|
|
f9386fd3f1 | ||
|
|
242590f3e8 | ||
|
|
65c383491e | ||
|
|
0356c2f606 | ||
|
|
60067f75d3 | ||
|
|
e896ccb72d | ||
|
|
6c3dc58cd6 | ||
|
|
57ada83bfe | ||
|
|
8a86f05133 | ||
|
|
f447cf69d3 | ||
|
|
d06b723adc | ||
|
|
f8617cf1b9 | ||
|
|
8630a6f74c | ||
|
|
424d892091 | ||
|
|
9aaef6e297 | ||
|
|
e749760136 | ||
|
|
7f2f3c54ba | ||
|
|
24f2c867c6 | ||
|
|
e7f3288fb7 | ||
|
|
2221062e98 | ||
|
|
430f5ee9e6 | ||
|
|
cd1a7cf312 | ||
|
|
002cdc64ef | ||
|
|
3d59686ba4 | ||
|
|
f6c72b9d0e | ||
|
|
d72d419044 | ||
|
|
c71a3a4002 | ||
|
|
02b70ed324 | ||
|
|
01d0a53049 | ||
|
|
c700ca6abb | ||
|
|
d9cba6c010 | ||
|
|
a6ed66cf1e | ||
|
|
4f5b7ad3fb | ||
|
|
962ea8b719 | ||
|
|
35e4d0b5aa | ||
|
|
497fe5ef98 | ||
|
|
0508387db1 | ||
|
|
1ff7c419ef | ||
|
|
612eda685c | ||
|
|
7fc7b571a3 | ||
|
|
5cce86bf8d | ||
|
|
7621d815ac | ||
|
|
81495e3478 | ||
|
|
5c591d3a5b | ||
|
|
f1c225b718 | ||
|
|
ca7a098cfa | ||
|
|
b2fbba8455 | ||
|
|
ae6300c43c | ||
|
|
cb62734da5 | ||
|
|
04a2e4ea54 | ||
|
|
2969469605 | ||
|
|
25a0f7a742 | ||
|
|
d2f6c3336e | ||
|
|
d2c7e00639 | ||
|
|
e23fb19c98 | ||
|
|
1f8d5b78a7 | ||
|
|
fee0362c69 | ||
|
|
428d944933 | ||
|
|
180d23fb1a | ||
|
|
f54dc0f028 | ||
|
|
ef141a6e7f | ||
|
|
55b0b5df75 | ||
|
|
bc78304e97 | ||
|
|
42d8ea3526 | ||
|
|
dfc0066c17 | ||
|
|
9e3e61e9a2 | ||
|
|
6551bffcdb | ||
|
|
44f3b4d6d5 | ||
|
|
c672eaaf81 | ||
|
|
460013d22a | ||
|
|
af89f082aa | ||
|
|
e0c3c8a343 | ||
|
|
83480db4c6 | ||
|
|
04d441cfd6 | ||
|
|
842c2654c6 | ||
|
|
01d825da86 | ||
|
|
d61dd872eb | ||
|
|
3c417c6a8e | ||
|
|
f0772a0969 | ||
|
|
2a83c1c548 | ||
|
|
12114c63bf | ||
|
|
8123ff2f27 | ||
|
|
b56ebb3fcb | ||
|
|
7adcce2361 | ||
|
|
6444ec153c | ||
|
|
841253708d | ||
|
|
467308be62 | ||
|
|
d2f8305727 | ||
|
|
1a19435b96 | ||
|
|
eb4b2b1e17 | ||
|
|
8bca4bc091 | ||
|
|
dfef20fb87 | ||
|
|
f4e1dbf385 | ||
|
|
93a84f668a | ||
|
|
f8463c9927 | ||
|
|
34b5cd89e5 | ||
|
|
6aae96ab87 | ||
|
|
3f9978e3c1 | ||
|
|
f43d32ca41 | ||
|
|
f6c5777865 | ||
|
|
cdd79b76a5 | ||
|
|
5fa152f118 | ||
|
|
7a233e6e3d | ||
|
|
0697a7e903 | ||
|
|
5abf3603cf | ||
|
|
1576d4a5a6 | ||
|
|
78579f33dc | ||
|
|
3d94eac961 | ||
|
|
c31ac308f6 | ||
|
|
e201591d14 | ||
|
|
e86a8b29ae | ||
|
|
9992885f03 | ||
|
|
44ae1e58bf | ||
|
|
5550853c7d | ||
|
|
1c70555d1c | ||
|
|
9dcc11c9f4 | ||
|
|
8d942d0f2e | ||
|
|
d556290a19 | ||
|
|
bf91c80e07 | ||
|
|
d5d8a43cb5 | ||
|
|
31cc490a55 | ||
|
|
3c0f870c22 | ||
|
|
4271d31d24 | ||
|
|
0f35426dbc | ||
|
|
c19276134d | ||
|
|
a93ab63e33 | ||
|
|
e41ab428b7 | ||
|
|
a3efda4b5c | ||
|
|
e7357b1b9c | ||
|
|
d9c8485358 | ||
|
|
84b7899b29 | ||
|
|
85e6de958c | ||
|
|
9658e9dfe4 | ||
|
|
d0efa0cb26 | ||
|
|
558d0cc7fc | ||
|
|
96558955aa | ||
|
|
383e7db013 | ||
|
|
bdd53e6003 | ||
|
|
04d48403bc | ||
|
|
bb0bd8fb84 | ||
|
|
27d63ad1c5 | ||
|
|
26581fb288 | ||
|
|
db6e106eb9 | ||
|
|
fce4a52abe | ||
|
|
81d6200c51 | ||
|
|
e9b6c45113 | ||
|
|
ae1120f311 | ||
|
|
71bf486cc6 | ||
|
|
7f8e0e90d5 | ||
|
|
bc702d76ca | ||
|
|
ea0d6e4544 | ||
|
|
2838486184 | ||
|
|
6d5c127571 | ||
|
|
7bc32a196d | ||
|
|
c8ccd8f2b4 | ||
|
|
a84d932050 | ||
|
|
57774c4122 | ||
|
|
b6bade9452 | ||
|
|
be8c5e6f76 | ||
|
|
d95af1e597 | ||
|
|
589a8c320e | ||
|
|
6d23722b69 | ||
|
|
b9d0865c26 | ||
|
|
87b440c8d7 | ||
|
|
726f19de2a | ||
|
|
406b3900cd | ||
|
|
3ce05f794a | ||
|
|
06752076ff | ||
|
|
19d1ebb773 | ||
|
|
e66f5f47f3 | ||
|
|
2c56e80f57 | ||
|
|
5cb6bed49d | ||
|
|
7cc95e2060 | ||
|
|
1873997348 | ||
|
|
559e84765b | ||
|
|
6df476096d | ||
|
|
7c064e70fd | ||
|
|
55e6058b70 | ||
|
|
8a03a4faec | ||
|
|
30eb102bbc | ||
|
|
09ce792bd2 | ||
|
|
0fc23712e4 | ||
|
|
6b9c717ec4 | ||
|
|
0c3e82c01e | ||
|
|
8e6e544b60 | ||
|
|
a4196fc118 | ||
|
|
d5a9b99a7a | ||
|
|
6d850f9f07 | ||
|
|
c4987b7c5e | ||
|
|
3880738ed9 | ||
|
|
68c00b843b | ||
|
|
dc352275b6 | ||
|
|
b3362987e5 | ||
|
|
fb3ec45059 | ||
|
|
5100b4a852 | ||
|
|
e9ec801dc5 | ||
|
|
70c31b8597 | ||
|
|
a078de1fc3 | ||
|
|
a1d759451c | ||
|
|
8a9373963c | ||
|
|
d964d5b859 | ||
|
|
b468865041 | ||
|
|
d6fec721ad | ||
|
|
9256398fa2 | ||
|
|
4fed08a8f9 | ||
|
|
b650156e57 | ||
|
|
4737d15be5 | ||
|
|
aca6dd7e1d | ||
|
|
5aa0d000dd | ||
|
|
e2b238fb81 | ||
|
|
ebdb3edbc1 | ||
|
|
b9f4e46d65 | ||
|
|
287ebd4e9c | ||
|
|
befdc3de6a | ||
|
|
55d00876a7 | ||
|
|
be0ee15448 | ||
|
|
7f91b85d6e | ||
|
|
80beacaef9 | ||
|
|
9f0521f9de | ||
|
|
3e1fffcfbb | ||
|
|
c0e77efad6 | ||
|
|
490f6f420b | ||
|
|
228185291d | ||
|
|
ab17861e7c | ||
|
|
567ca5192c | ||
|
|
442a0797a2 | ||
|
|
c1be977abd | ||
|
|
a6f670dcfb | ||
|
|
1d3e72aae2 | ||
|
|
513fce2059 | ||
|
|
6247aee871 | ||
|
|
fc0e230ca5 | ||
|
|
d2972f602f | ||
|
|
0f3b858a75 | ||
|
|
70b449e83d | ||
|
|
2a58b6644e | ||
|
|
96f4386f7a | ||
|
|
3e9de4e859 | ||
|
|
dad2db500c | ||
|
|
9bd33477b1 | ||
|
|
01c680b69a | ||
|
|
d20c3c2820 | ||
|
|
dcb73b1672 | ||
|
|
389f006d02 | ||
|
|
0266a6c5f9 | ||
|
|
9b53123e92 | ||
|
|
9e21110011 | ||
|
|
5377c67614 | ||
|
|
32f8c61d43 | ||
|
|
2a16db32ba | ||
|
|
735c3764db | ||
|
|
c160feb422 | ||
|
|
21ed81d9ce | ||
|
|
6c25c8570d | ||
|
|
560c9c3c8b | ||
|
|
095f4d6179 | ||
|
|
4d389a3e3b | ||
|
|
7f6a5aeba4 | ||
|
|
3006ffac30 | ||
|
|
d0a256a281 | ||
|
|
fceab89bc7 | ||
|
|
6c11525879 | ||
|
|
3decc0453b | ||
|
|
b4f9aec084 | ||
|
|
4cd1901e48 | ||
|
|
2aca1d42b0 | ||
|
|
23050b6788 | ||
|
|
07bd37bc51 | ||
|
|
de2ffe910f | ||
|
|
e3f33e0df4 | ||
|
|
d919bee580 | ||
|
|
ab10f02e3e | ||
|
|
647a4ed2b4 | ||
|
|
5b11e09ece | ||
|
|
5c006b3ba7 | ||
|
|
ba970a2ae4 | ||
|
|
2a51caba40 | ||
|
|
5b9035b766 | ||
|
|
41365e07f6 | ||
|
|
9fbaf9c628 | ||
|
|
730fe64eeb | ||
|
|
266fc497d8 | ||
|
|
871443b643 | ||
|
|
4094ee0211 | ||
|
|
0bcd099dcd | ||
|
|
04b603569d | ||
|
|
5a4951aec2 | ||
|
|
a16aa53561 | ||
|
|
a4bbcd5f99 | ||
|
|
75263af008 | ||
|
|
6c74c6f1d1 | ||
|
|
1ba064db1b | ||
|
|
e10c55a35b | ||
|
|
29a234d94d | ||
|
|
ccf97cca20 | ||
|
|
4ee5908c96 | ||
|
|
53128a49bb | ||
|
|
6092960af5 | ||
|
|
c9e4c9f077 | ||
|
|
d00a44de53 | ||
|
|
adfff4c520 | ||
|
|
fb0dac4e3b | ||
|
|
71a43bd431 | ||
|
|
339f0490cf | ||
|
|
3e9e71812a | ||
|
|
fd0e7c6f7f | ||
|
|
07a61712ea | ||
|
|
33080da0b1 | ||
|
|
02f48525e2 | ||
|
|
c2aacd1b0c | ||
|
|
b524ff0701 | ||
|
|
b5bffb6731 | ||
|
|
cf84c608a6 | ||
|
|
e61ea7c8b3 | ||
|
|
a63df948d7 | ||
|
|
509bad85c2 | ||
|
|
ef48117ab4 | ||
|
|
08724d4fa8 | ||
|
|
59e5c15c0f | ||
|
|
e96572b62b | ||
|
|
441eb3f439 | ||
|
|
479beb17de | ||
|
|
92939ba2fd | ||
|
|
4b4ba32191 | ||
|
|
2ba002d508 | ||
|
|
594f8a25da | ||
|
|
3ad852e1c8 | ||
|
|
b3a66eebee | ||
|
|
5baad90145 | ||
|
|
2ceb0b6219 | ||
|
|
f870625551 | ||
|
|
993aa1e439 | ||
|
|
44822601ee | ||
|
|
19e698cce4 | ||
|
|
f393156471 | ||
|
|
08e996d8df | ||
|
|
afffeed10f | ||
|
|
ac7efd60de | ||
|
|
f0db105e7f | ||
|
|
e07a8bdebb | ||
|
|
84cff08785 | ||
|
|
0f8740c54b | ||
|
|
35e1c9aca2 | ||
|
|
98848cffd1 | ||
|
|
df6b6f447d | ||
|
|
ae59f6c84b | ||
|
|
74ee1fa94c | ||
|
|
9e11143b88 | ||
|
|
9786e3e472 | ||
|
|
468c7d9bd7 | ||
|
|
640d428d70 | ||
|
|
9a8b78ce9c | ||
|
|
87e13ea777 | ||
|
|
8e70558363 | ||
|
|
5764842f52 | ||
|
|
c2634da6af | ||
|
|
bf04109e91 | ||
|
|
ebc46247ad | ||
|
|
bac1361f98 | ||
|
|
b26b1eacba | ||
|
|
367357821e | ||
|
|
030154a135 | ||
|
|
b0bb78acdd | ||
|
|
f98aafa8d1 | ||
|
|
805a041474 | ||
|
|
3f5a0ae4a0 | ||
|
|
27caf727de | ||
|
|
31a7d9bc9f | ||
|
|
3eaf2549e8 | ||
|
|
6f0d290d0d | ||
|
|
a03da1bbd3 | ||
|
|
35d6bd9ead | ||
|
|
97e7b712c7 | ||
|
|
fcdcb8fa1c | ||
|
|
71b64d74e6 | ||
|
|
bd411e3239 | ||
|
|
91ce9326b2 | ||
|
|
9711af2ff4 | ||
|
|
dabf1ca089 | ||
|
|
f43c4f7680 | ||
|
|
28ecc7c92d | ||
|
|
b36428b4ab | ||
|
|
21d219ca53 | ||
|
|
497ea897d3 | ||
|
|
35c4908936 | ||
|
|
091eb9ae8a | ||
|
|
445a5d37c3 | ||
|
|
e6b8a9383e | ||
|
|
66b350eb5e | ||
|
|
da84e1164a | ||
|
|
cde86d46c3 | ||
|
|
607ee2a6c8 | ||
|
|
6219c7ce9a | ||
|
|
098035d280 | ||
|
|
111b1275c4 | ||
|
|
d6119a41fb | ||
|
|
095dfde3bb | ||
|
|
3bc56bc934 | ||
|
|
14ecc52cda | ||
|
|
464355c91c | ||
|
|
82e704eaf7 | ||
|
|
54284a0543 | ||
|
|
2cf07382df | ||
|
|
1de01ac745 | ||
|
|
66fce9fb50 | ||
|
|
017500fb5a | ||
|
|
ddd8025fe5 | ||
|
|
f27bc065ba | ||
|
|
9db3819866 | ||
|
|
8a5470dc68 | ||
|
|
159f1b5938 | ||
|
|
89fc1ef8ee | ||
|
|
f249f77cfa | ||
|
|
fad7525101 | ||
|
|
8dc3583ec7 | ||
|
|
2936faab56 | ||
|
|
637b7a263a | ||
|
|
be26033dfe | ||
|
|
4bc7a7f292 | ||
|
|
9b6a9061bc | ||
|
|
6358358078 | ||
|
|
4c4224eb09 | ||
|
|
9100db600e | ||
|
|
263e3e6896 | ||
|
|
26f326668f | ||
|
|
74e26a05f3 | ||
|
|
36145b1ee7 | ||
|
|
5f457c6e4a | ||
|
|
65dc540577 | ||
|
|
c338e29ec4 | ||
|
|
c253f6684b | ||
|
|
aa740ffabf | ||
|
|
e9ffe83a93 | ||
|
|
c83e83bb06 | ||
|
|
b3c2e014c1 | ||
|
|
6631da42e1 | ||
|
|
ac5233582f | ||
|
|
32a1f4351a | ||
|
|
2ff88eeb03 | ||
|
|
62b505450a | ||
|
|
f7fd9dd42a | ||
|
|
acd8e9291a | ||
|
|
50c80fc708 | ||
|
|
bb02672085 | ||
|
|
f2e7efeaa6 | ||
|
|
aa0863e726 | ||
|
|
71cec6933f | ||
|
|
c2d407cd62 | ||
|
|
61adaa19db | ||
|
|
4c1cc0683d | ||
|
|
ce3b42af38 | ||
|
|
61c204ade0 | ||
|
|
e13fae6e67 | ||
|
|
31e4c3caa4 | ||
|
|
bccb77667d | ||
|
|
4ab0791740 | ||
|
|
a9afbad0a2 | ||
|
|
d625212ac1 | ||
|
|
ee23b2d47e | ||
|
|
30714d5b7d | ||
|
|
07734f70bb | ||
|
|
367d0cec7e | ||
|
|
ad00b95b88 | ||
|
|
9530b415c7 | ||
|
|
aff33cf99e | ||
|
|
83666bfce3 | ||
|
|
ca5f5670e5 | ||
|
|
ba15d4700e | ||
|
|
55bc9bb642 | ||
|
|
2728e6c141 | ||
|
|
2fde07aad2 | ||
|
|
aa6877e423 | ||
|
|
5e88bcd9be | ||
|
|
c117048ecb | ||
|
|
5ade086d6c | ||
|
|
78a59912f3 | ||
|
|
4997017f0f | ||
|
|
24ba7e179a | ||
|
|
2d3d8ba220 | ||
|
|
f3ceace3ba | ||
|
|
6b743772cb | ||
|
|
d66c02d0ec | ||
|
|
09764ab98c | ||
|
|
02f54c986b | ||
|
|
eaad46b391 | ||
|
|
29ee010aad | ||
|
|
9210100335 | ||
|
|
621fb6740d | ||
|
|
d26400f6d6 | ||
|
|
5a4674368a | ||
|
|
3b0a0a4db2 | ||
|
|
8263df961b | ||
|
|
d8a425665b | ||
|
|
cca0a12dcf | ||
|
|
b452d8e031 | ||
|
|
0fb3225f7c | ||
|
|
0ee6953180 | ||
|
|
0602616265 | ||
|
|
89b3a01c71 | ||
|
|
e65fea42f3 | ||
|
|
d5e1ac1968 | ||
|
|
70e2d6805b | ||
|
|
0370891b68 | ||
|
|
22f5737980 | ||
|
|
4c99a226be | ||
|
|
80c8dc7e53 | ||
|
|
912732a6c3 | ||
|
|
76dd4722cf | ||
|
|
676b2d1c0a | ||
|
|
133cad70ef | ||
|
|
62355aa6db | ||
|
|
be8b625a90 | ||
|
|
ee4a1da3d5 | ||
|
|
992a3eda18 | ||
|
|
37f02b6902 | ||
|
|
cbdf43174a | ||
|
|
80becff090 | ||
|
|
ffd52212e1 |
No files matched your search
@@ -0,0 +1 @@
|
||||
.gitea/CODEOWNERS linguist-detectable=false
|
||||
@@ -0,0 +1,3 @@
|
||||
# Pull requests request review from the eligible staff team(s).
|
||||
# One approval from either an Admin or Developer satisfies branch protection.
|
||||
* @trueog/Admins @trueog/Developers
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
replay_pid*
|
||||
|
||||
# macOS system files
|
||||
.DS_Store
|
||||
|
||||
# gradle build output files
|
||||
build/
|
||||
.gradle/
|
||||
|
||||
# eclipse project files
|
||||
.settings/
|
||||
.project
|
||||
.classpath
|
||||
.checkstyle
|
||||
bin/
|
||||
|
||||
# IntelliJ files
|
||||
.idea/
|
||||
.kotlin
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
out/
|
||||
@@ -1,21 +1,339 @@
|
||||
MIT License
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (c) 2024 Alihan
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
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:
|
||||
Preamble
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
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.
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
@@ -1,8 +1,564 @@
|
||||
# ProAntiTab
|
||||
# **A**BOUT
|
||||
ProAntiTab is an advanced **plugin hider** with **many features** and a very simple to understand system. It prevents your server from **plugin spoofers** used by hack clients, manipulates the **tab-completion**, blocks unwanted **suggestions** and much more!
|
||||
#####
|
||||
|
||||
### About
|
||||
ProAntiTab is a Spigot/Bungeecord Minecraft plugin that helps you to hide unwanted commands from your players.
|
||||
# **I**N ACTION
|
||||

|
||||
|
||||
### Support versions
|
||||
Spigot (+ Forks): 1.8x - 1.20x (latest)
|
||||
Bungeecord (+ Forks) | Waterfall recommended
|
||||
######
|
||||
# **C**USTOM SERVER BRAND (F3)
|
||||
Create your own animated custom server brand on your Spigot, Bungeecord and Velocity server!
|
||||
**
|
||||
<details>
|
||||
<summary>open config.yml section</summary>
|
||||
|
||||
|
||||
```yaml
|
||||
# This feature allows you to customize your server-brand you see when you press F3.
|
||||
# Normally there stands something like 'Purpur', or 'Spigot'.
|
||||
# With this feature you are able to change and even animate it! ^^
|
||||
custom-server-brand:
|
||||
enabled: false
|
||||
|
||||
# Determines the speed in that the animation goes
|
||||
repeat-delay: 3
|
||||
|
||||
# This here is the list of the animation
|
||||
# Possible placeholders:
|
||||
# %player% - name of the player
|
||||
# %displayname% - displayname of the player
|
||||
# %world% - name of world where the player is
|
||||
# and the other placeholders from PlaceholderAPI
|
||||
brands:
|
||||
- '&f&lP&froAntiTab |'
|
||||
- '&fP&lr&foAntiTab /'
|
||||
- '&fPr&lo&fAntiTab -'
|
||||
- '&fPro&lA&fntiTab |'
|
||||
- '&fProA&ln&ftiTab \'
|
||||
- '&fProAn<&fiTab |'
|
||||
- '&fProAnt&li&fTab /'
|
||||
- '&fProAnti&lT&fab -'
|
||||
- '&fProAnti&lT&fab \'
|
||||
- '&fProAntiT&la&fb |'
|
||||
- '&fProAntiTa&lb&f /'
|
||||
- '&fProAntiTab -'
|
||||
- '&fProAntiTab \'
|
||||
```
|
||||
</details>
|
||||
|
||||
######
|
||||
# **U**SE BLACKLIST AS WHITELIST
|
||||
You have way too many commands to block? Don't worry.
|
||||
There's a section in the config.yml located pretty much high that allows you to turn the blacklist into a whitelist instead. This will block every command on your server except for those that are listed.
|
||||
<details>
|
||||
<summary>section in config.yml</summary>
|
||||
|
||||
|
||||
```yaml
|
||||
# This is a very necessary feature if you have way too many commands to block and instead decide
|
||||
# to whitelist specific commands.
|
||||
# Enabling this will disable ALL commands except for those that are in the (group-)list.
|
||||
turn-blacklist-to-whitelist: false
|
||||
```
|
||||
</details>
|
||||
|
||||
######
|
||||
# **A**NTI PLUGIN SPOOFING
|
||||
##### ProAntiTab is able to detect and block plugin spoofing attempts used by hack clients.
|
||||
**
|
||||
|
||||
######
|
||||
# **B**LOCK SUB ARGUMENTS
|
||||
We all know the problem when players should be able to use some of the commands but should not see literally EVERY sub-argument in a command. Well, then just blend them out? ProAntiTab can do this for you and it's very easy to setup as well! (See some examples below)
|
||||
|
||||

|
||||
<details>
|
||||
<summary>example</summary>
|
||||
|
||||
|
||||
```yaml
|
||||
# Let's say you just want to allow "/help Minecraft" only and not "/help apple".
|
||||
# It will also automatically allow everything after "/help Minecraft ..."
|
||||
- help Minecraft
|
||||
|
||||
# [CMD] = Allow the execution of the command
|
||||
# [TAB] = Allow the tab-completion of the command
|
||||
- "[CMD]cmi tpa" # Only executable. Not tab-completable
|
||||
- tpa # Executable & Tab-Completable
|
||||
|
||||
# %hidden_online_players% = Online players (Removed from tab-completion)
|
||||
# %online_players% = Online players
|
||||
# %hidden_players% = Registered players (Removed from tab-completion)
|
||||
# %players% = Registered players
|
||||
# %numbers% = Numbers, such as 1000 or 1.000
|
||||
# _- = Block everything after
|
||||
- "tpa %online_players%"
|
||||
- "sell %numbers%"
|
||||
|
||||
# Using the operator _- at the end cancels every argument afterwards and blocks it.
|
||||
# This will allow the player to use "/help Minecraft" but not "/help Minecraft xyz"
|
||||
- help Minecraft _-
|
||||
```
|
||||
</details>
|
||||
|
||||
######
|
||||
# **B**LOCK COLLON COMMANDS
|
||||
It's annyoing after some time to block all commands including collons like essentials:spawn. With this option you can disable them entirely for good! Only people with the proantitab.namespace permission can see these commands again.
|
||||
|
||||

|
||||
<details>
|
||||
<summary>open config.yml section</summary>
|
||||
|
||||
|
||||
```yaml
|
||||
#>> HTP (Overwritten)
|
||||
# Here you can disable all namespace commands.
|
||||
# Namespace commands are commands like plugin:command (e.g: essentials:warp)
|
||||
# You can bypass this restriction with the proantitab.namespace permission.
|
||||
block-namespace-commands:
|
||||
enabled: false
|
||||
```
|
||||
</details>
|
||||
|
||||
######
|
||||
# **C**USTOM PLUGINS LIST
|
||||
Just blocking the /plugins command is pretty boring. This feature here allows you to make it more interesting by displaying for example fake plugins.
|
||||
|
||||

|
||||
<details>
|
||||
<summary>open config.yml section</summary>
|
||||
|
||||
|
||||
```yaml
|
||||
#>> HTP (Overwritten)
|
||||
# Here you can customize your own fake '/plugins' command.
|
||||
custom-plugins:
|
||||
enabled: true
|
||||
commands:
|
||||
- pl
|
||||
- plugins
|
||||
- bukkit:pl
|
||||
- bukkit:plugins
|
||||
message:
|
||||
- '&fPlugins (0):'
|
||||
```
|
||||
</details>
|
||||
|
||||
######
|
||||
# **C**USTOM VERSION COMMAND
|
||||
Who wouldn't like to pretend to own a custom server-jar? Have fun customizing your very own /version command to your personal liking.
|
||||
|
||||

|
||||
<details>
|
||||
<summary>open config.yml section</summary>
|
||||
|
||||
|
||||
```yaml
|
||||
#>> HTP (Overwritten)
|
||||
# Here you can customize your own fake '/version' command.
|
||||
custom-version:
|
||||
enabled: true
|
||||
commands:
|
||||
- version
|
||||
- ver
|
||||
- icanhasbukkit
|
||||
- bukkit:ver
|
||||
- bukkit:version
|
||||
message:
|
||||
- '&fThis server is running CraftBukkit version git-NasaSpigot-294 (MC: X)'
|
||||
```
|
||||
</details>
|
||||
|
||||
######
|
||||
# **C**USTOM UNKNOWN COMMAND MESSAGE
|
||||
The Bukkit/Spigot version of ProAntiTab gives your the possibility to create your own unknown-command message to align it with the blocked-command message for example.
|
||||
|
||||

|
||||
<details>
|
||||
<summary>open config.yml section</summary>
|
||||
|
||||
|
||||
```yaml
|
||||
# Now there we come to the good stuff! ^^
|
||||
# If ProAntiTab is loaded on a Spigot server, you will see this option right here.
|
||||
# With that you can also customize your own "Unknown Command"-message.
|
||||
custom-unknown-command:
|
||||
enabled: true
|
||||
message:
|
||||
- '&cThis command does not exist!'
|
||||
```
|
||||
</details>
|
||||
|
||||
|
||||
######
|
||||
# **C**USTOM PROTOCOL PING
|
||||
Do you know the red text message at the players count when you ping a server with the wrong version? Exactly this holds the information of what kind of server your proxy server is running at. This feature hides the version of the proxy with a custom made one. It's enabled by default but doesn't show the text. The text can be seen when someone pings the server with the wrong version or uses a resolver. This picture shows you what someone with the wrong version would see, unless the "always-show" is enabled. If this option is enabled, this text will always appear.
|
||||
|
||||
 <details>
|
||||
<summary>open config.yml section</summary>
|
||||
|
||||
|
||||
```yaml
|
||||
# Change the protocol for the version name when the server is being pinged
|
||||
# (!) Warning: It's required to use Paper or Purpur to use this feature!
|
||||
# (!) Supported server versions: 1.12.2 - latest
|
||||
custom-protocol-ping:
|
||||
enabled: false
|
||||
|
||||
# Normally it would only display when someone pings the server with the wrong version.
|
||||
# Enabling this will always display the protocol and replace it with the normal player count.
|
||||
always-show: false
|
||||
|
||||
# This number here determines the outcome for the %online_extended% placeholder.
|
||||
# It's the current amount of players increased by this number.
|
||||
# For example: 5/20 becomes 6/20
|
||||
extend-online-count: 1
|
||||
# true: Use new calculated online-count (%online_extended%) as max-players count.
|
||||
# false: Use the default max-players count.
|
||||
use-as-maxplayers: false
|
||||
|
||||
# Enabling this option hides the list of players on your server,
|
||||
# when you hover over the player count.
|
||||
hide-players: true
|
||||
|
||||
# The displayed protocol message
|
||||
# Available placeholders:
|
||||
# %online% - current online player count
|
||||
# %online_extended% - manipulated online player count
|
||||
# %max% - max player count
|
||||
protocol: '&f&lProAntiTab &7(&a%online%&7/&c%max%&7)'
|
||||
```
|
||||
</details>
|
||||
|
||||
######
|
||||
# **C**USTOM RESPONSE ACTIONS
|
||||
For some, it's important to determine how the response message should be or what should happen. You can customize that factor to your personal liking and use different actions to have full control over your blocked commands.
|
||||
|
||||

|
||||
|
||||

|
||||
<details>
|
||||
<summary>Bukkit/Spigot examples</summary>
|
||||
|
||||
|
||||
```yaml
|
||||
# ____ ___ __ _ ______ __
|
||||
# / __ \_________ / | ____ / /_(_)_ __/___ _/ /_
|
||||
# / /_/ / ___/ __ \/ /| | / __ \/ __/ / / / / __ `/ __ \
|
||||
# / ____/ / / /_/ / ___ |/ / / / /_/ / / / / /_/ / /_/ /
|
||||
# /_/ /_/ \____/_/ |_/_/ /_/\__/_/ /_/ \__,_/_.___/
|
||||
# custom-responses.yml
|
||||
#
|
||||
# Here you can configure a few of the blocked commands a bit further.
|
||||
# But what exactly is this here? Every command that would normally respond with the typical "command is blocked" message, can be configured in here!
|
||||
# And how does it work? It's simple. You just provide the a trigger of the command that would be normally blocked.
|
||||
# Commands that would normally work won't send the messages you have set here.
|
||||
# This way PAT can offer you full control over certain commands and their normal responses.
|
||||
# What are these action section at each block?
|
||||
# This is an additional feature to make your responses much more alive.
|
||||
# Example actions that can be used are the following:
|
||||
# Execute console command:
|
||||
# Syntax: console::command
|
||||
# Example: console::say %player% is an evil player
|
||||
# Execute player command:
|
||||
# Syntax: execute::command
|
||||
# Example: execute::help
|
||||
# Send actionbar:
|
||||
# Syntax: actionbar::text
|
||||
# Example: actionbar::&cThis is not cool %player%!
|
||||
# Send title:
|
||||
# Syntax: title::title::subtitle::5::20::5
|
||||
# Example: title::&aTest title::&cHello %player%!
|
||||
# Play sound:
|
||||
# Syntax: sound::soundName::volume::pitch
|
||||
# Example: sound::ENTITY_ENDER_DRAGON_GROWL::1.0::1.0
|
||||
# Give potion effect:
|
||||
# Syntax: effect::potionEffect::duration::amplifier
|
||||
# Example: effect::BLINDNESS::45::1
|
||||
|
||||
# Here are a few examples:
|
||||
|
||||
# Example with kits.
|
||||
# In here we only trigger the given message, if the player would type "/kit ...".
|
||||
# If this command would work through sub-arguments, then the player would only able to execute the command with the
|
||||
# listed sub-arguments assigned to it. Everything else will result with the set message in there.
|
||||
# --
|
||||
#example-with-kits:
|
||||
# triggers:
|
||||
# - "kit *"
|
||||
# message:
|
||||
# - "&cThis kit does not exist!"
|
||||
# actions:
|
||||
# - "actionbar::&cSorry %player%, but this kit does not exist!"
|
||||
|
||||
# Here another example with an auctionhouse plugin.
|
||||
# In here we only trigger the given message, if the player would type "/ah plugin".
|
||||
# Normally it would print out the "command is blocked" message, because PAT would have blocked it in our case.
|
||||
# Therefore, we can also assign a custom response message to it.
|
||||
# ---
|
||||
#example-with-auctionhouse:
|
||||
# triggers:
|
||||
# - "ah plugin"
|
||||
# message:
|
||||
# - "&cThis sub-command does not exist. Please type: &e/ah help"
|
||||
# actions:
|
||||
# - "console::say That's not nice %player%!"
|
||||
# - "effect::BLINDNESS::45::1"
|
||||
# - "sound::ENTITY_ENDER_DRAGON_GROWL::1.0::1.0"
|
||||
# - "title::&cHey!::&cYou can't do that %player%!::5::20::5"
|
||||
# - "actionbar::&cNop, sorry %player%"
|
||||
```
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Proxy examples</summary>
|
||||
|
||||
|
||||
```yaml
|
||||
# ____ ___ __ _ ______ __
|
||||
# / __ \_________ / | ____ / /_(_)_ __/___ _/ /_
|
||||
# / /_/ / ___/ __ \/ /| | / __ \/ __/ / / / / __ `/ __ \
|
||||
# / ____/ / / /_/ / ___ |/ / / / /_/ / / / / /_/ / /_/ /
|
||||
# /_/ /_/ \____/_/ |_/_/ /_/\__/_/ /_/ \__,_/_.___/
|
||||
# custom-responses.yml
|
||||
#
|
||||
# Here you can configure a few of the blocked commands a bit further.
|
||||
# But what exactly is this here? Every command that would normally respond with the typical "command is blocked" message, can be configured in here!
|
||||
# And how does it work? It's simple. You just provide the a trigger of the command that would be normally blocked.
|
||||
# Commands that would normally work won't send the messages you have set here.
|
||||
# This way PAT can offer you full control over certain commands and their normal responses.
|
||||
# What are these action section at each block?
|
||||
# This is an additional feature to make your responses much more alive.
|
||||
# Example actions that can be used are the following:
|
||||
# Execute console command:
|
||||
# Syntax: console::command
|
||||
# Example: console::send %player% fallback
|
||||
# Execute player command:
|
||||
# Syntax: execute::command
|
||||
# Example: execute::help
|
||||
# Send actionbar:
|
||||
# Syntax: actionbar::text
|
||||
# Example: actionbar::&cThis is not cool %player%!
|
||||
# Send title:
|
||||
# Syntax: title::title::subtitle::5::20::5
|
||||
# Example: title::&aTest title::&cHello %player%!
|
||||
|
||||
# Here are a few examples:
|
||||
|
||||
# Example with kits.
|
||||
# In here we only trigger the given message, if the player would type "/kit ...".
|
||||
# If this command would work through sub-arguments, then the player would only able to execute the command with the
|
||||
# listed sub-arguments assigned to it. Everything else will result with the set message in there.
|
||||
# --
|
||||
#example-with-kits:
|
||||
# triggers:
|
||||
# - "kit *"
|
||||
# message:
|
||||
# - "&cThis kit does not exist!"
|
||||
# actions:
|
||||
# - "actionbar::&cSorry %player%, but this kit does not exist!"
|
||||
|
||||
# Here another example with an auctionhouse plugin.
|
||||
# In here we only trigger the given message, if the player would type "/ah plugin".
|
||||
# Normally it would print out the "command is blocked" message, because PAT would have blocked it in our case.
|
||||
# Therefore, we can also assign a custom response message to it.
|
||||
# ---
|
||||
#example-with-auctionhouse:
|
||||
# triggers:
|
||||
# - "ah plugin"
|
||||
# message:
|
||||
# - "&cThis sub-command does not exist. Please type: &e/ah help"
|
||||
# actions:
|
||||
# - "console::say That's not nice %player%!"
|
||||
# - "title::Hey!::You can't do that %player%!::30::3000::30"
|
||||
# - "actionbar::Nop, sorry %player%"
|
||||
```
|
||||
</details>
|
||||
|
||||
#####
|
||||
# **N**EGATE COMMANDS
|
||||
It's not a must to write each and every possible sub-argument by hand. The same goes for commands in general.
|
||||
You can negate them with the help of the negation operator (``!``).
|
||||
|
||||
**
|
||||
|
||||
<details>
|
||||
<summary>example</summary>
|
||||
|
||||
```yaml
|
||||
# Allows /gamemode and all of its sub-arguments
|
||||
# except "/gamemode creative"
|
||||
- "gamemode"
|
||||
- "!gamemode creative"
|
||||
- '!gamemode toggle'
|
||||
```
|
||||
|
||||
```yaml
|
||||
# Allows all commands, except /anvil
|
||||
- "*"
|
||||
- "!anvil"
|
||||
```
|
||||
</details>
|
||||
|
||||
#####
|
||||
# **A**UTO-ADD ALL PLUGIN COMMANDS
|
||||
Sometimes it's so annoying to add all commands from a certain plugin by hand. That's why ProAntiTab offers the possebility to simply add all commands from a certain plugin with a simple shortcut.
|
||||
|
||||
You can simply add ``plugin=<plugin-name>`` to add all commands from a plugin automatically.
|
||||
**Only works for standalone Spigot (+Forks) servers**
|
||||
|
||||
<details>
|
||||
<summary>example</summary>
|
||||
|
||||
```yaml
|
||||
# Allows all Essentials commands except /anvil.
|
||||
# /gamemode is limited to only two sub-arguments
|
||||
- "plugin=essentials"
|
||||
- "!anvil"
|
||||
- "gamemode creative"
|
||||
- "gamemode survival"
|
||||
```
|
||||
</details>
|
||||
|
||||
######
|
||||
# **B**LOCK ON SPECIFIC SERVERS
|
||||
If you use ProAntiTab on a network, you can pretty easily manage on what servers what commands should exist. Everything can be handled via the proxy and does not require additional maintenance on the backend servers.
|
||||
|
||||
For this, just follow the official [setup](https://github.com/RayzsYT/ProAntiTab/wiki/How-to-setup#proxy--spigot-eg-bungeecord--spigot) and [how-to](https://github.com/RayzsYT/ProAntiTab/wiki/How-to#introduction) guide, which can be both found on the [Github wiki](https://github.com/RayzsYT/ProAntiTab/wiki).
|
||||
|
||||
######
|
||||
# **G**ROUP SYSYTEM
|
||||
The PAT group system allows you to allow certain commands only for a certain group of people. PAT group commands are mainly for **whitelisting** commands, can merge with other groups, and so on.
|
||||
|
||||
They can also be used to blacklist commands by negating the commands inside there. But for this to work, the option `allow-group-overruling` inside the `config.yml` needs to be enabled.
|
||||
|
||||
How to use the PAT group system in general can be seen on the [Github wiki](https://github.com/RayzsYT/ProAntiTab/wiki/How-to#use-the-group-system).
|
||||
|
||||
######
|
||||
# **P**LACEHOLDERAPI & PAPIPROXYBRIDGE SUPPORT
|
||||
Customization and uniqueness is an important factor for many server owners. That's why PAT offers you the possebility to edit and use many of its placeholders with the widely spreaded plugin [PlaceholderAPI](https://www.spigotmc.org/resources/6245/). Accessing those placeholders on the proxy isn't a problem either. With the support of the addtional plugin [PAPIProxyBridge](https://www.spigotmc.org/resources/108415/), PAT's placeholders are even accessable on your proxy server.
|
||||
<details>
|
||||
<summary>Available placeholders</summary>
|
||||
|
||||
```yaml
|
||||
# Some general Placeholders to work with:
|
||||
# %pat_general_user% = Get the name of the user who receives this message.
|
||||
# %pat_general_version_current% = Get current version name of PAT.
|
||||
# %pat_general_version_newest% = Get newest version name of PAT.
|
||||
|
||||
# Placeholders of some of the messages in the config.yml:
|
||||
# %pat_message_unknowncommand% = Get the "unknown command"-message from the config.yml of PAT. [cancel-blocked-command]
|
||||
# %pat_message_blocked% = Get the "command blocked"-message from the config.yml of PAT. [custom-unknown-command]
|
||||
|
||||
# Placeholders to list all commands:
|
||||
# %pat_list_size_commands% = Get the amount of all listed commands.
|
||||
# %pat_list_commands% = Get all listed commands.
|
||||
# %pat_list_sorted_commands% = Get all listed commands in alphabetic order. (A-Z)
|
||||
# %pat_list_reversed_groups% = Get all listed commands in reversed alphabetic order. (Z-A)
|
||||
|
||||
# Placeholders to list all commands of a group: (replace 'xxx' with the group-name)
|
||||
# %pat_list_size_commands_group_xxx% = Get the amount of all commands of a group.
|
||||
# %pat_list_commands_group_xxx% = Get all commands of a group.
|
||||
# %pat_list_sorted_commands_group_xxx% = Get all commands of a group in alphabetic order. (A-Z)
|
||||
# %pat_list_reversed_commands_group_xxx% = Get all commands of a group in reversed alphabetic order. (Z-A)
|
||||
|
||||
# Placeholders to list all groups:
|
||||
# %pat_list_size_groups% = Get the amount of all available groups.
|
||||
# %pat_list_groups% = Get all groups.
|
||||
# %pat_list_sorted_groups% = Get all groups in alphabetic order. (A-Z)
|
||||
# %pat_list_reversed_groups% = Get all groups in reversed alphabetic order. (Z-A)
|
||||
```
|
||||
</details>
|
||||
|
||||
###
|
||||
|
||||
# **M**INIMESSAGE SUPPORT
|
||||
## 
|
||||
##### You want to design your messages more unique? We got you covered! *(works on 1.17 server and above)*
|
||||
*([Click here to see the documentation for the format](https://docs.advntr.dev/minimessage/format.html#)*)
|
||||
|
||||
Look at those few examples to see what kind of possibilities awaits you:
|
||||
<details>
|
||||
<summary>example 1</summary>
|
||||
|
||||
|
||||
```yaml
|
||||
cancel-blocked-commands:
|
||||
enabled: true
|
||||
message: '<hover:show_text:"&cBlocked command: &4&o%command%">&cThis command is &4&lBLOCKED&c!'
|
||||
```
|
||||
|
||||
|
||||

|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>example 2</summary>
|
||||
|
||||
|
||||
```yaml
|
||||
cancel-blocked-commands:
|
||||
enabled: true
|
||||
message: '&cThis command is blocked! <click:suggest_command:/help>&7Click here to get a view of all available commands instead.'
|
||||
```
|
||||
|
||||
|
||||

|
||||
|
||||
</details>
|
||||
|
||||
|
||||
######
|
||||
# **H**OW TO SETUP?
|
||||
Despite of the fact that ProAntiTab is pretty easy to use, the setup is slidely different for each server engine.
|
||||
It normally is already enough to simply load ProAntiTab on the certain server you wanna use it, but in order to use ProAntiTab with all its features, its recommended to follow the [official setup guide on the Github wiki](https://github.com/RayzsYT/ProAntiTab/wiki/How-to-setup).
|
||||
|
||||
**Please feel free to join the [Discord](https://www.rayzs.de/discord) server to request for help if the instruction is unclear or too complicated. ^^**
|
||||
|
||||
|
||||
#
|
||||
# **H**OW TO ALLOW COMMANDS?
|
||||
[Please check out the wiki to get an idea on how PAT works and can be used.](https://github.com/RayzsYT/ProAntiTab/wiki/How-to)
|
||||
|
||||
If you want to bypass all blocked commands, simply give yourself the following permission: **proantitab.bypass**
|
||||
|
||||
Following permission is required to execute all listed commands within a certain group: **proantitab.group.<command>**
|
||||
|
||||
######
|
||||
# **C**OMMANDS & PERMISSIONS
|
||||
All commands and their permissions are listed on the [documentation](https://www.spigotmc.org/resources/113172/field?field=documentation) page at the very buttom.
|
||||
|
||||
######
|
||||
# **C**ONFIGURATION FILE
|
||||
|
||||
<details>
|
||||
<summary>Bukkit/Spigot</summary>
|
||||
|
||||
[config.yml](https://github.com/RayzsYT/ProAntiTab/blob/v2.0.1/src/main/resources/files/bukkit-config.yml)
|
||||
<br>
|
||||
[storage.yml](https://github.com/RayzsYT/ProAntiTab/blob/v2.0.1/src/main/resources/files/bukkit-storage.yml)
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
<details>
|
||||
<summary>Proxy (Bungeecord/Velocity)</summary>
|
||||
|
||||
[config.yml](https://github.com/RayzsYT/ProAntiTab/blob/v2.0.1/src/main/resources/files/proxy-config.yml)
|
||||
<br>
|
||||
[storage.yml](https://github.com/RayzsYT/ProAntiTab/blob/v2.0.1/src/main/resources/files/proxy-storage.yml)
|
||||
|
||||
</details>
|
||||
|
||||
######
|
||||
## **bStats**
|
||||
[](https://bstats.org/plugin/bukkit/proantitab%20-%20spigot/20089)
|
||||
|
||||
[](https://bstats.org/plugin/bungeecord/proantitab%20-%20bungeecord/20090)
|
||||
|
||||
[](https://bstats.org/plugin/velocity/proantitab%20-%20velocity/21638)
|
||||
|
||||
<center>
|
||||
|
||||
[](https://www.rayzs.de/discord)
|
||||
@@ -0,0 +1,140 @@
|
||||
/* ------------------------------ Plugins ------------------------------ */
|
||||
plugins {
|
||||
id("java") // Import Java plugin.
|
||||
id("java-library") // Import Java Library plugin.
|
||||
id("com.diffplug.spotless") version "8.1.0" // Import Spotless plugin.
|
||||
id("com.gradleup.shadow") version "8.3.9" // Import Shadow plugin.
|
||||
id("checkstyle") // Import Checkstyle plugin.
|
||||
eclipse
|
||||
}
|
||||
|
||||
/* --------------------------- JDK / Kotlin ---------------------------- */
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_17 // Compile with JDK 17 compatibility.
|
||||
toolchain { // Select Java toolchain.
|
||||
languageVersion.set(JavaLanguageVersion.of(17)) // Use JDK 17.
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------- Metadata ------------------------------ */
|
||||
group = "de.rayzs.pat" // Declare bundle identifier.
|
||||
|
||||
version = "2.3.2" // Declare plugin version (will be in .jar).
|
||||
|
||||
val apiVersion = "1.13" // Declare minecraft server target version.
|
||||
|
||||
/* ----------------------------- Resources ----------------------------- */
|
||||
tasks.named<ProcessResources>("processResources") {
|
||||
exclude("**/*.txt") // Exclude text files from the jar (matches the original Maven build).
|
||||
from("LICENSE") { into("/") } // Bundle licenses into jarfiles.
|
||||
}
|
||||
|
||||
/* ---------------------------- Repos ---------------------------------- */
|
||||
repositories {
|
||||
mavenCentral() // Import the Maven Central Maven Repository.
|
||||
gradlePluginPortal() // Import the Gradle Plugin Portal Maven Repository.
|
||||
maven { url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") } // Spigot.
|
||||
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") } // Sonatype (BungeeCord).
|
||||
maven { url = uri("https://repo.papermc.io/repository/maven-public/") } // PaperMC.
|
||||
maven { url = uri("https://jitpack.io") } // JitPack.
|
||||
maven { url = uri("https://repo.velocitypowered.com/snapshots/") } // Velocity.
|
||||
maven { url = uri("https://libraries.minecraft.net/") } // Minecraft Libraries.
|
||||
maven { url = uri("https://repo.extendedclip.com/content/repositories/placeholderapi/") } // PlaceholderAPI.
|
||||
maven { url = uri("https://repo.viaversion.com") } // ViaVersion.
|
||||
maven { url = uri("https://repo.william278.net/velocity") } // William278 (Velocity).
|
||||
maven { url = uri("https://repo.william278.net/papiproxybridge") } // William278 (PAPIProxyBridge).
|
||||
mavenLocal() // Import the local Maven Repository.
|
||||
}
|
||||
|
||||
/* ---------------------- Java project deps ---------------------------- */
|
||||
dependencies {
|
||||
// Platform / API dependencies (provided at runtime, not shaded).
|
||||
compileOnly("dev.folia:folia-api:1.20.1-R0.1-SNAPSHOT")
|
||||
compileOnly("org.spigotmc:spigot-api:1.19-R0.1-SNAPSHOT")
|
||||
compileOnly("io.netty:netty-all:4.2.0.Final")
|
||||
compileOnly("net.md-5:bungeecord-api:1.21-R0.5-SNAPSHOT")
|
||||
compileOnly("net.md-5:bungeecord-protocol:1.16-R0.4")
|
||||
compileOnly("com.mojang:authlib:4.0.43")
|
||||
compileOnly("com.github.ElgarL:groupmanager:3.2")
|
||||
compileOnly("com.mojang:brigadier:1.1.8")
|
||||
compileOnly("com.mojang:datafixerupper:6.0.8")
|
||||
compileOnly("com.mojang:logging:1.1.1")
|
||||
compileOnly("org.apache.maven:maven-resolver-provider:3.8.5")
|
||||
compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.3")
|
||||
compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3")
|
||||
compileOnly("org.apache.logging.log4j:log4j-core:2.18.0")
|
||||
compileOnly("io.github.waterfallmc:waterfall-api:1.20-R0.3-SNAPSHOT")
|
||||
compileOnly("net.william278:papiproxybridge:1.4")
|
||||
compileOnly("com.velocitypowered:velocity-api:3.3.0-SNAPSHOT")
|
||||
compileOnly("com.velocitypowered:velocity-proxy:3.3.0-SNAPSHOT") {
|
||||
exclude(group = "com.velocitypowered", module = "velocity-proxy-log4j2-plugin")
|
||||
}
|
||||
compileOnly("org.sonatype.sisu:sisu-guice:2.1.7")
|
||||
compileOnly("org.spongepowered:configurate-hocon:4.1.2")
|
||||
compileOnly("me.clip:placeholderapi:2.11.6")
|
||||
compileOnly("net.luckperms:api:5.5")
|
||||
compileOnly("com.viaversion:viaversion-api:5.7.0-SNAPSHOT")
|
||||
compileOnly("io.papermc.paper:paper-api:1.17-R0.1-SNAPSHOT")
|
||||
|
||||
// Generate velocity-plugin.json from the @Plugin annotation.
|
||||
annotationProcessor("com.velocitypowered:velocity-api:3.3.0-SNAPSHOT")
|
||||
|
||||
// Adventure (shaded into the jar).
|
||||
implementation("net.kyori:adventure-text-minimessage:4.26.1")
|
||||
implementation("net.kyori:adventure-api:4.26.1")
|
||||
implementation("net.kyori:adventure-platform-api:4.4.1")
|
||||
implementation("net.kyori:adventure-platform-bungeecord:4.4.1")
|
||||
implementation("net.kyori:adventure-platform-bukkit:4.4.1")
|
||||
}
|
||||
|
||||
/* ---------------------- Reproducible jars ---------------------------- */
|
||||
tasks.withType<AbstractArchiveTask>().configureEach { // Ensure reproducible .jars
|
||||
isPreserveFileTimestamps = false
|
||||
isReproducibleFileOrder = true
|
||||
}
|
||||
|
||||
/* ----------------------------- Shadow -------------------------------- */
|
||||
tasks.shadowJar {
|
||||
archiveFileName.set("ProAntiTab.jar") // Match the original Maven finalName.
|
||||
relocate("net.kyori", "de.rayzs.pat.libs.kyori") // Isolate shaded Adventure from the server's bundled copy.
|
||||
}
|
||||
|
||||
tasks.jar { archiveClassifier.set("part") } // Applies to root jarfile only.
|
||||
|
||||
tasks.build { dependsOn(tasks.spotlessApply, tasks.shadowJar) } // Build depends on spotless and shadow.
|
||||
|
||||
/* --------------------------- Javac opts ------------------------------- */
|
||||
tasks.withType<JavaCompile>().configureEach {
|
||||
options.compilerArgs.add("-parameters") // Enable reflection for java code.
|
||||
options.isFork = true // Run javac in its own process.
|
||||
options.compilerArgs.add("-Xlint:deprecation") // Trigger deprecation warning messages.
|
||||
options.encoding = "UTF-8" // Use UTF-8 file encoding.
|
||||
}
|
||||
|
||||
/* ----------------------------- Auto Formatting ------------------------ */
|
||||
spotless {
|
||||
java {
|
||||
eclipse().configFile("config/formatter/eclipse-java-formatter.xml") // Eclipse java formatting.
|
||||
leadingTabsToSpaces() // Convert leftover leading tabs to spaces.
|
||||
removeUnusedImports() // Remove imports that aren't being called.
|
||||
}
|
||||
kotlinGradle {
|
||||
ktfmt().kotlinlangStyle().configure { it.setMaxWidth(120) } // JetBrains Kotlin formatting.
|
||||
target("build.gradle.kts", "settings.gradle.kts") // Gradle files to format.
|
||||
}
|
||||
}
|
||||
|
||||
checkstyle {
|
||||
toolVersion = "10.18.1" // Declare checkstyle version to use.
|
||||
configFile = file("config/checkstyle/checkstyle.xml") // Point checkstyle to config file.
|
||||
isIgnoreFailures = true // Don't fail the build if checkstyle does not pass.
|
||||
isShowViolations = true // Show the violations in any IDE with the checkstyle plugin.
|
||||
}
|
||||
|
||||
tasks.named("compileJava") {
|
||||
dependsOn("spotlessApply") // Run spotless before compiling with the JDK.
|
||||
}
|
||||
|
||||
tasks.named("spotlessCheck") {
|
||||
dependsOn("spotlessApply") // Run spotless before checking if spotless ran.
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE module PUBLIC
|
||||
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
|
||||
"https://checkstyle.org/dtds/configuration_1_3.dtd">
|
||||
<module name="Checker">
|
||||
|
||||
<module name="FileTabCharacter">
|
||||
<property name="eachLine" value="true"/>
|
||||
<property name="severity" value="error"/>
|
||||
</module>
|
||||
|
||||
<module name="TreeWalker">
|
||||
<module name="FinalLocalVariable"/>
|
||||
<module name="AvoidStarImport"/>
|
||||
<module name="Indentation">
|
||||
<property name="severity" value="ignore"/>
|
||||
</module>
|
||||
</module>
|
||||
|
||||
<module name="RegexpSingleline">
|
||||
<property name="format" value="\borg\.junit\.jupiter\.api\.Assertions\.fail\s*\(\s*"Not yet implemented"\s*\)\s*;"/>
|
||||
<property name="message" value="Remove placeholder fail() and implement the test."/>
|
||||
<property name="ignoreCase" value="true"/>
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
|
||||
<module name="RegexpSingleline">
|
||||
<property name="format" value="(?<!\w)fail\s*\(\s*"Not yet implemented"\s*\)\s*;"/>
|
||||
<property name="message" value="Remove placeholder fail() and implement the test."/>
|
||||
<property name="severity" value="warning"/>
|
||||
</module>
|
||||
|
||||
</module>
|
||||
|
||||
@@ -0,0 +1,404 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<profiles version="23">
|
||||
<profile kind="CodeFormatterProfile" name="TrueOG Network Formatting" version="23">
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_with_spaces" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_record_components" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_logical_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_record_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_shift_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_parameters" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_loops" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_switch_case_arrow_operator" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_enum_constant" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.text_block_indentation" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_module_statements" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_permitted_types" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_annotations" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assertion_message_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines" value="2147483647"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_not_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_arguments" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_permitted_types_in_type_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_record_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.javadoc_do_not_separate_block_tags" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_tag_description" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_constructor" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_string_concatenation" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_shift_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_shift_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_additive_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case_after_arrow" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_record_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_relational_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_logical_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_record_declaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_switch_body_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_arrow" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_method_body_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_additive_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_constructor" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_relational_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_relational_operator" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_arrows_in_switch_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_additive_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_selector_in_method_invocation_on_expression_first_line" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_switch_case_with_arrow_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_colon" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_additive_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_conditional_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.join_line_comments" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_shift_operator" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_code_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_record_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assignment_operator" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_switch_case_with_arrow" value="20"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_record_constructor_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assertion_message" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_logical_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_relational_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_logical_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_permitted_types" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line" value="one_line_never"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="next_line_on_wrap"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_string_concatenation" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
|
||||
</profile>
|
||||
</profiles>
|
||||
Vendored
BIN
Binary file not shown.
+7
@@ -0,0 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -0,0 +1,251 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH="\\\"\\\""
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
Vendored
+94
@@ -0,0 +1,94 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@@ -1,326 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>de.rayzs.pat</groupId>
|
||||
<artifactId>ProAntiTab</artifactId>
|
||||
<version>1.9.2</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>bungeecord-repo</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>papermc</id>
|
||||
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>velocity</id>
|
||||
<url>https://repo.velocitypowered.com/snapshots/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>minecraft-libraries</id>
|
||||
<name>Minecraft Libraries</name>
|
||||
<url>https://libraries.minecraft.net/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>sonatype</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>placeholderapi</id>
|
||||
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>viaversion-repo</id>
|
||||
<url>https://repo.viaversion.com</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>william278-velocity</id>
|
||||
<name>William278</name>
|
||||
<url>https://repo.william278.net/velocity</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>william278-papiproxybridge</id>
|
||||
<name>William278</name>
|
||||
<url>https://repo.william278.net/papiproxybridge</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>skript-releases</id>
|
||||
<name>Skript Repository</name>
|
||||
<url>https://repo.skriptlang.org/releases</url>
|
||||
</repository>
|
||||
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.skriptlang</groupId>
|
||||
<artifactId>Skript</artifactId>
|
||||
<version>2.10.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>dev.folia</groupId>
|
||||
<artifactId>folia-api</artifactId>
|
||||
<version>1.20.1-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.19-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-all</artifactId>
|
||||
<version>4.0.23.Final</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-api</artifactId>
|
||||
<version>1.20-R0.3-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-protocol</artifactId>
|
||||
<version>1.16-R0.4</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.mojang</groupId>
|
||||
<artifactId>authlib</artifactId>
|
||||
<version>4.0.43</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.mojang</groupId>
|
||||
<artifactId>brigadier</artifactId>
|
||||
<version>1.1.8</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.mojang</groupId>
|
||||
<artifactId>datafixerupper</artifactId>
|
||||
<version>6.0.8</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.mojang</groupId>
|
||||
<artifactId>logging</artifactId>
|
||||
<version>1.1.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-resolver-provider</artifactId>
|
||||
<version>3.8.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.resolver</groupId>
|
||||
<artifactId>maven-resolver-connector-basic</artifactId>
|
||||
<version>1.7.3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.resolver</groupId>
|
||||
<artifactId>maven-resolver-transport-http</artifactId>
|
||||
<version>1.7.3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>2.18.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.github.waterfallmc</groupId>
|
||||
<artifactId>waterfall-api</artifactId>
|
||||
<version>1.20-R0.3-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.william278</groupId>
|
||||
<artifactId>papiproxybridge</artifactId>
|
||||
<version>1.4</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.velocitypowered</groupId>
|
||||
<artifactId>velocity-api</artifactId>
|
||||
<version>3.1.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.velocitypowered</groupId>
|
||||
<artifactId>velocity-proxy</artifactId>
|
||||
<version>3.3.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.velocitypowered</groupId>
|
||||
<artifactId>velocity-proxy-log4j2-plugin</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.sonatype.sisu</groupId>
|
||||
<artifactId>sisu-guice</artifactId>
|
||||
<version>2.1.7</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.spongepowered</groupId>
|
||||
<artifactId>configurate-hocon</artifactId>
|
||||
<version>4.1.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-text-minimessage</artifactId>
|
||||
<version>4.18.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-api</artifactId>
|
||||
<version>4.18.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-platform-api</artifactId>
|
||||
<version>4.3.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-platform-bungeecord</artifactId>
|
||||
<version>4.3.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.kyori</groupId>
|
||||
<artifactId>adventure-platform-bukkit</artifactId>
|
||||
<version>4.3.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>me.clip</groupId>
|
||||
<artifactId>placeholderapi</artifactId>
|
||||
<version>2.11.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.luckperms</groupId>
|
||||
<artifactId>api</artifactId>
|
||||
<version>5.4</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.viaversion</groupId>
|
||||
<artifactId>viaversion-api</artifactId>
|
||||
<version>LATEST</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.papermc.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>1.17-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>IgnoreThisJar</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<finalName>ProAntiTab</finalName>
|
||||
<shadedArtifactAttached>false</shadedArtifactAttached>
|
||||
<shadedClassifierName>shaded</shadedClassifierName>
|
||||
<artifactSet>
|
||||
<excludes/>
|
||||
</artifactSet>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1 @@
|
||||
rootProject.name = "ProAntiTab"
|
||||
@@ -1,24 +1,56 @@
|
||||
package de.rayzs.pat.api.brand;
|
||||
|
||||
import de.rayzs.pat.api.brand.impl.*;
|
||||
import de.rayzs.pat.api.storage.Storage;
|
||||
import de.rayzs.pat.utils.PacketUtils;
|
||||
import de.rayzs.pat.utils.Reflection;
|
||||
import de.rayzs.pat.api.brand.impl.*;
|
||||
|
||||
public class CustomServerBrand {
|
||||
|
||||
public static final String CHANNEL_NAME = Reflection.getMinor() < 13 ? "MC|Brand" : "minecraft:brand";
|
||||
private static final ServerBrand SERVER_BRAND = Reflection.isVelocityServer() ? new VelocityServerBrand() : Reflection.isProxyServer() ? new BungeeServerBrand() : new BukkitServerBrand();
|
||||
public static final String CHANNEL_NAME = Reflection.isBefore(1, 13) ? "MC|Brand" : "minecraft:brand";
|
||||
private static final ServerBrand SERVER_BRAND = Reflection.isVelocityServer() ? new VelocityServerBrand()
|
||||
: Reflection.isProxyServer() ? new BungeeServerBrand() : new BukkitServerBrand();
|
||||
|
||||
public static void initialize() { refreshTask(); }
|
||||
public static void refreshTask() { SERVER_BRAND.initializeTask(); }
|
||||
public static void preparePlayer(Object playerObj) { SERVER_BRAND.preparePlayer(playerObj); }
|
||||
public static void sendBrandToPlayer(Object playerObj) { SERVER_BRAND.send(playerObj); }
|
||||
public static void initialize() {
|
||||
|
||||
public static PacketUtils.BrandManipulate createBrandPacket(Object playerObj) { return SERVER_BRAND.createPacket(playerObj); }
|
||||
public static boolean isEnabled() { return Storage.ConfigSections.Settings.CUSTOM_BRAND.ENABLED; }
|
||||
refreshTask();
|
||||
|
||||
}
|
||||
|
||||
public static void refreshTask() {
|
||||
|
||||
SERVER_BRAND.initializeTask();
|
||||
|
||||
}
|
||||
|
||||
public static void preparePlayer(Object playerObj) {
|
||||
|
||||
SERVER_BRAND.preparePlayer(playerObj);
|
||||
|
||||
}
|
||||
|
||||
public static void sendBrandToPlayer(Object playerObj) {
|
||||
|
||||
SERVER_BRAND.send(playerObj);
|
||||
|
||||
}
|
||||
|
||||
public static PacketUtils.BrandManipulate createBrandPacket(Object playerObj) {
|
||||
|
||||
return SERVER_BRAND.createPacket(playerObj);
|
||||
|
||||
}
|
||||
|
||||
public static boolean isEnabled() {
|
||||
|
||||
return Storage.ConfigSections.Settings.CUSTOM_BRAND.ENABLED;
|
||||
|
||||
}
|
||||
|
||||
public static boolean isBrandTag(String tag) {
|
||||
|
||||
return tag.equals("MC|Brand") || tag.equals("minecraft:brand");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,8 +3,10 @@ package de.rayzs.pat.api.brand;
|
||||
import de.rayzs.pat.utils.PacketUtils;
|
||||
|
||||
public interface ServerBrand {
|
||||
|
||||
void preparePlayer(Object playerObj);
|
||||
void send(Object playerObj);
|
||||
PacketUtils.BrandManipulate createPacket(Object playerObj);
|
||||
void initializeTask();
|
||||
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package de.rayzs.pat.api.brand.impl;
|
||||
|
||||
import de.rayzs.pat.api.brand.CustomServerBrand;
|
||||
import de.rayzs.pat.api.netty.bukkit.BukkitPacketAnalyzer;
|
||||
import de.rayzs.pat.api.brand.ServerBrand;
|
||||
import de.rayzs.pat.utils.message.MessageTranslator;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import de.rayzs.pat.api.storage.Storage;
|
||||
@@ -8,7 +10,6 @@ import de.rayzs.pat.plugin.BukkitLoader;
|
||||
import de.rayzs.pat.utils.scheduler.PATScheduler;
|
||||
import de.rayzs.pat.utils.scheduler.PATSchedulerTask;
|
||||
import io.netty.channel.Channel;
|
||||
import de.rayzs.pat.api.brand.*;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import de.rayzs.pat.utils.*;
|
||||
@@ -18,118 +19,161 @@ import java.util.*;
|
||||
|
||||
public class BukkitServerBrand implements ServerBrand {
|
||||
|
||||
private static final List<Player> MODIFIED_BRAND_PLAYERS = new ArrayList<>();
|
||||
private static final Server SERVER = Bukkit.getServer();
|
||||
private static String BRAND = Storage.ConfigSections.Settings.CUSTOM_BRAND.BRANDS.getLines().get(0);
|
||||
private static PATSchedulerTask TASK;
|
||||
private static boolean INITIALIZED = false;
|
||||
private static Class<?> brandPayloadClass, clientBoundCustomPacketPayloadPacketClass, customPacketPayloadPacketClass;
|
||||
private static PATSchedulerTask TASK;
|
||||
private static boolean INITIALIZED = false, NO_PREP_CHANNELS = false;
|
||||
private static Class<?> brandPayloadClass, clientBoundCustomPacketPayloadPacketClass,
|
||||
customPacketPayloadPacketClass;
|
||||
|
||||
@Override
|
||||
public void initializeTask() {
|
||||
|
||||
if(Reflection.isWeird()) {
|
||||
if (Reflection.isWeird()) {
|
||||
|
||||
NO_PREP_CHANNELS = Reflection.isAtLeast(1, 21, 7);
|
||||
|
||||
if (brandPayloadClass == null)
|
||||
brandPayloadClass = Reflection.getClass("net.minecraft.network.protocol.common.custom.BrandPayload");
|
||||
|
||||
if (clientBoundCustomPacketPayloadPacketClass == null)
|
||||
clientBoundCustomPacketPayloadPacketClass = Reflection.getClass("net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket");
|
||||
clientBoundCustomPacketPayloadPacketClass = Reflection
|
||||
.getClass("net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket");
|
||||
|
||||
if (customPacketPayloadPacketClass == null)
|
||||
customPacketPayloadPacketClass = Reflection.getClass("net.minecraft.network.protocol.common.custom.CustomPacketPayload");
|
||||
customPacketPayloadPacketClass = Reflection
|
||||
.getClass("net.minecraft.network.protocol.common.custom.CustomPacketPayload");
|
||||
|
||||
}
|
||||
|
||||
Bukkit.getOnlinePlayers().forEach(this::preparePlayer);
|
||||
if(!INITIALIZED)
|
||||
if (!INITIALIZED)
|
||||
try {
|
||||
Method method = Reflection.getMethodsByParameterAndName(SERVER.getMessenger(), "addToOutgoing", Plugin.class, String.class).get(0);
|
||||
Reflection.invokeMethode(method, SERVER.getMessenger(), BukkitLoader.getPlugin(), CustomServerBrand.CHANNEL_NAME);
|
||||
SERVER.getMessenger().registerOutgoingPluginChannel(BukkitLoader.getPlugin(), CustomServerBrand.CHANNEL_NAME);
|
||||
|
||||
Method method = Reflection.getMethodsByParameterAndName(SERVER.getMessenger(), "addToOutgoing",
|
||||
Plugin.class, String.class).get(0);
|
||||
Reflection.invokeMethode(method, SERVER.getMessenger(), BukkitLoader.getPlugin(),
|
||||
CustomServerBrand.CHANNEL_NAME);
|
||||
SERVER.getMessenger().registerOutgoingPluginChannel(BukkitLoader.getPlugin(),
|
||||
CustomServerBrand.CHANNEL_NAME);
|
||||
INITIALIZED = true;
|
||||
|
||||
} catch (Exception exception) {
|
||||
|
||||
exception.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
if(TASK != null && TASK.isActive()) {
|
||||
if (TASK != null && TASK.isActive()) {
|
||||
|
||||
TASK.cancelTask();
|
||||
TASK = null;
|
||||
MODIFIED_BRAND_PLAYERS.clear();
|
||||
|
||||
}
|
||||
|
||||
if(!Storage.ConfigSections.Settings.CUSTOM_BRAND.ENABLED) return;
|
||||
if (!Storage.ConfigSections.Settings.CUSTOM_BRAND.ENABLED)
|
||||
return;
|
||||
|
||||
if (Storage.ConfigSections.Settings.CUSTOM_BRAND.REPEAT_DELAY == -1) {
|
||||
|
||||
if(Storage.ConfigSections.Settings.CUSTOM_BRAND.REPEAT_DELAY == -1) {
|
||||
BRAND = Storage.ConfigSections.Settings.CUSTOM_BRAND.BRANDS.getLines().get(0) + "§r";
|
||||
|
||||
PATScheduler.createAsyncScheduler(() -> {
|
||||
|
||||
Bukkit.getOnlinePlayers().forEach(this::send);
|
||||
|
||||
}, 1, 1);
|
||||
|
||||
} else {
|
||||
|
||||
AtomicInteger animationState = new AtomicInteger(0);
|
||||
TASK = PATScheduler.createAsyncScheduler(() -> {
|
||||
if (animationState.getAndIncrement() >= Storage.ConfigSections.Settings.CUSTOM_BRAND.BRANDS.getLines().size() - 1)
|
||||
|
||||
if (animationState
|
||||
.getAndIncrement() >= Storage.ConfigSections.Settings.CUSTOM_BRAND.BRANDS.getLines().size() - 1)
|
||||
animationState.set(0);
|
||||
BRAND = Storage.ConfigSections.Settings.CUSTOM_BRAND.BRANDS.getLines().get(animationState.get()) + "§r";
|
||||
Bukkit.getOnlinePlayers().forEach(this::send);
|
||||
|
||||
}, 1, Storage.ConfigSections.Settings.CUSTOM_BRAND.REPEAT_DELAY);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preparePlayer(Object playerObj) {
|
||||
if(!(playerObj instanceof Player) || !Storage.ConfigSections.Settings.CUSTOM_BRAND.ENABLED) return;
|
||||
|
||||
if (!(playerObj instanceof Player) || !Storage.ConfigSections.Settings.CUSTOM_BRAND.ENABLED)
|
||||
return;
|
||||
Player player = (Player) playerObj;
|
||||
|
||||
if (NO_PREP_CHANNELS) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
Field channelsField = Reflection.getFieldByName(player.getClass(), "channels");
|
||||
Set<String> channels = (Set<String>) channelsField.get(player);
|
||||
channels.add(CustomServerBrand.CHANNEL_NAME);
|
||||
Reflection.closeAccess(channelsField);
|
||||
if(!MODIFIED_BRAND_PLAYERS.contains(player)) MODIFIED_BRAND_PLAYERS.add(player);
|
||||
|
||||
} catch (Exception exception) {
|
||||
|
||||
exception.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(Object playerObj) {
|
||||
if(!(playerObj instanceof Player) || !Storage.ConfigSections.Settings.CUSTOM_BRAND.ENABLED) return;
|
||||
Player player = (Player) playerObj;
|
||||
String playerName = player.getName(), displayName = player.getDisplayName(), worldName = player.getWorld().getName(),
|
||||
customBrand = BRAND.replace("%player%", playerName).replace("%displayname%", displayName).replace("%world%", worldName);
|
||||
|
||||
if(!Reflection.isWeird()) {
|
||||
PacketUtils.BrandManipulate serverBrand = new PacketUtils.BrandManipulate(MessageTranslator.replaceMessage(player, customBrand));
|
||||
if (!(playerObj instanceof Player) || !Storage.ConfigSections.Settings.CUSTOM_BRAND.ENABLED)
|
||||
return;
|
||||
Player player = (Player) playerObj;
|
||||
String playerName = player.getName(), displayName = player.getDisplayName(),
|
||||
worldName = player.getWorld().getName(), customBrand = BRAND.replace("%player%", playerName)
|
||||
.replace("%displayname%", displayName).replace("%world%", worldName);
|
||||
|
||||
if (!Reflection.isWeird()) {
|
||||
|
||||
PacketUtils.BrandManipulate serverBrand = new PacketUtils.BrandManipulate(
|
||||
MessageTranslator.replaceMessage(player, customBrand));
|
||||
player.sendPluginMessage(BukkitLoader.getPlugin(), CustomServerBrand.CHANNEL_NAME, serverBrand.getBytes());
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
Channel channel = BukkitPacketAnalyzer.INJECTED_PLAYERS.get(player.getUniqueId());
|
||||
if(channel == null) return;
|
||||
|
||||
Object brandPayloadObj = brandPayloadClass.getDeclaredConstructor(String.class).newInstance(MessageTranslator.replaceMessage(player, customBrand)),
|
||||
customPacketPayloadPacket = clientBoundCustomPacketPayloadPacketClass.getDeclaredConstructor(customPacketPayloadPacketClass).newInstance(brandPayloadObj);
|
||||
Channel channel = BukkitPacketAnalyzer.INJECTED_PLAYERS.get(player.getUniqueId());
|
||||
if (channel == null)
|
||||
return;
|
||||
|
||||
Object brandPayloadObj = brandPayloadClass.getDeclaredConstructor(String.class)
|
||||
.newInstance(MessageTranslator.replaceMessage(player, customBrand)),
|
||||
customPacketPayloadPacket = clientBoundCustomPacketPayloadPacketClass
|
||||
.getDeclaredConstructor(customPacketPayloadPacketClass).newInstance(brandPayloadObj);
|
||||
|
||||
channel.pipeline().writeAndFlush(customPacketPayloadPacket);
|
||||
|
||||
} catch (Exception exception) {
|
||||
|
||||
exception.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketUtils.BrandManipulate createPacket(Object playerObj) {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
private boolean isModified(Player player) {
|
||||
if(!Storage.ConfigSections.Settings.CUSTOM_BRAND.ENABLED || Storage.ConfigSections.Settings.CUSTOM_BRAND.REPEAT_DELAY != -1) return false;
|
||||
return MODIFIED_BRAND_PLAYERS.contains(player);
|
||||
}
|
||||
|
||||
public static void removeFromModified(Player player) {
|
||||
MODIFIED_BRAND_PLAYERS.remove(player);
|
||||
}
|
||||
}
|
||||
@@ -18,56 +18,85 @@ public class BungeeServerBrand implements ServerBrand {
|
||||
private static ScheduledTask TASK;
|
||||
private static String BRAND = Storage.ConfigSections.Settings.CUSTOM_BRAND.BRANDS.getLines().get(0);
|
||||
|
||||
public BungeeServerBrand() { }
|
||||
public BungeeServerBrand() {
|
||||
|
||||
@Override
|
||||
public void initializeTask() {
|
||||
if(TASK != null) TASK.cancel();
|
||||
|
||||
if(!Storage.ConfigSections.Settings.CUSTOM_BRAND.ENABLED) return;
|
||||
|
||||
if(Storage.ConfigSections.Settings.CUSTOM_BRAND.REPEAT_DELAY == -1) {
|
||||
BRAND = MessageTranslator.replaceMessage(Storage.ConfigSections.Settings.CUSTOM_BRAND.BRANDS.getLines().get(0)) + "§r";
|
||||
SERVER.getPlayers().forEach(this::send);
|
||||
} else {
|
||||
AtomicInteger animationState = new AtomicInteger(0);
|
||||
TASK = SERVER.getScheduler().schedule(BungeeLoader.getPlugin(), () -> {
|
||||
if (animationState.getAndIncrement() >= Storage.ConfigSections.Settings.CUSTOM_BRAND.BRANDS.getLines().size() - 1)
|
||||
animationState.set(0);
|
||||
BRAND = MessageTranslator.replaceMessage(Storage.ConfigSections.Settings.CUSTOM_BRAND.BRANDS.getLines().get(animationState.get())) + "§r";
|
||||
SERVER.getPlayers().forEach(this::send);
|
||||
}, 1, Storage.ConfigSections.Settings.CUSTOM_BRAND.REPEAT_DELAY, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preparePlayer(Object playerObj) { }
|
||||
public void initializeTask() {
|
||||
|
||||
if (TASK != null)
|
||||
TASK.cancel();
|
||||
|
||||
if (!Storage.ConfigSections.Settings.CUSTOM_BRAND.ENABLED)
|
||||
return;
|
||||
|
||||
if (Storage.ConfigSections.Settings.CUSTOM_BRAND.REPEAT_DELAY == -1) {
|
||||
|
||||
BRAND = MessageTranslator
|
||||
.replaceMessage(Storage.ConfigSections.Settings.CUSTOM_BRAND.BRANDS.getLines().get(0)) + "§r";
|
||||
SERVER.getPlayers().forEach(this::send);
|
||||
|
||||
} else {
|
||||
|
||||
AtomicInteger animationState = new AtomicInteger(0);
|
||||
TASK = SERVER.getScheduler().schedule(BungeeLoader.getPlugin(), () -> {
|
||||
|
||||
if (animationState
|
||||
.getAndIncrement() >= Storage.ConfigSections.Settings.CUSTOM_BRAND.BRANDS.getLines().size() - 1)
|
||||
animationState.set(0);
|
||||
BRAND = MessageTranslator.replaceMessage(
|
||||
Storage.ConfigSections.Settings.CUSTOM_BRAND.BRANDS.getLines().get(animationState.get()))
|
||||
+ "§r";
|
||||
SERVER.getPlayers().forEach(this::send);
|
||||
|
||||
}, 1, Storage.ConfigSections.Settings.CUSTOM_BRAND.REPEAT_DELAY, TimeUnit.MILLISECONDS);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preparePlayer(Object playerObj) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(Object playerObj) {
|
||||
if (!(playerObj instanceof ProxiedPlayer) || !Storage.ConfigSections.Settings.CUSTOM_BRAND.ENABLED) return;
|
||||
|
||||
if (!(playerObj instanceof ProxiedPlayer) || !Storage.ConfigSections.Settings.CUSTOM_BRAND.ENABLED)
|
||||
return;
|
||||
ProxiedPlayer player = (ProxiedPlayer) playerObj;
|
||||
|
||||
String serverName = "", playerName = player.getName(), customBrand;
|
||||
Server server = player.getServer();
|
||||
if(server != null) serverName = server.getInfo().getName();
|
||||
if (server != null)
|
||||
serverName = server.getInfo().getName();
|
||||
customBrand = BRAND.replace("%player%", playerName).replace("%server%", serverName);
|
||||
|
||||
PacketUtils.BrandManipulate serverBrand = new PacketUtils.BrandManipulate(customBrand);
|
||||
String brand = player.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_13 ? "minecraft:brand" : "MC|Brand";
|
||||
String brand = player.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_1_13
|
||||
? "minecraft:brand"
|
||||
: "MC|Brand";
|
||||
player.sendData(brand, serverBrand.getBytes());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketUtils.BrandManipulate createPacket(Object playerObj) {
|
||||
if (!(playerObj instanceof ProxiedPlayer) || !Storage.ConfigSections.Settings.CUSTOM_BRAND.ENABLED) return null;
|
||||
|
||||
if (!(playerObj instanceof ProxiedPlayer) || !Storage.ConfigSections.Settings.CUSTOM_BRAND.ENABLED)
|
||||
return null;
|
||||
ProxiedPlayer player = (ProxiedPlayer) playerObj;
|
||||
|
||||
String serverName = "", playerName = player.getName(), customBrand;
|
||||
Server server = player.getServer();
|
||||
if(server != null) serverName = server.getInfo().getName();
|
||||
if (server != null)
|
||||
serverName = server.getInfo().getName();
|
||||
customBrand = BRAND.replace("%player%", playerName).replace("%server%", serverName);
|
||||
|
||||
return new PacketUtils.BrandManipulate(customBrand);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,81 +24,121 @@ public class VelocityServerBrand implements ServerBrand {
|
||||
|
||||
@Override
|
||||
public void initializeTask() {
|
||||
if(TASK != null) TASK.cancel();
|
||||
|
||||
if(!Storage.ConfigSections.Settings.CUSTOM_BRAND.ENABLED) return;
|
||||
if (TASK != null)
|
||||
TASK.cancel();
|
||||
|
||||
if(pluginMessagePacketClass == null)
|
||||
pluginMessagePacketClass = Reflection.getClass("com.velocitypowered.proxy.protocol.packet.PluginMessagePacket");
|
||||
if (!Storage.ConfigSections.Settings.CUSTOM_BRAND.ENABLED)
|
||||
return;
|
||||
|
||||
if(minecraftConnectionClass == null)
|
||||
if (pluginMessagePacketClass == null)
|
||||
pluginMessagePacketClass = Reflection
|
||||
.getClass("com.velocitypowered.proxy.protocol.packet.PluginMessagePacket");
|
||||
|
||||
if (minecraftConnectionClass == null)
|
||||
minecraftConnectionClass = Reflection.getClass("com.velocitypowered.proxy.connection.MinecraftConnection");
|
||||
|
||||
if(connectedPlayerConnectionClass == null)
|
||||
connectedPlayerConnectionClass = Reflection.getClass("com.velocitypowered.proxy.connection.client.ConnectedPlayer");
|
||||
if (connectedPlayerConnectionClass == null)
|
||||
connectedPlayerConnectionClass = Reflection
|
||||
.getClass("com.velocitypowered.proxy.connection.client.ConnectedPlayer");
|
||||
|
||||
if(connectionMethod == null)
|
||||
if (connectionMethod == null)
|
||||
connectionMethod = Reflection.getMethodByName(connectedPlayerConnectionClass, "getConnection");
|
||||
|
||||
if(Storage.ConfigSections.Settings.CUSTOM_BRAND.REPEAT_DELAY == -1) {
|
||||
BRAND = MessageTranslator.replaceMessage(Storage.ConfigSections.Settings.CUSTOM_BRAND.BRANDS.getLines().get(0)) + "§r";
|
||||
if (Storage.ConfigSections.Settings.CUSTOM_BRAND.REPEAT_DELAY == -1) {
|
||||
|
||||
BRAND = MessageTranslator
|
||||
.replaceMessage(Storage.ConfigSections.Settings.CUSTOM_BRAND.BRANDS.getLines().get(0)) + "§r";
|
||||
SERVER.getAllPlayers().forEach(this::send);
|
||||
|
||||
} else {
|
||||
|
||||
AtomicInteger animationState = new AtomicInteger(0);
|
||||
TASK = SERVER.getScheduler().buildTask(VelocityLoader.getInstance(), () -> {
|
||||
if (animationState.getAndIncrement() >= Storage.ConfigSections.Settings.CUSTOM_BRAND.BRANDS.getLines().size() - 1)
|
||||
|
||||
if (animationState
|
||||
.getAndIncrement() >= Storage.ConfigSections.Settings.CUSTOM_BRAND.BRANDS.getLines().size() - 1)
|
||||
animationState.set(0);
|
||||
BRAND = MessageTranslator.replaceMessage(Storage.ConfigSections.Settings.CUSTOM_BRAND.BRANDS.getLines().get(animationState.get())) + "§r";
|
||||
BRAND = MessageTranslator.replaceMessage(
|
||||
Storage.ConfigSections.Settings.CUSTOM_BRAND.BRANDS.getLines().get(animationState.get()))
|
||||
+ "§r";
|
||||
SERVER.getAllPlayers().forEach(this::send);
|
||||
|
||||
}).repeat(Storage.ConfigSections.Settings.CUSTOM_BRAND.REPEAT_DELAY, TimeUnit.MILLISECONDS).schedule();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void preparePlayer(Object playerObj) { }
|
||||
public void preparePlayer(Object playerObj) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(Object playerObj) {
|
||||
if (!(playerObj instanceof Player) || !Storage.ConfigSections.Settings.CUSTOM_BRAND.ENABLED) return;
|
||||
|
||||
if (!(playerObj instanceof Player) || !Storage.ConfigSections.Settings.CUSTOM_BRAND.ENABLED)
|
||||
return;
|
||||
|
||||
try {
|
||||
|
||||
Player player = (Player) playerObj;
|
||||
Object connectedPlayerObj = connectedPlayerConnectionClass.cast(player),
|
||||
minecraftConnectionObj = connectionMethod.invoke(connectedPlayerObj);
|
||||
|
||||
String serverName = "", playerName = player.getUsername(), customBrand;
|
||||
Optional<ServerConnection> serverConnection = player.getCurrentServer();
|
||||
if(serverConnection.isPresent()) serverName = serverConnection.get().getServerInfo().getName();
|
||||
customBrand = BRAND.replace("%player%", playerName).replace("%server%", serverName).replace("%ping%", String.valueOf(player.getPing()));
|
||||
if (serverConnection.isPresent())
|
||||
serverName = serverConnection.get().getServerInfo().getName();
|
||||
customBrand = BRAND.replace("%player%", playerName).replace("%server%", serverName).replace("%ping%",
|
||||
String.valueOf(player.getPing()));
|
||||
|
||||
PacketUtils.BrandManipulate serverBrand = new PacketUtils.BrandManipulate(customBrand, false);
|
||||
String brand = player.getProtocolVersion().getProtocol() >= ProtocolConstants.MINECRAFT_1_13 ? "minecraft:brand" : "MC|Brand";
|
||||
Object pluginMessagePacket = pluginMessagePacketClass.getConstructor(String.class, ByteBuf.class).newInstance(brand, serverBrand.getByteBuf());
|
||||
Reflection.getMethodsByParameterAndName(minecraftConnectionObj, "write", Object.class).get(0).invoke(minecraftConnectionObj, pluginMessagePacket);
|
||||
String brand = player.getProtocolVersion().getProtocol() >= ProtocolConstants.MINECRAFT_1_13
|
||||
? "minecraft:brand"
|
||||
: "MC|Brand";
|
||||
Object pluginMessagePacket = pluginMessagePacketClass.getConstructor(String.class, ByteBuf.class)
|
||||
.newInstance(brand, serverBrand.getByteBuf());
|
||||
Reflection.getMethodsByParameterAndName(minecraftConnectionObj, "write", Object.class).get(0)
|
||||
.invoke(minecraftConnectionObj, pluginMessagePacket);
|
||||
|
||||
} catch (Exception exception) {
|
||||
|
||||
exception.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketUtils.BrandManipulate createPacket(Object playerObj) {
|
||||
if (!(playerObj instanceof Player) || !Storage.ConfigSections.Settings.CUSTOM_BRAND.ENABLED) return null;
|
||||
|
||||
if (!(playerObj instanceof Player) || !Storage.ConfigSections.Settings.CUSTOM_BRAND.ENABLED)
|
||||
return null;
|
||||
|
||||
try {
|
||||
|
||||
Player player = (Player) playerObj;
|
||||
|
||||
String serverName = "", playerName = player.getUsername(), customBrand;
|
||||
Optional<ServerConnection> serverConnection = player.getCurrentServer();
|
||||
|
||||
if(serverConnection.isPresent()) serverName = serverConnection.get().getServerInfo().getName();
|
||||
customBrand = BRAND.replace("%player%", playerName).replace("%server%", serverName).replace("%ping%", String.valueOf(player.getPing()));
|
||||
if (serverConnection.isPresent())
|
||||
serverName = serverConnection.get().getServerInfo().getName();
|
||||
customBrand = BRAND.replace("%player%", playerName).replace("%server%", serverName).replace("%ping%",
|
||||
String.valueOf(player.getPing()));
|
||||
|
||||
return new PacketUtils.BrandManipulate(customBrand, false);
|
||||
|
||||
} catch (Exception exception) {
|
||||
|
||||
exception.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package de.rayzs.pat.api.command;
|
||||
|
||||
import de.rayzs.pat.utils.*;
|
||||
import de.rayzs.pat.utils.sender.CommandSender;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public abstract class ProCommand {
|
||||
|
||||
private final String name;
|
||||
private final List<String> aliases;
|
||||
|
||||
protected boolean proxyOnly = false, serverCommand = false;
|
||||
|
||||
public ProCommand(String name, String... aliases) {
|
||||
|
||||
this.name = name.toLowerCase();
|
||||
this.aliases = aliases != null && !aliases[0].isBlank() ? Arrays.asList(aliases) : new ArrayList<>();
|
||||
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
||||
return name;
|
||||
|
||||
}
|
||||
|
||||
public boolean isProxyOnly() {
|
||||
|
||||
return proxyOnly;
|
||||
|
||||
}
|
||||
|
||||
public boolean isServerCommand() {
|
||||
|
||||
return serverCommand;
|
||||
|
||||
}
|
||||
|
||||
public List<String> getAliases() {
|
||||
|
||||
return aliases;
|
||||
|
||||
}
|
||||
|
||||
public boolean isCommand(String label) {
|
||||
|
||||
String commandName = StringUtils.getFirstArg(label);
|
||||
|
||||
if (name.equalsIgnoreCase(commandName))
|
||||
return true;
|
||||
|
||||
return !aliases.isEmpty() && aliases.stream().anyMatch(commandName::equalsIgnoreCase);
|
||||
|
||||
}
|
||||
|
||||
public abstract boolean execute(CommandSender sender, String[] args);
|
||||
public abstract List<String> tabComplete(CommandSender sender, String[] args);
|
||||
|
||||
}
|
||||
@@ -6,34 +6,128 @@ import org.bukkit.Bukkit;
|
||||
|
||||
public class BackendUpdater {
|
||||
|
||||
private BackendUpdater() {
|
||||
|
||||
}
|
||||
|
||||
private static PATSchedulerTask TASK;
|
||||
private static boolean CONNECTED = false, WAITING = false;
|
||||
|
||||
private static final long SCHEDULER_PERIOD_TIME = 20 * 10;
|
||||
|
||||
public static void handle() {
|
||||
if(isRunning() || !shouldRun() || !Storage.ConfigSections.Settings.HANDLE_THROUGH_PROXY.ENABLED) return;
|
||||
|
||||
if (!Storage.ConfigSections.Settings.HANDLE_THROUGH_PROXY.ENABLED) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (isRunning() || !canRun()) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
start();
|
||||
|
||||
}
|
||||
|
||||
public static boolean isRunning() {
|
||||
return TASK != null && TASK.isActive();
|
||||
public static void restart() {
|
||||
|
||||
stop();
|
||||
handle();
|
||||
|
||||
}
|
||||
|
||||
public static void start() {
|
||||
if(isRunning()) return;
|
||||
public static void receivedKeepAlivePacket() {
|
||||
|
||||
WAITING = false;
|
||||
CONNECTED = true;
|
||||
|
||||
}
|
||||
|
||||
public static boolean isConnected() {
|
||||
|
||||
return CONNECTED;
|
||||
|
||||
}
|
||||
|
||||
private static void start() {
|
||||
|
||||
if (isRunning())
|
||||
return;
|
||||
|
||||
TASK = PATScheduler.createScheduler(() -> {
|
||||
if (shouldRun()) Communicator.sendRequest();
|
||||
else stop();
|
||||
}, 5, 20);
|
||||
|
||||
if (!canRun()) {
|
||||
|
||||
stop();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (CONNECTED) {
|
||||
|
||||
if (WAITING) {
|
||||
|
||||
disconnect();
|
||||
|
||||
Communicator.Backend2Proxy.sendIdentityRequest();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
WAITING = true;
|
||||
|
||||
Communicator.Backend2Proxy.sendKeepAliveRequest();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
Communicator.Backend2Proxy.sendIdentityRequest();
|
||||
|
||||
}, 20, SCHEDULER_PERIOD_TIME);
|
||||
|
||||
}
|
||||
|
||||
public static void stop() {
|
||||
if(TASK == null || !TASK.isActive()) return;
|
||||
TASK.cancelTask();
|
||||
TASK = null;
|
||||
|
||||
disconnect();
|
||||
|
||||
if (isRunning()) {
|
||||
|
||||
TASK.cancelTask();
|
||||
TASK = null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static boolean shouldRun() {
|
||||
int onlinePlayerSize = Bukkit.getOnlinePlayers().size();
|
||||
return onlinePlayerSize >= 1;
|
||||
private static void disconnect() {
|
||||
|
||||
CONNECTED = false;
|
||||
WAITING = false;
|
||||
|
||||
}
|
||||
|
||||
private static boolean isRunning() {
|
||||
|
||||
return TASK != null && TASK.isActive();
|
||||
|
||||
}
|
||||
|
||||
private static boolean canRun() {
|
||||
|
||||
if (!Storage.ConfigSections.Settings.HANDLE_THROUGH_PROXY.ENABLED) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
final int onlinePlayerSize = Bukkit.getOnlinePlayers().size();
|
||||
return onlinePlayerSize >= 1;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,12 @@
|
||||
package de.rayzs.pat.api.communication;
|
||||
|
||||
import de.rayzs.pat.utils.CommunicationPackets;
|
||||
|
||||
public interface Client {
|
||||
|
||||
String CHANNEL_NAME = "pat:channel";
|
||||
void send(Object packet);
|
||||
|
||||
void reload();
|
||||
void send(CommunicationPackets.PATPacket packet);
|
||||
|
||||
}
|
||||
@@ -1,205 +1,439 @@
|
||||
package de.rayzs.pat.api.communication;
|
||||
|
||||
import de.rayzs.pat.api.communication.client.ClientInfo;
|
||||
import de.rayzs.pat.api.communication.client.impl.*;
|
||||
import de.rayzs.pat.api.event.PATEventHandler;
|
||||
import de.rayzs.pat.utils.permission.PermissionUtil;
|
||||
import de.rayzs.pat.api.storage.blacklist.impl.*;
|
||||
import de.rayzs.pat.api.communication.impl.*;
|
||||
import de.rayzs.pat.plugin.BukkitLoader;
|
||||
import de.rayzs.pat.api.storage.Storage;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import de.rayzs.pat.utils.group.*;
|
||||
import de.rayzs.pat.utils.*;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import de.rayzs.pat.api.communication.client.ClientInfo;
|
||||
import de.rayzs.pat.api.communication.client.impl.BungeeClientInfo;
|
||||
import de.rayzs.pat.api.communication.client.impl.VelocityClientInfo;
|
||||
import de.rayzs.pat.api.storage.Storage;
|
||||
import de.rayzs.pat.plugin.BukkitLoader;
|
||||
import de.rayzs.pat.plugin.logger.Logger;
|
||||
import de.rayzs.pat.utils.CommunicationPackets;
|
||||
import de.rayzs.pat.utils.ExpireCache;
|
||||
import de.rayzs.pat.utils.Reflection;
|
||||
|
||||
public class Communicator {
|
||||
|
||||
private static final Client CLIENT = Reflection.isVelocityServer() ? new VelocityClient() : Reflection.isProxyServer() ? new BungeeClient() : new BukkitClient();
|
||||
private static final UUID SERVER_ID = UUID.randomUUID();
|
||||
public static final List<ClientInfo> CLIENTS = new ArrayList<>();
|
||||
private static final ExpireCache<String, ClientInfo> QUEUE_CLIENTS = new ExpireCache<>(15, TimeUnit.SECONDS);
|
||||
public static long LAST_DATA_UPDATE = System.currentTimeMillis(), LAST_SENT_REQUEST = 0, LAST_BUKKIT_SYNC = System.currentTimeMillis();
|
||||
public static int SERVER_DATA_SYNC_COUNT = 0;
|
||||
private static Communicator instance = null;
|
||||
|
||||
public static void initialize(final Client client) {
|
||||
|
||||
if (instance != null) {
|
||||
|
||||
Logger.warning("Communicator instance is already initialized!");
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
instance = new Communicator(client);
|
||||
|
||||
public static void sendPacket(Object packet) {
|
||||
CLIENT.send(packet);
|
||||
}
|
||||
|
||||
public static void sendPacket(ClientInfo clientInfo, Object packet) {
|
||||
clientInfo.sendBytes(CommunicationPackets.convertToBytes(packet));
|
||||
public static Communicator get() {
|
||||
|
||||
return instance;
|
||||
|
||||
}
|
||||
|
||||
public static void receiveInformation(String serverName, Object packet) {
|
||||
if(packet instanceof CommunicationPackets.RequestPacket) {
|
||||
CommunicationPackets.RequestPacket requestPacket = (CommunicationPackets.RequestPacket) packet;
|
||||
if (!requestPacket.isToken(Storage.TOKEN)) return;
|
||||
public static class Backend2Proxy {
|
||||
|
||||
private Backend2Proxy() {
|
||||
|
||||
}
|
||||
|
||||
public static void sendIdentityRequest() {
|
||||
|
||||
get().send2Proxy(new CommunicationPackets.Backend2Proxy.IdentityRequestPacket(get().getId()));
|
||||
|
||||
}
|
||||
|
||||
public static void sendKeepAliveRequest() {
|
||||
|
||||
get().send2Proxy(new CommunicationPackets.Backend2Proxy.KeepAlivePacket());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class Proxy2Backend {
|
||||
|
||||
private Proxy2Backend() {
|
||||
|
||||
}
|
||||
|
||||
// Update commands for all players
|
||||
public static void sendUpdateCommand() {
|
||||
|
||||
get().send2AllClients(new CommunicationPackets.Proxy2Backend.UpdatePacket(null));
|
||||
|
||||
}
|
||||
|
||||
// Update commands for a certain player.
|
||||
public static void sendUpdateCommand(UUID playerId, String serverName) {
|
||||
|
||||
final ClientInfo clientInfo = get().clients.get(serverName);
|
||||
if (clientInfo == null)
|
||||
return;
|
||||
|
||||
clientInfo.send(new CommunicationPackets.Proxy2Backend.UpdatePacket(playerId));
|
||||
|
||||
}
|
||||
|
||||
public static void sendDataSync() {
|
||||
|
||||
Communicator.get().lastSync = System.currentTimeMillis();
|
||||
|
||||
Communicator.get().send2AllClients(Communicator.get().constructDataSyncPacket());
|
||||
|
||||
}
|
||||
|
||||
// Sync data for one server
|
||||
public static void sendDataSync(String serverName) {
|
||||
|
||||
final ClientInfo clientInfo = get().clients.get(serverName);
|
||||
if (clientInfo == null)
|
||||
return;
|
||||
|
||||
clientInfo.send(Communicator.get().constructDataSyncPacket());
|
||||
|
||||
}
|
||||
|
||||
// Sync data for all registered clients.
|
||||
public static void sendConsoleMessage(String serverName, String message) {
|
||||
|
||||
final ClientInfo clientInfo = get().clients.get(serverName);
|
||||
if (clientInfo == null)
|
||||
return;
|
||||
|
||||
clientInfo.send(new CommunicationPackets.Proxy2Backend.ConsoleMessagePacket(message));
|
||||
|
||||
}
|
||||
|
||||
public static void sendExecutePlayerCommand(String serverName, UUID playerId, String command) {
|
||||
|
||||
final ClientInfo clientInfo = get().clients.get(serverName);
|
||||
if (clientInfo == null)
|
||||
return;
|
||||
|
||||
clientInfo.send(new CommunicationPackets.Proxy2Backend.ExecutePlayerCommandPacket(playerId, command));
|
||||
|
||||
}
|
||||
|
||||
public static void sendExecuteConsoleCommand(String serverName, String command) {
|
||||
|
||||
final ClientInfo clientInfo = get().clients.get(serverName);
|
||||
if (clientInfo == null)
|
||||
return;
|
||||
|
||||
clientInfo.send(new CommunicationPackets.Proxy2Backend.ExecuteConsoleCommandPacket(command));
|
||||
|
||||
}
|
||||
|
||||
public static void sendNotification(UUID playerId, String serverName, String command) {
|
||||
|
||||
if (!Storage.ConfigSections.Settings.FORWARD_CONSOLE_NOTIFICATIONS.ENABLED) {
|
||||
|
||||
return;
|
||||
|
||||
ClientInfo client = getClientByName(serverName);
|
||||
if (client == null) {
|
||||
client = Reflection.isVelocityServer() ? new VelocityClientInfo(requestPacket.getServerId(), serverName) : new BungeeClientInfo(requestPacket.getServerId(), serverName);
|
||||
CLIENTS.add(client);
|
||||
}
|
||||
|
||||
if (!client.compareId(requestPacket.getServerId())) client.setId(requestPacket.getServerId());
|
||||
final ClientInfo clientInfo = get().clients.get(serverName);
|
||||
if (clientInfo == null)
|
||||
return;
|
||||
|
||||
clientInfo.send(new CommunicationPackets.Proxy2Backend.NotificationPacket(playerId, command));
|
||||
|
||||
syncData(client.getId());
|
||||
return;
|
||||
}
|
||||
|
||||
if(packet instanceof CommunicationPackets.ForcePermissionResetPacket) {
|
||||
if(Reflection.isProxyServer()) return;
|
||||
CommunicationPackets.ForcePermissionResetPacket permissionResetPacket = (CommunicationPackets.ForcePermissionResetPacket) packet;
|
||||
if(!permissionResetPacket.isToken(Storage.TOKEN)) return;
|
||||
}
|
||||
|
||||
private final Client client;
|
||||
private final UUID id = UUID.randomUUID();
|
||||
|
||||
// Server name, ClientInfo
|
||||
private final Map<String, ClientInfo> clients = new HashMap<>();
|
||||
private final ExpireCache<String, ClientInfo> pendingClients = new ExpireCache<>(2, TimeUnit.SECONDS);
|
||||
|
||||
private long lastReceivedKeepAliveResponse = System.currentTimeMillis();
|
||||
private long lastSync = System.currentTimeMillis();
|
||||
|
||||
private Communicator(final Client client) {
|
||||
|
||||
this.client = client;
|
||||
|
||||
}
|
||||
|
||||
// BACKEND -> PROXY
|
||||
public void handleB2PPacket(String serverName, CommunicationPackets.PATPacket incomingPacket) {
|
||||
|
||||
if (!incomingPacket.tokenMatches(Storage.TOKEN)) {
|
||||
|
||||
if(permissionResetPacket.hasTarget()) PermissionUtil.setPlayerPermissions(permissionResetPacket.getTargetUUID());
|
||||
else PermissionUtil.reloadPermissions();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if(packet instanceof CommunicationPackets.BackendDataPacket) {
|
||||
CommunicationPackets.BackendDataPacket backendDataPacket = (CommunicationPackets.BackendDataPacket) packet;
|
||||
if (!backendDataPacket.isToken(Storage.TOKEN)) return;
|
||||
Storage.SERVER_NAME = backendDataPacket.getServerName();
|
||||
if (incomingPacket instanceof CommunicationPackets.Backend2Proxy.KeepAlivePacket packet) {
|
||||
|
||||
final ClientInfo clientInfo = clients.get(serverName);
|
||||
if (clientInfo == null)
|
||||
return;
|
||||
|
||||
clientInfo.updateKeepAliveTime();
|
||||
clientInfo.send(new CommunicationPackets.Proxy2Backend.KeepAliveResponsePacket());
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if(packet instanceof CommunicationPackets.FeedbackPacket) {
|
||||
CommunicationPackets.FeedbackPacket feedbackPacket = (CommunicationPackets.FeedbackPacket) packet;
|
||||
if (!feedbackPacket.isToken(Storage.TOKEN)) return;
|
||||
String serverId = feedbackPacket.getServerId();
|
||||
if (incomingPacket instanceof CommunicationPackets.Backend2Proxy.IdentityRequestPacket packet) {
|
||||
|
||||
final ClientInfo registeredClientInfo = clients.get(serverName);
|
||||
|
||||
final boolean exist = registeredClientInfo != null;
|
||||
final boolean same = exist && registeredClientInfo.getId().equals(packet.serverId());
|
||||
|
||||
if (!same) {
|
||||
|
||||
final ClientInfo clientInfo = Reflection.isVelocityServer()
|
||||
? new VelocityClientInfo(packet.serverId(), serverName)
|
||||
: new BungeeClientInfo(packet.serverId(), serverName);
|
||||
|
||||
pendingClients.put(serverName, clientInfo);
|
||||
clientInfo.send(new CommunicationPackets.Proxy2Backend.IdentityPacket(packet.serverId(), serverName));
|
||||
|
||||
} else {
|
||||
|
||||
registeredClientInfo.send(new CommunicationPackets.Proxy2Backend.KeepAliveResponsePacket());
|
||||
registeredClientInfo
|
||||
.send(new CommunicationPackets.Proxy2Backend.IdentityPacket(packet.serverId(), serverName));
|
||||
|
||||
ClientInfo client = getClientByName(serverName);
|
||||
if (client == null) {
|
||||
client = Reflection.isVelocityServer() ? new VelocityClientInfo(feedbackPacket.getServerId(), serverName) : new BungeeClientInfo(feedbackPacket.getServerId(), serverName);
|
||||
CLIENTS.add(client);
|
||||
}
|
||||
|
||||
if (!client.compareId(feedbackPacket.getServerId())) client.setId(feedbackPacket.getServerId());
|
||||
if (client.hasSentFeedback()) return;
|
||||
client.setFeedback(true);
|
||||
client.syncTime();
|
||||
SERVER_DATA_SYNC_COUNT++;
|
||||
|
||||
CommunicationPackets.BackendDataPacket backendDataPacket = new CommunicationPackets.BackendDataPacket(Storage.TOKEN, serverId, serverName);
|
||||
sendPacket(client, backendDataPacket);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if(packet instanceof CommunicationPackets.PacketBundle) {
|
||||
CommunicationPackets.PacketBundle packetBundle = (CommunicationPackets.PacketBundle) packet;
|
||||
if(!packetBundle.isToken(Storage.TOKEN) || !packetBundle.isId(SERVER_ID.toString())) return;
|
||||
if (incomingPacket instanceof CommunicationPackets.Backend2Proxy.IdentityResponsePacket packet) {
|
||||
|
||||
Storage.USE_VELOCITY = packetBundle.isVelocity();
|
||||
LAST_BUKKIT_SYNC = System.currentTimeMillis();
|
||||
BukkitLoader.synchronize(packetBundle);
|
||||
}
|
||||
}
|
||||
final ClientInfo clientInfo = pendingClients.get(serverName);
|
||||
|
||||
public static void syncData() {
|
||||
syncData(null);
|
||||
}
|
||||
if (clientInfo != null && clientInfo.getId().equals(packet.serverId())) {
|
||||
|
||||
public static void syncData(String serverId) {
|
||||
if (Storage.ConfigSections.Settings.DISABLE_SYNC.DISABLED) return;
|
||||
clientInfo.setId(packet.serverId());
|
||||
|
||||
pendingClients.remove(serverName);
|
||||
clients.put(serverName, clientInfo);
|
||||
|
||||
clientInfo.send(new CommunicationPackets.Proxy2Backend.KeepAliveResponsePacket());
|
||||
clientInfo.send(constructDataSyncPacket());
|
||||
|
||||
clientInfo.updateSyncTime();
|
||||
|
||||
}
|
||||
|
||||
LAST_DATA_UPDATE = System.currentTimeMillis();
|
||||
ClientInfo clientInfo;
|
||||
if(serverId == null) {
|
||||
SERVER_DATA_SYNC_COUNT = 0;
|
||||
CLIENTS.forEach(currentClient -> syncData(currentClient.getId()));
|
||||
return;
|
||||
} else {
|
||||
clientInfo = getClientById(serverId);
|
||||
if(clientInfo != null) clientInfo.setFeedback(false);
|
||||
|
||||
SERVER_DATA_SYNC_COUNT = SERVER_DATA_SYNC_COUNT -1;
|
||||
if(SERVER_DATA_SYNC_COUNT <= 0) SERVER_DATA_SYNC_COUNT = 0;
|
||||
}
|
||||
|
||||
CommunicationPackets.CommandsPacket commandsPacket = new CommunicationPackets.CommandsPacket();
|
||||
CommunicationPackets.GroupsPacket groupsPacket;
|
||||
CommunicationPackets.PacketBundle bundle;
|
||||
List<String> commands = new ArrayList<>();
|
||||
String tempServerName = "";
|
||||
if (incomingPacket instanceof CommunicationPackets.Backend2Proxy.DataSyncReceivedPacket packet) {
|
||||
|
||||
if(clientInfo != null && clientInfo.getName() != null) {
|
||||
tempServerName = clientInfo.getName().toLowerCase();
|
||||
if(!Storage.Blacklist.isOnIgnoredServer(tempServerName))
|
||||
commands.addAll(Storage.Blacklist.getBlacklist().getCommands());
|
||||
final ClientInfo clientInfo = clients.get(serverName);
|
||||
if (clientInfo == null)
|
||||
return;
|
||||
|
||||
clientInfo.updateSyncTime();
|
||||
|
||||
List<GeneralBlacklist> serverBlacklists = Storage.Blacklist.getBlacklists(clientInfo.getName());
|
||||
serverBlacklists.stream().filter(serverBlacklist -> serverBlacklist != null && serverBlacklist.getCommands() != null).forEach(serverBlacklist -> commands.addAll(serverBlacklist.getCommands()));
|
||||
}
|
||||
|
||||
final String serverName = tempServerName;
|
||||
List<TinyGroup> groups = new ArrayList<>();
|
||||
}
|
||||
|
||||
TinyGroup tinyGroup;
|
||||
for (Group group : GroupManager.getGroups()) {
|
||||
if(groups.stream().anyMatch(cTG -> cTG.getGroupName().equals(group.getGroupName()))) continue;
|
||||
// PROXY -> BACKEND
|
||||
public void handleP2BPacket(CommunicationPackets.PATPacket incomingPacket) {
|
||||
|
||||
tinyGroup = new TinyGroup(group.getGroupName(), group.getPriority(), group.getAllCommands(serverName));
|
||||
for (GroupBlacklist groupBlacklist : group.getAllServerGroupBlacklist(serverName))
|
||||
tinyGroup.addAll(groupBlacklist.getCommands());
|
||||
if (!incomingPacket.tokenMatches(Storage.TOKEN)) {
|
||||
|
||||
return;
|
||||
|
||||
groups.add(tinyGroup);
|
||||
}
|
||||
|
||||
groupsPacket = new CommunicationPackets.GroupsPacket(groups);
|
||||
commandsPacket.setTurnBlacklistToWhitelist(Storage.ConfigSections.Settings.TURN_BLACKLIST_TO_WHITELIST.ENABLED);
|
||||
commandsPacket.setCommands(commands);
|
||||
if (incomingPacket instanceof CommunicationPackets.Proxy2Backend.KeepAliveResponsePacket packet) {
|
||||
|
||||
bundle = new CommunicationPackets.PacketBundle(Storage.TOKEN, serverId, commandsPacket, groupsPacket);
|
||||
clientInfo.sendBytes(CommunicationPackets.convertToBytes(bundle));
|
||||
lastReceivedKeepAliveResponse = System.currentTimeMillis();
|
||||
BackendUpdater.receivedKeepAlivePacket();
|
||||
|
||||
PATEventHandler.callSentSyncEvents(bundle, serverName);
|
||||
}
|
||||
return;
|
||||
|
||||
public static void sendRequest() {
|
||||
if(System.currentTimeMillis() - LAST_SENT_REQUEST >= 5000) {
|
||||
LAST_SENT_REQUEST = System.currentTimeMillis();
|
||||
sendPacket(new CommunicationPackets.RequestPacket(Storage.TOKEN, SERVER_ID.toString()));
|
||||
}
|
||||
|
||||
if (incomingPacket instanceof CommunicationPackets.Proxy2Backend.IdentityPacket packet) {
|
||||
|
||||
Storage.SERVER_NAME = packet.serverName();
|
||||
|
||||
send2Proxy(new CommunicationPackets.Backend2Proxy.IdentityResponsePacket(id));
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (incomingPacket instanceof CommunicationPackets.Proxy2Backend.DataSyncPacket packet) {
|
||||
|
||||
lastSync = System.currentTimeMillis();
|
||||
|
||||
send2Proxy(new CommunicationPackets.Backend2Proxy.DataSyncReceivedPacket());
|
||||
BukkitLoader.handleDataSyncPacket(packet);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (incomingPacket instanceof CommunicationPackets.Proxy2Backend.UpdatePacket packet) {
|
||||
|
||||
BukkitLoader.handleUpdateCommandsPacket(packet);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (incomingPacket instanceof CommunicationPackets.Proxy2Backend.NotificationPacket packet) {
|
||||
|
||||
BukkitLoader.handleNotificationPacket(packet);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (incomingPacket instanceof CommunicationPackets.Proxy2Backend.ConsoleMessagePacket packet) {
|
||||
|
||||
BukkitLoader.handleConsoleMessagePacket(packet);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (incomingPacket instanceof CommunicationPackets.Proxy2Backend.ExecutePlayerCommandPacket packet) {
|
||||
|
||||
BukkitLoader.handlePlayerExecuteCommandPacket(packet);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (incomingPacket instanceof CommunicationPackets.Proxy2Backend.ExecuteConsoleCommandPacket packet) {
|
||||
|
||||
BukkitLoader.handleConsoleExecuteCommandPacket(packet);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void sendPermissionReset() {
|
||||
if(Reflection.isProxyServer())
|
||||
sendPacket(new CommunicationPackets.ForcePermissionResetPacket(Storage.TOKEN));
|
||||
private void send2Proxy(CommunicationPackets.PATPacket packet) {
|
||||
|
||||
if (Reflection.isProxyServer()) {
|
||||
|
||||
Logger.warning("Cannot send B2P packet as proxy!");
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
client.send(packet);
|
||||
|
||||
}
|
||||
|
||||
public static void sendFeedback(UUID targetUUID) {
|
||||
if(Reflection.isProxyServer())
|
||||
sendPacket(new CommunicationPackets.ForcePermissionResetPacket(Storage.TOKEN, targetUUID));
|
||||
private void send2Client(ClientInfo clientInfo, CommunicationPackets.PATPacket packet) {
|
||||
|
||||
if (!Reflection.isProxyServer()) {
|
||||
|
||||
Logger.warning("Cannot send P2B packet as backend!");
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (clientInfo == null || Storage.ConfigSections.Settings.DISABLE_SYNC.DISABLED) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
clientInfo.send(packet);
|
||||
|
||||
}
|
||||
|
||||
public static void sendFeedback() {
|
||||
sendPacket(new CommunicationPackets.FeedbackPacket(Storage.TOKEN, SERVER_ID.toString()));
|
||||
private void send2AllClients(CommunicationPackets.PATPacket packet) {
|
||||
|
||||
if (!Reflection.isProxyServer()) {
|
||||
|
||||
Logger.warning("Cannot send P2B packet as backend!");
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (Storage.ConfigSections.Settings.DISABLE_SYNC.DISABLED) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
getClients().forEach(clientInfo -> {
|
||||
|
||||
clientInfo.send(packet);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public static Client getClient() {
|
||||
return CLIENT;
|
||||
private CommunicationPackets.Proxy2Backend.DataSyncPacket constructDataSyncPacket() {
|
||||
|
||||
return new CommunicationPackets.Proxy2Backend.DataSyncPacket(
|
||||
new CommunicationPackets.Proxy2Backend.DataSyncPacket.Messages(
|
||||
Storage.ConfigSections.Messages.PREFIX.PREFIX),
|
||||
new CommunicationPackets.Proxy2Backend.DataSyncPacket.AutoLowerCase(
|
||||
Storage.ConfigSections.Settings.AUTO_LOWERCASE_COMMANDS.ENABLED),
|
||||
new CommunicationPackets.Proxy2Backend.DataSyncPacket.UnknownCommand(
|
||||
Storage.ConfigSections.Settings.CUSTOM_UNKNOWN_COMMAND.ENABLED,
|
||||
Storage.ConfigSections.Settings.CUSTOM_UNKNOWN_COMMAND.MESSAGE));
|
||||
|
||||
}
|
||||
|
||||
public static ClientInfo getClientById(String id) {
|
||||
return CLIENTS.isEmpty() ? null : CLIENTS.stream().filter(client -> client != null && client.compareId(id)).findFirst().orElse(null);
|
||||
public void reload() {
|
||||
|
||||
this.client.reload();
|
||||
|
||||
}
|
||||
|
||||
public static ClientInfo getClientByName(String name) {
|
||||
return CLIENTS.isEmpty() ? null : CLIENTS.stream().filter(client -> client != null && client.getName().equalsIgnoreCase(name)).findFirst().orElse(null);
|
||||
public UUID getClientId(String serverName) {
|
||||
|
||||
final ClientInfo clientInfo = clients.get(serverName);
|
||||
if (clientInfo == null)
|
||||
return null;
|
||||
|
||||
return clientInfo.getId();
|
||||
|
||||
}
|
||||
|
||||
public static ClientInfo getQueueClientById(String id) {
|
||||
return QUEUE_CLIENTS.get(id);
|
||||
public boolean hasConnectedClients() {
|
||||
|
||||
return !clients.isEmpty();
|
||||
|
||||
}
|
||||
|
||||
public static void resetAllFeedbacks() {
|
||||
CLIENTS.forEach(client -> client.setFeedback(false));
|
||||
public Set<ClientInfo> getClients() {
|
||||
|
||||
return new HashSet<>(clients.values());
|
||||
|
||||
}
|
||||
|
||||
public static List<String> getRegisteredServerNames() {
|
||||
List<String> result = new ArrayList<>();
|
||||
CLIENTS.stream().filter(client -> client != null && client.getName() != null).forEach(client -> result.add(client.getName()));
|
||||
return result;
|
||||
public UUID getId() {
|
||||
|
||||
return id;
|
||||
|
||||
}
|
||||
|
||||
public long getLastReceivedKeepAliveResponse() {
|
||||
|
||||
return lastReceivedKeepAliveResponse;
|
||||
|
||||
}
|
||||
|
||||
public long getLastSync() {
|
||||
|
||||
return lastSync;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,58 +1,84 @@
|
||||
package de.rayzs.pat.api.communication.client;
|
||||
|
||||
import de.rayzs.pat.utils.CommunicationPackets;
|
||||
import de.rayzs.pat.utils.TimeConverter;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public abstract class ClientInfo {
|
||||
|
||||
private String id, name;
|
||||
private UUID id;
|
||||
private String serverName;
|
||||
|
||||
private boolean sentFeedback = false;
|
||||
private long syncTime = System.currentTimeMillis();
|
||||
private long syncTime = System.currentTimeMillis(), keepAliveTime = System.currentTimeMillis();
|
||||
|
||||
public ClientInfo(UUID id) {
|
||||
|
||||
this.id = id;
|
||||
|
||||
public ClientInfo(String serverId) {
|
||||
this.id = serverId;
|
||||
}
|
||||
|
||||
public ClientInfo(String serverId, String name) {
|
||||
this.id = serverId;
|
||||
this.name = name;
|
||||
public ClientInfo(UUID id, String name) {
|
||||
|
||||
this.id = id;
|
||||
this.serverName = name;
|
||||
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
public abstract void send(CommunicationPackets.PATPacket packet);
|
||||
|
||||
public void setServerName(String name) {
|
||||
|
||||
this.serverName = name;
|
||||
|
||||
}
|
||||
|
||||
public void setId(String serverId) {
|
||||
this.id = serverId;
|
||||
public void setId(UUID id) {
|
||||
|
||||
this.id = id;
|
||||
|
||||
}
|
||||
|
||||
public abstract void sendBytes(byte[] bytes);
|
||||
public String getServerName() {
|
||||
|
||||
return serverName;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public boolean compareId(String id) {
|
||||
return this.id.equals(id);
|
||||
}
|
||||
public void updateSyncTime() {
|
||||
|
||||
public void syncTime() {
|
||||
syncTime = System.currentTimeMillis();
|
||||
|
||||
}
|
||||
|
||||
public String getSyncTime() {
|
||||
public void updateKeepAliveTime() {
|
||||
|
||||
keepAliveTime = System.currentTimeMillis();
|
||||
|
||||
}
|
||||
|
||||
public boolean isAlive() {
|
||||
|
||||
return System.currentTimeMillis() - keepAliveTime > 5000;
|
||||
|
||||
}
|
||||
|
||||
public String getFormattedSyncTime() {
|
||||
|
||||
return TimeConverter.calcAndGetTime(syncTime);
|
||||
|
||||
}
|
||||
|
||||
public void setFeedback(boolean state) {
|
||||
this.sentFeedback = state;
|
||||
public String getFormattedLastReceivedKeepAlivePacketTime() {
|
||||
|
||||
return TimeConverter.calcAndGetTime(keepAliveTime);
|
||||
|
||||
}
|
||||
|
||||
public boolean hasSentFeedback() {
|
||||
return sentFeedback;
|
||||
}
|
||||
public UUID getId() {
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,51 +2,45 @@ package de.rayzs.pat.api.communication.client.impl;
|
||||
|
||||
import de.rayzs.pat.api.communication.client.ClientInfo;
|
||||
import de.rayzs.pat.api.communication.Client;
|
||||
import de.rayzs.pat.utils.CommunicationPackets;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class BungeeClientInfo extends ClientInfo {
|
||||
|
||||
public BungeeClientInfo(String serverId) {
|
||||
super(serverId);
|
||||
public BungeeClientInfo(UUID id) {
|
||||
|
||||
super(id);
|
||||
|
||||
}
|
||||
|
||||
public BungeeClientInfo(String serverId, String name) {
|
||||
super(serverId, name);
|
||||
public BungeeClientInfo(UUID id, String name) {
|
||||
|
||||
super(id, name);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBytes(byte[] bytes) {
|
||||
ProxyServer.getInstance().getServers().entrySet().stream().filter(entry -> entry.getKey().equalsIgnoreCase(getName())).forEach(entry -> entry.getValue().sendData(Client.CHANNEL_NAME, bytes));
|
||||
public void send(CommunicationPackets.PATPacket packet) {
|
||||
|
||||
final byte[] preparedPacket = CommunicationPackets.preparePacket(packet, getId());
|
||||
|
||||
if (preparedPacket == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
final ServerInfo serverInfo = ProxyServer.getInstance().getServerInfo(getServerName());
|
||||
|
||||
if (serverInfo != null) {
|
||||
|
||||
serverInfo.sendData(Client.CHANNEL_NAME, preparedPacket);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return super.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return super.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSyncTime() {
|
||||
return super.getSyncTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFeedback(boolean state) {
|
||||
super.setFeedback(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(String serverId) {
|
||||
super.setId(serverId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(String name) {
|
||||
super.setName(name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,51 +1,47 @@
|
||||
package de.rayzs.pat.api.communication.client.impl;
|
||||
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import de.rayzs.pat.api.communication.impl.VelocityClient;
|
||||
import de.rayzs.pat.api.communication.client.ClientInfo;
|
||||
import de.rayzs.pat.plugin.VelocityLoader;
|
||||
import de.rayzs.pat.utils.CommunicationPackets;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
public class VelocityClientInfo extends ClientInfo {
|
||||
|
||||
public VelocityClientInfo(String serverId) {
|
||||
super(serverId);
|
||||
public VelocityClientInfo(UUID id) {
|
||||
|
||||
super(id);
|
||||
|
||||
}
|
||||
|
||||
public VelocityClientInfo(String serverId, String name) {
|
||||
super(serverId, name);
|
||||
public VelocityClientInfo(UUID id, String name) {
|
||||
|
||||
super(id, name);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBytes(byte[] bytes) {
|
||||
VelocityLoader.getServer().getAllServers().stream().filter(server -> server.getServerInfo().getName().equalsIgnoreCase(getName())).forEach(server -> server.sendPluginMessage(VelocityClient.getIdentifier(), bytes));
|
||||
public void send(CommunicationPackets.PATPacket packet) {
|
||||
|
||||
final byte[] preparedPacket = CommunicationPackets.preparePacket(packet, getId());
|
||||
|
||||
if (preparedPacket == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
final Optional<RegisteredServer> optServer = VelocityLoader.getServer().getServer(getServerName());
|
||||
|
||||
optServer.ifPresent(registeredServer -> {
|
||||
|
||||
registeredServer.sendPluginMessage(VelocityClient.getIdentifier(), preparedPacket);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return super.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return super.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSyncTime() {
|
||||
return super.getSyncTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFeedback(boolean state) {
|
||||
super.setFeedback(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(String serverId) {
|
||||
super.setId(serverId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(String name) {
|
||||
super.setName(name);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package de.rayzs.pat.api.communication.impl;
|
||||
|
||||
import de.rayzs.pat.api.storage.Storage;
|
||||
import de.rayzs.pat.utils.scheduler.PATScheduler;
|
||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||
import de.rayzs.pat.utils.CommunicationPackets;
|
||||
@@ -7,30 +8,135 @@ import de.rayzs.pat.plugin.BukkitLoader;
|
||||
import de.rayzs.pat.api.communication.*;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.*;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class BukkitClient implements Client, PluginMessageListener {
|
||||
|
||||
private static final Server SERVER = Bukkit.getServer();
|
||||
private boolean registered = false;
|
||||
|
||||
public BukkitClient() {
|
||||
SERVER.getMessenger().registerIncomingPluginChannel(BukkitLoader.getPlugin(), CHANNEL_NAME, this);
|
||||
SERVER.getMessenger().registerOutgoingPluginChannel(BukkitLoader.getPlugin(), CHANNEL_NAME);
|
||||
|
||||
reload();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(Object packet) {
|
||||
try { SERVER.sendPluginMessage(BukkitLoader.getPlugin(), CHANNEL_NAME, CommunicationPackets.convertToBytes(packet));
|
||||
} catch (Throwable throwable) { throwable.printStackTrace(); }
|
||||
public void reload() {
|
||||
|
||||
if (!Storage.ConfigSections.Settings.HANDLE_THROUGH_PROXY.ENABLED) {
|
||||
|
||||
if (registered) {
|
||||
|
||||
unregister();
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (!registered) {
|
||||
|
||||
register();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void register() {
|
||||
|
||||
registered = true;
|
||||
|
||||
SERVER.getMessenger().registerIncomingPluginChannel(BukkitLoader.getPlugin(), CHANNEL_NAME, this);
|
||||
SERVER.getMessenger().registerOutgoingPluginChannel(BukkitLoader.getPlugin(), CHANNEL_NAME);
|
||||
|
||||
}
|
||||
|
||||
private void unregister() {
|
||||
|
||||
registered = false;
|
||||
|
||||
SERVER.getMessenger().unregisterIncomingPluginChannel(BukkitLoader.getPlugin(), CHANNEL_NAME, this);
|
||||
SERVER.getMessenger().unregisterOutgoingPluginChannel(BukkitLoader.getPlugin(), CHANNEL_NAME);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(CommunicationPackets.PATPacket packet) {
|
||||
|
||||
final byte[] preparedPacket = CommunicationPackets.preparePacket(packet);
|
||||
|
||||
if (preparedPacket == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
final Player carrier = selectCarrier();
|
||||
if (carrier == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
PATScheduler.execute(() -> {
|
||||
|
||||
if (!carrier.isOnline()) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
carrier.sendPluginMessage(BukkitLoader.getPlugin(), CHANNEL_NAME, preparedPacket);
|
||||
|
||||
} catch (Exception exception) {
|
||||
|
||||
exception.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
}, carrier);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPluginMessageReceived(String channel, Player player, byte[] bytes) {
|
||||
if(!channel.equals(CHANNEL_NAME)) return;
|
||||
try {
|
||||
Object packetObj = CommunicationPackets.buildFromBytes(bytes);
|
||||
if(!CommunicationPackets.isPacket(packetObj)) return;
|
||||
|
||||
PATScheduler.createScheduler(() -> Communicator.receiveInformation("proxy", packetObj));
|
||||
} catch (Throwable throwable) { throwable.printStackTrace(); }
|
||||
if (!channel.equals(CHANNEL_NAME)) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
final Object packetObj = CommunicationPackets.readPacket(bytes);
|
||||
|
||||
if (!CommunicationPackets.isP2BPacket(packetObj)) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
PATScheduler.createScheduler(
|
||||
() -> Communicator.get().handleP2BPacket((CommunicationPackets.PATPacket) packetObj));
|
||||
|
||||
} catch (Exception exception) {
|
||||
|
||||
exception.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Player selectCarrier() {
|
||||
|
||||
final Iterator<? extends Player> iterator = SERVER.getOnlinePlayers().iterator();
|
||||
return iterator.hasNext() ? iterator.next() : null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package de.rayzs.pat.api.communication.impl;
|
||||
|
||||
import de.rayzs.pat.api.storage.Storage;
|
||||
import net.md_5.bungee.api.event.PluginMessageEvent;
|
||||
import de.rayzs.pat.utils.CommunicationPackets;
|
||||
import net.md_5.bungee.api.connection.Server;
|
||||
@@ -10,32 +11,93 @@ import de.rayzs.pat.plugin.BungeeLoader;
|
||||
import de.rayzs.pat.api.communication.*;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class BungeeClient implements Client, Listener {
|
||||
|
||||
private static final ProxyServer SERVER = ProxyServer.getInstance();
|
||||
|
||||
public BungeeClient() {
|
||||
|
||||
if (Storage.ConfigSections.Settings.DISABLE_SYNC.DISABLED) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
SERVER.registerChannel(CHANNEL_NAME);
|
||||
SERVER.getPluginManager().registerListener(BungeeLoader.getPlugin(), this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(Object packet) {
|
||||
for(ServerInfo serverInfo : ProxyServer.getInstance().getServers().values()) {
|
||||
try { serverInfo.sendData(CHANNEL_NAME, CommunicationPackets.convertToBytes(packet));
|
||||
} catch (Throwable throwable) { throwable.printStackTrace(); }
|
||||
public void reload() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(CommunicationPackets.PATPacket packet) {
|
||||
|
||||
final byte[] preparedPacket = CommunicationPackets.preparePacket(packet);
|
||||
|
||||
if (preparedPacket == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
for (ServerInfo serverInfo : ProxyServer.getInstance().getServers().values()) {
|
||||
|
||||
try {
|
||||
|
||||
serverInfo.sendData(CHANNEL_NAME, preparedPacket);
|
||||
|
||||
} catch (Exception exception) {
|
||||
|
||||
exception.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onQueryReceive(PluginMessageEvent event) {
|
||||
if (!event.getTag().equalsIgnoreCase(CHANNEL_NAME)) return;
|
||||
try {
|
||||
Object packetObj = CommunicationPackets.buildFromBytes(event.getData());
|
||||
if(!CommunicationPackets.isPacket(packetObj)) return;
|
||||
|
||||
Server server = (Server) event.getSender();
|
||||
Communicator.receiveInformation(server.getInfo().getName().toLowerCase(), packetObj);
|
||||
} catch (Throwable throwable) { throwable.printStackTrace(); }
|
||||
if (!event.getTag().equalsIgnoreCase(CHANNEL_NAME)) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
final Server server = (Server) event.getSender();
|
||||
final String serverName = server.getInfo().getName();
|
||||
final UUID clientId = Communicator.get().getClientId(serverName);
|
||||
|
||||
if (!CommunicationPackets.isInitialPacket(event.getData()) && clientId == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
Object packetObj = CommunicationPackets.readPacket(event.getData(), clientId);
|
||||
if (!CommunicationPackets.isB2PPacket(packetObj)) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
Communicator.get().handleB2PPacket(serverName, (CommunicationPackets.PATPacket) packetObj);
|
||||
|
||||
} catch (Throwable throwable) {
|
||||
|
||||
throwable.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,11 +3,13 @@ package de.rayzs.pat.api.communication.impl;
|
||||
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
|
||||
import com.velocitypowered.api.event.connection.PluginMessageEvent;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import de.rayzs.pat.api.storage.Storage;
|
||||
import de.rayzs.pat.utils.CommunicationPackets;
|
||||
import com.velocitypowered.api.event.Subscribe;
|
||||
import de.rayzs.pat.plugin.VelocityLoader;
|
||||
import de.rayzs.pat.api.communication.*;
|
||||
import com.velocitypowered.api.proxy.*;
|
||||
import java.util.UUID;
|
||||
|
||||
public class VelocityClient implements Client {
|
||||
|
||||
@@ -15,29 +17,85 @@ public class VelocityClient implements Client {
|
||||
private static final MinecraftChannelIdentifier IDENTIFIER = MinecraftChannelIdentifier.from(CHANNEL_NAME);
|
||||
|
||||
public VelocityClient() {
|
||||
|
||||
if (Storage.ConfigSections.Settings.DISABLE_SYNC.DISABLED) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
SERVER.getChannelRegistrar().register(IDENTIFIER);
|
||||
SERVER.getEventManager().register(VelocityLoader.getInstance(), this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(Object packet) {
|
||||
for (RegisteredServer registeredServer : SERVER.getAllServers()) {
|
||||
try { registeredServer.sendPluginMessage(IDENTIFIER, CommunicationPackets.convertToBytes(packet));
|
||||
} catch (Throwable throwable) { throwable.printStackTrace(); }
|
||||
public void reload() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(CommunicationPackets.PATPacket packet) {
|
||||
|
||||
final byte[] preparedPacket = CommunicationPackets.preparePacket(packet);
|
||||
|
||||
if (preparedPacket == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
for (RegisteredServer registeredServer : SERVER.getAllServers()) {
|
||||
|
||||
try {
|
||||
|
||||
registeredServer.sendPluginMessage(IDENTIFIER, preparedPacket);
|
||||
|
||||
} catch (Exception exception) {
|
||||
|
||||
exception.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onQueryReceive(PluginMessageEvent event) {
|
||||
if (event.getIdentifier() != IDENTIFIER) return;
|
||||
Object packetObj = CommunicationPackets.buildFromBytes(event.getData());
|
||||
if(!CommunicationPackets.isPacket(packetObj)) return;
|
||||
|
||||
ServerConnection server = (ServerConnection) event.getSource();
|
||||
Communicator.receiveInformation(server.getServerInfo().getName().toLowerCase(), packetObj);
|
||||
if (event.getIdentifier() != IDENTIFIER) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
final ServerConnection server = (ServerConnection) event.getSource();
|
||||
final String serverName = server.getServerInfo().getName();
|
||||
final UUID clientId = Communicator.get().getClientId(serverName);
|
||||
|
||||
if (!CommunicationPackets.isInitialPacket(event.getData()) && clientId == null) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
Object packetObj = CommunicationPackets.readPacket(event.getData(), clientId);
|
||||
|
||||
if (!CommunicationPackets.isB2PPacket(packetObj)) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
Communicator.get().handleB2PPacket(serverName, (CommunicationPackets.PATPacket) packetObj);
|
||||
|
||||
}
|
||||
|
||||
public static MinecraftChannelIdentifier getIdentifier() {
|
||||
|
||||
return IDENTIFIER;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,19 +6,29 @@ public abstract class PATEvent<T> {
|
||||
private boolean cancelled = false;
|
||||
|
||||
public PATEvent(Object senderObj) {
|
||||
|
||||
this.senderObj = senderObj;
|
||||
|
||||
}
|
||||
|
||||
public abstract void handle(T t);
|
||||
|
||||
public void setCancelled(boolean cancelled) {
|
||||
|
||||
this.cancelled = cancelled;
|
||||
|
||||
}
|
||||
|
||||
public Object getSenderObj() {
|
||||
|
||||
return senderObj;
|
||||
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
|
||||
return cancelled;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,191 +9,303 @@ public class PATEventHandler {
|
||||
|
||||
private static List<PATEvent> EVENTS = new ArrayList<>();
|
||||
|
||||
public static ExecuteCommandEvent callExecuteCommandEvents(Object senderObj, String command, boolean blocked) {
|
||||
ExecuteCommandEvent event = EmptyEvent.createEmptyExecuteCommandEvent(senderObj, command, blocked);
|
||||
public static ExecuteCommandEvent callExecuteCommandEvents(Object senderObj, String command, boolean blocked,
|
||||
boolean notify)
|
||||
{
|
||||
|
||||
ExecuteCommandEvent event = EmptyEvent.createEmptyExecuteCommandEvent(senderObj, command, blocked, notify);
|
||||
|
||||
for (PATEvent patEvent : EVENTS) {
|
||||
if(patEvent instanceof ExecuteCommandEvent) {
|
||||
|
||||
if (patEvent instanceof ExecuteCommandEvent) {
|
||||
|
||||
ExecuteCommandEvent executeCommandEvent = (ExecuteCommandEvent) patEvent;
|
||||
executeCommandEvent.handle(event);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return event;
|
||||
|
||||
}
|
||||
|
||||
public static FilteredSuggestionEvent callFilteredSuggestionEvents(Object senderObj, List<String> suggestions) {
|
||||
|
||||
FilteredSuggestionEvent event = EmptyEvent.createEmptyFilteredSuggestionEvent(senderObj, suggestions);
|
||||
|
||||
for (PATEvent patEvent : EVENTS) {
|
||||
if(patEvent instanceof FilteredSuggestionEvent) {
|
||||
|
||||
if (patEvent instanceof FilteredSuggestionEvent) {
|
||||
|
||||
FilteredSuggestionEvent filteredSuggestion = (FilteredSuggestionEvent) patEvent;
|
||||
filteredSuggestion.handle(event);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return event;
|
||||
|
||||
}
|
||||
|
||||
public static FilteredTabCompletionEvent callFilteredTabCompletionEvents(Object senderObj, String cursor, List<String> completion) {
|
||||
public static FilteredTabCompletionEvent callFilteredTabCompletionEvents(Object senderObj, String cursor,
|
||||
List<String> completion)
|
||||
{
|
||||
|
||||
FilteredTabCompletionEvent event = EmptyEvent.createEmptyFilteredTabCompletion(senderObj, cursor, completion);
|
||||
|
||||
for (PATEvent patEvent : EVENTS) {
|
||||
if(patEvent instanceof FilteredTabCompletionEvent) {
|
||||
|
||||
if (patEvent instanceof FilteredTabCompletionEvent) {
|
||||
|
||||
FilteredTabCompletionEvent filteredTabCompletion = (FilteredTabCompletionEvent) patEvent;
|
||||
filteredTabCompletion.handle(event);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return event;
|
||||
|
||||
}
|
||||
|
||||
public static ServerPlayersChangeEvent callServerPlayersChangeEvents(Object senderObj, ServerPlayersChangeEvent.Type type) {
|
||||
public static ServerPlayersChangeEvent callServerPlayersChangeEvents(Object senderObj,
|
||||
ServerPlayersChangeEvent.Type type)
|
||||
{
|
||||
|
||||
ServerPlayersChangeEvent event = EmptyEvent.createEmptyServerPlayersChangeEvent(senderObj, type);
|
||||
|
||||
for (PATEvent patEvent : EVENTS) {
|
||||
if(patEvent instanceof ServerPlayersChangeEvent) {
|
||||
|
||||
if (patEvent instanceof ServerPlayersChangeEvent) {
|
||||
|
||||
ServerPlayersChangeEvent serverPlayersChangeEvent = (ServerPlayersChangeEvent) patEvent;
|
||||
serverPlayersChangeEvent.handle(event);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return event;
|
||||
|
||||
}
|
||||
|
||||
public static UpdatePluginEvent callUpdatePluginEvents() {
|
||||
|
||||
UpdatePluginEvent event = EmptyEvent.createEmptyUpdatePluginEvent();
|
||||
|
||||
for (PATEvent patEvent : EVENTS) {
|
||||
if(patEvent instanceof UpdatePluginEvent) {
|
||||
|
||||
if (patEvent instanceof UpdatePluginEvent) {
|
||||
|
||||
UpdatePluginEvent updatePluginEvent = (UpdatePluginEvent) patEvent;
|
||||
updatePluginEvent.handle(event);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return event;
|
||||
|
||||
}
|
||||
|
||||
public static UpdatePlayerCommandsEvent callUpdatePlayerCommandsEvents(Object playerObj, List<String> commands, boolean serverBased) {
|
||||
UpdatePlayerCommandsEvent event = EmptyEvent.createEmptyUpdatePlayerCommandsEvent(playerObj, commands, serverBased);
|
||||
public static UpdatePlayerCommandsEvent callUpdatePlayerCommandsEvents(Object playerObj, List<String> commands,
|
||||
boolean serverBased)
|
||||
{
|
||||
|
||||
UpdatePlayerCommandsEvent event = EmptyEvent.createEmptyUpdatePlayerCommandsEvent(playerObj, commands,
|
||||
serverBased);
|
||||
|
||||
for (PATEvent patEvent : EVENTS) {
|
||||
if(patEvent instanceof UpdatePlayerCommandsEvent) {
|
||||
|
||||
if (patEvent instanceof UpdatePlayerCommandsEvent) {
|
||||
|
||||
UpdatePlayerCommandsEvent updatePlayerCommandsEvent = (UpdatePlayerCommandsEvent) patEvent;
|
||||
updatePlayerCommandsEvent.handle(event);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return event;
|
||||
|
||||
}
|
||||
|
||||
public static SentSyncEvent callSentSyncEvents(CommunicationPackets.PacketBundle packetBundle, String serverName) {
|
||||
SentSyncEvent event = EmptyEvent.createEmptySentSyncEvent(packetBundle, serverName);
|
||||
public static SentSyncEvent callSentSyncEvents(CommunicationPackets.Proxy2Backend.DataSyncPacket dataSyncPacket,
|
||||
String serverName)
|
||||
{
|
||||
|
||||
SentSyncEvent event = EmptyEvent.createEmptySentSyncEvent(dataSyncPacket, serverName);
|
||||
|
||||
for (PATEvent patEvent : EVENTS) {
|
||||
if(patEvent instanceof SentSyncEvent) {
|
||||
|
||||
if (patEvent instanceof SentSyncEvent) {
|
||||
|
||||
SentSyncEvent sentSyncEvent = (SentSyncEvent) patEvent;
|
||||
sentSyncEvent.handle(event);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return event;
|
||||
|
||||
}
|
||||
|
||||
public static ReceiveSyncEvent callReceiveSyncEvents(CommunicationPackets.PacketBundle packetBundle) {
|
||||
ReceiveSyncEvent event = EmptyEvent.createEmptyReceiveSyncEvent(packetBundle);
|
||||
public static ReceiveSyncEvent callReceiveSyncEvents(
|
||||
CommunicationPackets.Proxy2Backend.DataSyncPacket dataSyncPacket)
|
||||
{
|
||||
|
||||
ReceiveSyncEvent event = EmptyEvent.createEmptyReceiveSyncEvent(dataSyncPacket);
|
||||
|
||||
for (PATEvent patEvent : EVENTS) {
|
||||
if(patEvent instanceof ReceiveSyncEvent) {
|
||||
|
||||
if (patEvent instanceof ReceiveSyncEvent) {
|
||||
|
||||
ReceiveSyncEvent proxySyncEvent = (ReceiveSyncEvent) patEvent;
|
||||
proxySyncEvent.handle(event);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return event;
|
||||
|
||||
}
|
||||
|
||||
public static void register(PATEvent event) {
|
||||
|
||||
EVENTS.add(event);
|
||||
|
||||
}
|
||||
|
||||
public static void unregister(PATEvent event) {
|
||||
|
||||
EVENTS.remove(event);
|
||||
|
||||
}
|
||||
|
||||
public static class EmptyEvent {
|
||||
|
||||
public static ServerPlayersChangeEvent createEmptyServerPlayersChangeEvent(Object senderObj, ServerPlayersChangeEvent.Type type) {
|
||||
public static ServerPlayersChangeEvent createEmptyServerPlayersChangeEvent(Object senderObj,
|
||||
ServerPlayersChangeEvent.Type type)
|
||||
{
|
||||
|
||||
return new ServerPlayersChangeEvent(senderObj, type) {
|
||||
|
||||
@Override
|
||||
public void handle(ServerPlayersChangeEvent event) {
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public static SentSyncEvent createEmptySentSyncEvent(CommunicationPackets.PacketBundle packetBundle, String serverName) {
|
||||
return new SentSyncEvent(null, packetBundle, serverName) {
|
||||
public static SentSyncEvent createEmptySentSyncEvent(
|
||||
CommunicationPackets.Proxy2Backend.DataSyncPacket dataSyncPacket, String serverName)
|
||||
{
|
||||
|
||||
return new SentSyncEvent(null, dataSyncPacket, serverName) {
|
||||
|
||||
@Override
|
||||
public void handle(SentSyncEvent event) {
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public static ReceiveSyncEvent createEmptyReceiveSyncEvent(CommunicationPackets.PacketBundle packetBundle) {
|
||||
return new ReceiveSyncEvent(null, packetBundle) {
|
||||
public static ReceiveSyncEvent createEmptyReceiveSyncEvent(
|
||||
CommunicationPackets.Proxy2Backend.DataSyncPacket dataSyncPacket)
|
||||
{
|
||||
|
||||
return new ReceiveSyncEvent(null, dataSyncPacket) {
|
||||
|
||||
@Override
|
||||
public void handle(ReceiveSyncEvent event) {
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public static UpdatePlayerCommandsEvent createEmptyUpdatePlayerCommandsEvent(Object playerObj, List<String> commands, boolean serverBased) {
|
||||
public static UpdatePlayerCommandsEvent createEmptyUpdatePlayerCommandsEvent(Object playerObj,
|
||||
List<String> commands, boolean serverBased)
|
||||
{
|
||||
|
||||
return new UpdatePlayerCommandsEvent(playerObj, commands, serverBased) {
|
||||
|
||||
@Override
|
||||
public void handle(UpdatePlayerCommandsEvent event) {
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public static UpdatePluginEvent createEmptyUpdatePluginEvent() {
|
||||
|
||||
return new UpdatePluginEvent(null) {
|
||||
|
||||
@Override
|
||||
public void handle(UpdatePluginEvent event) {
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public static ExecuteCommandEvent createEmptyExecuteCommandEvent(Object senderObj, String command, boolean blocked) {
|
||||
return new ExecuteCommandEvent(senderObj, command, blocked) {
|
||||
public static ExecuteCommandEvent createEmptyExecuteCommandEvent(Object senderObj, String command,
|
||||
boolean blocked, boolean notify)
|
||||
{
|
||||
|
||||
return new ExecuteCommandEvent(senderObj, command, blocked, notify) {
|
||||
|
||||
@Override
|
||||
public void handle(ExecuteCommandEvent event) {
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public static FilteredSuggestionEvent createEmptyFilteredSuggestionEvent(Object senderObj, List<String> suggestions) {
|
||||
public static FilteredSuggestionEvent createEmptyFilteredSuggestionEvent(Object senderObj,
|
||||
List<String> suggestions)
|
||||
{
|
||||
|
||||
return new FilteredSuggestionEvent(senderObj, suggestions) {
|
||||
|
||||
@Override
|
||||
public void handle(FilteredSuggestionEvent event) {
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public static FilteredTabCompletionEvent createEmptyFilteredTabCompletion(Object senderObj, String cursor, List<String> completion) {
|
||||
public static FilteredTabCompletionEvent createEmptyFilteredTabCompletion(Object senderObj, String cursor,
|
||||
List<String> completion)
|
||||
{
|
||||
|
||||
return new FilteredTabCompletionEvent(senderObj, cursor, completion) {
|
||||
|
||||
@Override
|
||||
public void handle(FilteredTabCompletionEvent event) {
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,29 +5,54 @@ import de.rayzs.pat.api.event.PATEvent;
|
||||
public abstract class ExecuteCommandEvent extends PATEvent<ExecuteCommandEvent> {
|
||||
|
||||
private final String command;
|
||||
private boolean blocked;
|
||||
private boolean blocked, notify;
|
||||
|
||||
public ExecuteCommandEvent() {
|
||||
|
||||
super(null);
|
||||
this.blocked = false;
|
||||
this.notify = false;
|
||||
this.command = null;
|
||||
|
||||
}
|
||||
|
||||
public ExecuteCommandEvent(Object senderObj, String command, boolean blocked) {
|
||||
public ExecuteCommandEvent(Object senderObj, String command, boolean blocked, boolean notify) {
|
||||
|
||||
super(senderObj);
|
||||
this.blocked = blocked;
|
||||
this.command = command;
|
||||
this.notify = notify;
|
||||
|
||||
}
|
||||
|
||||
public void setDoesNotify(boolean notify) {
|
||||
|
||||
this.notify = notify;
|
||||
|
||||
}
|
||||
|
||||
public String getCommand() {
|
||||
|
||||
return command;
|
||||
|
||||
}
|
||||
|
||||
public boolean isBlocked() {
|
||||
|
||||
return blocked;
|
||||
|
||||
}
|
||||
|
||||
public boolean doesNotify() {
|
||||
|
||||
return notify;
|
||||
|
||||
}
|
||||
|
||||
public void setBlocked(boolean blocked) {
|
||||
|
||||
this.blocked = blocked;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,20 +8,29 @@ public abstract class FilteredSuggestionEvent extends PATEvent<FilteredSuggestio
|
||||
private List<String> suggestions;
|
||||
|
||||
public FilteredSuggestionEvent() {
|
||||
|
||||
super(null);
|
||||
this.suggestions = null;
|
||||
|
||||
}
|
||||
|
||||
public FilteredSuggestionEvent(Object senderObj, List<String> suggestions) {
|
||||
|
||||
super(senderObj);
|
||||
this.suggestions = suggestions;
|
||||
|
||||
}
|
||||
|
||||
public List<String> getSuggestions() {
|
||||
|
||||
return suggestions;
|
||||
|
||||
}
|
||||
|
||||
public void setSuggestions(List<String> suggestions) {
|
||||
|
||||
this.suggestions = suggestions;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,28 +9,39 @@ public abstract class FilteredTabCompletionEvent extends PATEvent<FilteredTabCom
|
||||
private List<String> completion;
|
||||
|
||||
public FilteredTabCompletionEvent() {
|
||||
|
||||
super(null);
|
||||
this.cursor = null;
|
||||
this.completion = null;
|
||||
|
||||
}
|
||||
|
||||
public FilteredTabCompletionEvent(Object senderObj, String cursor, List<String> completion) {
|
||||
|
||||
super(senderObj);
|
||||
this.cursor = cursor;
|
||||
this.completion = completion;
|
||||
|
||||
}
|
||||
|
||||
public abstract void handle(FilteredTabCompletionEvent event);
|
||||
|
||||
public String getCursor() {
|
||||
|
||||
return cursor;
|
||||
|
||||
}
|
||||
|
||||
public List<String> getCompletion() {
|
||||
|
||||
return completion;
|
||||
|
||||
}
|
||||
|
||||
public void setCompletion(List<String> completion) {
|
||||
|
||||
this.completion = completion;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,19 +5,26 @@ import de.rayzs.pat.api.event.PATEvent;
|
||||
|
||||
public abstract class ReceiveSyncEvent extends PATEvent<ReceiveSyncEvent> {
|
||||
|
||||
private final CommunicationPackets.PacketBundle packetBundle;
|
||||
private final CommunicationPackets.Proxy2Backend.DataSyncPacket dataSyncPacket;
|
||||
|
||||
public ReceiveSyncEvent() {
|
||||
|
||||
super(null);
|
||||
this.packetBundle = null;
|
||||
this.dataSyncPacket = null;
|
||||
|
||||
}
|
||||
|
||||
public ReceiveSyncEvent(Object senderObj, CommunicationPackets.PacketBundle packetBundle) {
|
||||
public ReceiveSyncEvent(Object senderObj, CommunicationPackets.Proxy2Backend.DataSyncPacket dataSyncPacket) {
|
||||
|
||||
super(senderObj);
|
||||
this.packetBundle = packetBundle;
|
||||
this.dataSyncPacket = dataSyncPacket;
|
||||
|
||||
}
|
||||
|
||||
public CommunicationPackets.PacketBundle getPacketBundle() {
|
||||
return packetBundle;
|
||||
public CommunicationPackets.Proxy2Backend.DataSyncPacket getDataSyncPacket() {
|
||||
|
||||
return dataSyncPacket;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,26 +5,37 @@ import de.rayzs.pat.api.event.PATEvent;
|
||||
|
||||
public abstract class SentSyncEvent extends PATEvent<SentSyncEvent> {
|
||||
|
||||
private final CommunicationPackets.PacketBundle packetBundle;
|
||||
private final CommunicationPackets.Proxy2Backend.DataSyncPacket dataSyncPacket;
|
||||
private final String serverName;
|
||||
|
||||
public SentSyncEvent() {
|
||||
|
||||
super(null);
|
||||
this.packetBundle = null;
|
||||
this.dataSyncPacket = null;
|
||||
this.serverName = null;
|
||||
|
||||
}
|
||||
|
||||
public SentSyncEvent(Object senderObj, CommunicationPackets.PacketBundle packetBundle, String serverName) {
|
||||
public SentSyncEvent(Object senderObj, CommunicationPackets.Proxy2Backend.DataSyncPacket dataSyncPacket,
|
||||
String serverName)
|
||||
{
|
||||
|
||||
super(senderObj);
|
||||
this.packetBundle = packetBundle;
|
||||
this.dataSyncPacket = dataSyncPacket;
|
||||
this.serverName = serverName;
|
||||
|
||||
}
|
||||
|
||||
public String getServerName() {
|
||||
|
||||
return serverName;
|
||||
|
||||
}
|
||||
|
||||
public CommunicationPackets.PacketBundle getPacketBundle() {
|
||||
return packetBundle;
|
||||
public CommunicationPackets.Proxy2Backend.DataSyncPacket getDataSyncPacket() {
|
||||
|
||||
return dataSyncPacket;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,14 +7,21 @@ public abstract class ServerPlayersChangeEvent extends PATEvent<ServerPlayersCha
|
||||
private final Type type;
|
||||
|
||||
public ServerPlayersChangeEvent(Object senderObj, Type type) {
|
||||
|
||||
super(senderObj);
|
||||
this.type = type;
|
||||
|
||||
}
|
||||
|
||||
public ServerPlayersChangeEvent() {
|
||||
|
||||
super(null);
|
||||
this.type = Type.UNKNOWN;
|
||||
|
||||
}
|
||||
|
||||
public enum Type {
|
||||
JOINED, LEFT, UNKNOWN
|
||||
}
|
||||
|
||||
public enum Type { JOINED, LEFT, UNKNOWN }
|
||||
}
|
||||
@@ -9,20 +9,29 @@ public abstract class UpdatePlayerCommandsEvent extends PATEvent<UpdatePlayerCom
|
||||
private boolean serverBased;
|
||||
|
||||
public UpdatePlayerCommandsEvent() {
|
||||
|
||||
super(null);;
|
||||
|
||||
}
|
||||
|
||||
public UpdatePlayerCommandsEvent(Object senderObj, List<String> commands, boolean serverBased) {
|
||||
|
||||
super(senderObj);
|
||||
this.commands = commands;
|
||||
this.serverBased = serverBased;
|
||||
|
||||
}
|
||||
|
||||
public List<String> getCommands() {
|
||||
|
||||
return commands;
|
||||
|
||||
}
|
||||
|
||||
public boolean isServerBased() {
|
||||
|
||||
return serverBased;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,10 +5,15 @@ import de.rayzs.pat.api.event.PATEvent;
|
||||
public abstract class UpdatePluginEvent extends PATEvent<UpdatePluginEvent> {
|
||||
|
||||
public UpdatePluginEvent() {
|
||||
|
||||
super(null);;
|
||||
|
||||
}
|
||||
|
||||
public UpdatePluginEvent(Object senderObj) {
|
||||
|
||||
super(senderObj);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,34 +10,49 @@ public abstract class ExecuteCommandEvent extends Event implements Cancellable {
|
||||
private boolean blocked;
|
||||
|
||||
public ExecuteCommandEvent() {
|
||||
|
||||
this.blocked = false;
|
||||
this.command = null;
|
||||
|
||||
}
|
||||
|
||||
public ExecuteCommandEvent(Player player, String command, boolean blocked) {
|
||||
|
||||
this.blocked = blocked;
|
||||
this.command = command;
|
||||
|
||||
}
|
||||
|
||||
public String getCommand() {
|
||||
|
||||
return command;
|
||||
|
||||
}
|
||||
|
||||
public boolean isBlocked() {
|
||||
|
||||
return blocked;
|
||||
|
||||
}
|
||||
|
||||
public void setBlocked(boolean blocked) {
|
||||
|
||||
this.blocked = blocked;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
|
||||
return blocked;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
|
||||
this.blocked = cancel;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,18 +9,27 @@ public abstract class FilteredSuggestionEvent extends Event {
|
||||
private List<String> suggestions;
|
||||
|
||||
public FilteredSuggestionEvent() {
|
||||
|
||||
this.suggestions = null;
|
||||
|
||||
}
|
||||
|
||||
public FilteredSuggestionEvent(Player player, List<String> suggestions) {
|
||||
|
||||
this.suggestions = suggestions;
|
||||
|
||||
}
|
||||
|
||||
public List<String> getSuggestions() {
|
||||
|
||||
return suggestions;
|
||||
|
||||
}
|
||||
|
||||
public void setSuggestions(List<String> suggestions) {
|
||||
|
||||
this.suggestions = suggestions;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,26 +10,37 @@ public abstract class FilteredTabCompletionEvent extends Event {
|
||||
private List<String> completion;
|
||||
|
||||
public FilteredTabCompletionEvent() {
|
||||
|
||||
this.cursor = null;
|
||||
this.completion = null;
|
||||
|
||||
}
|
||||
|
||||
public FilteredTabCompletionEvent(Player player, String cursor, List<String> completion) {
|
||||
|
||||
this.cursor = cursor;
|
||||
this.completion = completion;
|
||||
|
||||
}
|
||||
|
||||
public abstract void handle(FilteredTabCompletionEvent event);
|
||||
|
||||
public String getCursor() {
|
||||
|
||||
return cursor;
|
||||
|
||||
}
|
||||
|
||||
public List<String> getCompletion() {
|
||||
|
||||
return completion;
|
||||
|
||||
}
|
||||
|
||||
public void setCompletion(List<String> completion) {
|
||||
|
||||
this.completion = completion;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package de.rayzs.pat.api.netty.bukkit;
|
||||
|
||||
import de.rayzs.pat.plugin.logger.Logger;
|
||||
import de.rayzs.pat.utils.permission.PermissionUtil;
|
||||
import de.rayzs.pat.api.netty.bukkit.handlers.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -7,6 +8,9 @@ import de.rayzs.pat.api.storage.Storage;
|
||||
import de.rayzs.pat.utils.ExpireCache;
|
||||
import de.rayzs.pat.utils.Reflection;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import de.rayzs.pat.utils.sender.CommandSender;
|
||||
import de.rayzs.pat.utils.sender.CommandSenderHandler;
|
||||
import org.bukkit.entity.Player;
|
||||
import io.netty.channel.*;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -18,122 +22,251 @@ public class BukkitPacketAnalyzer {
|
||||
private static final ExpireCache<UUID, Object> SENT_PACKET = new ExpireCache<>(2, TimeUnit.SECONDS);
|
||||
|
||||
private static final String HANDLER_NAME = "pat-bukkit-handler", PIPELINE_NAME = "packet_handler";
|
||||
private static final BukkitPacketHandler PACKET_HANDLER = Reflection.getMinor() >= 16 ? new ModernPacketHandler() : new LegacyPacketHandler();
|
||||
|
||||
private static final BukkitPacketHandler PACKET_HANDLER = Reflection.isAtLeast(1, 16) ? new ModernPacketHandler()
|
||||
: new LegacyPacketHandler();
|
||||
private static final BukkitPacketHandler COMMANDS_NODE_HANDLER = new ModernCommandsNodeHandler();
|
||||
|
||||
private static final HashMap<Player, String> PLAYER_INPUT_CACHE = new HashMap<>();
|
||||
|
||||
public static void injectAll() {
|
||||
|
||||
Bukkit.getOnlinePlayers().forEach(BukkitPacketAnalyzer::inject);
|
||||
|
||||
}
|
||||
|
||||
public static void uninjectAll() {
|
||||
|
||||
BukkitPacketAnalyzer.INJECTED_PLAYERS.keySet().forEach(BukkitPacketAnalyzer::uninject);
|
||||
BukkitPacketAnalyzer.INJECTED_PLAYERS.clear();
|
||||
|
||||
}
|
||||
|
||||
public static void sendPacket(UUID uuid, Object object) {
|
||||
|
||||
Channel channel = INJECTED_PLAYERS.get(uuid);
|
||||
if(channel == null) return;
|
||||
|
||||
if (channel == null)
|
||||
return;
|
||||
|
||||
SENT_PACKET.put(uuid, object);
|
||||
channel.pipeline().writeAndFlush(object);
|
||||
|
||||
}
|
||||
|
||||
public static boolean inject(Player player) {
|
||||
if(Storage.USE_VELOCITY) return true;
|
||||
|
||||
if (Storage.ConfigSections.Settings.HANDLE_THROUGH_PROXY.ENABLED)
|
||||
return true;
|
||||
|
||||
try {
|
||||
|
||||
Channel channel = Reflection.getPlayerChannel(player);
|
||||
if(channel == null) {
|
||||
System.err.println("Failed to inject " + player.getName() + "! Channel is null.");
|
||||
|
||||
if (channel == null) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
if(channel.pipeline().names().contains(BukkitPacketAnalyzer.HANDLER_NAME))
|
||||
if (channel.pipeline().names().contains(BukkitPacketAnalyzer.HANDLER_NAME))
|
||||
uninject(channel);
|
||||
|
||||
channel.pipeline().addBefore(BukkitPacketAnalyzer.PIPELINE_NAME, BukkitPacketAnalyzer.HANDLER_NAME, new PacketDecoder(player));
|
||||
channel.pipeline().addBefore(BukkitPacketAnalyzer.PIPELINE_NAME, BukkitPacketAnalyzer.HANDLER_NAME,
|
||||
new PacketDecoder(player));
|
||||
BukkitPacketAnalyzer.INJECTED_PLAYERS.put(player.getUniqueId(), channel);
|
||||
} catch (Throwable throwable) {
|
||||
throwable.printStackTrace();
|
||||
|
||||
} catch (IndexOutOfBoundsException indexOutOfBoundsException) {
|
||||
|
||||
Reflection.toggleInjectionMethod();
|
||||
boolean success = inject(player);
|
||||
|
||||
if (!success) {
|
||||
|
||||
Logger.warning(
|
||||
"Both injection methods failed! Please report this back to me on my Discord! (https://www.rayzs.de/discord)");
|
||||
|
||||
}
|
||||
|
||||
return success;
|
||||
|
||||
} catch (Exception exception) {
|
||||
|
||||
if (!Storage.ConfigSections.Settings.INJECTION_FAILED.SUPPRESS_EXCEPTIONS) {
|
||||
|
||||
exception.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
} return true;
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public static void uninject(UUID uuid) {
|
||||
if(Storage.USE_VELOCITY) return;
|
||||
|
||||
if(BukkitPacketAnalyzer.INJECTED_PLAYERS.containsKey(uuid)) {
|
||||
if (Storage.SEND_CONSOLE_NOTIFICATION)
|
||||
return;
|
||||
|
||||
if (BukkitPacketAnalyzer.INJECTED_PLAYERS.containsKey(uuid)) {
|
||||
|
||||
Channel channel = BukkitPacketAnalyzer.INJECTED_PLAYERS.get(uuid);
|
||||
uninject(channel);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void uninject(Channel channel) {
|
||||
if(Storage.USE_VELOCITY) return;
|
||||
|
||||
if(channel != null) {
|
||||
if (Storage.ConfigSections.Settings.HANDLE_THROUGH_PROXY.ENABLED)
|
||||
return;
|
||||
|
||||
if (channel != null) {
|
||||
|
||||
channel.eventLoop().submit(() -> {
|
||||
|
||||
ChannelPipeline pipeline = channel.pipeline();
|
||||
if (pipeline.names().contains(BukkitPacketAnalyzer.HANDLER_NAME)) pipeline.remove(BukkitPacketAnalyzer.HANDLER_NAME);
|
||||
|
||||
if (pipeline.names().contains(BukkitPacketAnalyzer.HANDLER_NAME))
|
||||
pipeline.remove(BukkitPacketAnalyzer.HANDLER_NAME);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static String getPlayerInput(Player player) {
|
||||
|
||||
String input = PLAYER_INPUT_CACHE.get(player);
|
||||
PLAYER_INPUT_CACHE.remove(player);
|
||||
return input;
|
||||
|
||||
}
|
||||
|
||||
public static void insertPlayerInput(Player player, String text) {
|
||||
|
||||
PLAYER_INPUT_CACHE.put(player, text);
|
||||
|
||||
}
|
||||
|
||||
private static class PacketDecoder extends ChannelDuplexHandler {
|
||||
|
||||
private final Player player;
|
||||
private final CommandSender sender;
|
||||
|
||||
private PacketDecoder(Player player) {
|
||||
|
||||
this.player = player;
|
||||
this.sender = CommandSenderHandler.from(player);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead(ChannelHandlerContext channel, Object packetObj) {
|
||||
try {
|
||||
if (!PermissionUtil.hasBypassPermission(player) && packetObj.getClass() != null) {
|
||||
String packetName = packetObj.getClass().getSimpleName();
|
||||
|
||||
if (packetName.equals("PacketPlayInTabComplete") || packetName.equals("ServerboundCommandSuggestionPacket")) {
|
||||
if (!PACKET_HANDLER.handleIncomingPacket(player, packetObj)) return;
|
||||
}
|
||||
try {
|
||||
|
||||
if (packetObj.getClass() == null || Storage.ConfigSections.Settings.HANDLE_THROUGH_PROXY.ENABLED) {
|
||||
|
||||
super.channelRead(channel, packetObj);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
String packetName = packetObj.getClass().getSimpleName();
|
||||
|
||||
if (!packetName.equals("PacketPlayInTabComplete")
|
||||
&& !packetName.equals("ServerboundCommandSuggestionPacket"))
|
||||
{
|
||||
|
||||
super.channelRead(channel, packetObj);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (!PermissionUtil.hasBypassPermission(sender)) {
|
||||
|
||||
if (!PACKET_HANDLER.handleIncomingPacket(player, sender, packetObj))
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
super.channelRead(channel, packetObj);
|
||||
} catch (Throwable exception) { exception.printStackTrace(); }
|
||||
|
||||
} catch (Throwable exception) {
|
||||
|
||||
exception.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(ChannelHandlerContext channel, Object packetObj, ChannelPromise promise) {
|
||||
|
||||
try {
|
||||
if(packetObj.getClass() != null)
|
||||
if (!PermissionUtil.hasBypassPermission(player)) {
|
||||
String packetName = packetObj.getClass().getSimpleName();
|
||||
if (packetName.equals("PacketPlayOutTabComplete") || packetName.equals("ClientboundCommandSuggestionsPacket")) {
|
||||
|
||||
UUID uuid = player.getUniqueId();
|
||||
if (packetObj.getClass() == null || Storage.ConfigSections.Settings.HANDLE_THROUGH_PROXY.ENABLED) {
|
||||
|
||||
if((packetName.equals("ClientboundCommandSuggestionsPacket") || Reflection.isFoliaServer()) && SENT_PACKET.contains(player.getUniqueId())) {
|
||||
Object newPacketObj = SENT_PACKET.get(uuid);
|
||||
SENT_PACKET.remove(uuid);
|
||||
super.write(channel, newPacketObj, promise);
|
||||
return;
|
||||
}
|
||||
super.write(channel, packetObj, promise);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
final String packetName = packetObj.getClass().getSimpleName();
|
||||
final boolean isCommandsPacket = packetName.equals("ClientboundCommandsPacket");
|
||||
final boolean isTabCompletePacket = packetName.equals("PacketPlayOutTabComplete")
|
||||
|| packetName.equals("ClientboundCommandSuggestionsPacket");
|
||||
|
||||
if (!isCommandsPacket && !isTabCompletePacket || PermissionUtil.hasBypassPermission(sender)) {
|
||||
|
||||
super.write(channel, packetObj, promise);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (isCommandsPacket) {
|
||||
|
||||
COMMANDS_NODE_HANDLER.handleOutgoingPacket(player, sender, packetObj);
|
||||
|
||||
super.write(channel, packetObj, promise);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
UUID uuid = player.getUniqueId();
|
||||
Object sentPacketObj = SENT_PACKET.get(uuid);
|
||||
|
||||
if (sentPacketObj != null) {
|
||||
|
||||
if (sentPacketObj == packetObj) {
|
||||
|
||||
SENT_PACKET.remove(uuid);
|
||||
super.write(channel, sentPacketObj, promise);
|
||||
return;
|
||||
|
||||
if(!PACKET_HANDLER.handleOutgoingPacket(player, packetObj)) return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!PACKET_HANDLER.handleOutgoingPacket(player, sender, packetObj))
|
||||
return;
|
||||
|
||||
super.write(channel, packetObj, promise);
|
||||
} catch (Throwable exception) { exception.printStackTrace(); }
|
||||
|
||||
} catch (Throwable exception) {
|
||||
|
||||
exception.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
package de.rayzs.pat.api.netty.bukkit;
|
||||
|
||||
import de.rayzs.pat.utils.sender.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public interface BukkitPacketHandler {
|
||||
boolean handleIncomingPacket(Player player, Object packetObj) throws Exception;
|
||||
boolean handleOutgoingPacket(Player player, Object packetObj) throws Exception;
|
||||
|
||||
boolean handleIncomingPacket(Player player, CommandSender sender, Object packetObj) throws Exception;
|
||||
boolean handleOutgoingPacket(Player player, CommandSender sender, Object packetObj) throws Exception;
|
||||
|
||||
}
|
||||
@@ -1,89 +1,158 @@
|
||||
package de.rayzs.pat.api.netty.bukkit.handlers;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import de.rayzs.pat.utils.StringUtils;
|
||||
import de.rayzs.pat.utils.group.Group;
|
||||
import de.rayzs.pat.utils.group.GroupManager;
|
||||
import de.rayzs.pat.utils.sender.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import de.rayzs.pat.api.event.PATEventHandler;
|
||||
import de.rayzs.pat.api.event.events.FilteredTabCompletionEvent;
|
||||
import de.rayzs.pat.plugin.logger.Logger;
|
||||
import de.rayzs.pat.api.netty.bukkit.BukkitPacketAnalyzer;
|
||||
import de.rayzs.pat.api.netty.bukkit.BukkitPacketHandler;
|
||||
import de.rayzs.pat.api.storage.Storage;
|
||||
import de.rayzs.pat.plugin.BukkitLoader;
|
||||
import de.rayzs.pat.api.netty.bukkit.*;
|
||||
import org.bukkit.entity.Player;
|
||||
import java.lang.reflect.Field;
|
||||
import de.rayzs.pat.utils.*;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import de.rayzs.pat.plugin.logger.Logger;
|
||||
import de.rayzs.pat.utils.Reflection;
|
||||
|
||||
public class LegacyPacketHandler implements BukkitPacketHandler {
|
||||
|
||||
@Override
|
||||
public boolean handleIncomingPacket(Player player, Object packetObj) throws Exception {
|
||||
Field stringField = Reflection.getFirstFieldByType(packetObj.getClass(), "String", Reflection.SearchOption.ENDS);
|
||||
if(stringField == null) {
|
||||
public boolean handleIncomingPacket(Player player, CommandSender sender, Object packetObj) throws Exception {
|
||||
|
||||
Field stringField = Reflection.getFirstFieldByType(packetObj.getClass(), "String",
|
||||
Reflection.SearchOption.ENDS);
|
||||
if (stringField == null) {
|
||||
|
||||
Logger.warning("Failed PacketAnalyze process! (#1)");
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
String text = (String) stringField.get(packetObj);
|
||||
BukkitPacketAnalyzer.insertPlayerInput(player, text);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleOutgoingPacket(Player player, Object packetObj) throws Exception {
|
||||
String input = BukkitPacketAnalyzer.getPlayerInput(player);
|
||||
public boolean handleOutgoingPacket(Player player, CommandSender sender, Object packetObj) throws Exception {
|
||||
|
||||
if(input == null) return false;
|
||||
final String rawInput = BukkitPacketAnalyzer.getPlayerInput(player);
|
||||
|
||||
boolean cancelsBeforeHand;
|
||||
int spaces = 0;
|
||||
if (rawInput == null) {
|
||||
|
||||
if(input.startsWith("/")) {
|
||||
input = input.replace("/", "");
|
||||
if(input.contains(" ")) {
|
||||
String[] split = input.split(" ");
|
||||
spaces = split.length;
|
||||
if(spaces > 0) input = split[0];
|
||||
}
|
||||
return false;
|
||||
|
||||
cancelsBeforeHand = Storage.Blacklist.isBlocked(player, input, !Storage.ConfigSections.Settings.TURN_BLACKLIST_TO_WHITELIST.ENABLED);
|
||||
if(!cancelsBeforeHand) cancelsBeforeHand = Storage.ConfigSections.Settings.CUSTOM_VERSION.isTabCompletable(input) || Storage.ConfigSections.Settings.CUSTOM_PLUGIN.isTabCompletable(input);
|
||||
} else return true;
|
||||
}
|
||||
|
||||
final List<Group> groups = GroupManager.getPlayerGroups(sender);
|
||||
|
||||
String input = rawInput;
|
||||
boolean cancelsBeforeHand = false;
|
||||
|
||||
if (!input.startsWith("/")) {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
input = input.substring(1);
|
||||
|
||||
final boolean doesBypassNamespace = Storage.ConfigSections.Settings.BLOCK_NAMESPACE_COMMANDS.doesBypass(sender);
|
||||
final boolean spaces = input.contains(" ");
|
||||
|
||||
if (Storage.ConfigSections.Settings.BLOCK_NAMESPACE_COMMANDS.isCommand(input) && !doesBypassNamespace) {
|
||||
|
||||
cancelsBeforeHand = true;
|
||||
|
||||
}
|
||||
|
||||
if (!cancelsBeforeHand && !input.isEmpty()) {
|
||||
|
||||
cancelsBeforeHand = !Storage.Blacklist.canPlayerAccessTab(sender, groups, StringUtils.getFirstArg(input));
|
||||
|
||||
}
|
||||
|
||||
if (!cancelsBeforeHand) {
|
||||
|
||||
cancelsBeforeHand = Storage.ConfigSections.Settings.CUSTOM_PLUGIN.isCommand(input)
|
||||
|| Storage.ConfigSections.Settings.CUSTOM_VERSION.isCommand(input);
|
||||
|
||||
}
|
||||
|
||||
for (Field field : Reflection.getFields(packetObj)) {
|
||||
|
||||
field.setAccessible(true);
|
||||
Object result = field.get(packetObj);
|
||||
|
||||
if (!(result instanceof String[])) continue;
|
||||
List<String> newResultList = new ArrayList<>();
|
||||
String[] tR = (String[]) result;
|
||||
if (!(result instanceof String[])) {
|
||||
|
||||
String tempName;
|
||||
continue;
|
||||
|
||||
if(spaces == 0) {
|
||||
for (String s : tR) {
|
||||
if(!BukkitLoader.isLoaded()) continue;
|
||||
if(!s.startsWith("/")) {
|
||||
newResultList.add(s);
|
||||
continue;
|
||||
}
|
||||
|
||||
tempName = s.replaceFirst("/", "");
|
||||
|
||||
if (!Storage.Blacklist.isBlocked(player, tempName, !Storage.ConfigSections.Settings.TURN_BLACKLIST_TO_WHITELIST.ENABLED))
|
||||
newResultList.add(s);
|
||||
}
|
||||
} else {
|
||||
if(!cancelsBeforeHand) {
|
||||
FilteredTabCompletionEvent filteredTabCompletionEvent = PATEventHandler.callFilteredTabCompletionEvents(player.getUniqueId(), input, Arrays.asList(tR));
|
||||
if(!filteredTabCompletionEvent.isCancelled()) {
|
||||
List<String> suggestions = Arrays.stream(tR).filter(s -> filteredTabCompletionEvent.getCompletion().contains(s)).collect(Collectors.toList());
|
||||
newResultList.addAll(suggestions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
field.set(packetObj, newResultList.toArray(new String[0]));
|
||||
String[] tR = (String[]) result;
|
||||
List<String> suggestions = new ArrayList<>(Arrays.asList(tR));
|
||||
|
||||
if (spaces) {
|
||||
|
||||
if (cancelsBeforeHand) {
|
||||
|
||||
suggestions.clear();
|
||||
field.set(packetObj, suggestions.toArray(new String[0]));
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
FilteredTabCompletionEvent filteredTabCompletionEvent = PATEventHandler
|
||||
.callFilteredTabCompletionEvents(player.getUniqueId(), rawInput, new ArrayList<>(suggestions));
|
||||
|
||||
if (filteredTabCompletionEvent.isCancelled()) {
|
||||
|
||||
suggestions.clear();
|
||||
|
||||
} else {
|
||||
|
||||
suggestions.removeIf(s -> !filteredTabCompletionEvent.getCompletion().contains(s));
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
suggestions.removeIf(s -> {
|
||||
|
||||
String cpy = s;
|
||||
if (cpy.startsWith("/")) {
|
||||
|
||||
cpy = cpy.substring(1);
|
||||
|
||||
}
|
||||
|
||||
if (Storage.ConfigSections.Settings.CUSTOM_PLUGIN.isTabCompletable(cpy)
|
||||
|| Storage.ConfigSections.Settings.CUSTOM_VERSION.isTabCompletable(cpy))
|
||||
{
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
return !Storage.Blacklist.canPlayerAccessTab(sender, groups, cpy);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
field.set(packetObj, suggestions.toArray(new String[0]));
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package de.rayzs.pat.api.netty.bukkit.handlers;
|
||||
|
||||
import de.rayzs.pat.api.netty.bukkit.BukkitPacketHandler;
|
||||
import de.rayzs.pat.plugin.subarguments.SubArguments;
|
||||
import de.rayzs.pat.utils.node.BukkitCommandNodeHelper;
|
||||
import de.rayzs.pat.utils.sender.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class ModernCommandsNodeHandler implements BukkitPacketHandler {
|
||||
|
||||
public boolean handleIncomingPacket(Player player, CommandSender sender, Object packetObj) throws Exception {
|
||||
|
||||
// Ignored
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleOutgoingPacket(Player player, CommandSender sender, Object packetObj) throws Exception {
|
||||
|
||||
final BukkitCommandNodeHelper helper = new BukkitCommandNodeHelper(packetObj);
|
||||
|
||||
SubArguments.handleCommandNode(player.getUniqueId(), helper);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,173 +1,355 @@
|
||||
package de.rayzs.pat.api.netty.bukkit.handlers;
|
||||
|
||||
import de.rayzs.pat.api.event.events.FilteredTabCompletionEvent;
|
||||
import de.rayzs.pat.api.event.PATEventHandler;
|
||||
import com.mojang.brigadier.suggestion.*;
|
||||
import de.rayzs.pat.plugin.logger.Logger;
|
||||
import de.rayzs.pat.api.storage.Storage;
|
||||
import de.rayzs.pat.plugin.BukkitLoader;
|
||||
import de.rayzs.pat.api.netty.bukkit.*;
|
||||
import de.rayzs.pat.utils.message.MessageTranslator;
|
||||
import de.rayzs.pat.utils.scheduler.PATScheduler;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import de.rayzs.pat.utils.*;
|
||||
import java.lang.reflect.*;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import de.rayzs.pat.utils.group.Group;
|
||||
import de.rayzs.pat.utils.group.GroupManager;
|
||||
import de.rayzs.pat.utils.sender.CommandSender;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.mojang.brigadier.suggestion.Suggestion;
|
||||
import com.mojang.brigadier.suggestion.Suggestions;
|
||||
|
||||
import de.rayzs.pat.api.event.PATEventHandler;
|
||||
import de.rayzs.pat.api.event.events.FilteredTabCompletionEvent;
|
||||
import de.rayzs.pat.api.netty.bukkit.BukkitPacketAnalyzer;
|
||||
import de.rayzs.pat.api.netty.bukkit.BukkitPacketHandler;
|
||||
import de.rayzs.pat.api.storage.Storage;
|
||||
import de.rayzs.pat.plugin.logger.Logger;
|
||||
import de.rayzs.pat.utils.Reflection;
|
||||
import de.rayzs.pat.utils.StringUtils;
|
||||
import de.rayzs.pat.utils.message.MessageTranslator;
|
||||
import de.rayzs.pat.utils.scheduler.PATScheduler;
|
||||
|
||||
public class ModernPacketHandler implements BukkitPacketHandler {
|
||||
|
||||
@Override
|
||||
public boolean handleIncomingPacket(Player player, Object packetObj) throws Exception {
|
||||
Field stringField = Reflection.getFirstFieldByType(packetObj.getClass(), "String", Reflection.SearchOption.ENDS);
|
||||
private static boolean modifiable = true;
|
||||
|
||||
@Override
|
||||
public boolean handleIncomingPacket(Player player, CommandSender sender, Object packetObj) throws Exception {
|
||||
|
||||
Field stringField = Reflection.getFirstFieldByType(packetObj.getClass(), "String",
|
||||
Reflection.SearchOption.ENDS);
|
||||
|
||||
if (stringField == null) {
|
||||
|
||||
if(stringField == null) {
|
||||
Logger.warning("Failed PacketAnalyze process! (#1)");
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
String text = (String) stringField.get(packetObj);
|
||||
if(Storage.ConfigSections.Settings.PATCH_EXPLOITS.isMalicious(text)) {
|
||||
MessageTranslator.send(Bukkit.getConsoleSender(), Storage.ConfigSections.Settings.PATCH_EXPLOITS.ALERT_MESSAGE.get().replace("%player%", player.getName()));
|
||||
PATScheduler.createScheduler(() -> player.kickPlayer(ChatColor.translateAlternateColorCodes('&', Storage.ConfigSections.Settings.PATCH_EXPLOITS.KICK_MESSAGE.get())));
|
||||
if (!text.isBlank() && text.charAt(0) != '/')
|
||||
text = '/' + text;
|
||||
|
||||
if (Storage.ConfigSections.Settings.PATCH_EXPLOITS.isMalicious(text)) {
|
||||
|
||||
MessageTranslator.send(Bukkit.getConsoleSender(),
|
||||
Storage.ConfigSections.Settings.PATCH_EXPLOITS.ALERT_MESSAGE.get().replace("%player%",
|
||||
player.getName()));
|
||||
|
||||
PATScheduler.createScheduler(() -> player.kickPlayer(
|
||||
StringUtils.replace(Storage.ConfigSections.Settings.PATCH_EXPLOITS.KICK_MESSAGE.get(), "&", "§")));
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
BukkitPacketAnalyzer.insertPlayerInput(player, text);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleOutgoingPacket(Player player, Object packetObj) throws Exception {
|
||||
public boolean handleOutgoingPacket(Player player, CommandSender sender, Object packetObj) throws Exception {
|
||||
|
||||
Object suggestionObj;
|
||||
String rawInput = BukkitPacketAnalyzer.getPlayerInput(player), input = rawInput;
|
||||
if(input == null) return false;
|
||||
|
||||
if (input == null) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
final List<Group> groups = GroupManager.getPlayerGroups(sender);
|
||||
|
||||
boolean is121Packet = packetObj.getClass().getSimpleName().equals("ClientboundCommandSuggestionsPacket"),
|
||||
cancelsBeforeHand = false;
|
||||
|
||||
int spaces = 0;
|
||||
if(input.startsWith("/") || is121Packet) {
|
||||
if (input.startsWith("/") || is121Packet) {
|
||||
|
||||
input = input.replace("/", "");
|
||||
if(input.contains(" ")) {
|
||||
if (input.contains(" ")) {
|
||||
|
||||
String[] split = input.split(" ");
|
||||
spaces = split.length;
|
||||
if(spaces > 0) input = split[0];
|
||||
if (spaces > 0)
|
||||
input = split[0];
|
||||
|
||||
}
|
||||
|
||||
cancelsBeforeHand = Storage.Blacklist.isBlocked(player, input, !Storage.ConfigSections.Settings.TURN_BLACKLIST_TO_WHITELIST.ENABLED);
|
||||
if(!cancelsBeforeHand) cancelsBeforeHand = Storage.ConfigSections.Settings.CUSTOM_VERSION.isTabCompletable(input) || Storage.ConfigSections.Settings.CUSTOM_PLUGIN.isTabCompletable(input);
|
||||
cancelsBeforeHand = !Storage.Blacklist.canPlayerAccessTab(sender, groups, input);
|
||||
|
||||
if (!cancelsBeforeHand)
|
||||
cancelsBeforeHand = Storage.ConfigSections.Settings.CUSTOM_VERSION.isTabCompletable(input)
|
||||
|| Storage.ConfigSections.Settings.CUSTOM_PLUGIN.isTabCompletable(input);
|
||||
|
||||
}
|
||||
|
||||
if(is121Packet || Reflection.isFoliaServer() && packetObj.getClass().getSimpleName().equals("PacketPlayOutTabComplete")) {
|
||||
try {
|
||||
Field suggestionsField = Reflection.getFieldsByTypeNormal(packetObj.getClass(), "List", Reflection.SearchOption.ENDS).get(0);
|
||||
List<?> suggestionsTmp = (List<?>) suggestionsField.get(packetObj),
|
||||
suggestions = new ArrayList<>(suggestionsTmp);
|
||||
if (is121Packet || Reflection.isFoliaServer()
|
||||
&& packetObj.getClass().getSimpleName().equals("PacketPlayOutTabComplete"))
|
||||
{
|
||||
|
||||
List<Field> intFields = Reflection.getFieldsByTypeNormal(packetObj.getClass(), "int", Reflection.SearchOption.ENDS);
|
||||
int id = (int) intFields.get(0).get(packetObj),
|
||||
start = (int) intFields.get(1).get(packetObj),
|
||||
try {
|
||||
|
||||
Field suggestionsField = Reflection
|
||||
.getFieldsByTypeNormal(packetObj.getClass(), "List", Reflection.SearchOption.ENDS).get(0);
|
||||
List<?> suggestionsTmp = (List<?>) suggestionsField.get(packetObj),
|
||||
suggestions = new ArrayList<>(suggestionsTmp);
|
||||
|
||||
List<Field> intFields = Reflection.getFieldsByTypeNormal(packetObj.getClass(), "int",
|
||||
Reflection.SearchOption.ENDS);
|
||||
int id = (int) intFields.get(0).get(packetObj), start = (int) intFields.get(1).get(packetObj),
|
||||
length = (int) intFields.get(2).get(packetObj);
|
||||
|
||||
Class<?> clientboundCommandSuggestionsPacketClass = Class.forName("net.minecraft.network.protocol.game." + (packetObj.getClass().getSimpleName().equals("PacketPlayOutTabComplete") ? "PacketPlayOutTabComplete" : "ClientboundCommandSuggestionsPacket"));
|
||||
if ((input.isEmpty() || cancelsBeforeHand) && Reflection.isWeird()) return false;
|
||||
if (spaces >= 1 && cancelsBeforeHand || !BukkitLoader.isLoaded()) {
|
||||
Class<?> clientboundCommandSuggestionsPacketClass = Class.forName("net.minecraft.network.protocol.game."
|
||||
+ (packetObj.getClass().getSimpleName().equals("PacketPlayOutTabComplete")
|
||||
? "PacketPlayOutTabComplete"
|
||||
: "ClientboundCommandSuggestionsPacket"));
|
||||
if ((input.isEmpty() || cancelsBeforeHand) && Reflection.isWeird())
|
||||
return false;
|
||||
|
||||
if (spaces >= 1 && cancelsBeforeHand) {
|
||||
|
||||
suggestions.clear();
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
if (spaces == 0) {
|
||||
|
||||
suggestions.removeIf(suggestion -> {
|
||||
|
||||
String command = getSuggestionFromEntry(suggestion);
|
||||
return Storage.Blacklist.isBlocked(player, command);
|
||||
return !Storage.Blacklist.canPlayerAccessTab(sender, groups, command);
|
||||
|
||||
});
|
||||
|
||||
return true;
|
||||
|
||||
} else {
|
||||
|
||||
List<String> suggestionsAsString = new ArrayList<>();
|
||||
for (Object suggestion : suggestions)
|
||||
suggestionsAsString.add(getSuggestionFromEntry(suggestion));
|
||||
|
||||
FilteredTabCompletionEvent filteredTabCompletionEvent = PATEventHandler.callFilteredTabCompletionEvents(player.getUniqueId(), rawInput, suggestionsAsString);
|
||||
if (filteredTabCompletionEvent.isCancelled()) suggestions.clear();
|
||||
FilteredTabCompletionEvent filteredTabCompletionEvent = PATEventHandler
|
||||
.callFilteredTabCompletionEvents(player.getUniqueId(), rawInput, suggestionsAsString);
|
||||
if (filteredTabCompletionEvent.isCancelled())
|
||||
suggestions.clear();
|
||||
|
||||
for (int i = 0; i < suggestions.size(); i++) {
|
||||
|
||||
Object csO = suggestions.get(i);
|
||||
|
||||
String suggestionAsString = getSuggestionFromEntry(csO);
|
||||
if (!filteredTabCompletionEvent.getCompletion().contains(suggestionAsString))
|
||||
suggestions.remove(csO);
|
||||
|
||||
}
|
||||
|
||||
suggestions.removeIf(suggestion -> !filteredTabCompletionEvent.getCompletion().contains(getSuggestionFromEntry(suggestion)));
|
||||
suggestions.removeIf(suggestion -> !filteredTabCompletionEvent.getCompletion()
|
||||
.contains(getSuggestionFromEntry(suggestion)));
|
||||
|
||||
}
|
||||
|
||||
if(!suggestions.isEmpty()) {
|
||||
if (!suggestions.isEmpty()) {
|
||||
|
||||
Object clientboundCommandSuggestionsPacketObj = clientboundCommandSuggestionsPacketClass
|
||||
.getConstructor(int.class, int.class, int.class, List.class)
|
||||
.newInstance(id, start, length, suggestions);
|
||||
|
||||
BukkitPacketAnalyzer.sendPacket(player.getUniqueId(), clientboundCommandSuggestionsPacketObj);
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
} catch (Throwable throwable) { throwable.printStackTrace(); }
|
||||
} catch (Throwable throwable) {
|
||||
|
||||
throwable.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
return !cancelsBeforeHand;
|
||||
|
||||
}
|
||||
|
||||
if (Reflection.getMinor() < 17) {
|
||||
Field suggestionsField = Reflection.getFieldsByType(packetObj.getClass(), "Suggestions", Reflection.SearchOption.ENDS).get(0);
|
||||
if (suggestionsField == null) return false;
|
||||
if (Reflection.isBefore(1, 17)) {
|
||||
|
||||
Field suggestionsField = Reflection
|
||||
.getFieldsByType(packetObj.getClass(), "Suggestions", Reflection.SearchOption.ENDS).get(0);
|
||||
if (suggestionsField == null)
|
||||
return false;
|
||||
suggestionObj = suggestionsField.get(packetObj);
|
||||
|
||||
} else {
|
||||
Method suggestionsMethod = Reflection.getMethodsByReturnType(packetObj.getClass(), "Suggestions", Reflection.SearchOption.ENDS).get(0);
|
||||
if (suggestionsMethod == null) return false;
|
||||
|
||||
List<Method> methods = Reflection.getMethodsByReturnType(packetObj.getClass(), "Suggestions",
|
||||
Reflection.SearchOption.ENDS);
|
||||
|
||||
if (methods.isEmpty())
|
||||
return false;
|
||||
Method suggestionsMethod = methods.get(0);
|
||||
|
||||
if (suggestionsMethod == null)
|
||||
return false;
|
||||
|
||||
suggestionObj = suggestionsMethod.invoke(packetObj);
|
||||
|
||||
}
|
||||
|
||||
Suggestions suggestions = (Suggestions) suggestionObj;
|
||||
|
||||
if((input.isEmpty() || cancelsBeforeHand) && Reflection.isWeird()) return false;
|
||||
if(spaces >= 1 && cancelsBeforeHand || !BukkitLoader.isLoaded()) {
|
||||
suggestions.getList().clear();
|
||||
return true;
|
||||
if ((input.isEmpty() || cancelsBeforeHand) && Reflection.isWeird()) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
if(spaces == 0) {
|
||||
suggestions.getList().removeIf(suggestion -> {
|
||||
String command = suggestion.getText();
|
||||
return Storage.Blacklist.isBlocked(player, command);
|
||||
});
|
||||
if (spaces >= 1 && cancelsBeforeHand) {
|
||||
|
||||
suggestions.getList().clear();
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
if (spaces == 0) {
|
||||
|
||||
suggestions.getList().removeIf(suggestion -> {
|
||||
|
||||
String command = suggestion.getText();
|
||||
return !Storage.Blacklist.canPlayerAccessTab(sender, groups, command);
|
||||
|
||||
});
|
||||
|
||||
return true;
|
||||
|
||||
} else {
|
||||
|
||||
List<String> suggestionsAsString = new ArrayList<>();
|
||||
for (Suggestion suggestion : suggestions.getList())
|
||||
suggestionsAsString.add(suggestion.getText());
|
||||
|
||||
FilteredTabCompletionEvent filteredTabCompletionEvent = PATEventHandler.callFilteredTabCompletionEvents(player.getUniqueId(), rawInput, suggestionsAsString);
|
||||
if(filteredTabCompletionEvent.isCancelled()) suggestions.getList().clear();
|
||||
suggestions.getList().removeIf(suggestion -> !filteredTabCompletionEvent.getCompletion().contains(suggestion.getText()));
|
||||
return !suggestions.getList().isEmpty();
|
||||
FilteredTabCompletionEvent filteredTabCompletionEvent = PATEventHandler
|
||||
.callFilteredTabCompletionEvents(player.getUniqueId(), rawInput, suggestionsAsString);
|
||||
|
||||
if (modifiable) {
|
||||
|
||||
try {
|
||||
|
||||
if (filteredTabCompletionEvent.isCancelled())
|
||||
suggestions.getList().clear();
|
||||
else
|
||||
suggestions.getList().removeIf(suggestion -> !filteredTabCompletionEvent.getCompletion()
|
||||
.contains(suggestion.getText()));
|
||||
|
||||
return !suggestions.getList().isEmpty();
|
||||
|
||||
} catch (UnsupportedOperationException exception) {
|
||||
|
||||
modifiable = false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return handleUnmodifiableTabCompletion(player, packetObj, suggestions, filteredTabCompletionEvent);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean handleUnmodifiableTabCompletion(Player player, Object packetObj, Suggestions suggestions,
|
||||
FilteredTabCompletionEvent filteredTabCompletionEvent)
|
||||
{
|
||||
|
||||
List<Suggestion> filteredSuggestionsList = new ArrayList<>();
|
||||
|
||||
if (!filteredTabCompletionEvent.isCancelled())
|
||||
for (Suggestion suggestion : suggestions.getList()) {
|
||||
|
||||
if (filteredTabCompletionEvent.getCompletion().contains(suggestion.getText())) {
|
||||
|
||||
filteredSuggestionsList.add(suggestion);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Suggestions filteredSuggestions = new Suggestions(suggestions.getRange(), filteredSuggestionsList);
|
||||
|
||||
try {
|
||||
|
||||
int val = -1;
|
||||
|
||||
Method method = Reflection.getMethodByName(packetObj.getClass(), "e");
|
||||
if (method != null) {
|
||||
|
||||
val = (int) method.invoke(packetObj);
|
||||
|
||||
}
|
||||
|
||||
if (val == -1) {
|
||||
|
||||
Logger.warning("Failed to read packet input!");
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
Object packet = Reflection.getConstructor(packetObj.getClass(), int.class, Suggestions.class)
|
||||
.newInstance(val, filteredSuggestions);
|
||||
|
||||
BukkitPacketAnalyzer.sendPacket(player.getUniqueId(), packet);
|
||||
|
||||
} catch (Exception exception) {
|
||||
|
||||
exception.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
private String getSuggestionFromEntry(Object suggestionObj) {
|
||||
|
||||
try {
|
||||
List<Field> fields = Reflection.getFieldsByTypeNormal(suggestionObj.getClass(), "String", Reflection.SearchOption.ENDS);
|
||||
if(fields.isEmpty()) return "";
|
||||
|
||||
List<Field> fields = Reflection.getFieldsByTypeNormal(suggestionObj.getClass(), "String",
|
||||
Reflection.SearchOption.ENDS);
|
||||
if (fields.isEmpty())
|
||||
return "";
|
||||
|
||||
Field field = fields.get(0);
|
||||
String result = (String) field.get(suggestionObj);
|
||||
field.setAccessible(false);
|
||||
return result;
|
||||
|
||||
} catch (Throwable throwable) {
|
||||
|
||||
throwable.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
return "";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +1,37 @@
|
||||
package de.rayzs.pat.api.netty.proxy;
|
||||
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import de.rayzs.pat.api.brand.CustomServerBrand;
|
||||
import de.rayzs.pat.api.communication.client.ClientInfo;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.netty.handler.codec.MessageToMessageDecoder;
|
||||
import de.rayzs.pat.utils.permission.PermissionUtil;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import de.rayzs.pat.api.communication.Communicator;
|
||||
import net.md_5.bungee.protocol.DefinedPacket;
|
||||
import net.md_5.bungee.protocol.PacketWrapper;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import com.mojang.brigadier.tree.CommandNode;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
import net.md_5.bungee.protocol.packet.*;
|
||||
import de.rayzs.pat.api.storage.Storage;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import com.mojang.brigadier.builder.*;
|
||||
import java.lang.reflect.Field;
|
||||
import de.rayzs.pat.utils.*;
|
||||
import io.netty.channel.*;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.mojang.brigadier.tree.CommandNode;
|
||||
|
||||
import com.mojang.brigadier.tree.RootCommandNode;
|
||||
import de.rayzs.pat.api.brand.CustomServerBrand;
|
||||
import de.rayzs.pat.api.communication.Communicator;
|
||||
import de.rayzs.pat.api.storage.Storage;
|
||||
import de.rayzs.pat.plugin.logger.Logger;
|
||||
import de.rayzs.pat.plugin.subarguments.SubArguments;
|
||||
import de.rayzs.pat.utils.CommandsCache;
|
||||
import de.rayzs.pat.utils.ExpireCache;
|
||||
import de.rayzs.pat.utils.group.Group;
|
||||
import de.rayzs.pat.utils.group.GroupManager;
|
||||
import de.rayzs.pat.utils.node.ProxyCommandNodeHelper;
|
||||
import de.rayzs.pat.utils.Reflection;
|
||||
import de.rayzs.pat.utils.permission.PermissionUtil;
|
||||
import de.rayzs.pat.utils.sender.CommandSender;
|
||||
import de.rayzs.pat.utils.sender.CommandSenderHandler;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import io.netty.handler.codec.MessageToMessageDecoder;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
import net.md_5.bungee.protocol.PacketWrapper;
|
||||
import net.md_5.bungee.protocol.packet.Commands;
|
||||
import net.md_5.bungee.protocol.packet.PluginMessage;
|
||||
|
||||
public class BungeePacketAnalyzer {
|
||||
|
||||
@@ -30,33 +39,61 @@ public class BungeePacketAnalyzer {
|
||||
|
||||
private static final String HANDLER_NAME = "pat-bungee-handler", PIPELINE_NAME = "packet-decoder";
|
||||
private static final HashMap<ProxiedPlayer, Boolean> PLAYER_MODIFIED = new HashMap<>();
|
||||
private static final HashMap<ProxiedPlayer, String> PLAYER_INPUT_CACHE = new HashMap<>();
|
||||
private static final ExpireCache<UUID, String> PLAYER_INPUT_CACHE = new ExpireCache<>(5, TimeUnit.SECONDS);
|
||||
|
||||
private static final com.mojang.brigadier.Command DUMMY_COMMAND = (context) -> 0;
|
||||
private static final List<String> PLUGIN_COMMANDS = new ArrayList<>();
|
||||
|
||||
private static Class<?> channelWrapperClass, serverConnectionClass;
|
||||
|
||||
private static List<String> PROXY_COMMANDS;
|
||||
|
||||
static {
|
||||
|
||||
ProxyCommandNodeHelper.setDefaultSuggestionProvider(Commands.SuggestionRegistry.ASK_SERVER);
|
||||
loadProxyCommands();
|
||||
|
||||
}
|
||||
|
||||
public static void loadProxyCommands() {
|
||||
|
||||
PROXY_COMMANDS = ProxyServer.getInstance().getPluginManager().getCommands().stream().map(entry -> {
|
||||
|
||||
String key = entry.getKey();
|
||||
return key.startsWith("/") ? key.substring(1) : key;
|
||||
|
||||
}).toList();
|
||||
|
||||
}
|
||||
|
||||
public static void injectAll() {
|
||||
|
||||
ProxyServer.getInstance().getPlayers().forEach(BungeePacketAnalyzer::inject);
|
||||
|
||||
}
|
||||
|
||||
public static void uninjectAll() {
|
||||
|
||||
BungeePacketAnalyzer.INJECTED_PLAYERS.keySet().forEach(BungeePacketAnalyzer::uninject);
|
||||
BungeePacketAnalyzer.INJECTED_PLAYERS.clear();
|
||||
|
||||
}
|
||||
|
||||
public static void setPluginCommands() {
|
||||
if(!PLUGIN_COMMANDS.isEmpty()) return;
|
||||
ProxyServer.getInstance().getPluginManager().getCommands().stream().filter(entry -> !PLUGIN_COMMANDS.contains(entry.getKey())).forEach(entry -> PLUGIN_COMMANDS.add(entry.getKey()));
|
||||
|
||||
if (!PLUGIN_COMMANDS.isEmpty())
|
||||
return;
|
||||
ProxyServer.getInstance().getPluginManager().getCommands().stream()
|
||||
.filter(entry -> !PLUGIN_COMMANDS.contains(entry.getKey()))
|
||||
.forEach(entry -> PLUGIN_COMMANDS.add(entry.getKey()));
|
||||
|
||||
}
|
||||
|
||||
public static boolean inject(ProxiedPlayer player) {
|
||||
|
||||
if(channelWrapperClass == null)
|
||||
if (channelWrapperClass == null)
|
||||
channelWrapperClass = Reflection.getClass("net.md_5.bungee.netty.ChannelWrapper");
|
||||
|
||||
if(serverConnectionClass == null)
|
||||
if (serverConnectionClass == null)
|
||||
serverConnectionClass = Reflection.getClass("net.md_5.bungee.ServerConnection");
|
||||
|
||||
Object channelWrapperObj;
|
||||
@@ -64,186 +101,341 @@ public class BungeePacketAnalyzer {
|
||||
Channel channel;
|
||||
|
||||
try {
|
||||
|
||||
channelField = Reflection.getFieldByName(serverConnectionClass, "ch");
|
||||
channelWrapperObj = channelField.get(player.getServer());
|
||||
channel = (Channel) Reflection.getFieldsByType(channelWrapperClass, "Channel", Reflection.SearchOption.ENDS).get(0).get(channelWrapperObj);
|
||||
channel = (Channel) Reflection.getFieldsByType(channelWrapperClass, "Channel", Reflection.SearchOption.ENDS)
|
||||
.get(0).get(channelWrapperObj);
|
||||
|
||||
if(channel == null) {
|
||||
System.err.println("Failed to inject " + player.getName() + "! Channel is null.");
|
||||
if (channel == null) {
|
||||
|
||||
Logger.warning("Failed to inject " + player.getName() + "! Channel is null.");
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
channelField.setAccessible(false);
|
||||
|
||||
if(channel.pipeline().names().contains(BungeePacketAnalyzer.HANDLER_NAME))
|
||||
if (channel.pipeline().names().contains(BungeePacketAnalyzer.HANDLER_NAME))
|
||||
uninject(player);
|
||||
|
||||
channel.pipeline().addAfter(BungeePacketAnalyzer.PIPELINE_NAME, BungeePacketAnalyzer.HANDLER_NAME, new PacketDecoder(player));
|
||||
channel.pipeline().addAfter(BungeePacketAnalyzer.PIPELINE_NAME, BungeePacketAnalyzer.HANDLER_NAME,
|
||||
new PacketDecoder(player));
|
||||
BungeePacketAnalyzer.INJECTED_PLAYERS.put(player, channel);
|
||||
} catch (Throwable throwable) {
|
||||
throwable.printStackTrace();
|
||||
|
||||
} catch (Exception exception) {
|
||||
|
||||
if (!Storage.ConfigSections.Settings.INJECTION_FAILED.SUPPRESS_EXCEPTIONS) {
|
||||
|
||||
exception.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
} return true;
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public static void uninject(ProxiedPlayer player) {
|
||||
BungeePacketAnalyzer.PLAYER_INPUT_CACHE.remove(player);
|
||||
|
||||
BungeePacketAnalyzer.PLAYER_INPUT_CACHE.remove(player.getUniqueId());
|
||||
BungeePacketAnalyzer.PLAYER_MODIFIED.remove(player);
|
||||
|
||||
if(BungeePacketAnalyzer.INJECTED_PLAYERS.containsKey(player)) {
|
||||
if (BungeePacketAnalyzer.INJECTED_PLAYERS.containsKey(player)) {
|
||||
|
||||
Channel channel = BungeePacketAnalyzer.INJECTED_PLAYERS.get(player);
|
||||
if(channel != null) {
|
||||
if (channel != null) {
|
||||
|
||||
BungeePacketAnalyzer.INJECTED_PLAYERS.remove(player);
|
||||
channel.eventLoop().submit(() -> {
|
||||
|
||||
ChannelPipeline pipeline = channel.pipeline();
|
||||
if (pipeline.names().contains(BungeePacketAnalyzer.HANDLER_NAME)) pipeline.remove(BungeePacketAnalyzer.HANDLER_NAME);
|
||||
|
||||
if (pipeline.names().contains(BungeePacketAnalyzer.HANDLER_NAME))
|
||||
pipeline.remove(BungeePacketAnalyzer.HANDLER_NAME);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void setPlayerInput(ProxiedPlayer player, String input) {
|
||||
|
||||
PLAYER_INPUT_CACHE.putIgnoreIfContains(player.getUniqueId(), input);
|
||||
|
||||
}
|
||||
|
||||
public static String getPlayerInput(ProxiedPlayer player) {
|
||||
String input = PLAYER_INPUT_CACHE.get(player);
|
||||
PLAYER_INPUT_CACHE.remove(player);
|
||||
|
||||
String input = PLAYER_INPUT_CACHE.get(player.getUniqueId());
|
||||
PLAYER_INPUT_CACHE.remove(player.getUniqueId());
|
||||
return input;
|
||||
|
||||
}
|
||||
|
||||
public static void insertPlayerInput(ProxiedPlayer player, String text) {
|
||||
PLAYER_INPUT_CACHE.put(player, text.toLowerCase());
|
||||
}
|
||||
private static void modifyCommands(ProxiedPlayer player, CommandSender sender, Commands commands) {
|
||||
|
||||
private static void modifyCommands(ProxiedPlayer player, Commands commands, List<String> list) {
|
||||
final String serverName = player.getServer().getInfo().getName();
|
||||
final boolean turn = Storage.ConfigSections.Settings.TURN_BLACKLIST_TO_WHITELIST.ENABLED;
|
||||
list.clear();
|
||||
String serverName = sender.getServerName();
|
||||
|
||||
final boolean ignore = PermissionUtil.hasBypassPermission(sender)
|
||||
|| Storage.Blacklist.isDisabledServer(serverName);
|
||||
|
||||
ProxyCommandNodeHelper helper = new ProxyCommandNodeHelper<CommandNode>(commands.getRoot());
|
||||
|
||||
List<String> commandsAsString = new ArrayList<>(PROXY_COMMANDS);
|
||||
commandsAsString.addAll(helper.getChildrenNames());
|
||||
|
||||
List<String> playerCommands = new ArrayList<>();
|
||||
|
||||
if (!ignore) {
|
||||
|
||||
final List<Group> groups = GroupManager.getPlayerGroups(sender);
|
||||
|
||||
final Map<String, CommandsCache> cache = Storage.getLoader().getCommandsCacheMap();
|
||||
if (!cache.containsKey(serverName)) {
|
||||
|
||||
cache.put(serverName, new CommandsCache());
|
||||
|
||||
}
|
||||
|
||||
final CommandsCache commandsCache = cache.get(serverName);
|
||||
commandsCache.handleCommands(commandsAsString, serverName);
|
||||
|
||||
final List<String> tmpPlayerCommands = commandsCache.getPlayerCommands(commandsAsString, sender, groups,
|
||||
serverName);
|
||||
|
||||
if (commands.getRoot().getChildren().size() != 0) {
|
||||
|
||||
helper.removeIf(str -> !tmpPlayerCommands.contains(str));
|
||||
|
||||
}
|
||||
|
||||
if (Storage.ConfigSections.Settings.CUSTOM_VERSION.ALWAYS_TAB_COMPLETABLE) {
|
||||
|
||||
Storage.ConfigSections.Settings.CUSTOM_VERSION.COMMANDS.getLines()
|
||||
.forEach(input -> helper.add(input, false));
|
||||
|
||||
}
|
||||
|
||||
if (Storage.ConfigSections.Settings.CUSTOM_PLUGIN.ALWAYS_TAB_COMPLETABLE) {
|
||||
|
||||
Storage.ConfigSections.Settings.CUSTOM_PLUGIN.COMMANDS.getLines()
|
||||
.forEach(input -> helper.add(input, false));
|
||||
|
||||
}
|
||||
|
||||
playerCommands = tmpPlayerCommands;
|
||||
|
||||
}
|
||||
|
||||
for (Map.Entry<String, Command> command : ProxyServer.getInstance().getPluginManager().getCommands()) {
|
||||
if (!ProxyServer.getInstance().getDisabledCommands().contains(command.getKey()) && commands.getRoot().getChild(command.getKey()) == null && command.getValue().hasPermission(player)) {
|
||||
|
||||
List<String> commandsToCheck =
|
||||
new ArrayList<>(Arrays.asList(command.getValue().getAliases()));
|
||||
if(!commandsToCheck.contains(command.getValue().getName()))
|
||||
commandsToCheck.add(command.getValue().getName());
|
||||
if(!commandsToCheck.contains(command.getKey()))
|
||||
commandsToCheck.add(command.getKey());
|
||||
if (ProxyServer.getInstance().getDisabledCommands().contains(command.getKey()))
|
||||
continue;
|
||||
|
||||
commandsToCheck.removeAll(list);
|
||||
commandsToCheck.removeIf(commandName -> commandName.startsWith("/"));
|
||||
if (commands.getRoot().getChild(command.getKey()) != null)
|
||||
continue;
|
||||
|
||||
for (String commandName : commandsToCheck) {
|
||||
if (!list.contains(commandName)) {
|
||||
if (!Storage.Blacklist.isBlocked(player, commandName, !turn, serverName)) {
|
||||
list.add(commandName);
|
||||
CommandNode dummy = LiteralArgumentBuilder.literal(commandName)
|
||||
.executes(DUMMY_COMMAND)
|
||||
.then(RequiredArgumentBuilder.argument("args", StringArgumentType.greedyString())
|
||||
.suggests(Commands.SuggestionRegistry.ASK_SERVER).executes(DUMMY_COMMAND))
|
||||
.build();
|
||||
if (!command.getValue().hasPermission(player)) {
|
||||
|
||||
continue;
|
||||
|
||||
commands.getRoot().addChild(dummy);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String commandName = command.getKey();
|
||||
commandName = commandName.startsWith("/") ? commandName.substring(1) : commandName;
|
||||
|
||||
if (!ignore) {
|
||||
|
||||
boolean tabablePluginCommand = Storage.ConfigSections.Settings.CUSTOM_PLUGIN
|
||||
.isTabCompletable(commandName);
|
||||
boolean tabableVersionCommand = Storage.ConfigSections.Settings.CUSTOM_VERSION
|
||||
.isTabCompletable(commandName);
|
||||
|
||||
if (!tabablePluginCommand && !tabableVersionCommand && !playerCommands.contains(commandName)) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
CommandNode dummy = ProxyCommandNodeHelper.createDummyCommandNode(command.getKey());
|
||||
commands.getRoot().addChild(dummy);
|
||||
|
||||
}
|
||||
|
||||
for (String command : PROXY_COMMANDS) {
|
||||
|
||||
if (ignore || playerCommands.contains(command)) {
|
||||
|
||||
helper.add(command, true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!ignore) {
|
||||
|
||||
SubArguments.handleCommandNode(player.getUniqueId(), helper);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void sendCommandsPacket() {
|
||||
|
||||
if (!Communicator.get().hasConnectedClients()) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
for (ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) {
|
||||
|
||||
if (player.getPendingConnection().getVersion() < 754)
|
||||
continue;
|
||||
|
||||
final CommandSender sender = CommandSenderHandler.from(player);
|
||||
|
||||
RootCommandNode root = new RootCommandNode();
|
||||
Commands packet = new Commands(root);
|
||||
|
||||
modifyCommands(player, sender, packet);
|
||||
player.unsafe().sendPacket(packet);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class PacketDecoder extends MessageToMessageDecoder<PacketWrapper> {
|
||||
|
||||
private final ProxiedPlayer player;
|
||||
private final List<String> commands = new ArrayList<>();
|
||||
private final CommandSender sender;
|
||||
|
||||
private PacketDecoder(ProxiedPlayer player) {
|
||||
|
||||
this.player = player;
|
||||
this.sender = CommandSenderHandler.from(player);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void decode(ChannelHandlerContext channelHandlerContext, PacketWrapper wrapper, List<Object> list) {
|
||||
|
||||
if (wrapper.packet == null) {
|
||||
|
||||
list.add(wrapper);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if(wrapper.packet instanceof PluginMessage) {
|
||||
if (wrapper.packet instanceof PluginMessage) {
|
||||
|
||||
PluginMessage pluginMessage = (PluginMessage) wrapper.packet;
|
||||
if(CustomServerBrand.isEnabled() && CustomServerBrand.isBrandTag(pluginMessage.getTag()))
|
||||
if (CustomServerBrand.isEnabled() && CustomServerBrand.isBrandTag(pluginMessage.getTag()))
|
||||
return;
|
||||
|
||||
} else if (wrapper.packet instanceof Commands) {
|
||||
|
||||
Commands response = (Commands) wrapper.packet;
|
||||
modifyCommands(player, response, commands);
|
||||
modifyCommands(player, sender, response);
|
||||
|
||||
player.unsafe().sendPacket(response);
|
||||
return;
|
||||
|
||||
} else if (wrapper.packet instanceof TabCompleteResponse) {
|
||||
TabCompleteResponse response = (TabCompleteResponse) wrapper.packet;
|
||||
|
||||
if(player.getPendingConnection().getVersion() < 754) {
|
||||
if(!PermissionUtil.hasBypassPermission(player)) {
|
||||
|
||||
ClientInfo clientInfo = Communicator.getClientByName(player.getServer().getInfo().getName());
|
||||
if (clientInfo == null || !PLAYER_INPUT_CACHE.containsKey(player))
|
||||
return;
|
||||
|
||||
boolean cancelsBeforeHand = false;
|
||||
String playerInput = getPlayerInput(player), server = player.getServer().getInfo().getName();
|
||||
int spaces = 0;
|
||||
|
||||
if(playerInput.contains(" ")) {
|
||||
String[] split = playerInput.split(" ");
|
||||
spaces = split.length;
|
||||
if(spaces > 0) playerInput = split[0];
|
||||
}
|
||||
|
||||
if(!playerInput.equals("/")) {
|
||||
cancelsBeforeHand = Storage.Blacklist.isBlocked(player, StringUtils.replaceFirst(playerInput, "/", ""), !Storage.ConfigSections.Settings.TURN_BLACKLIST_TO_WHITELIST.ENABLED, server);
|
||||
|
||||
if(!cancelsBeforeHand) cancelsBeforeHand = Storage.ConfigSections.Settings.CUSTOM_VERSION.isTabCompletable(StringUtils.replaceFirst(playerInput, "/", "")) || Storage.ConfigSections.Settings.CUSTOM_PLUGIN.isTabCompletable(StringUtils.replaceFirst(playerInput, "/", ""));
|
||||
}
|
||||
final String cursor = playerInput;
|
||||
if(cursor.startsWith("/")) {
|
||||
if(spaces == 0) {
|
||||
List<String> suggestions = new ArrayList<>(response.getCommands());
|
||||
|
||||
if (Storage.ConfigSections.Settings.TURN_BLACKLIST_TO_WHITELIST.ENABLED) {
|
||||
setPluginCommands();
|
||||
|
||||
Storage.Blacklist.getAllBlacklists(server).forEach(blacklist -> blacklist.getCommands().stream().filter(command -> !suggestions.contains("/" + command)).forEach(command -> {
|
||||
if (BungeePacketAnalyzer.PLUGIN_COMMANDS.contains(command))
|
||||
suggestions.add("/" + command);
|
||||
}));
|
||||
|
||||
BungeePacketAnalyzer.PLUGIN_COMMANDS.stream().filter(command -> !suggestions.contains(command)).forEach(command -> {
|
||||
if(command.startsWith("/")) command = StringUtils.replaceFirst(command, "/", "");
|
||||
if(PermissionUtil.hasBypassPermission(player, command, server)) {
|
||||
suggestions.add("/" + command);
|
||||
}
|
||||
});
|
||||
|
||||
suggestions.stream().filter(suggestion -> suggestion.startsWith(cursor) && !response.getCommands().contains(suggestion)).forEach(command -> response.getCommands().add(command));
|
||||
|
||||
} else {
|
||||
BungeePacketAnalyzer.PLUGIN_COMMANDS.stream().filter(command -> !suggestions.contains(command)).forEach(suggestions::add);
|
||||
suggestions.removeIf(command -> {
|
||||
if(command.startsWith("/")) command = StringUtils.replaceFirst(command, "/", "");
|
||||
return Storage.Blacklist.isBlocked(player, command, true, server, true);
|
||||
});
|
||||
response.getCommands().clear();
|
||||
suggestions.forEach(command -> response.getCommands().add(command));
|
||||
}
|
||||
|
||||
if (response.getCommands().isEmpty()) return;
|
||||
} else {
|
||||
if(cancelsBeforeHand) return;
|
||||
}
|
||||
|
||||
player.unsafe().sendPacket(new TabCompleteResponse(response.getCommands()));
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* } else if (wrapper.packet instanceof TabCompleteResponse) {
|
||||
* TabCompleteResponse response = (TabCompleteResponse) wrapper.packet; String
|
||||
* serverName = player.getServer().getInfo().getName();
|
||||
*
|
||||
* System.out.println("damn");
|
||||
*
|
||||
* if (!Storage.Blacklist.isDisabledServer(serverName) &&
|
||||
* player.getPendingConnection().getVersion() < 754) { if
|
||||
* (!PermissionUtil.hasBypassPermission(player)) {
|
||||
*
|
||||
* System.out.println("Further!"); System.out.println("Got: " +
|
||||
* PLAYER_INPUT_CACHE.get(player.getUniqueId()));
|
||||
*
|
||||
* if (!PLAYER_INPUT_CACHE.contains(player.getUniqueId())) return;
|
||||
*
|
||||
* boolean cancelsBeforeHand = false;
|
||||
*
|
||||
* String rawPlayerInput = PLAYER_INPUT_CACHE.get(player.getUniqueId()); int
|
||||
* spaces = rawPlayerInput.contains(" ") ? rawPlayerInput.split(" ").length : 0;
|
||||
*
|
||||
* String playerInput = StringUtils.getFirstArg(rawPlayerInput), server =
|
||||
* player.getServer().getInfo().getName();
|
||||
*
|
||||
* System.out.println("NETTY -> " + playerInput);
|
||||
*
|
||||
* if (!playerInput.equals("/")) { cancelsBeforeHand =
|
||||
* !Storage.Blacklist.canPlayerAccessTab(player,
|
||||
* StringUtils.replaceFirst(playerInput, "/", ""), server);
|
||||
*
|
||||
* if (!cancelsBeforeHand) cancelsBeforeHand =
|
||||
* !Storage.ConfigSections.Settings.CUSTOM_VERSION.isTabCompletable(StringUtils.
|
||||
* replaceFirst(playerInput, "/", "")) ||
|
||||
* Storage.ConfigSections.Settings.CUSTOM_PLUGIN.isTabCompletable(StringUtils.
|
||||
* replaceFirst(playerInput, "/", "")); }
|
||||
*
|
||||
* final String cursor = playerInput;
|
||||
*
|
||||
* if (cursor.startsWith("/")) { if (spaces == 0) { List<String> suggestions =
|
||||
* new ArrayList<>(response.getCommands());
|
||||
*
|
||||
* if (Storage.ConfigSections.Settings.TURN_BLACKLIST_TO_WHITELIST.ENABLED) {
|
||||
* setPluginCommands();
|
||||
*
|
||||
* Storage.Blacklist.getServerBlacklists(server).forEach(blacklist ->
|
||||
* blacklist.getCommands().stream().filter(command -> !suggestions.contains("/"
|
||||
* + command)).forEach(command -> { if
|
||||
* (BungeePacketAnalyzer.PLUGIN_COMMANDS.contains(command)) suggestions.add("/"
|
||||
* + command); }));
|
||||
*
|
||||
* BungeePacketAnalyzer.PLUGIN_COMMANDS.stream().filter(command ->
|
||||
* !suggestions.contains(command)).forEach(command -> { if
|
||||
* (command.startsWith("/")) command = StringUtils.replaceFirst(command, "/",
|
||||
* "");
|
||||
*
|
||||
* if (Storage.Blacklist.canPlayerAccessTab(player, command, server)) {
|
||||
* suggestions.add("/" + command); } });
|
||||
*
|
||||
* suggestions.stream().filter(suggestion -> suggestion.startsWith(cursor) &&
|
||||
* !response.getCommands().contains(suggestion)).forEach(command ->
|
||||
* response.getCommands().add(command));
|
||||
*
|
||||
* } else { BungeePacketAnalyzer.PLUGIN_COMMANDS.stream().filter(command ->
|
||||
* !suggestions.contains(command)).forEach(suggestions::add);
|
||||
*
|
||||
* suggestions.removeIf(command -> { if (command.startsWith("/")) command =
|
||||
* StringUtils.replaceFirst(command, "/", "");
|
||||
*
|
||||
* return !Storage.Blacklist.canPlayerAccessTab(player, command, server); });
|
||||
*
|
||||
* response.getCommands().clear(); suggestions.forEach(command ->
|
||||
* response.getCommands().add(command)); }
|
||||
*
|
||||
* if (response.getCommands().isEmpty()) return;
|
||||
*
|
||||
* } else { if (cancelsBeforeHand) return; }
|
||||
*
|
||||
* player.unsafe().sendPacket(new TabCompleteResponse(response.getCommands()));
|
||||
* } } }
|
||||
*/
|
||||
}
|
||||
|
||||
list.add(wrapper);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,265 +1,574 @@
|
||||
package de.rayzs.pat.api.netty.proxy;
|
||||
|
||||
import com.mojang.brigadier.tree.CommandNode;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import com.mojang.brigadier.suggestion.SuggestionProvider;
|
||||
import com.velocitypowered.api.command.CommandSource;
|
||||
import com.velocitypowered.proxy.crypto.SignedChatCommand;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.proxy.protocol.MinecraftPacket;
|
||||
import com.velocitypowered.proxy.protocol.packet.AvailableCommandsPacket;
|
||||
import com.velocitypowered.proxy.protocol.packet.PluginMessagePacket;
|
||||
import com.velocitypowered.proxy.protocol.packet.TabCompleteRequestPacket;
|
||||
import com.velocitypowered.proxy.protocol.packet.TabCompleteResponsePacket;
|
||||
import com.velocitypowered.proxy.protocol.packet.chat.session.UnsignedPlayerCommandPacket;
|
||||
|
||||
import de.rayzs.pat.api.brand.CustomServerBrand;
|
||||
import de.rayzs.pat.api.event.PATEventHandler;
|
||||
import de.rayzs.pat.api.event.events.FilteredTabCompletionEvent;
|
||||
import de.rayzs.pat.api.storage.Storage;
|
||||
import de.rayzs.pat.plugin.VelocityLoader;
|
||||
import de.rayzs.pat.plugin.listeners.velocity.VelocityBlockCommandListener;
|
||||
import de.rayzs.pat.plugin.logger.Logger;
|
||||
import de.rayzs.pat.plugin.subarguments.SubArguments;
|
||||
import de.rayzs.pat.utils.CommandsCache;
|
||||
import de.rayzs.pat.utils.PacketUtils;
|
||||
import de.rayzs.pat.utils.Reflection;
|
||||
import de.rayzs.pat.utils.StringUtils;
|
||||
import de.rayzs.pat.utils.group.Group;
|
||||
import de.rayzs.pat.utils.group.GroupManager;
|
||||
import de.rayzs.pat.utils.message.MessageTranslator;
|
||||
import de.rayzs.pat.utils.node.ProxyCommandNodeHelper;
|
||||
import de.rayzs.pat.utils.permission.PermissionUtil;
|
||||
import com.velocitypowered.proxy.protocol.packet.*;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import de.rayzs.pat.plugin.VelocityLoader;
|
||||
import de.rayzs.pat.api.storage.Storage;
|
||||
import de.rayzs.pat.utils.*;
|
||||
import io.netty.channel.*;
|
||||
import de.rayzs.pat.utils.sender.CommandSender;
|
||||
import de.rayzs.pat.utils.sender.CommandSenderHandler;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelDuplexHandler;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import io.netty.channel.ChannelPromise;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class VelocityPacketAnalyzer {
|
||||
|
||||
private static boolean FAILED = false;
|
||||
|
||||
static {
|
||||
|
||||
try {
|
||||
|
||||
final String name = "minecraft:ask_server";
|
||||
|
||||
final Object availableCommandsPacket = AvailableCommandsPacket.class.newInstance();
|
||||
final Class<?> packetInstanceObjClass = availableCommandsPacket.getClass();
|
||||
|
||||
for (Class<?> clazz : packetInstanceObjClass.getClasses()) {
|
||||
|
||||
if (clazz.getSimpleName().equals("ProtocolSuggestionProvider")) {
|
||||
|
||||
final Object suggestionProviderObj = clazz.getConstructor(String.class).newInstance(name);
|
||||
final SuggestionProvider<?> suggestionProvider = (SuggestionProvider<?>) suggestionProviderObj;
|
||||
|
||||
ProxyCommandNodeHelper.setDefaultSuggestionProvider(suggestionProvider);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception exception) {
|
||||
|
||||
exception.printStackTrace();
|
||||
FAILED = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static final ConcurrentHashMap<Player, Channel> INJECTED_PLAYERS = new ConcurrentHashMap<>();
|
||||
|
||||
private static final String PIPELINE_NAME = "pat-velocity-handler", HANDLER_NAME = "handler";
|
||||
private static final HashMap<Player, String> PLAYER_INPUT_CACHE = new HashMap<>();
|
||||
private static HashMap<String, CommandsCache> COMMANDS_CACHE_MAP = new HashMap<>();
|
||||
|
||||
private static Class<?> minecraftConnectionClass, connectedPlayerConnectionClass, signedChatCommandPacketClass;
|
||||
|
||||
public static void injectAll() {
|
||||
|
||||
VelocityLoader.getServer().getAllPlayers().forEach(VelocityPacketAnalyzer::inject);
|
||||
|
||||
}
|
||||
|
||||
public static void uninjectAll() {
|
||||
|
||||
VelocityPacketAnalyzer.INJECTED_PLAYERS.keySet().forEach(VelocityPacketAnalyzer::uninject);
|
||||
VelocityPacketAnalyzer.INJECTED_PLAYERS.clear();
|
||||
|
||||
}
|
||||
|
||||
public static boolean isInjected(Player player) {
|
||||
|
||||
return INJECTED_PLAYERS.containsKey(player);
|
||||
|
||||
}
|
||||
|
||||
public static boolean inject(Player player) {
|
||||
|
||||
if(connectedPlayerConnectionClass == null)
|
||||
connectedPlayerConnectionClass = Reflection.getClass("com.velocitypowered.proxy.connection.client.ConnectedPlayer");
|
||||
if (connectedPlayerConnectionClass == null)
|
||||
connectedPlayerConnectionClass = Reflection
|
||||
.getClass("com.velocitypowered.proxy.connection.client.ConnectedPlayer");
|
||||
|
||||
if(minecraftConnectionClass == null)
|
||||
if (minecraftConnectionClass == null)
|
||||
minecraftConnectionClass = Reflection.getClass("com.velocitypowered.proxy.connection.MinecraftConnection");
|
||||
|
||||
Channel channel;
|
||||
|
||||
try {
|
||||
Object connectedPlayerObj = connectedPlayerConnectionClass.cast(player),
|
||||
minecraftConnectionObj = Reflection.getMethodsByName(connectedPlayerConnectionClass, "getConnection").get(0).invoke(connectedPlayerObj);
|
||||
|
||||
channel = (Channel) Reflection.getMethodsByName(minecraftConnectionClass, "getChannel").get(0).invoke(minecraftConnectionObj);
|
||||
Object connectedPlayerObj = connectedPlayerConnectionClass.cast(player), minecraftConnectionObj = Reflection
|
||||
.getMethodsByName(connectedPlayerConnectionClass, "getConnection").get(0)
|
||||
.invoke(connectedPlayerObj);
|
||||
|
||||
if(channel == null) {
|
||||
System.out.println("Failed to inject " + player.getUsername() + "! Channel is null.");
|
||||
channel = (Channel) Reflection.getMethodsByName(minecraftConnectionClass, "getChannel").get(0)
|
||||
.invoke(minecraftConnectionObj);
|
||||
|
||||
if (channel == null) {
|
||||
|
||||
Logger.warning("Failed to inject " + player.getUsername() + "! Channel is null.");
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
if(channel.pipeline().names().contains(VelocityPacketAnalyzer.PIPELINE_NAME))
|
||||
if (channel.pipeline().names().contains(VelocityPacketAnalyzer.PIPELINE_NAME))
|
||||
uninject(player);
|
||||
|
||||
channel.pipeline().addBefore(VelocityPacketAnalyzer.HANDLER_NAME, VelocityPacketAnalyzer.PIPELINE_NAME, new PacketDecoder(player));
|
||||
channel.pipeline().addBefore(VelocityPacketAnalyzer.HANDLER_NAME, VelocityPacketAnalyzer.PIPELINE_NAME,
|
||||
new PacketDecoder(player));
|
||||
VelocityPacketAnalyzer.INJECTED_PLAYERS.put(player, channel);
|
||||
} catch (Throwable throwable) {
|
||||
throwable.printStackTrace();
|
||||
|
||||
} catch (NoSuchElementException e) {
|
||||
|
||||
Logger.warning("Failed to find 'handler' inside player pipeline! (name=" + player.getUsername() + ", uuid="
|
||||
+ player.getUniqueId() + ", version=" + player.getProtocolVersion() + ", brand="
|
||||
+ player.getClientBrand() + " )");
|
||||
return false;
|
||||
} return true;
|
||||
|
||||
} catch (Exception exception) {
|
||||
|
||||
if (!Storage.ConfigSections.Settings.INJECTION_FAILED.SUPPRESS_EXCEPTIONS) {
|
||||
|
||||
exception.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public static void uninject(Player player) {
|
||||
|
||||
VelocityPacketAnalyzer.PLAYER_INPUT_CACHE.remove(player);
|
||||
|
||||
if(VelocityPacketAnalyzer.INJECTED_PLAYERS.containsKey(player)) {
|
||||
if (VelocityPacketAnalyzer.INJECTED_PLAYERS.containsKey(player)) {
|
||||
|
||||
Channel channel = VelocityPacketAnalyzer.INJECTED_PLAYERS.get(player);
|
||||
if(channel != null) {
|
||||
if (channel != null) {
|
||||
|
||||
VelocityPacketAnalyzer.INJECTED_PLAYERS.remove(player);
|
||||
channel.eventLoop().submit(() -> {
|
||||
|
||||
ChannelPipeline pipeline = channel.pipeline();
|
||||
if (pipeline.names().contains(VelocityPacketAnalyzer.PIPELINE_NAME)) pipeline.remove(VelocityPacketAnalyzer.PIPELINE_NAME);
|
||||
if (pipeline.names().contains(VelocityPacketAnalyzer.PIPELINE_NAME))
|
||||
pipeline.remove(VelocityPacketAnalyzer.PIPELINE_NAME);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static String getPlayerInput(Player player) {
|
||||
|
||||
String input = PLAYER_INPUT_CACHE.get(player);
|
||||
PLAYER_INPUT_CACHE.remove(player);
|
||||
return input;
|
||||
|
||||
}
|
||||
|
||||
public static void insertPlayerInput(Player player, String text) {
|
||||
|
||||
PLAYER_INPUT_CACHE.put(player, text.toLowerCase());
|
||||
|
||||
}
|
||||
|
||||
private static void modifyCommands(Player player, CommandSender sender, AvailableCommandsPacket commands) {
|
||||
|
||||
if (commands.getRootNode().getChildren().size() == 1 && player.getProtocolVersion().getProtocol() > 340
|
||||
&& commands.getRootNode().getChild("args") != null
|
||||
&& commands.getRootNode().getChild("args").getChildren().isEmpty())
|
||||
{
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
String serverName = sender.getServerName();
|
||||
|
||||
final boolean ignore = PermissionUtil.hasBypassPermission(sender)
|
||||
|| Storage.Blacklist.isDisabledServer(serverName);
|
||||
final ProxyCommandNodeHelper<CommandSource> helper = new ProxyCommandNodeHelper<>(commands.getRootNode());
|
||||
|
||||
final List<String> commandsAsString = new ArrayList<>();
|
||||
commandsAsString.addAll(helper.getChildrenNames());
|
||||
|
||||
if (ignore) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
final List<Group> groups = GroupManager.getPlayerGroups(sender);
|
||||
|
||||
final Map<String, CommandsCache> cache = Storage.getLoader().getCommandsCacheMap();
|
||||
if (!cache.containsKey(serverName)) {
|
||||
|
||||
cache.put(serverName, new CommandsCache());
|
||||
|
||||
}
|
||||
|
||||
final CommandsCache commandsCache = cache.get(serverName);
|
||||
commandsCache.handleCommands(commandsAsString, serverName);
|
||||
|
||||
final List<String> playerCommands = commandsCache.getPlayerCommands(commandsAsString, sender, groups,
|
||||
serverName);
|
||||
helper.removeIf(str -> {
|
||||
|
||||
if (str.equals("args")) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
return !playerCommands.contains(str);
|
||||
|
||||
});
|
||||
|
||||
if (Storage.ConfigSections.Settings.CUSTOM_VERSION.ALWAYS_TAB_COMPLETABLE) {
|
||||
|
||||
Storage.ConfigSections.Settings.CUSTOM_VERSION.COMMANDS.getLines()
|
||||
.forEach(input -> helper.add(input, false));
|
||||
|
||||
}
|
||||
|
||||
if (Storage.ConfigSections.Settings.CUSTOM_PLUGIN.ALWAYS_TAB_COMPLETABLE) {
|
||||
|
||||
Storage.ConfigSections.Settings.CUSTOM_PLUGIN.COMMANDS.getLines()
|
||||
.forEach(input -> helper.add(input, false));
|
||||
|
||||
}
|
||||
|
||||
SubArguments.handleCommandNode(player.getUniqueId(), helper);
|
||||
|
||||
}
|
||||
|
||||
private static class PacketDecoder extends ChannelDuplexHandler {
|
||||
|
||||
private final Player player;
|
||||
private final CommandSender sender;
|
||||
|
||||
private PacketDecoder(Player player) {
|
||||
|
||||
this.player = player;
|
||||
this.sender = CommandSenderHandler.from(player);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
|
||||
if (!(msg instanceof MinecraftPacket)) {
|
||||
|
||||
super.channelRead(ctx, msg);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
MinecraftPacket packet = (MinecraftPacket) msg;
|
||||
|
||||
if(packet.getClass().getSimpleName().equals("SignedChatCommand")) {
|
||||
if (packet.getClass().getSimpleName().equals("SignedChatCommand")) {
|
||||
|
||||
try {
|
||||
if(signedChatCommandPacketClass == null)
|
||||
signedChatCommandPacketClass = Class.forName("com.velocitypowered.proxy.crypto.SignedChatCommand");
|
||||
|
||||
if (signedChatCommandPacketClass == null)
|
||||
signedChatCommandPacketClass = Class
|
||||
.forName("com.velocitypowered.proxy.crypto.SignedChatCommand");
|
||||
|
||||
Object signedChatCommandPacket = signedChatCommandPacketClass.cast(packet);
|
||||
Field commandField = signedChatCommandPacket.getClass().getField("command");
|
||||
String command = (String) commandField.get(signedChatCommandPacket);
|
||||
|
||||
if(!VelocityBlockCommandListener.handleCommand(player, command))
|
||||
if (!VelocityBlockCommandListener.handleCommand(player, command).getResult().isAllowed())
|
||||
return;
|
||||
|
||||
} catch (Exception exception) {
|
||||
|
||||
exception.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(packet instanceof UnsignedPlayerCommandPacket) {
|
||||
if (packet instanceof UnsignedPlayerCommandPacket unsignedPlayerCommandPacket) {
|
||||
|
||||
UnsignedPlayerCommandPacket unsignedPlayerCommandPacket = (UnsignedPlayerCommandPacket) packet;
|
||||
if(VelocityBlockCommandListener.handleCommand(player, unsignedPlayerCommandPacket.getCommand()))
|
||||
if (!VelocityBlockCommandListener.handleCommand(player, unsignedPlayerCommandPacket.getCommand())
|
||||
.getResult().isAllowed())
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if(packet instanceof TabCompleteRequestPacket) {
|
||||
TabCompleteRequestPacket request = (TabCompleteRequestPacket) msg;
|
||||
if(request.getCommand() != null) {
|
||||
if (packet instanceof TabCompleteRequestPacket request) {
|
||||
|
||||
if (request.getCommand() != null) {
|
||||
|
||||
if (Storage.ConfigSections.Settings.PATCH_EXPLOITS.isMalicious(request.getCommand())) {
|
||||
|
||||
MessageTranslator.send(VelocityLoader.getServer().getConsoleCommandSource(),
|
||||
Storage.ConfigSections.Settings.PATCH_EXPLOITS.ALERT_MESSAGE.get().replace("%player%",
|
||||
player.getUsername()));
|
||||
player.disconnect(LegacyComponentSerializer.legacyAmpersand()
|
||||
.deserialize(Storage.ConfigSections.Settings.PATCH_EXPLOITS.KICK_MESSAGE.get()));
|
||||
|
||||
if(Storage.ConfigSections.Settings.PATCH_EXPLOITS.isMalicious(request.getCommand())) {
|
||||
MessageTranslator.send(VelocityLoader.getServer().getConsoleCommandSource(), Storage.ConfigSections.Settings.PATCH_EXPLOITS.ALERT_MESSAGE.get().replace("%player%", player.getUsername()));
|
||||
player.disconnect(LegacyComponentSerializer.legacyAmpersand().deserialize(Storage.ConfigSections.Settings.PATCH_EXPLOITS.KICK_MESSAGE.get()));
|
||||
} else {
|
||||
|
||||
insertPlayerInput(player, request.getCommand());
|
||||
super.channelRead(ctx, msg);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} else super.channelRead(ctx, msg);
|
||||
|
||||
} else
|
||||
super.channelRead(ctx, msg);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
|
||||
|
||||
if (!(msg instanceof MinecraftPacket)) {
|
||||
|
||||
super.write(ctx, msg, promise);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
MinecraftPacket packet = (MinecraftPacket) msg;
|
||||
|
||||
if(packet instanceof PluginMessagePacket) {
|
||||
PluginMessagePacket pluginMessagePacket = (PluginMessagePacket) packet;
|
||||
if(CustomServerBrand.isEnabled() && CustomServerBrand.isBrandTag(pluginMessagePacket.getChannel()) && !player.getCurrentServer().isPresent()) {
|
||||
if (packet instanceof PluginMessagePacket pluginMessagePacket) {
|
||||
|
||||
if (CustomServerBrand.isEnabled() && CustomServerBrand.isBrandTag(pluginMessagePacket.getChannel())
|
||||
&& !player.getCurrentServer().isPresent())
|
||||
{
|
||||
|
||||
PacketUtils.BrandManipulate brandManipulatePacket = CustomServerBrand.createBrandPacket(player);
|
||||
super.write(ctx, new PluginMessagePacket(pluginMessagePacket.getChannel(), brandManipulatePacket.getByteBuf()), promise);
|
||||
super.write(ctx, new PluginMessagePacket(pluginMessagePacket.getChannel(),
|
||||
brandManipulatePacket.getByteBuf()), promise);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
} else if(packet instanceof TabCompleteResponsePacket) {
|
||||
if (!PermissionUtil.hasBypassPermission(player) && player.getCurrentServer().isPresent()) {
|
||||
TabCompleteResponsePacket response = (TabCompleteResponsePacket) packet;
|
||||
} else if (packet instanceof TabCompleteResponsePacket response) {
|
||||
|
||||
String serverName = player.getCurrentServer().get().getServer().getServerInfo().getName();
|
||||
|
||||
if (Storage.Blacklist.isDisabledServer(serverName)) {
|
||||
|
||||
super.write(ctx, msg, promise);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (!PermissionUtil.hasBypassPermission(sender) && player.getCurrentServer().isPresent()) {
|
||||
|
||||
final List<Group> groups = GroupManager.getPlayerGroups(sender);
|
||||
|
||||
boolean cancelsBeforeHand = false;
|
||||
String playerInput = getPlayerInput(player), rawPlayerInput = playerInput, server = player.getCurrentServer().get().getServerInfo().getName();
|
||||
String playerInput = getPlayerInput(player), rawPlayerInput = playerInput,
|
||||
server = player.getCurrentServer().get().getServerInfo().getName();
|
||||
int spaces = 0;
|
||||
|
||||
if(playerInput.contains(" ")) {
|
||||
if (playerInput.contains(" ")) {
|
||||
|
||||
String[] split = playerInput.split(" ");
|
||||
spaces = split.length;
|
||||
if(spaces > 0) playerInput = split[0];
|
||||
if (spaces > 0)
|
||||
playerInput = split[0];
|
||||
|
||||
}
|
||||
|
||||
if(!playerInput.equals("/")) {
|
||||
cancelsBeforeHand = Storage.Blacklist.isBlocked(player, StringUtils.replaceFirst(playerInput, "/", ""), !Storage.ConfigSections.Settings.TURN_BLACKLIST_TO_WHITELIST.ENABLED, server);
|
||||
if(!cancelsBeforeHand) cancelsBeforeHand = Storage.ConfigSections.Settings.CUSTOM_VERSION.isTabCompletable(StringUtils.replaceFirst(playerInput, "/", "")) || Storage.ConfigSections.Settings.CUSTOM_PLUGIN.isTabCompletable(StringUtils.replaceFirst(playerInput, "/", ""));
|
||||
if (!playerInput.equals("/")) {
|
||||
|
||||
cancelsBeforeHand = !Storage.Blacklist.canPlayerAccessTab(sender, groups,
|
||||
StringUtils.replaceFirst(playerInput, "/", ""), server);
|
||||
|
||||
if (!cancelsBeforeHand)
|
||||
cancelsBeforeHand = Storage.ConfigSections.Settings.CUSTOM_VERSION
|
||||
.isTabCompletable(StringUtils.replaceFirst(playerInput, "/", ""))
|
||||
|| Storage.ConfigSections.Settings.CUSTOM_PLUGIN
|
||||
.isTabCompletable(StringUtils.replaceFirst(playerInput, "/", ""));
|
||||
|
||||
}
|
||||
|
||||
final String cursor = playerInput;
|
||||
|
||||
if(!cursor.startsWith("/") && spaces < 2 && player.getProtocolVersion().getProtocol() >= 754) {
|
||||
Logger.debug("Player won't receive TabCompleteResponsePacket because the client protocol id is " + player.getProtocolVersion().getProtocol() + "! This doesn't makes sense, that's why.");
|
||||
if (!cursor.startsWith("/") && spaces < 2 && player.getProtocolVersion().getProtocol() >= 754) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if(cursor.startsWith("/")) {
|
||||
if (spaces == 0) {
|
||||
response.getOffers().removeIf(offer -> {
|
||||
String command = offer.getText();
|
||||
if (command.startsWith("/")) command = StringUtils.replaceFirst(command, "/", "");
|
||||
if (cursor.startsWith("/")) {
|
||||
|
||||
if (spaces == 0) {
|
||||
|
||||
response.getOffers().removeIf(offer -> {
|
||||
|
||||
String command = offer.getText();
|
||||
if (command.startsWith("/"))
|
||||
command = StringUtils.replaceFirst(command, "/", "");
|
||||
|
||||
if (Storage.ConfigSections.Settings.CUSTOM_PLUGIN.isTabCompletable(command)
|
||||
|| Storage.ConfigSections.Settings.CUSTOM_VERSION.isTabCompletable(command))
|
||||
{
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
return !Storage.Blacklist.canPlayerAccessTab(sender, groups, command,
|
||||
player.getCurrentServer().get().getServerInfo().getName());
|
||||
|
||||
return Storage.Blacklist.isBlocked(player, command, !Storage.ConfigSections.Settings.TURN_BLACKLIST_TO_WHITELIST.ENABLED, player.getCurrentServer().get().getServerInfo().getName(), !Storage.ConfigSections.Settings.TURN_BLACKLIST_TO_WHITELIST.ENABLED);
|
||||
});
|
||||
|
||||
} else {
|
||||
if (cancelsBeforeHand) return;
|
||||
|
||||
if (cancelsBeforeHand)
|
||||
return;
|
||||
|
||||
List<String> suggestionsAsString = new ArrayList<>();
|
||||
|
||||
response.getOffers().forEach(offer -> suggestionsAsString.add(offer.getText()));
|
||||
|
||||
FilteredTabCompletionEvent filteredTabCompletionEvent = PATEventHandler.callFilteredTabCompletionEvents(player.getUniqueId(), rawPlayerInput, suggestionsAsString);
|
||||
if(filteredTabCompletionEvent.isCancelled()) return;
|
||||
response.getOffers().removeIf(offer -> !filteredTabCompletionEvent.getCompletion().contains(offer.getText()));
|
||||
FilteredTabCompletionEvent filteredTabCompletionEvent = PATEventHandler
|
||||
.callFilteredTabCompletionEvents(player.getUniqueId(), rawPlayerInput,
|
||||
suggestionsAsString);
|
||||
if (filteredTabCompletionEvent.isCancelled()) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
response.getOffers().removeIf(
|
||||
offer -> !filteredTabCompletionEvent.getCompletion().contains(offer.getText()));
|
||||
|
||||
if (response.getOffers().isEmpty())
|
||||
return;
|
||||
|
||||
if(response.getOffers().isEmpty()) return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if(packet instanceof AvailableCommandsPacket) {
|
||||
if (!PermissionUtil.hasBypassPermission(player) && player.getCurrentServer().isPresent()) {
|
||||
AvailableCommandsPacket commands = (AvailableCommandsPacket) packet;
|
||||
} else if (packet instanceof AvailableCommandsPacket commands) {
|
||||
|
||||
if(!commands.getRootNode().getChildren().isEmpty()) {
|
||||
String serverName = player.getCurrentServer().get().getServer().getServerInfo().getName();
|
||||
if (player.getCurrentServer().isPresent()) {
|
||||
|
||||
if (!COMMANDS_CACHE_MAP.containsKey(serverName))
|
||||
COMMANDS_CACHE_MAP.put(serverName, new CommandsCache().reverse());
|
||||
CommandsCache commandsCache = COMMANDS_CACHE_MAP.get(serverName);
|
||||
if (!FAILED) {
|
||||
|
||||
modifyCommands(player, sender, commands);
|
||||
super.write(ctx, msg, promise);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (!PermissionUtil.hasBypassPermission(player)) {
|
||||
|
||||
super.write(ctx, msg, promise);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
final String serverName = player.getCurrentServer().get().getServer().getServerInfo().getName();
|
||||
|
||||
if (Storage.Blacklist.isDisabledServer(serverName)) {
|
||||
|
||||
super.write(ctx, msg, promise);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
final List<Group> groups = GroupManager.getPlayerGroups(sender);
|
||||
|
||||
if (!commands.getRootNode().getChildren().isEmpty()) {
|
||||
|
||||
Map<String, CommandsCache> cache = Storage.getLoader().getCommandsCacheMap();
|
||||
|
||||
if (!cache.containsKey(serverName))
|
||||
cache.put(serverName, new CommandsCache());
|
||||
|
||||
CommandsCache commandsCache = cache.get(serverName);
|
||||
|
||||
List<String> commandsAsString = new ArrayList<>();
|
||||
commands.getRootNode().getChildren().stream().filter(command -> command != null && command.getName() != null).forEach(command -> commandsAsString.add(command.getName()));
|
||||
commands.getRootNode().getChildren().stream()
|
||||
.filter(command -> command != null && command.getName() != null)
|
||||
.forEach(command -> commandsAsString.add(command.getName()));
|
||||
commandsCache.handleCommands(commandsAsString, serverName);
|
||||
|
||||
if (PermissionUtil.hasBypassPermission(player)) return;
|
||||
if (PermissionUtil.hasBypassPermission(player))
|
||||
return;
|
||||
|
||||
final boolean newer = player.getProtocolVersion().getProtocol() > 340;
|
||||
final List<String> playerCommands = commandsCache.getPlayerCommands(commandsAsString, player, player.getUniqueId(), serverName);
|
||||
final List<String> playerCommands = commandsCache.getPlayerCommands(commandsAsString, sender,
|
||||
groups, serverName);
|
||||
|
||||
if(commands.getRootNode().getChildren().size() == 1 && newer
|
||||
if (commands.getRootNode().getChildren().size() == 1 && newer
|
||||
&& commands.getRootNode().getChild("args") != null
|
||||
&& commands.getRootNode().getChild("args").getChildren().isEmpty()) {
|
||||
&& commands.getRootNode().getChild("args").getChildren().isEmpty())
|
||||
{
|
||||
|
||||
super.write(ctx, msg, promise);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
commands.getRootNode().getChildren().removeIf(command -> command == null || command.getName() == null || playerCommands.contains(command.getName()));
|
||||
commands.getRootNode().getChildren().removeIf(command -> {
|
||||
|
||||
if (command == null || command.getName() == null)
|
||||
return true;
|
||||
|
||||
if (command.getName().equals("args"))
|
||||
return false;
|
||||
|
||||
if (Storage.ConfigSections.Settings.CUSTOM_PLUGIN.isTabCompletable(command.getName())
|
||||
|| Storage.ConfigSections.Settings.CUSTOM_VERSION
|
||||
.isTabCompletable(command.getName()))
|
||||
{
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
return !playerCommands.contains(command.getName());
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
super.write(ctx, msg, promise);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -9,31 +9,47 @@ public abstract class StorageTemplate implements Serializable {
|
||||
private final ConfigurationBuilder configuration;
|
||||
|
||||
public StorageTemplate(ConfigurationBuilder configuration, String navigatePath) {
|
||||
|
||||
this.navigatePath = navigatePath;
|
||||
this.configuration = configuration;
|
||||
this.load();
|
||||
|
||||
}
|
||||
|
||||
public StorageTemplate setIfEmpty(String target, Object obj) {
|
||||
|
||||
configuration.getOrSet(target, obj);
|
||||
return this;
|
||||
|
||||
}
|
||||
|
||||
public StorageTemplate set(String target, Object obj) {
|
||||
|
||||
configuration.setAndSave(target, obj);
|
||||
return this;
|
||||
|
||||
}
|
||||
|
||||
public Object get(String target, Object obj) {
|
||||
|
||||
configuration.getOrSet(target, obj);
|
||||
return this;
|
||||
|
||||
}
|
||||
|
||||
public ConfigurationBuilder getConfig() {
|
||||
|
||||
return configuration;
|
||||
|
||||
}
|
||||
|
||||
public String getNavigatePath() {
|
||||
|
||||
return navigatePath;
|
||||
|
||||
}
|
||||
public String getNavigatePath() { return navigatePath; }
|
||||
|
||||
public abstract void save();
|
||||
public abstract void load();
|
||||
|
||||
}
|
||||
@@ -6,34 +6,44 @@ import de.rayzs.pat.api.storage.Storage;
|
||||
public class BlacklistCreator {
|
||||
|
||||
public static GeneralBlacklist createGeneralBlacklist() {
|
||||
|
||||
return new GeneralBlacklist("commands");
|
||||
|
||||
}
|
||||
|
||||
public static GeneralBlacklist createGeneralBlacklist(String server) {
|
||||
server = server.toLowerCase();
|
||||
|
||||
return new GeneralBlacklist("servers." + server + ".commands");
|
||||
|
||||
}
|
||||
|
||||
public static GroupBlacklist createGroupBlacklist(String group) {
|
||||
|
||||
return new GroupBlacklist(group, "commands");
|
||||
|
||||
}
|
||||
|
||||
public static GroupBlacklist createGroupBlacklist(String group, String server, boolean ignoreExist) {
|
||||
server = server.toLowerCase();
|
||||
|
||||
if (!exist(group, server) && !ignoreExist)
|
||||
return null;
|
||||
|
||||
return new GroupBlacklist(group, "servers." + server + ".commands");
|
||||
|
||||
}
|
||||
|
||||
public static boolean exist(String server) {
|
||||
server = server.toLowerCase();
|
||||
|
||||
Object obj = Storage.Blacklist.getBlacklist().getConfig().get("global.servers." + server);
|
||||
return obj != null;
|
||||
|
||||
}
|
||||
|
||||
public static boolean exist(String group, String server) {
|
||||
server = server.toLowerCase();
|
||||
|
||||
Object obj = Storage.Blacklist.getBlacklist().getConfig().get("groups." + group + ".servers." + server);
|
||||
return obj != null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,55 +6,80 @@ import java.util.List;
|
||||
|
||||
public class GeneralBlacklist extends BlacklistStorage {
|
||||
|
||||
public GeneralBlacklist(String navigatePath) { super("global." + navigatePath); }
|
||||
public GeneralBlacklist(String navigatePath) {
|
||||
|
||||
super("global." + navigatePath);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getCommands() {
|
||||
|
||||
return super.getCommands();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlacklistStorage add(String command) {
|
||||
|
||||
return super.add(command);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlacklistStorage remove(String command) {
|
||||
|
||||
return super.remove(command);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlacklistStorage clear() {
|
||||
|
||||
return super.clear();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageTemplate setIfEmpty(String target, Object obj) {
|
||||
|
||||
return super.setIfEmpty(target, obj);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageTemplate set(String target, Object obj) {
|
||||
|
||||
return super.set(target, obj);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setList(List<String> commands) {
|
||||
|
||||
super.setList(commands);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object get(String target, Object obj) {
|
||||
|
||||
return super.get(target, obj);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
|
||||
super.save();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,36 +5,51 @@ import de.rayzs.pat.api.storage.storages.IgnoredServersStorage;
|
||||
public class GeneralIgnoredServers extends IgnoredServersStorage {
|
||||
|
||||
public GeneralIgnoredServers() {
|
||||
|
||||
super("global.ignored-servers");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IgnoredServersStorage add(String server) {
|
||||
|
||||
return super.add(server);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IgnoredServersStorage remove(String server) {
|
||||
|
||||
return super.remove(server);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isListed(String server) {
|
||||
|
||||
return super.isListed(server);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isListEmpty() {
|
||||
|
||||
return super.isListEmpty();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
|
||||
super.save();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,53 +6,80 @@ import java.util.List;
|
||||
|
||||
public class GroupBlacklist extends BlacklistStorage {
|
||||
|
||||
public GroupBlacklist(String group, String navigatePath) { super("groups." + group + "." + navigatePath); }
|
||||
public GroupBlacklist(String group, String navigatePath) {
|
||||
|
||||
super("groups." + group + "." + navigatePath);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getCommands() {
|
||||
|
||||
return super.getCommands();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlacklistStorage add(String command) {
|
||||
|
||||
return super.add(command);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlacklistStorage remove(String command) { return super.remove(command); }
|
||||
public BlacklistStorage remove(String command) {
|
||||
|
||||
return super.remove(command);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlacklistStorage clear() {
|
||||
|
||||
return super.clear();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageTemplate setIfEmpty(String target, Object obj) {
|
||||
|
||||
return super.setIfEmpty(target, obj);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageTemplate set(String target, Object obj) {
|
||||
|
||||
return super.set(target, obj);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setList(List<String> commands) {
|
||||
|
||||
super.setList(commands);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object get(String target, Object obj) {
|
||||
|
||||
return super.get(target, obj);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
|
||||
super.save();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import de.rayzs.pat.utils.Reflection;
|
||||
public class BlacklistSection extends ConfigStorage {
|
||||
|
||||
public String CLEAR, CLEAR_CONFIRM, CLEAR_SERVER, CLEAR_SERVER_CONFIRM, CLEAR_SERVER_NOT_FOUND;
|
||||
public String LIST_MESSAGE, LIST_SPLITTER, LIST_COMMAND, LIST_SERVER_MESSAGE, LIST_SERVER_SPLITTER, LIST_SERVER_COMMAND;
|
||||
public String LIST_MESSAGE, LIST_SPLITTER, LIST_SERVER_MESSAGE, LIST_SERVER_SPLITTER;
|
||||
|
||||
public String ADD_SUCCESS, ADD_FAILED;
|
||||
public String REMOVE_SUCCESS, REMOVE_FAILED;
|
||||
@@ -16,38 +16,56 @@ public class BlacklistSection extends ConfigStorage {
|
||||
public String REMOVE_SERVER_SUCCESS, REMOVE_SERVER_FAILED;
|
||||
|
||||
public BlacklistSection() {
|
||||
|
||||
super("blacklist");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
CLEAR = new ConfigSectionHelper<String>(this, "clear", "&aList has been cleared!").getOrSet();
|
||||
CLEAR_CONFIRM = new ConfigSectionHelper<String>(this, "clear-confirmation", "&4Warning! &7This command will &cclear the entire list&7! &7Repeat the &esame command &7to confirm this action.").getOrSet();
|
||||
CLEAR_CONFIRM = new ConfigSectionHelper<String>(this, "clear-confirmation",
|
||||
"&4Warning! &7This command will &cclear the entire list&7! &7Repeat the &esame command &7to confirm this action.")
|
||||
.getOrSet();
|
||||
|
||||
LIST_MESSAGE = new ConfigSectionHelper<String>(this, "list.message", "&7Listed commands (&f%size%&7)&8: &f%commands%").getOrSet();
|
||||
LIST_SPLITTER = new ConfigSectionHelper<String>(this, "list.splitter", "&7, ").getOrSet();
|
||||
LIST_COMMAND = new ConfigSectionHelper<String>(this, "list.command", "&f%command%").getOrSet();
|
||||
LIST_MESSAGE = new ConfigSectionHelper<String>(this, "list.message",
|
||||
"&7Listed commands (&f%size%&7)&8: &f%commands%").getOrSet();
|
||||
LIST_SPLITTER = new ConfigSectionHelper<String>(this, "list.splitter", "&7, &f").getOrSet();
|
||||
|
||||
ADD_SUCCESS = new ConfigSectionHelper<String>(this, "add.success", "&aSuccessfully added %command% into the list!").getOrSet();
|
||||
ADD_FAILED = new ConfigSectionHelper<String>(this, "add.failed", "&c%command% is already in the list!").getOrSet();
|
||||
ADD_SUCCESS = new ConfigSectionHelper<String>(this, "add.success",
|
||||
"&aSuccessfully added %command% into the list!").getOrSet();
|
||||
ADD_FAILED = new ConfigSectionHelper<String>(this, "add.failed", "&c%command% is already in the list!")
|
||||
.getOrSet();
|
||||
|
||||
REMOVE_SUCCESS = new ConfigSectionHelper<String>(this, "remove.success", "&aSuccessfully removed %command% from the list!").getOrSet();
|
||||
REMOVE_SUCCESS = new ConfigSectionHelper<String>(this, "remove.success",
|
||||
"&aSuccessfully removed %command% from the list!").getOrSet();
|
||||
REMOVE_FAILED = new ConfigSectionHelper<String>(this, "remove.failed", "&c%command% is not listed!").getOrSet();
|
||||
if(!Reflection.isProxyServer()) return;
|
||||
if (!Reflection.isProxyServer())
|
||||
return;
|
||||
|
||||
CLEAR_SERVER = new ConfigSectionHelper<String>(this, "clear-server", "&aList has been cleared!").getOrSet();
|
||||
CLEAR_SERVER_CONFIRM = new ConfigSectionHelper<String>(this, "clear-confirmation-server", "&4Warning! &7This command will &cclear the entire list of this server&7! &7Repeat the &esame command &7to confirm this action.").getOrSet();
|
||||
CLEAR_SERVER_NOT_FOUND = new ConfigSectionHelper<String>(this, "clear-server-not-found", "&cThe server %server% does not have any commands!").getOrSet();
|
||||
CLEAR_SERVER_CONFIRM = new ConfigSectionHelper<String>(this, "clear-confirmation-server",
|
||||
"&4Warning! &7This command will &cclear the entire list of this server&7! &7Repeat the &esame command &7to confirm this action.")
|
||||
.getOrSet();
|
||||
CLEAR_SERVER_NOT_FOUND = new ConfigSectionHelper<String>(this, "clear-server-not-found",
|
||||
"&cThe server %server% does not have any commands!").getOrSet();
|
||||
|
||||
LIST_SERVER_MESSAGE = new ConfigSectionHelper<String>(this, "list.message-server", "&7Listed commands of %server% (&f%size%&7)&8: &f%commands%").getOrSet();
|
||||
LIST_SERVER_SPLITTER = new ConfigSectionHelper<String>(this, "list.splitter-server", "&7, ").getOrSet();
|
||||
LIST_SERVER_COMMAND = new ConfigSectionHelper<String>(this, "list.command-server", "&f%command%").getOrSet();
|
||||
LIST_SERVER_MESSAGE = new ConfigSectionHelper<String>(this, "list.message-server",
|
||||
"&7Listed commands of %server% (&f%size%&7)&8: &f%commands%").getOrSet();
|
||||
LIST_SERVER_SPLITTER = new ConfigSectionHelper<String>(this, "list.splitter-server", "&7, &f").getOrSet();
|
||||
|
||||
ADD_SERVER_SUCCESS = new ConfigSectionHelper<String>(this, "add.success-server", "&aSuccessfully added %command% into the list of %server%!").getOrSet();
|
||||
ADD_SERVER_FAILED = new ConfigSectionHelper<String>(this, "add.failed-server", "&c%command% is already in the list of %server%!").getOrSet();
|
||||
ADD_SERVER_SUCCESS = new ConfigSectionHelper<String>(this, "add.success-server",
|
||||
"&aSuccessfully added %command% into the list of %server%!").getOrSet();
|
||||
ADD_SERVER_FAILED = new ConfigSectionHelper<String>(this, "add.failed-server",
|
||||
"&c%command% is already in the list of %server%!").getOrSet();
|
||||
|
||||
REMOVE_SERVER_SUCCESS = new ConfigSectionHelper<String>(this, "remove.success-server",
|
||||
"&aSuccessfully removed %command% from the list of %server%!").getOrSet();
|
||||
REMOVE_SERVER_FAILED = new ConfigSectionHelper<String>(this, "remove.failed-server",
|
||||
"&c%command% is not the list of %server%!").getOrSet();
|
||||
|
||||
REMOVE_SERVER_SUCCESS = new ConfigSectionHelper<String>(this, "remove.success-server", "&aSuccessfully removed %command% from the list of %server%!").getOrSet();
|
||||
REMOVE_SERVER_FAILED = new ConfigSectionHelper<String>(this, "remove.failed-server", "&c%command% is not the list of %server%!").getOrSet();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,12 +8,18 @@ public class CommandFailedSection extends ConfigStorage {
|
||||
public String MESSAGE;
|
||||
|
||||
public CommandFailedSection() {
|
||||
|
||||
super("command-failed");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
MESSAGE = new ConfigSectionHelper<String>(this, null, "&cFailed to execute this command! Use \"/pat\" to see all available commands.").getOrSet();
|
||||
MESSAGE = new ConfigSectionHelper<String>(this, null,
|
||||
"&cFailed to execute this command! Use \"/pat\" to see all available commands.").getOrSet();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package de.rayzs.pat.api.storage.config.messages;
|
||||
|
||||
import de.rayzs.pat.api.storage.storages.ConfigStorage;
|
||||
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
|
||||
import de.rayzs.pat.utils.configuration.helper.MultipleMessagesHelper;
|
||||
|
||||
public class ConvertSection extends ConfigStorage {
|
||||
|
||||
public MultipleMessagesHelper MESSAGE;
|
||||
|
||||
public ConvertSection() {
|
||||
|
||||
super("convert");
|
||||
|
||||
}
|
||||
|
||||
public String INVALID_CONVERTER, SUCCESS;
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
|
||||
INVALID_CONVERTER = new ConfigSectionHelper<String>(this, "converter-not-found",
|
||||
"&cConverter or necessary files could not be found!").getOrSet();
|
||||
SUCCESS = new ConfigSectionHelper<String>(this, "success",
|
||||
"&aSuccessfully converted &e%converter% &ainto the PAT storage.yml!").getOrSet();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package de.rayzs.pat.api.storage.config.messages;
|
||||
|
||||
import de.rayzs.pat.api.storage.storages.ConfigStorage;
|
||||
import de.rayzs.pat.utils.Reflection;
|
||||
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
|
||||
import de.rayzs.pat.utils.configuration.helper.MultipleMessagesHelper;
|
||||
|
||||
public class ExtractSection extends ConfigStorage {
|
||||
|
||||
public MultipleMessagesHelper MESSAGE;
|
||||
|
||||
public ExtractSection() {
|
||||
|
||||
super("extract");
|
||||
|
||||
}
|
||||
|
||||
public String USAGE, PLUGIN_NOT_FOUND, SUCCESS;
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
|
||||
if (Reflection.isProxyServer()) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
USAGE = new ConfigSectionHelper<String>(this, "usage",
|
||||
"&7Usage: &f/pat extract (plugin) <option> &7or &f(group) <option>").getOrSet();
|
||||
PLUGIN_NOT_FOUND = new ConfigSectionHelper<String>(this, "plugin-not-found", "&cPlugin %plugin% not found!")
|
||||
.getOrSet();
|
||||
SUCCESS = new ConfigSectionHelper<String>(this, "success",
|
||||
"&aSuccessfully extracted &e%amount% &anew commands from %plugin%!").getOrSet();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,12 +6,13 @@ import de.rayzs.pat.utils.Reflection;
|
||||
|
||||
public class GroupSection extends ConfigStorage {
|
||||
|
||||
public String CREATE, ALREADY_EXIST, DOES_NOT_EXIST, DELETE, DELETE_CONFIRM, CREATE_SERVER, ALREADY_SERVER_EXIST, DOES_NOT_EXIST_SERVER, DELETE_SERVER, DELETE_SERVER_CONFIRM;
|
||||
public String CREATE, ALREADY_EXIST, DOES_NOT_EXIST, DELETE, DELETE_CONFIRM, CREATE_SERVER, ALREADY_SERVER_EXIST,
|
||||
DOES_NOT_EXIST_SERVER, DELETE_SERVER, DELETE_SERVER_CONFIRM;
|
||||
public String CLEAR, CLEAR_CONFIRM, CLEAR_SERVER, CLEAR_SERVER_CONFIRM;
|
||||
public String PRIORITY_SUCCESS, PRIORITY_FAILED;
|
||||
|
||||
public String LIST_MESSAGE, LIST_SPLITTER, LIST_COMMAND, LIST_SERVER_MESSAGE, LIST_SERVER_SPLITTER, LIST_SERVER_COMMAND;
|
||||
public String LIST_GROUP_MESSAGE, LIST_GROUP_SPLITTER, LIST_GROUP_GROUPS, LIST_GROUP_SERVER_MESSAGE, LIST_GROUP_SERVER_SPLITTER, LIST_GROUP_SERVER_GROUPS;
|
||||
public String LIST_MESSAGE, LIST_SPLITTER, LIST_SERVER_MESSAGE, LIST_SERVER_SPLITTER;
|
||||
public String LIST_GROUP_MESSAGE, LIST_GROUP_SPLITTER, LIST_GROUP_SERVER_MESSAGE, LIST_GROUP_SERVER_SPLITTER;
|
||||
public String LIST_PRIORITY_MESSAGE, LIST_PRIORITY_SPLITTER, LIST_PRIORITY_GROUPS;
|
||||
|
||||
public String ADD_SUCCESS, ADD_FAILED;
|
||||
@@ -21,66 +22,99 @@ public class GroupSection extends ConfigStorage {
|
||||
public String REMOVE_SERVER_SUCCESS, REMOVE_SERVER_FAILED;
|
||||
|
||||
public GroupSection() {
|
||||
|
||||
super("group");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
|
||||
CREATE = new ConfigSectionHelper<String>(this, "create", "&aGroup %group% has been created!").getOrSet();
|
||||
ALREADY_EXIST = new ConfigSectionHelper<String>(this, "already-exist", "&cGroup %group% already exist!").getOrSet();
|
||||
DOES_NOT_EXIST = new ConfigSectionHelper<String>(this, "does-not-exist", "&cGroup %group% does not exist!").getOrSet();
|
||||
ALREADY_EXIST = new ConfigSectionHelper<String>(this, "already-exist", "&cGroup %group% already exist!")
|
||||
.getOrSet();
|
||||
DOES_NOT_EXIST = new ConfigSectionHelper<String>(this, "does-not-exist", "&cGroup %group% does not exist!")
|
||||
.getOrSet();
|
||||
DELETE = new ConfigSectionHelper<String>(this, "delete", "&cGroup %group% has been deleted!").getOrSet();
|
||||
DELETE_CONFIRM = new ConfigSectionHelper<String>(this, "delete-confirmation", "&4Warning! &7This command will &cdelete the group with the whole list&7 of this group! &7Repeat the &esame command &7to confirm this action.").getOrSet();
|
||||
DELETE_CONFIRM = new ConfigSectionHelper<String>(this, "delete-confirmation",
|
||||
"&4Warning! &7This command will &cdelete the group with the whole list&7 of this group! &7Repeat the &esame command &7to confirm this action.")
|
||||
.getOrSet();
|
||||
|
||||
CLEAR = new ConfigSectionHelper<String>(this, "clear", "&aList of group %group% has been cleared!").getOrSet();
|
||||
CLEAR_CONFIRM = new ConfigSectionHelper<String>(this, "clear-confirmation", "&4Warning! &7This command will &cclear the entire list&7 of this group! &7Repeat the &esame command &7to confirm this action.").getOrSet();
|
||||
CLEAR_CONFIRM = new ConfigSectionHelper<String>(this, "clear-confirmation",
|
||||
"&4Warning! &7This command will &cclear the entire list&7 of this group! &7Repeat the &esame command &7to confirm this action.")
|
||||
.getOrSet();
|
||||
|
||||
PRIORITY_SUCCESS = new ConfigSectionHelper<String>(this, "priority.success", "&aSuccessfully set the priority of group &e%group% &ato &e%priority%&a!").getOrSet();
|
||||
PRIORITY_FAILED = new ConfigSectionHelper<String>(this, "priority.failed", "&cInvalid priority! Please choose a number which is greater than 0.").getOrSet();
|
||||
PRIORITY_SUCCESS = new ConfigSectionHelper<String>(this, "priority.success",
|
||||
"&aSuccessfully set the priority of group &e%group% &ato &e%priority%&a!").getOrSet();
|
||||
PRIORITY_FAILED = new ConfigSectionHelper<String>(this, "priority.failed",
|
||||
"&cInvalid priority! Please choose a number which is greater than 0.").getOrSet();
|
||||
|
||||
LIST_MESSAGE = new ConfigSectionHelper<String>(this, "list.message", "&7Listed commands of group %group% (&f%size%&7)&8: &f%commands%").getOrSet();
|
||||
LIST_SPLITTER = new ConfigSectionHelper<String>(this, "list.splitter", "&7, ").getOrSet();
|
||||
LIST_COMMAND = new ConfigSectionHelper<String>(this, "list.command", "&f").getOrSet();
|
||||
LIST_MESSAGE = new ConfigSectionHelper<String>(this, "list.message",
|
||||
"&7Listed commands of group %group% (&f%size%&7)&8: &f%commands%").getOrSet();
|
||||
LIST_SPLITTER = new ConfigSectionHelper<String>(this, "list.splitter", "&7, &f").getOrSet();
|
||||
|
||||
LIST_PRIORITY_MESSAGE = new ConfigSectionHelper<String>(this, "list-priorities.message", "&7List of all group priorities (&f%size%&7)&8: &f%groups%").getOrSet();
|
||||
LIST_PRIORITY_MESSAGE = new ConfigSectionHelper<String>(this, "list-priorities.message",
|
||||
"&7List of all group priorities (&f%size%&7)&8: &f%groups%").getOrSet();
|
||||
LIST_PRIORITY_SPLITTER = new ConfigSectionHelper<String>(this, "list-priorities.splitter", "\\n").getOrSet();
|
||||
LIST_PRIORITY_GROUPS = new ConfigSectionHelper<String>(this, "list-priorities.group", "&8- &e%priority%&8: &f%group%").getOrSet();
|
||||
LIST_PRIORITY_GROUPS = new ConfigSectionHelper<String>(this, "list-priorities.group",
|
||||
"&8- &e%priority%&8: &e%group%").getOrSet();
|
||||
|
||||
LIST_GROUP_MESSAGE = new ConfigSectionHelper<String>(this, "list-groups.message", "&7All groups (&f%size%&7)&8: &f%groups%").getOrSet();
|
||||
LIST_GROUP_SPLITTER = new ConfigSectionHelper<String>(this, "list-groups.splitter", "&7, ").getOrSet();
|
||||
LIST_GROUP_GROUPS = new ConfigSectionHelper<String>(this, "list-groups.command", "&f").getOrSet();
|
||||
LIST_GROUP_MESSAGE = new ConfigSectionHelper<String>(this, "list-groups.message",
|
||||
"&7All groups (&f%size%&7)&8: &f%groups%").getOrSet();
|
||||
LIST_GROUP_SPLITTER = new ConfigSectionHelper<String>(this, "list-groups.splitter", "&7, &f").getOrSet();
|
||||
|
||||
ADD_SUCCESS = new ConfigSectionHelper<String>(this, "add.success", "&aSuccessfully added %command% into the list of group %group%!").getOrSet();
|
||||
ADD_FAILED = new ConfigSectionHelper<String>(this, "add.failed", "&c%command% is already in the list of group %group%!").getOrSet();
|
||||
ADD_SUCCESS = new ConfigSectionHelper<String>(this, "add.success",
|
||||
"&aSuccessfully added %command% into the list of group %group%!").getOrSet();
|
||||
ADD_FAILED = new ConfigSectionHelper<String>(this, "add.failed",
|
||||
"&c%command% is already in the list of group %group%!").getOrSet();
|
||||
|
||||
REMOVE_SUCCESS = new ConfigSectionHelper<String>(this, "remove.success", "&aSuccessfully removed %command% from the list of group %group%!").getOrSet();
|
||||
REMOVE_FAILED = new ConfigSectionHelper<String>(this, "remove.failed", "&c%command% is not listed in the group %group%!").getOrSet();
|
||||
if(!Reflection.isProxyServer()) return;
|
||||
REMOVE_SUCCESS = new ConfigSectionHelper<String>(this, "remove.success",
|
||||
"&aSuccessfully removed %command% from the list of group %group%!").getOrSet();
|
||||
REMOVE_FAILED = new ConfigSectionHelper<String>(this, "remove.failed",
|
||||
"&c%command% is not listed in the group %group%!").getOrSet();
|
||||
if (!Reflection.isProxyServer())
|
||||
return;
|
||||
|
||||
CREATE_SERVER = new ConfigSectionHelper<String>(this, "create-server", "&aGroup %group% for %server% has been created!").getOrSet();
|
||||
ALREADY_SERVER_EXIST = new ConfigSectionHelper<String>(this, "already-exist-server", "&cGroup %group% for %server% already exist!").getOrSet();
|
||||
DOES_NOT_EXIST_SERVER = new ConfigSectionHelper<String>(this, "does-not-exist-server", "&cGroup %group% of %server% does not exist!").getOrSet();
|
||||
DELETE_SERVER = new ConfigSectionHelper<String>(this, "delete-server", "&cGroup %group% of %server% has been deleted!").getOrSet();
|
||||
DELETE_SERVER_CONFIRM = new ConfigSectionHelper<String>(this, "delete-confirmation-server", "&4Warning! &7This command will &cdelete the group of the server %server% with the whole list&7 of this group! &7Repeat the &esame command &7to confirm this action.").getOrSet();
|
||||
CREATE_SERVER = new ConfigSectionHelper<String>(this, "create-server",
|
||||
"&aGroup %group% for %server% has been created!").getOrSet();
|
||||
ALREADY_SERVER_EXIST = new ConfigSectionHelper<String>(this, "already-exist-server",
|
||||
"&cGroup %group% for %server% already exist!").getOrSet();
|
||||
DOES_NOT_EXIST_SERVER = new ConfigSectionHelper<String>(this, "does-not-exist-server",
|
||||
"&cGroup %group% of %server% does not exist!").getOrSet();
|
||||
DELETE_SERVER = new ConfigSectionHelper<String>(this, "delete-server",
|
||||
"&cGroup %group% of %server% has been deleted!").getOrSet();
|
||||
DELETE_SERVER_CONFIRM = new ConfigSectionHelper<String>(this, "delete-confirmation-server",
|
||||
"&4Warning! &7This command will &cdelete the group of the server %server% with the whole list&7 of this group! &7Repeat the &esame command &7to confirm this action.")
|
||||
.getOrSet();
|
||||
|
||||
CLEAR_SERVER = new ConfigSectionHelper<String>(this, "clear-server", "&aList of group %group% from %server% has been cleared!").getOrSet();
|
||||
CLEAR_SERVER_CONFIRM = new ConfigSectionHelper<String>(this, "clear-confirmation-server", "&4Warning! &7This command will &cclear the entire list&7 of this group for %server%! &7Repeat the &esame command &7to confirm this action.").getOrSet();
|
||||
CLEAR_SERVER = new ConfigSectionHelper<String>(this, "clear-server",
|
||||
"&aList of group %group% from %server% has been cleared!").getOrSet();
|
||||
CLEAR_SERVER_CONFIRM = new ConfigSectionHelper<String>(this, "clear-confirmation-server",
|
||||
"&4Warning! &7This command will &cclear the entire list&7 of this group for %server%! &7Repeat the &esame command &7to confirm this action.")
|
||||
.getOrSet();
|
||||
|
||||
LIST_SERVER_MESSAGE = new ConfigSectionHelper<String>(this, "list.message-server", "&7Listed commands of group %group% from %server% (&f%size%&7)&8: &f%commands%").getOrSet();
|
||||
LIST_SERVER_SPLITTER = new ConfigSectionHelper<String>(this, "list.splitter-server", "&7, ").getOrSet();
|
||||
LIST_SERVER_COMMAND = new ConfigSectionHelper<String>(this, "list.command-server", "&f%group%").getOrSet();
|
||||
LIST_SERVER_MESSAGE = new ConfigSectionHelper<String>(this, "list.message-server",
|
||||
"&7Listed commands of group %group% from %server% (&f%size%&7)&8: &f%commands%").getOrSet();
|
||||
LIST_SERVER_SPLITTER = new ConfigSectionHelper<String>(this, "list.splitter-server", "&7, &f").getOrSet();
|
||||
|
||||
LIST_GROUP_SERVER_MESSAGE = new ConfigSectionHelper<String>(this, "list-groups.message-server", "&7All groups from %server% (&f%size%&7)&8: &f%groups%").getOrSet();
|
||||
LIST_GROUP_SERVER_SPLITTER = new ConfigSectionHelper<String>(this, "list-groups.splitter-server", "&7, ").getOrSet();
|
||||
LIST_GROUP_SERVER_GROUPS = new ConfigSectionHelper<String>(this, "list-groups.command-server", "&f%group%").getOrSet();
|
||||
LIST_GROUP_SERVER_MESSAGE = new ConfigSectionHelper<String>(this, "list-groups.message-server",
|
||||
"&7All groups from %server% (&f%size%&7)&8: &f%groups%").getOrSet();
|
||||
LIST_GROUP_SERVER_SPLITTER = new ConfigSectionHelper<String>(this, "list-groups.splitter-server", "&7, &f")
|
||||
.getOrSet();
|
||||
|
||||
ADD_SERVER_SUCCESS = new ConfigSectionHelper<String>(this, "add.success-server", "&aSuccessfully added %command% into the list of group %group% for %server%!").getOrSet();
|
||||
ADD_SERVER_FAILED = new ConfigSectionHelper<String>(this, "add.failed-server", "&c%command% is already in the list of group %group% of %server%!").getOrSet();
|
||||
ADD_SERVER_SUCCESS = new ConfigSectionHelper<String>(this, "add.success-server",
|
||||
"&aSuccessfully added %command% into the list of group %group% for %server%!").getOrSet();
|
||||
ADD_SERVER_FAILED = new ConfigSectionHelper<String>(this, "add.failed-server",
|
||||
"&c%command% is already in the list of group %group% of %server%!").getOrSet();
|
||||
|
||||
REMOVE_SERVER_SUCCESS = new ConfigSectionHelper<String>(this, "remove.success-server", "&aSuccessfully removed %command% from the list of group %group% from %server%!").getOrSet();
|
||||
REMOVE_SERVER_FAILED = new ConfigSectionHelper<String>(this, "remove.failed-server", "&c%command% is not listed in the group %group% of %server%!").getOrSet();
|
||||
REMOVE_SERVER_SUCCESS = new ConfigSectionHelper<String>(this, "remove.success-server",
|
||||
"&aSuccessfully removed %command% from the list of group %group% from %server%!").getOrSet();
|
||||
REMOVE_SERVER_FAILED = new ConfigSectionHelper<String>(this, "remove.failed-server",
|
||||
"&c%command% is not listed in the group %group% of %server%!").getOrSet();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,52 +10,44 @@ public class HelpSection extends ConfigStorage {
|
||||
public MultipleMessagesHelper MESSAGE;
|
||||
|
||||
public HelpSection() {
|
||||
|
||||
super("help");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
MESSAGE = new MultipleMessagesHelper(this, null, Reflection.isProxyServer() ?
|
||||
Arrays.asList(
|
||||
"&7Available commands are: &f/%label%&7..."
|
||||
, "&7Format: &8<optional> (required)"
|
||||
, "&f reload &7to reload the plugin"
|
||||
, "&f notify &7to get alerted"
|
||||
, "&f info &7to get a few information"
|
||||
, "&f postdebug &7to post the PAT logs"
|
||||
, "&f update <player> &7to update player(s) permissions"
|
||||
, "&f perms <player> &7to check a player's permissions"
|
||||
, "&f creategroup (group) &7Create a group"
|
||||
, "&f deletegroup (group) &7Delete a group"
|
||||
, "&f setpriority (group) (priority) &7to set the priority"
|
||||
, "&f list &8(optional: group) &7to see all listed commands"
|
||||
, "&f listgroups &7List all groups"
|
||||
, "&f listpriorities &7to list all group priorities"
|
||||
, "&f add/rem (command) &8<group> &7to manage the list"
|
||||
, "&f clear &8<group> &7to clear the list")
|
||||
:
|
||||
Arrays.asList(
|
||||
"&7Available commands are: &f/%label%&7..."
|
||||
, "&7Format: &8<optional> (required)"
|
||||
, "&f reload &7to reload the plugin"
|
||||
, "&f notify &7to get alerted"
|
||||
, "&f info &7to get a few information"
|
||||
, "&f postdebug &7to post the PAT logs"
|
||||
, "&f update <player> &7to update player(s) permissions"
|
||||
, "&f perms <player> &7to check a player's permissions"
|
||||
, "&f creategroup (group) &7Create a group"
|
||||
, "&f deletegroup (group) &7Delete a group"
|
||||
, "&f setpriority (group) (priority) &7to set the priority"
|
||||
, "&f list &8<group> &7to see all listed commands"
|
||||
, "&f listgroups &8<server> &7List all groups"
|
||||
, "&f listpriorities &7to list all group priorities"
|
||||
, "&f add/rem (command) &8<group> &7to manage the list"
|
||||
, "&f clear &8<group> &7to clear the list"
|
||||
, "&7 For a specific server:"
|
||||
, "&f serv list (server) &8<group>"
|
||||
, "&f serv add/rem (server) (command) &8<group>"
|
||||
, "&f serv clear (server) &8<group>"
|
||||
));
|
||||
|
||||
MESSAGE = new MultipleMessagesHelper(this, null, Reflection.isProxyServer() ? Arrays.asList(
|
||||
"&7Available commands are: &f/%label%&7...", "&7Format: &8<optional> (required)",
|
||||
"&f reload &7to reload the plugin", "&f notify &7to get alerted",
|
||||
"&f info &7to get a few information", "&f postdebug &7to post the PAT logs",
|
||||
"&f update <player> &7to update player(s) permissions",
|
||||
"&f perms <player> &7to check a player's permissions",
|
||||
"&f extract (plugin) &7to extract all plugin commands",
|
||||
"&f convert (plugin) &7converts into a PAT storage.yml", "&f creategroup (group) &7Create a group",
|
||||
"&f deletegroup (group) &7Delete a group", "&f setpriority (group) (priority) &7to set the priority",
|
||||
"&f list &8(optional: group) &7to see all listed commands", "&f listgroups &7List all groups",
|
||||
"&f listpriorities &7to list all group priorities",
|
||||
"&f add/rem (command) &8<group> &7to manage the list", "&f clear &8<group> &7to clear the list")
|
||||
: Arrays.asList("&7Available commands are: &f/%label%&7...", "&7Format: &8<optional> (required)",
|
||||
"&f reload &7to reload the plugin", "&f notify &7to get alerted",
|
||||
"&f info &7to get a few information", "&f postdebug &7to post the PAT logs",
|
||||
"&f update <player> &7to update player(s) permissions",
|
||||
"&f perms <player> &7to check a player's permissions",
|
||||
"&f extract (plugin) &7to extract all plugin commands",
|
||||
"&f creategroup (group) &7Create a group", "&f deletegroup (group) &7Delete a group",
|
||||
"&f setpriority (group) (priority) &7to set the priority",
|
||||
"&f list &8<group> &7to see all listed commands",
|
||||
"&f listgroups &8<server> &7List all groups",
|
||||
"&f listpriorities &7to list all group priorities",
|
||||
"&f add/rem (command) &8<group> &7to manage the list",
|
||||
"&f clear &8<group> &7to clear the list", "&7 For a specific server:",
|
||||
"&f serv list (server) &8<group>", "&f serv add/rem (server) (command) &8<group>",
|
||||
"&f serv clear (server) &8<group>"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,36 +1,46 @@
|
||||
package de.rayzs.pat.api.storage.config.messages;
|
||||
|
||||
import de.rayzs.pat.api.storage.storages.ConfigStorage;
|
||||
import de.rayzs.pat.utils.Reflection;
|
||||
import de.rayzs.pat.utils.configuration.helper.*;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class InfoSection extends ConfigStorage {
|
||||
|
||||
public String VERSION_OUTDATED, VERSION_UPDATED, SYNC_TIME, SYNC_DISABLED;
|
||||
public String VERSION_OUTDATED, VERSION_UPDATED, SYNC_TIME, SYNC_DISABLED, SYNC_WAITING;
|
||||
public MultipleMessagesHelper MESSAGE;
|
||||
|
||||
public InfoSection() {
|
||||
|
||||
super("info");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
|
||||
VERSION_UPDATED = new ConfigSectionHelper<String>(this, "version.updated", "&aLatest version").getOrSet();
|
||||
VERSION_OUTDATED = new ConfigSectionHelper<String>(this, "version.outdated", "&cOutdated (%newest_version%)").getOrSet();
|
||||
VERSION_OUTDATED = new ConfigSectionHelper<String>(this, "version.outdated", "&cOutdated (%newest_version%)")
|
||||
.getOrSet();
|
||||
SYNC_TIME = new ConfigSectionHelper<String>(this, "proxy-sync.time", "&e%time%").getOrSet();
|
||||
|
||||
if (!Reflection.isProxyServer()) {
|
||||
|
||||
SYNC_WAITING = new ConfigSectionHelper<String>(this, "proxy-sync.waiting",
|
||||
"&cWaiting to establish connection...").getOrSet();
|
||||
|
||||
}
|
||||
|
||||
SYNC_DISABLED = new ConfigSectionHelper<String>(this, "proxy-sync.disabled", "&cDisabled").getOrSet();
|
||||
|
||||
MESSAGE = new MultipleMessagesHelper(this, "message",
|
||||
Arrays.asList(
|
||||
"&7Necessary information about &fPAT&8:"
|
||||
, "&7 Version: &e%current_version%"
|
||||
, "&7 Status: %version_status%"
|
||||
, "&7 Last sync with proxy: &e%sync_time%"
|
||||
, "&7 Proxy sync-token: &e%token%"
|
||||
, "&7 Proxy-received server name: &e%sync_server_name%"
|
||||
)
|
||||
);
|
||||
Arrays.asList("&7Necessary information about &fPAT&8:", "&7 Version: &e%current_version%",
|
||||
"&7 Status: %version_status%", "&7 Last sync with proxy: &e%sync_time%",
|
||||
"&7 Last received alive packet: %last_alive_response%", "&7 Proxy sync-token: &e%token%",
|
||||
"&7 Proxy-received server name: &e%sync_server_name%"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,12 +8,19 @@ public class NoPermissionSection extends ConfigStorage {
|
||||
public String MESSAGE;
|
||||
|
||||
public NoPermissionSection() {
|
||||
|
||||
super("no-permissions");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
MESSAGE = new ConfigSectionHelper<String>(this, null, "&cYou are not allowed to execute this command! Missing permission: &4proantitab.%permission%").getOrSet();
|
||||
MESSAGE = new ConfigSectionHelper<String>(this, null,
|
||||
"&cYou are not allowed to execute this command! Missing permission: &4proantitab.%permission%")
|
||||
.getOrSet();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,14 +11,22 @@ public class NotificationSection extends ConfigStorage {
|
||||
public MultipleMessagesHelper ALERT;
|
||||
|
||||
public NotificationSection() {
|
||||
|
||||
super("notification");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
ENABLED = new ConfigSectionHelper<String>(this, "enabled", "&aEnabled notifications").getOrSet();
|
||||
DISABLED = new ConfigSectionHelper<String>(this, "disabled", "&cDisabled notifications").getOrSet();
|
||||
ALERT = new MultipleMessagesHelper(this, "alert", Collections.singletonList("&8[&4ALERT&8] &c%player% &8(&7" + (Reflection.isProxyServer() ? "server: &e%server%" : "world: &e%world%") + "&8) &ctried to execute the following blocked command: &4%command%"));
|
||||
ALERT = new MultipleMessagesHelper(this, "alert",
|
||||
Collections.singletonList("&8[&4ALERT&8] &c%player% &8(&7"
|
||||
+ (Reflection.isProxyServer() ? "server: &e%server%" : "world: &e%world%")
|
||||
+ "&8) &ctried to execute the following blocked command: &4%command%"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,13 +9,20 @@ public class OnlyForProxySection extends ConfigStorage {
|
||||
public String MESSAGE;
|
||||
|
||||
public OnlyForProxySection() {
|
||||
|
||||
super("only-for-proxy");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
if(Reflection.isProxyServer()) return;
|
||||
MESSAGE = new ConfigSectionHelper<String>(this, null, "&cThis command works on Bungeecord/Velocity servers only!").getOrSet();
|
||||
if (Reflection.isProxyServer())
|
||||
return;
|
||||
MESSAGE = new ConfigSectionHelper<String>(this, null,
|
||||
"&cThis command works on Bungeecord/Velocity servers only!").getOrSet();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,14 +8,22 @@ public class PermsCheckSection extends ConfigStorage {
|
||||
public String MESSAGE, PLAYER_MISSING, PLAYER_NOT_ONLINE;
|
||||
|
||||
public PermsCheckSection() {
|
||||
|
||||
super("perms-check");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
MESSAGE = new ConfigSectionHelper<String>(this, "message", "&7All of &e%player%'s &7PAT-related permission: &e%permissions%").getOrSet();
|
||||
PLAYER_MISSING = new ConfigSectionHelper<String>(this, "player-is-missing", "&cPlease specify the player whose permission you want to check.").getOrSet();
|
||||
PLAYER_NOT_ONLINE = new ConfigSectionHelper<String>(this, "player-not-online", "&c%player% is not online!").getOrSet();
|
||||
MESSAGE = new ConfigSectionHelper<String>(this, "message",
|
||||
"&7All of &e%player%'s &7PAT-related permission: &e%permissions%").getOrSet();
|
||||
PLAYER_MISSING = new ConfigSectionHelper<String>(this, "player-is-missing",
|
||||
"&cPlease specify the player whose permission you want to check.").getOrSet();
|
||||
PLAYER_NOT_ONLINE = new ConfigSectionHelper<String>(this, "player-not-online", "&c%player% is not online!")
|
||||
.getOrSet();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,13 +8,20 @@ public class PostDebugSection extends ConfigStorage {
|
||||
public String SUCCESS, FAILED;
|
||||
|
||||
public PostDebugSection() {
|
||||
|
||||
super("post-debug");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
SUCCESS = new ConfigSectionHelper<String>(this, "success", "&aSuccessfully uploaded debug logs: &e%link% &8(<click:open_url:%link%><gray>CLICK</click>&8)").getOrSet();
|
||||
SUCCESS = new ConfigSectionHelper<String>(this, "success",
|
||||
"&aSuccessfully uploaded debug logs: &e%link% &8(<click:open_url:%link%><gray>CLICK</click>&8)")
|
||||
.getOrSet();
|
||||
FAILED = new ConfigSectionHelper<String>(this, "failed", "&cFailed to upload debug logs!").getOrSet();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,12 +8,17 @@ public class PrefixSection extends ConfigStorage {
|
||||
public String PREFIX;
|
||||
|
||||
public PrefixSection() {
|
||||
|
||||
super("prefix");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
PREFIX = new ConfigSectionHelper<String>(this, null, "&8[&4ProAntiTab&8]").getOrSet();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,13 +8,19 @@ public class ReloadSection extends ConfigStorage {
|
||||
public String LOADING, DONE;
|
||||
|
||||
public ReloadSection() {
|
||||
|
||||
super("reload");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
LOADING = new ConfigSectionHelper<String>(this, "loading", "&eReloading all configuration files...").getOrSet();
|
||||
DONE = new ConfigSectionHelper<String>(this, "done", "&aSuccessfully reloaded all configuration files!").getOrSet();
|
||||
DONE = new ConfigSectionHelper<String>(this, "done", "&aSuccessfully reloaded all configuration files!")
|
||||
.getOrSet();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,26 +7,34 @@ import de.rayzs.pat.utils.Reflection;
|
||||
public class ServerListSection extends ConfigStorage {
|
||||
|
||||
public String SERVER_DOES_NOT_EXIST, GROUP_DOES_NOT_EXIST;
|
||||
public String LIST_SERVER_MESSAGE, LIST_SERVER_SPLITTER, LIST_SERVER_COMMAND, LIST_GROUP_MESSAGE, LIST_GROUP_SPLITTER, LIST_GROUP_COMMAND;
|
||||
public String LIST_SERVER_MESSAGE, LIST_SERVER_SPLITTER, LIST_GROUP_MESSAGE, LIST_GROUP_SPLITTER;
|
||||
|
||||
public ServerListSection() {
|
||||
|
||||
super("server-list");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
if(!Reflection.isProxyServer()) return;
|
||||
if (!Reflection.isProxyServer())
|
||||
return;
|
||||
|
||||
SERVER_DOES_NOT_EXIST = new ConfigSectionHelper<String>(this, "server-not-found", "&cThe server %server% does not have any commands!").getOrSet();
|
||||
GROUP_DOES_NOT_EXIST = new ConfigSectionHelper<String>(this, "group-does-not-exist", "&cGroup %group% does not exist for %server%!").getOrSet();
|
||||
SERVER_DOES_NOT_EXIST = new ConfigSectionHelper<String>(this, "server-not-found",
|
||||
"&cThe server %server% does not have any commands!").getOrSet();
|
||||
GROUP_DOES_NOT_EXIST = new ConfigSectionHelper<String>(this, "group-does-not-exist",
|
||||
"&cGroup %group% does not exist for %server%!").getOrSet();
|
||||
|
||||
LIST_SERVER_MESSAGE = new ConfigSectionHelper<String>(this, "list.server.message", "&7Listed commands of %server% (&f%size%&7)&8: &f%commands%").getOrSet();
|
||||
LIST_SERVER_SPLITTER = new ConfigSectionHelper<String>(this, "list.server.splitter", "&7, ").getOrSet();
|
||||
LIST_SERVER_COMMAND = new ConfigSectionHelper<String>(this, "list.server.command", "&f%command%").getOrSet();
|
||||
LIST_SERVER_MESSAGE = new ConfigSectionHelper<String>(this, "list.server.message",
|
||||
"&7Listed commands of %server% (&f%size%&7)&8: &f%commands%").getOrSet();
|
||||
LIST_SERVER_SPLITTER = new ConfigSectionHelper<String>(this, "list.server.splitter", "&7, &f").getOrSet();
|
||||
|
||||
LIST_GROUP_MESSAGE = new ConfigSectionHelper<String>(this, "list.group.message",
|
||||
"&7Listed commands of %group% from %server% (&f%size%&7)&8: &f%commands%").getOrSet();
|
||||
LIST_GROUP_SPLITTER = new ConfigSectionHelper<String>(this, "list.group.splitter", "&7, &f").getOrSet();
|
||||
|
||||
LIST_GROUP_MESSAGE = new ConfigSectionHelper<String>(this, "list.group.message", "&7Listed commands of %group% from %server% (&f%size%&7)&8: &f%commands%").getOrSet();
|
||||
LIST_GROUP_SPLITTER = new ConfigSectionHelper<String>(this, "list.group.splitter", "&7, ").getOrSet();
|
||||
LIST_GROUP_COMMAND = new ConfigSectionHelper<String>(this, "list.group.command", "&f%command%").getOrSet();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,19 +12,31 @@ public class StatsSection extends ConfigStorage {
|
||||
public MultipleMessagesHelper STATISTIC;
|
||||
|
||||
public StatsSection() {
|
||||
|
||||
super("stats");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
if(!Reflection.isProxyServer()) return;
|
||||
|
||||
if (!Reflection.isProxyServer()) {
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
NO_SERVER = new ConfigSectionHelper<String>(this, "no-server", "&cNone!").getOrSet();
|
||||
SPLITTER = new ConfigSectionHelper<String>(this, "message.splitter", "&7, ").getOrSet();
|
||||
SERVER = new ConfigSectionHelper<String>(this, "message.server", "&f%servername% &8(%updated%)").getOrSet();
|
||||
STATISTIC = new MultipleMessagesHelper(this, "message.statistic", Arrays.asList(
|
||||
"&7Last sync sent to &f%server_count% &7servers. &8&o(%last_sync_time% ago)",
|
||||
"&7Sent to servers: &f%servers%"
|
||||
));
|
||||
SERVER = new ConfigSectionHelper<String>(this, "message.server",
|
||||
"&f%servername% &8(&a%last_alive_response% &8/ &2%updated%&8)").getOrSet();
|
||||
STATISTIC = new MultipleMessagesHelper(this, "message.statistic",
|
||||
Arrays.asList("&7Format: &eserver (last alive packet / last sync packet)",
|
||||
"&7Last sync sent to &f%server_count% &7server(s) &e%last_sync_time% &7ago:",
|
||||
"&7Sent to servers: &f%servers%"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+9
-2
@@ -8,14 +8,21 @@ public class UpdatePermissionsSection extends ConfigStorage {
|
||||
public String UPDATE_ALL, UPDATE_SPECIFIC, PLAYER_NOT_ONLINE;
|
||||
|
||||
public UpdatePermissionsSection() {
|
||||
|
||||
super("update-permissions");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
UPDATE_ALL = new ConfigSectionHelper<String>(this, "all-players", "&aUpdated permissions!").getOrSet();
|
||||
UPDATE_SPECIFIC = new ConfigSectionHelper<String>(this, "specific-player", "&aUpdated %target%'s permissions!").getOrSet();
|
||||
PLAYER_NOT_ONLINE = new ConfigSectionHelper<String>(this, "player-not-online", "&c%target% is not online!").getOrSet();
|
||||
UPDATE_SPECIFIC = new ConfigSectionHelper<String>(this, "specific-player", "&aUpdated %target%'s permissions!")
|
||||
.getOrSet();
|
||||
PLAYER_NOT_ONLINE = new ConfigSectionHelper<String>(this, "player-not-online", "&c%target% is not online!")
|
||||
.getOrSet();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package de.rayzs.pat.api.storage.config.settings;
|
||||
|
||||
import de.rayzs.pat.api.storage.storages.ConfigStorage;
|
||||
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
|
||||
|
||||
public class AllowGroupOverrulingSection extends ConfigStorage {
|
||||
|
||||
public boolean ENABLED;
|
||||
|
||||
public AllowGroupOverrulingSection() {
|
||||
|
||||
super("allow-group-overruling");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
ENABLED = new ConfigSectionHelper<Boolean>(this, null, false).getOrSet();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package de.rayzs.pat.api.storage.config.settings;
|
||||
|
||||
import de.rayzs.pat.api.storage.storages.ConfigStorage;
|
||||
import de.rayzs.pat.utils.StringUtils;
|
||||
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
|
||||
|
||||
public class AutoLowercaseCommandsSection extends ConfigStorage {
|
||||
|
||||
public boolean ENABLED;
|
||||
|
||||
public AutoLowercaseCommandsSection() {
|
||||
|
||||
super("auto-lowercase-commands");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
|
||||
ENABLED = new ConfigSectionHelper<Boolean>(this, "enabled", true).getOrSet();
|
||||
|
||||
}
|
||||
|
||||
public boolean isCommand(String command) {
|
||||
|
||||
if (!ENABLED)
|
||||
return false;
|
||||
|
||||
return !StringUtils.isLowercased(command);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package de.rayzs.pat.api.storage.config.settings;
|
||||
|
||||
import de.rayzs.pat.api.storage.storages.ConfigStorage;
|
||||
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
|
||||
|
||||
public class BaseCommandCaseSensitiveSection extends ConfigStorage {
|
||||
|
||||
public boolean ENABLED;
|
||||
|
||||
public BaseCommandCaseSensitiveSection() {
|
||||
|
||||
super("base-command-case-sensitive");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
ENABLED = new ConfigSectionHelper<Boolean>(this, null, true).getOrSet();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+26
-9
@@ -1,34 +1,51 @@
|
||||
package de.rayzs.pat.api.storage.config.settings;
|
||||
|
||||
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
|
||||
import de.rayzs.pat.api.storage.storages.ConfigStorage;
|
||||
import de.rayzs.pat.api.storage.Storage;
|
||||
import de.rayzs.pat.utils.StringUtils;
|
||||
import de.rayzs.pat.utils.permission.PermissionUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
|
||||
import de.rayzs.pat.utils.sender.CommandSender;
|
||||
|
||||
public class BlockNamespaceCommandsSection extends ConfigStorage {
|
||||
|
||||
public boolean ENABLED;
|
||||
public boolean ENABLED, ALWAYS_BLOCK_COMMAND;
|
||||
|
||||
public BlockNamespaceCommandsSection() {
|
||||
|
||||
super("block-namespace-commands");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
ENABLED = new ConfigSectionHelper<Boolean>(this, "enabled", true).getOrSet();
|
||||
ALWAYS_BLOCK_COMMAND = new ConfigSectionHelper<Boolean>(this, "always-block-command", true).getOrSet();
|
||||
|
||||
}
|
||||
|
||||
public boolean doesAlwaysBlock(String command) {
|
||||
|
||||
return ALWAYS_BLOCK_COMMAND && isCommand(command);
|
||||
|
||||
}
|
||||
|
||||
public boolean isCommand(String command) {
|
||||
if(!ENABLED || Storage.ConfigSections.Settings.TURN_BLACKLIST_TO_WHITELIST.ENABLED) return false;
|
||||
|
||||
if (!ENABLED) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
return StringUtils.getFirstArg(command).contains(":");
|
||||
|
||||
}
|
||||
|
||||
public boolean doesBypass(Object targetObj) {
|
||||
public boolean doesBypass(CommandSender sender) {
|
||||
|
||||
return !ENABLED || sender.hasPermission("namespace");
|
||||
|
||||
return !ENABLED || PermissionUtil.hasPermission(targetObj, "namespace");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package de.rayzs.pat.api.storage.config.settings;
|
||||
|
||||
import de.rayzs.pat.api.storage.storages.ConfigStorage;
|
||||
import de.rayzs.pat.utils.StringUtils;
|
||||
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
|
||||
import de.rayzs.pat.utils.permission.PermissionUtil;
|
||||
import de.rayzs.pat.utils.sender.CommandSender;
|
||||
|
||||
public class BlockSlashCommandsSection extends ConfigStorage {
|
||||
|
||||
public boolean ENABLED;
|
||||
|
||||
public BlockSlashCommandsSection() {
|
||||
|
||||
super("block-slash-commands");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
ENABLED = new ConfigSectionHelper<Boolean>(this, "enabled", false).getOrSet();
|
||||
|
||||
}
|
||||
|
||||
public boolean isCommand(String command) {
|
||||
|
||||
if (!ENABLED) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
return StringUtils.getFirstArg(command).contains("/");
|
||||
|
||||
}
|
||||
|
||||
public boolean doesBypass(CommandSender sender) {
|
||||
|
||||
return !ENABLED || PermissionUtil.hasPermission(sender, "slash");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,14 +10,21 @@ public class CancelCommandSection extends ConfigStorage {
|
||||
public MultipleMessagesHelper BASE_COMMAND_RESPONSE, SUB_COMMAND_RESPONSE;
|
||||
|
||||
public CancelCommandSection() {
|
||||
|
||||
super("cancel-blocked-commands");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
ENABLED = new ConfigSectionHelper<Boolean>(this, "enabled", true).getOrSet();
|
||||
BASE_COMMAND_RESPONSE = new MultipleMessagesHelper(this, "base-command-message", Collections.singletonList("&cThe command %command% is blocked!"));
|
||||
SUB_COMMAND_RESPONSE = new MultipleMessagesHelper(this, "sub-command-message", Collections.singletonList("&cThis sub-argument is blocked!"));
|
||||
BASE_COMMAND_RESPONSE = new MultipleMessagesHelper(this, "base-command-message",
|
||||
Collections.singletonList("&cThe command %command% is blocked!"));
|
||||
SUB_COMMAND_RESPONSE = new MultipleMessagesHelper(this, "sub-command-message",
|
||||
Collections.singletonList("&cThis sub-argument is blocked!"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,28 +11,23 @@ public class CustomBrandSection extends ConfigStorage {
|
||||
public MultipleMessagesHelper BRANDS;
|
||||
|
||||
public CustomBrandSection() {
|
||||
|
||||
super("custom-server-brand");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
ENABLED = new ConfigSectionHelper<Boolean>(this, "enabled", false).getOrSet();
|
||||
REPEAT_DELAY = new ConfigSectionHelper<Integer>(this, "repeat-delay", 3).getOrSet();
|
||||
BRANDS = new MultipleMessagesHelper(this, "brands", Arrays.asList(
|
||||
"&f&lP&froAntiTab |",
|
||||
"&fP&lr&foAntiTab /",
|
||||
"&fPr&lo&fAntiTab -",
|
||||
"&fPro&lA&fntiTab |",
|
||||
"&fProA&ln&ftiTab \\",
|
||||
"&fProAn<&fiTab |",
|
||||
"&fProAnt&li&fTab /",
|
||||
"&fProAnti&lT&fab -",
|
||||
"&fProAnti&lT&fab \\",
|
||||
"&fProAntiT&la&fb |",
|
||||
"&fProAntiTa&lb&f /",
|
||||
"&fProAntiTab -",
|
||||
"&fProAntiTab \\"
|
||||
));
|
||||
BRANDS = new MultipleMessagesHelper(this, "brands",
|
||||
Arrays.asList("&f&lP&froAntiTab |", "&fP&lr&foAntiTab /", "&fPr&lo&fAntiTab -", "&fPro&lA&fntiTab |",
|
||||
"&fProA&ln&ftiTab \\", "&fProAn<&fiTab |", "&fProAnt&li&fTab /", "&fProAnti&lT&fab -",
|
||||
"&fProAnti&lT&fab \\", "&fProAntiT&la&fb |", "&fProAntiTa&lb&f /", "&fProAntiTab -",
|
||||
"&fProAntiTab \\"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package de.rayzs.pat.api.storage.config.settings;
|
||||
|
||||
import de.rayzs.pat.api.storage.storages.ConfigStorage;
|
||||
import de.rayzs.pat.utils.StringUtils;
|
||||
import de.rayzs.pat.utils.configuration.helper.*;
|
||||
import java.util.*;
|
||||
|
||||
@@ -10,38 +11,46 @@ public class CustomPluginsSection extends ConfigStorage {
|
||||
public MultipleMessagesHelper MESSAGE, COMMANDS;
|
||||
|
||||
public CustomPluginsSection() {
|
||||
|
||||
super("custom-plugins");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
ENABLED = new ConfigSectionHelper<Boolean>(this, "enabled", true).getOrSet();
|
||||
ALWAYS_TAB_COMPLETABLE = new ConfigSectionHelper<Boolean>(this, "always-tab-completable", false).getOrSet();
|
||||
COMMANDS = new MultipleMessagesHelper(this, "commands", Arrays.asList("pl", "plugins"));
|
||||
MESSAGE = new MultipleMessagesHelper(this, "message", Collections.singletonList("&fPlugins (0):"));
|
||||
|
||||
}
|
||||
|
||||
public boolean isTabCompletable(String command) {
|
||||
|
||||
if (!isCommand(command))
|
||||
return false;
|
||||
|
||||
return ALWAYS_TAB_COMPLETABLE;
|
||||
|
||||
}
|
||||
|
||||
public boolean isCommand(String command) {
|
||||
if(!ENABLED) return false;
|
||||
|
||||
if (command.contains(" ")) {
|
||||
String[] split = command.split(" ");
|
||||
if (split.length > 0)
|
||||
command = split[0];
|
||||
command = command.split(" ")[0];
|
||||
}
|
||||
if (!ENABLED)
|
||||
return false;
|
||||
command = StringUtils.getFirstArg(command);
|
||||
|
||||
for (String currentCommand : COMMANDS.getLines()) {
|
||||
|
||||
if (currentCommand.equalsIgnoreCase(command))
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+34
-7
@@ -1,33 +1,60 @@
|
||||
package de.rayzs.pat.api.storage.config.settings;
|
||||
|
||||
import de.rayzs.pat.plugin.logger.Logger;
|
||||
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
|
||||
import de.rayzs.pat.api.storage.storages.ConfigStorage;
|
||||
import de.rayzs.pat.utils.Reflection;
|
||||
import de.rayzs.pat.utils.configuration.helper.MultipleMessagesHelper;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class CustomProtocolPingSection extends ConfigStorage {
|
||||
|
||||
public boolean ENABLED, ALWAYS_SHOW, HIDE_PLAYERS, USE_EXTEND_AS_MAX_COUNT;
|
||||
public boolean ENABLED, ALWAYS_SHOW, HIDE_PLAYERS, USE_EXTEND_AS_MAX_COUNT, USE_CUSTOM_PLAYERLIST;
|
||||
public String PROTOCOL;
|
||||
|
||||
public MultipleMessagesHelper PLAYERLIST;
|
||||
|
||||
public int EXTEND_COUNT;
|
||||
|
||||
public CustomProtocolPingSection() {
|
||||
|
||||
super("custom-protocol-ping");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
if(!Reflection.isProxyServer()) {
|
||||
if(!Reflection.isPaper() || Reflection.getMinor() < 12)
|
||||
|
||||
if (!Reflection.isProxyServer() && (!Reflection.isPaper() || Reflection.isBefore(1, 12)))
|
||||
return;
|
||||
}
|
||||
|
||||
ENABLED = new ConfigSectionHelper<Boolean>(this, "enabled", true).getOrSet();
|
||||
ALWAYS_SHOW = new ConfigSectionHelper<Boolean>(this, "always-show", Reflection.isProxyServer() || Reflection.isPaper()).getOrSet();
|
||||
ALWAYS_SHOW = new ConfigSectionHelper<Boolean>(this, "always-show",
|
||||
Reflection.isProxyServer() || Reflection.isPaper()).getOrSet();
|
||||
USE_EXTEND_AS_MAX_COUNT = new ConfigSectionHelper<Boolean>(this, "use-as-maxplayers", false).getOrSet();
|
||||
PROTOCOL = new ConfigSectionHelper<String>(this, "protocol", "&f&lProAntiTab &7(&a%online%&7/&c%max%&7)").getOrSet();
|
||||
PROTOCOL = new ConfigSectionHelper<String>(this, "protocol", "&f&lProAntiTab &7(&a%online%&7/&c%max%&7)")
|
||||
.getOrSet();
|
||||
EXTEND_COUNT = new ConfigSectionHelper<Integer>(this, "extend-online-count", 1).getOrSet();
|
||||
if(Reflection.isProxyServer()) return;
|
||||
|
||||
HIDE_PLAYERS = new ConfigSectionHelper<Boolean>(this, "hide-players", true).getOrSet();
|
||||
|
||||
USE_CUSTOM_PLAYERLIST = new ConfigSectionHelper<Boolean>(this, "custom-playerlist.enabled", false).getOrSet();
|
||||
PLAYERLIST = new MultipleMessagesHelper(this, "custom-playerlist.list",
|
||||
Arrays.asList("&8> &7Online players: &f%online%&7/&c%max%", "&8> &7Using &fProAntiTab"));
|
||||
|
||||
if (HIDE_PLAYERS && USE_CUSTOM_PLAYERLIST) {
|
||||
|
||||
Logger.warning(
|
||||
"You can't use both 'hide-players' and 'custom-playerlist' at the same time! (Section: custom-protocol-ping)");
|
||||
Logger.warning("You gotta choose what feature from those two you want to use.");
|
||||
Logger.warning(
|
||||
"In order to avoid any problems, the 'custom-playerlist' feature has been temporarily disabled.");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+9
-2
@@ -11,15 +11,22 @@ public class CustomUnknownCommandSection extends ConfigStorage {
|
||||
public MultipleMessagesHelper MESSAGE;
|
||||
|
||||
public CustomUnknownCommandSection() {
|
||||
|
||||
super("custom-unknown-command");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
|
||||
if(Storage.ConfigSections.Settings.HANDLE_THROUGH_PROXY.ENABLED) return;
|
||||
if (Storage.ConfigSections.Settings.HANDLE_THROUGH_PROXY.ENABLED)
|
||||
return;
|
||||
ENABLED = new ConfigSectionHelper<Boolean>(this, "enabled", true).getOrSet();
|
||||
MESSAGE = new MultipleMessagesHelper(this, "message", Collections.singletonList("&cThis command does not exist!"));
|
||||
MESSAGE = new MultipleMessagesHelper(this, "message",
|
||||
Collections.singletonList("&cThis command does not exist!"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,33 +11,48 @@ public class CustomVersionSection extends ConfigStorage {
|
||||
public MultipleMessagesHelper MESSAGE, COMMANDS;
|
||||
|
||||
public CustomVersionSection() {
|
||||
|
||||
super("custom-version");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
ENABLED = new ConfigSectionHelper<Boolean>(this, "enabled", true).getOrSet();
|
||||
ALWAYS_TAB_COMPLETABLE = new ConfigSectionHelper<Boolean>(this, "always-tab-completable", false).getOrSet();
|
||||
COMMANDS = new MultipleMessagesHelper(this, "commands", Arrays.asList("icanhasbukkit", "about", "ver", "version"));
|
||||
MESSAGE = new MultipleMessagesHelper(this, "message", Collections.singletonList("&fThis server is running CraftBukkit version git-NasaSpigot-294 (MC: X)"));
|
||||
COMMANDS = new MultipleMessagesHelper(this, "commands",
|
||||
Arrays.asList("icanhasbukkit", "about", "ver", "version"));
|
||||
MESSAGE = new MultipleMessagesHelper(this, "message",
|
||||
Collections.singletonList("&fThis server is running CraftBukkit version git-NasaSpigot-294 (MC: X)"));
|
||||
|
||||
}
|
||||
|
||||
public boolean isTabCompletable(String command) {
|
||||
|
||||
if (!isCommand(command))
|
||||
return false;
|
||||
|
||||
return ALWAYS_TAB_COMPLETABLE;
|
||||
|
||||
}
|
||||
|
||||
public boolean isCommand(String command) {
|
||||
if(!ENABLED) return false;
|
||||
|
||||
if (!ENABLED)
|
||||
return false;
|
||||
command = StringUtils.getFirstArg(command);
|
||||
|
||||
for (String currentCommand : COMMANDS.getLines()) {
|
||||
|
||||
if (currentCommand.equalsIgnoreCase(command))
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,14 +9,20 @@ public class DisableSyncSection extends ConfigStorage {
|
||||
public boolean DISABLED;
|
||||
|
||||
public DisableSyncSection() {
|
||||
|
||||
super("disable-sync");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
|
||||
if(!Reflection.isProxyServer()) return;
|
||||
if (!Reflection.isProxyServer())
|
||||
return;
|
||||
DISABLED = new ConfigSectionHelper<Boolean>(this, null, false).getOrSet();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package de.rayzs.pat.api.storage.config.settings;
|
||||
|
||||
import de.rayzs.pat.api.storage.storages.ConfigStorage;
|
||||
import de.rayzs.pat.utils.Reflection;
|
||||
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
|
||||
|
||||
public class ForwardConsoleNotificationAlertsSection extends ConfigStorage {
|
||||
|
||||
public boolean ENABLED;
|
||||
|
||||
public ForwardConsoleNotificationAlertsSection() {
|
||||
|
||||
super("forward-console-notification-alerts");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
|
||||
if (!Reflection.isProxyServer())
|
||||
return;
|
||||
ENABLED = new ConfigSectionHelper<Boolean>(this, null, false).getOrSet();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+17
-2
@@ -6,19 +6,34 @@ import de.rayzs.pat.utils.Reflection;
|
||||
|
||||
public class HandleThroughProxySection extends ConfigStorage {
|
||||
|
||||
public boolean ENABLED;
|
||||
public boolean ENABLED, ALLOW_P2B_ACTIONS;
|
||||
|
||||
public boolean LOAD_FROM_ENV;
|
||||
public String ENV_NAME;
|
||||
|
||||
public String TOKEN;
|
||||
|
||||
public HandleThroughProxySection() {
|
||||
|
||||
super("handle-through-proxy");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
if(Reflection.isProxyServer()) return;
|
||||
if (Reflection.isProxyServer())
|
||||
return;
|
||||
|
||||
ENABLED = new ConfigSectionHelper<Boolean>(this, "enabled", false).getOrSet();
|
||||
TOKEN = new ConfigSectionHelper<String>(this, "token", "insert-token-of-proxy-here").getOrSet();
|
||||
|
||||
ALLOW_P2B_ACTIONS = new ConfigSectionHelper<Boolean>(this, "allow-p2b-actions", false).getOrSet();
|
||||
|
||||
LOAD_FROM_ENV = new ConfigSectionHelper<Boolean>(this, "load-from-env.enabled", false).getOrSet();
|
||||
ENV_NAME = new ConfigSectionHelper<String>(this, "load-from-env.name", "PAT_TOKEN").getOrSet();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package de.rayzs.pat.api.storage.config.settings;
|
||||
|
||||
import de.rayzs.pat.api.storage.storages.ConfigStorage;
|
||||
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
|
||||
|
||||
public class InjectionFailedSection extends ConfigStorage {
|
||||
|
||||
public boolean ENABLED, SUPPRESS_EXCEPTIONS;
|
||||
public String KICK_MESSAGE, CONSOLE_MESSAGE;
|
||||
|
||||
public InjectionFailedSection() {
|
||||
|
||||
super("injection-failed");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
ENABLED = new ConfigSectionHelper<Boolean>(this, "kick-on-failure", true).getOrSet();
|
||||
SUPPRESS_EXCEPTIONS = new ConfigSectionHelper<Boolean>(this, "suppress-exceptions", false).getOrSet();
|
||||
KICK_MESSAGE = new ConfigSectionHelper<String>(this, "kick-message",
|
||||
"&cInjection process failed! Please reconnect.").getOrSet();
|
||||
CONSOLE_MESSAGE = new ConfigSectionHelper<String>(this, "console-message",
|
||||
"&cInjection process failed! (%player%)").getOrSet();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package de.rayzs.pat.api.storage.config.settings;
|
||||
import de.rayzs.pat.api.storage.storages.ConfigStorage;
|
||||
import de.rayzs.pat.utils.configuration.helper.*;
|
||||
import de.rayzs.pat.utils.StringUtils;
|
||||
import java.util.Collections;
|
||||
|
||||
public class PatchExploitSection extends ConfigStorage {
|
||||
|
||||
@@ -11,22 +10,30 @@ public class PatchExploitSection extends ConfigStorage {
|
||||
public ConfigSectionHelper<String> ALERT_MESSAGE, KICK_MESSAGE;
|
||||
|
||||
public PatchExploitSection() {
|
||||
|
||||
super("patch-exploits");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
ENABLED = new ConfigSectionHelper<Boolean>(this, "enabled", true).getOrSet();
|
||||
ALERT_MESSAGE = new ConfigSectionHelper<>(this, "alert-message", "%prefix% &4%player% &ctried to crash/lag the server.");
|
||||
ALERT_MESSAGE = new ConfigSectionHelper<>(this, "alert-message",
|
||||
"%prefix% &4%player% &ctried to crash/lag the server.");
|
||||
KICK_MESSAGE = new ConfigSectionHelper(this, "kick-message", "&cFailed to read packet! Please reconnect.");
|
||||
|
||||
}
|
||||
|
||||
public boolean isMalicious(String text) {
|
||||
if(!ENABLED) return false;
|
||||
|
||||
return text.length() > 256
|
||||
|| text.contains("nbt")
|
||||
if (!ENABLED)
|
||||
return false;
|
||||
|
||||
return text.length() > 256 || text.contains("nbt")
|
||||
&& (StringUtils.countMatches('[', text) > 15 || StringUtils.countMatches('{', text) > 25);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+5
@@ -8,12 +8,17 @@ public class TurnBlacklistToWhitelistSection extends ConfigStorage {
|
||||
public boolean ENABLED;
|
||||
|
||||
public TurnBlacklistToWhitelistSection() {
|
||||
|
||||
super("turn-blacklist-to-whitelist");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
ENABLED = new ConfigSectionHelper<Boolean>(this, null, false).getOrSet();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package de.rayzs.pat.api.storage.config.settings;
|
||||
|
||||
import de.rayzs.pat.api.storage.storages.ConfigStorage;
|
||||
import de.rayzs.pat.utils.Reflection;
|
||||
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
|
||||
|
||||
public class UpdateGroupsPerServerSection extends ConfigStorage {
|
||||
|
||||
public boolean ENABLED = false;
|
||||
|
||||
public UpdateGroupsPerServerSection() {
|
||||
|
||||
super("update-groups-per-server");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
|
||||
if (!Reflection.isProxyServer())
|
||||
return;
|
||||
|
||||
ENABLED = new ConfigSectionHelper<Boolean>(this, null, false).getOrSet();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package de.rayzs.pat.api.storage.config.settings;
|
||||
|
||||
import de.rayzs.pat.api.storage.storages.ConfigStorage;
|
||||
import de.rayzs.pat.utils.Reflection;
|
||||
import de.rayzs.pat.utils.configuration.helper.ConfigSectionHelper;
|
||||
|
||||
public class UpdateGroupsPerWorldSection extends ConfigStorage {
|
||||
|
||||
public boolean ENABLED;
|
||||
|
||||
public UpdateGroupsPerWorldSection() {
|
||||
|
||||
super("update-groups-per-world");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
|
||||
if (Reflection.isProxyServer())
|
||||
return;
|
||||
|
||||
ENABLED = new ConfigSectionHelper<Boolean>(this, null, false).getOrSet();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,20 +11,26 @@ public class UpdateSection extends ConfigStorage {
|
||||
public MultipleMessagesHelper OUTDATED, UPDATED;
|
||||
|
||||
public UpdateSection() {
|
||||
|
||||
super("updater");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
ENABLED = new ConfigSectionHelper<Boolean>(this, "enabled", true).getOrSet();
|
||||
PERIOD = new ConfigSectionHelper<Integer>(this, "period", 10000).getOrSet();
|
||||
AUTO_UPDATE_CONFIG = new ConfigSectionHelper<Boolean>(this, "auto-update-config", true).getOrSet();
|
||||
UPDATED = new MultipleMessagesHelper(this, "updated", Collections.singletonList("&aYou are using the newest version! ^^"));
|
||||
OUTDATED = new MultipleMessagesHelper(this, "outdated", Arrays.asList(
|
||||
"&8[&4ProAntiTab&8] &cThere is a new version available! (%newest_version%)",
|
||||
"&8[&4ProAntiTab&8] &cYou are still using the %current_version%.",
|
||||
"&8[&4ProAntiTab&8] &cGet the newest version here:",
|
||||
"&8[&4ProAntiTab&8] &ehttps://www.rayzs.de/products/proantitab/page"));
|
||||
UPDATED = new MultipleMessagesHelper(this, "updated",
|
||||
Collections.singletonList("&aYou are using the newest version! ^^"));
|
||||
OUTDATED = new MultipleMessagesHelper(this, "outdated",
|
||||
Arrays.asList("&8[&4ProAntiTab&8] &cThere is a new version available! (%newest_version%)",
|
||||
"&8[&4ProAntiTab&8] &cYou are still using the %current_version%.",
|
||||
"&8[&4ProAntiTab&8] &cGet the newest version here:",
|
||||
"&8[&4ProAntiTab&8] &ehttps://www.rayzs.de/products/proantitab/page"));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+13
-10
@@ -8,24 +8,27 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class ListCommandsPlaceholder extends PlaceholderStorage {
|
||||
|
||||
public ListCommandsPlaceholder() { super("list_commands"); }
|
||||
public ListCommandsPlaceholder() {
|
||||
|
||||
public String COMMAND, SPLITTER;
|
||||
super("list_commands");
|
||||
|
||||
}
|
||||
|
||||
public String SPLITTER;
|
||||
|
||||
@Override
|
||||
public String onRequest(Player player, String param) {
|
||||
return StringUtils.buildStringList(
|
||||
Storage.Blacklist.getBlacklist().getCommands(),
|
||||
SPLITTER,
|
||||
COMMAND,
|
||||
"%command%"
|
||||
);
|
||||
|
||||
return StringUtils.getStringList(Storage.Blacklist.getBlacklist().getCommands(), SPLITTER);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
SPLITTER = new ConfigSectionHelper<String>(this, "splitter", "&7-> ").getOrSet();
|
||||
COMMAND = new ConfigSectionHelper<String>(this, "command", "&f%command%\\n").getOrSet();
|
||||
SPLITTER = new ConfigSectionHelper<String>(this, "splitter", "&7, &e").getOrSet();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+13
-11
@@ -8,25 +8,27 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class ListReversedCommandsPlaceholder extends PlaceholderStorage {
|
||||
|
||||
public ListReversedCommandsPlaceholder() { super("list_reversed_commands"); }
|
||||
public ListReversedCommandsPlaceholder() {
|
||||
|
||||
public String COMMAND, SPLITTER;
|
||||
super("list_reversed_commands");
|
||||
|
||||
}
|
||||
|
||||
public String SPLITTER;
|
||||
|
||||
@Override
|
||||
public String onRequest(Player player, String param) {
|
||||
return StringUtils.buildSortedStringList(
|
||||
Storage.Blacklist.getBlacklist().getCommands(),
|
||||
SPLITTER,
|
||||
COMMAND,
|
||||
"%command%",
|
||||
true
|
||||
);
|
||||
|
||||
return StringUtils.getReversedStringList(Storage.Blacklist.getBlacklist().getCommands(), SPLITTER);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
SPLITTER = new ConfigSectionHelper<String>(this, "splitter", "&7-> ").getOrSet();
|
||||
COMMAND = new ConfigSectionHelper<String>(this, "command", "&f%command%\\n").getOrSet();
|
||||
SPLITTER = new ConfigSectionHelper<String>(this, "splitter", "&7, &e").getOrSet();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+10
-1
@@ -6,15 +6,24 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class ListSizeCommandsPlaceholder extends PlaceholderStorage {
|
||||
|
||||
public ListSizeCommandsPlaceholder() { super("list_size_commands"); }
|
||||
public ListSizeCommandsPlaceholder() {
|
||||
|
||||
super("list_size_commands");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onRequest(Player player, String param) {
|
||||
|
||||
return String.valueOf(Storage.Blacklist.getBlacklist().getCommands().size());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+13
-11
@@ -8,25 +8,27 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class ListSortedCommandsPlaceholder extends PlaceholderStorage {
|
||||
|
||||
public ListSortedCommandsPlaceholder() { super("list_sorted_commands"); }
|
||||
public ListSortedCommandsPlaceholder() {
|
||||
|
||||
public String COMMAND, SPLITTER;
|
||||
super("list_sorted_commands");
|
||||
|
||||
}
|
||||
|
||||
public String SPLITTER;
|
||||
|
||||
@Override
|
||||
public String onRequest(Player player, String param) {
|
||||
return StringUtils.buildSortedStringList(
|
||||
Storage.Blacklist.getBlacklist().getCommands(),
|
||||
SPLITTER,
|
||||
COMMAND,
|
||||
"%command%",
|
||||
false
|
||||
);
|
||||
|
||||
return StringUtils.getSortedStringList(Storage.Blacklist.getBlacklist().getCommands(), SPLITTER);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
SPLITTER = new ConfigSectionHelper<String>(this, "splitter", "&7-> ").getOrSet();
|
||||
COMMAND = new ConfigSectionHelper<String>(this, "command", "&f%command%\\n").getOrSet();
|
||||
SPLITTER = new ConfigSectionHelper<String>(this, "splitter", "&7, &e").getOrSet();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+16
-12
@@ -8,27 +8,31 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class ListGroupCommandsPlaceholder extends PlaceholderStorage {
|
||||
|
||||
public ListGroupCommandsPlaceholder() { super("list_commands_group_"); }
|
||||
public ListGroupCommandsPlaceholder() {
|
||||
|
||||
public String COMMAND, SPLITTER;
|
||||
super("list_commands_group_");
|
||||
|
||||
}
|
||||
|
||||
public String SPLITTER;
|
||||
|
||||
@Override
|
||||
public String onRequest(Player player, String param) {
|
||||
Group group = GroupManager.getGroupByName(param);
|
||||
if(group == null) return null;
|
||||
|
||||
return StringUtils.buildStringList(
|
||||
group.getCommands(),
|
||||
SPLITTER,
|
||||
COMMAND,
|
||||
"%command%"
|
||||
);
|
||||
Group group = GroupManager.getGroupByName(param);
|
||||
if (group == null)
|
||||
return null;
|
||||
|
||||
return StringUtils.getStringList(group.getCommands(), SPLITTER);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
SPLITTER = new ConfigSectionHelper<String>(this, "splitter", "&7-> ").getOrSet();
|
||||
COMMAND = new ConfigSectionHelper<String>(this, "command", "&f%command%\\n").getOrSet();
|
||||
SPLITTER = new ConfigSectionHelper<String>(this, "splitter", "&7, &e").getOrSet();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+16
-13
@@ -8,28 +8,31 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class ListGroupReversedCommandsPlaceholder extends PlaceholderStorage {
|
||||
|
||||
public ListGroupReversedCommandsPlaceholder() { super("list_reversed_commands_group_"); }
|
||||
public ListGroupReversedCommandsPlaceholder() {
|
||||
|
||||
public String COMMAND, SPLITTER;
|
||||
super("list_reversed_commands_group_");
|
||||
|
||||
}
|
||||
|
||||
public String SPLITTER;
|
||||
|
||||
@Override
|
||||
public String onRequest(Player player, String param) {
|
||||
Group group = GroupManager.getGroupByName(param);
|
||||
if(group == null) return null;
|
||||
|
||||
return StringUtils.buildSortedStringList(
|
||||
group.getCommands(),
|
||||
SPLITTER,
|
||||
COMMAND,
|
||||
"%command%",
|
||||
true
|
||||
);
|
||||
Group group = GroupManager.getGroupByName(param);
|
||||
if (group == null)
|
||||
return null;
|
||||
|
||||
return StringUtils.getReversedStringList(group.getCommands(), SPLITTER);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
SPLITTER = new ConfigSectionHelper<String>(this, "splitter", "&7-> ").getOrSet();
|
||||
COMMAND = new ConfigSectionHelper<String>(this, "command", "&f%command%\\n").getOrSet();
|
||||
SPLITTER = new ConfigSectionHelper<String>(this, "splitter", "&7, &e").getOrSet();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+12
-2
@@ -6,17 +6,27 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class ListGroupSizeCommandsPlaceholder extends PlaceholderStorage {
|
||||
|
||||
public ListGroupSizeCommandsPlaceholder() { super("list_size_commands_group_"); }
|
||||
public ListGroupSizeCommandsPlaceholder() {
|
||||
|
||||
super("list_size_commands_group_");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onRequest(Player player, String param) {
|
||||
|
||||
Group group = GroupManager.getGroupByName(param);
|
||||
if(group == null) return null;
|
||||
if (group == null)
|
||||
return null;
|
||||
return String.valueOf(group.getCommands().size());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+16
-13
@@ -8,28 +8,31 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public class ListGroupSortedCommandsPlaceholder extends PlaceholderStorage {
|
||||
|
||||
public ListGroupSortedCommandsPlaceholder() { super("list_sorted_commands_group_"); }
|
||||
public ListGroupSortedCommandsPlaceholder() {
|
||||
|
||||
public String COMMAND, SPLITTER;
|
||||
super("list_sorted_commands_group_");
|
||||
|
||||
}
|
||||
|
||||
public String SPLITTER;
|
||||
|
||||
@Override
|
||||
public String onRequest(Player player, String param) {
|
||||
Group group = GroupManager.getGroupByName(param);
|
||||
if(group == null) return null;
|
||||
|
||||
return StringUtils.buildSortedStringList(
|
||||
group.getCommands(),
|
||||
SPLITTER,
|
||||
COMMAND,
|
||||
"%command%",
|
||||
false
|
||||
);
|
||||
Group group = GroupManager.getGroupByName(param);
|
||||
if (group == null)
|
||||
return null;
|
||||
|
||||
return StringUtils.getSortedStringList(group.getCommands(), SPLITTER);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load() {
|
||||
|
||||
super.load();
|
||||
SPLITTER = new ConfigSectionHelper<String>(this, "splitter", "&7-> ").getOrSet();
|
||||
COMMAND = new ConfigSectionHelper<String>(this, "command", "&f%command%\\n").getOrSet();
|
||||
SPLITTER = new ConfigSectionHelper<String>(this, "splitter", "&7, &e").getOrSet();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loaded 100 of 266 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user