Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5bb90aa0de | ||
|
|
9b1e92b555 | ||
|
|
104615edb5 | ||
|
|
9f54ca6843 | ||
|
|
46919017e1 | ||
|
|
0a1ce38c7e | ||
|
|
f60d5230c3 | ||
|
|
8034f5dc89 | ||
|
|
265ade55d0 | ||
|
|
cffcbaf596 | ||
|
|
4dc90a2920 | ||
|
|
b5f6a7f6b8 | ||
|
|
f916addda3 | ||
|
|
d275fb8d8b | ||
|
|
3ce8971215 | ||
|
|
5866e4ede1 | ||
|
|
a47040e18a | ||
|
|
631b41d9d0 | ||
|
|
8b9cf0c283 | ||
|
|
e7afd771f8 | ||
|
|
98446b5afc | ||
|
|
0fbfca81a1 | ||
|
|
33f1eab93b | ||
|
|
38fcccd7c9 | ||
|
|
053768ccfa | ||
|
|
d11a0406cb | ||
|
|
5966ca1355 | ||
|
|
72944a00c0 | ||
|
|
671c935134 | ||
|
|
c931974779 | ||
|
|
5e6d0bffde | ||
|
|
c08719acc7 | ||
|
|
e76b00c880 | ||
|
|
b30d56ed0b | ||
|
|
211b85a51b | ||
|
|
f895ff0e0a | ||
|
|
6f0f6eaa24 | ||
|
|
d6ee3b356e | ||
|
|
7b800a9015 | ||
|
|
ba0feb31f0 | ||
|
|
36b73752f7 | ||
|
|
6f0586ce23 | ||
|
|
59159d47a0 | ||
|
|
23c0fc9bff | ||
|
|
c34690197d | ||
|
|
c98425cb99 | ||
|
|
55f4280ccb | ||
|
|
b9299dfa96 | ||
|
|
b1fb30163c | ||
|
|
50b8776aa9 | ||
|
|
d47b450307 | ||
|
|
1f41447a02 | ||
|
|
a306ac26b9 | ||
|
|
df6a334a00 | ||
|
|
c43ea28f59 | ||
|
|
596f1b57ce | ||
|
|
386238aae8 | ||
|
|
e7dcb4c96e | ||
|
|
6049e37d87 | ||
|
|
a41e747da7 | ||
|
|
c4c61dff3c | ||
|
|
84b85c8f00 | ||
|
|
f9b3786c16 | ||
|
|
d2350ad383 | ||
|
|
f6c554da02 | ||
|
|
7ff8c40402 | ||
|
|
df6d7fa741 | ||
|
|
3a5aa401f0 | ||
|
|
9c5263bf20 | ||
|
|
838426e1bf | ||
|
|
d486863a64 | ||
|
|
cd98e8488b | ||
|
|
a7c6f88a11 | ||
|
|
c15b88e77f | ||
|
|
1a2d39d68f | ||
|
|
fe8ca640cc | ||
|
|
e8bdd02838 | ||
|
|
b962876dfd | ||
|
|
f0135204e3 | ||
|
|
5bedb44e11 | ||
|
|
4e3ada1bd8 | ||
|
|
38d68418dc | ||
|
|
5f8efaaf0f | ||
|
|
9b8de173e4 | ||
|
|
de4594fbdc | ||
|
|
5eae00ef0b | ||
|
|
3c418473d8 | ||
|
|
1e919053c6 | ||
|
|
30ff648bad | ||
|
|
6c5d9beb76 | ||
|
|
3e828ea9ee | ||
|
|
4ef8b381d7 | ||
|
|
24838cd7d9 | ||
|
|
e17b877b5f | ||
|
|
8b85bc8d4d | ||
|
|
fca9ad22fe | ||
|
|
8f7ec3d38a | ||
|
|
41969994b2 | ||
|
|
667652bfb8 | ||
|
|
2da42185e8 | ||
|
|
fd1b918956 | ||
|
|
828013bf77 | ||
|
|
6e30fb393a | ||
|
|
cbfca6c5fa | ||
|
|
945ca46491 | ||
|
|
f7d5252bf0 | ||
|
|
a624a76427 | ||
|
|
39f9ed008c | ||
|
|
a0096b3032 | ||
|
|
ae1a0258fe | ||
|
|
f863ad026f | ||
|
|
abea90564f | ||
|
|
3bdd110864 | ||
|
|
b2e47f48a5 | ||
|
|
513de88321 | ||
|
|
4a2146d16d | ||
|
|
5a49cf2687 | ||
|
|
65fba0b83d | ||
|
|
5272557f58 | ||
|
|
51abf38d3f | ||
|
|
33abe17a2b | ||
|
|
593015dd0b | ||
|
|
079a2fcc53 | ||
|
|
b9d4ed6a60 | ||
|
|
aec45f19e4 | ||
|
|
0aaa4f42b1 | ||
|
|
75dfc63d3b | ||
|
|
ac501a26b2 | ||
|
|
3ebf39d3bd | ||
|
|
363931875f | ||
|
|
b1802fbc0c | ||
|
|
9f9cdca53a | ||
|
|
00c85f3e41 | ||
|
|
b48a91bcee | ||
|
|
709edd8b21 | ||
|
|
90edf6002e | ||
|
|
4e151f8dfb | ||
|
|
0165e8a4ac | ||
|
|
385000b608 | ||
|
|
a1b7c947a0 | ||
|
|
ab5163bc66 | ||
|
|
38b25b6d48 | ||
|
|
9d5d4858cf | ||
|
|
2e6c43ba06 | ||
|
|
f180a4a172 | ||
|
|
5ce6b8bf9e | ||
|
|
b61602741b | ||
|
|
13ba9e7b81 | ||
|
|
d4c9444fd5 | ||
|
|
b6c079af66 | ||
|
|
a18d288079 | ||
|
|
c3d8f91e85 | ||
|
|
0ca2f5c50a | ||
|
|
cdc7ed36e0 | ||
|
|
5d63308a22 | ||
|
|
214706dbb6 | ||
|
|
fa3b563c70 | ||
|
|
55e31483e7 | ||
|
|
aa34910468 | ||
|
|
5e44913a5e | ||
|
|
b8dc964112 | ||
|
|
890844fb60 | ||
|
|
fc57c9e077 | ||
|
|
f12ef113aa | ||
|
|
e8144ece97 | ||
|
|
b611ad5522 | ||
|
|
53e1014c8d | ||
|
|
69f992a984 | ||
|
|
fde9db39b7 | ||
|
|
6c6a2535c8 | ||
|
|
23d06075dd | ||
|
|
926fd1ae50 | ||
|
|
756add003f | ||
|
|
aaf00bf167 | ||
|
|
d72c8df72c | ||
|
|
800ffafb96 | ||
|
|
ba2d9ae9f0 | ||
|
|
31d07e4a39 | ||
|
|
ec36a5d1d8 | ||
|
|
08ba59e1d9 | ||
|
|
851c74e827 | ||
|
|
b31893e035 | ||
|
|
4718fb985d | ||
|
|
aed9bc14fa | ||
|
|
1daad13da3 | ||
|
|
65a984e805 | ||
|
|
a923b950f6 | ||
|
|
ac5790411f | ||
|
|
cd3449ade2 | ||
|
|
75af221f77 | ||
|
|
6f9b2cf5e9 | ||
|
|
4b4dd492cf | ||
|
|
68471d32c8 | ||
|
|
b7d0ce9518 | ||
|
|
58abfc0c1e | ||
|
|
a3f6adac2f | ||
|
|
f0c9af4464 | ||
|
|
f43fff899f | ||
|
|
9291fd8953 | ||
|
|
feb975010e | ||
|
|
5c34c8e6c3 | ||
|
|
8aaf40fc74 | ||
|
|
c6fcab2923 | ||
|
|
64006b91a4 | ||
|
|
625a66f45a | ||
|
|
0c6208f931 | ||
|
|
be32f464c5 | ||
|
|
3389baf40e | ||
|
|
edc85e68e8 | ||
|
|
3f9f093934 | ||
|
|
31426cc69c | ||
|
|
cec8c9789f | ||
|
|
f771e15ce0 | ||
|
|
68a3702cd6 | ||
|
|
8f4f688fb8 | ||
|
|
0a380344c5 | ||
|
|
ab458ded62 | ||
|
|
3bc78c1aec | ||
|
|
0feebb6819 | ||
|
|
cdb48e0ab6 | ||
|
|
85e819d72f | ||
|
|
10d44fe3cb | ||
|
|
6b5ada3c5d | ||
|
|
2f0861c7b7 | ||
|
|
abc8695a29 | ||
|
|
c6577646ce | ||
|
|
a6c68b2d0e | ||
|
|
23e0861192 | ||
|
|
7539aa345c | ||
|
|
2a076a61a0 | ||
|
|
bf0ec04cec | ||
|
|
fea687bba9 | ||
|
|
25e83d6181 | ||
|
|
95a91bb1f2 | ||
|
|
e1e057eabb | ||
|
|
f81120f8ed | ||
|
|
e44ad5edc2 | ||
|
|
c35d0854bc | ||
|
|
47dbb5e9c0 | ||
|
|
702894dd07 | ||
|
|
4801196942 | ||
|
|
c88a9c412c | ||
|
|
4012472404 | ||
|
|
54f3f3c221 | ||
|
|
873557151b | ||
|
|
32e96f3f51 | ||
|
|
cdffd10999 | ||
|
|
1524a546d8 | ||
|
|
40d7be6236 | ||
|
|
98b2b7b631 | ||
|
|
54704811b3 | ||
|
|
54241497b5 | ||
|
|
99637743f5 | ||
|
|
702452c3a1 | ||
|
|
7e424cd46b | ||
|
|
58401fc18e | ||
|
|
7285eeff5a | ||
|
|
cfb57e7a99 | ||
|
|
93cd6f39f9 | ||
|
|
9975706ba8 | ||
|
|
9b88a9ef98 | ||
|
|
548c6183a4 | ||
|
|
19d271881c | ||
|
|
a64978cb0a | ||
|
|
527beda70f | ||
|
|
127421a1d2 | ||
|
|
4a188bd116 | ||
|
|
cd6db40a0d | ||
|
|
d050c10eab | ||
|
|
82e5b68119 | ||
|
|
3f00e1d817 | ||
|
|
7296072bcb | ||
|
|
132ae43496 | ||
|
|
2465ba9306 | ||
|
|
2e10b151c9 | ||
|
|
9a338cd897 | ||
|
|
7c0bac33df | ||
|
|
db8c4ce08d | ||
|
|
af52640237 | ||
|
|
b6d71a79a1 | ||
|
|
407257c2ce | ||
|
|
19e7bc6190 | ||
|
|
e0beccff4d | ||
|
|
1728e667ea | ||
|
|
c2cce6fac7 | ||
|
|
9cf38bc325 | ||
|
|
c0522d7836 | ||
|
|
dc1ac3beb3 | ||
|
|
d59a11a340 | ||
|
|
a8e95c23ac | ||
|
|
607b8dde56 | ||
|
|
a0ccfb4875 | ||
|
|
afcf98e2c8 | ||
|
|
51d74ae7ea | ||
|
|
7b6308c4e0 | ||
|
|
cdbe0df0f3 | ||
|
|
d799ba7190 | ||
|
|
8c03d2e3a0 | ||
|
|
7c2994e54d | ||
|
|
e1e61feebf | ||
|
|
e6fb117182 | ||
|
|
a7aa3eae68 | ||
|
|
d38089a46a | ||
|
|
e2a980adde | ||
|
|
a4e116d34f | ||
|
|
6b61682fe4 | ||
|
|
0c4709ac57 | ||
|
|
c6a542d206 | ||
|
|
d67028f568 | ||
|
|
af48ee3938 | ||
|
|
945919c1e0 | ||
|
|
38de7a4b94 | ||
|
|
419232a075 | ||
|
|
e705b2725d | ||
|
|
004702f642 | ||
|
|
4c29d39292 | ||
|
|
24e8ff4fb4 | ||
|
|
cf61f74ade | ||
|
|
72ab24b419 | ||
|
|
8c8357bfbc | ||
|
|
59d36b6e55 | ||
|
|
decf5579a3 | ||
|
|
187f5a54c6 | ||
|
|
647c05fe98 | ||
|
|
a089b98f6d | ||
|
|
9d21b834cc | ||
|
|
069e872204 | ||
|
|
e945c9c56f | ||
|
|
b8058b57d8 | ||
|
|
7ce167157a | ||
|
|
0503e99c50 | ||
|
|
413d5e1eb5 | ||
|
|
51ebbb7914 | ||
|
|
2b98d5c90b | ||
|
|
099ea9b7e9 | ||
|
|
ce703febc3 | ||
|
|
dce59f99fd | ||
|
|
5ff498b6f0 | ||
|
|
32b85dce18 | ||
|
|
89b8d823c4 | ||
|
|
fc0f1eec68 | ||
|
|
765fb79321 | ||
|
|
eb42c1b473 | ||
|
|
ce484ecac5 | ||
|
|
cb3e4d33a7 | ||
|
|
12c01eb2fa | ||
|
|
c4b8a17437 | ||
|
|
5dde544e07 | ||
|
|
d16ad2154d | ||
|
|
245da7a870 | ||
|
|
2a0b217718 | ||
|
|
582cfa7b57 | ||
|
|
1b295dc827 | ||
|
|
a83248f70d | ||
|
|
42a1375c00 | ||
|
|
fbe89306f5 | ||
|
|
faeb2f55d3 | ||
|
|
239cc09c9f | ||
|
|
6aac1faac4 | ||
|
|
ea4ab05bff | ||
|
|
d53f39bbc7 | ||
|
|
8f28b71ee2 | ||
|
|
58df1fcc91 | ||
|
|
060b919fa3 | ||
|
|
7d0d4aa672 | ||
|
|
e3cde54ab2 | ||
|
|
d681345e41 | ||
|
|
3939b534ad | ||
|
|
a8afbd2a0b | ||
|
|
7d7cbb4445 | ||
|
|
1c5dceb47d | ||
|
|
876fbf6fbf | ||
|
|
b469ce2a69 | ||
|
|
6f7823e8cb | ||
|
|
2619a4398d | ||
|
|
d411fe44fe | ||
|
|
67af517510 | ||
|
|
cce862bc57 | ||
|
|
319750e3f9 | ||
|
|
78ccd8b2d5 | ||
|
|
50ef62f4fb | ||
|
|
05a5b5284b | ||
|
|
8c6865405d | ||
|
|
a204b5d521 | ||
|
|
da0128b330 | ||
|
|
84b005a3b0 | ||
|
|
38fd7eae6d | ||
|
|
e3d08fa0de | ||
|
|
0da59c3585 | ||
|
|
b4145fda44 | ||
|
|
5df58a116d | ||
|
|
7899d8cb46 | ||
|
|
b47e0f20ef | ||
|
|
63a7121653 | ||
|
|
7927c89ba2 | ||
|
|
db5c97a324 | ||
|
|
d4b919430f | ||
|
|
d52df749fa | ||
|
|
63eac8f0f6 | ||
|
|
0d7a618d87 | ||
|
|
7a8d440475 | ||
|
|
89b63802ac | ||
|
|
17e8b51205 | ||
|
|
8bb12b6913 | ||
|
|
8a194d1ff6 | ||
|
|
45bc1e3d80 | ||
|
|
a812e22312 | ||
|
|
b7c9015b39 | ||
|
|
98c7c0d49c | ||
|
|
dc10e3cca6 | ||
|
|
54ae21fd5d | ||
|
|
5d851e849a | ||
|
|
09ef7c2e80 | ||
|
|
e8d7fc30a5 | ||
|
|
5fbb6d7349 | ||
|
|
28b67601c1 | ||
|
|
ba02780727 | ||
|
|
2c756925a1 | ||
|
|
ac37b708c0 | ||
|
|
6b92403dea | ||
|
|
f63da3d3d2 | ||
|
|
de763c948c | ||
|
|
4469b93ed9 | ||
|
|
873c09d224 | ||
|
|
646b0a1050 | ||
|
|
470975ca77 | ||
|
|
2005daa11f | ||
|
|
e28f4e3993 | ||
|
|
7509ecb971 | ||
|
|
738309506d | ||
|
|
5243d9f17d | ||
|
|
bd91ef1be1 | ||
|
|
8a9338ae46 | ||
|
|
9aa27103a0 | ||
|
|
af105f4add | ||
|
|
d2d3d84cbf | ||
|
|
e9a5c9315c | ||
|
|
3a93098804 | ||
|
|
0b404d04cd | ||
|
|
f7b6fc476f | ||
|
|
0bcf58cf80 | ||
|
|
f9390aa69d | ||
|
|
3f6bb1a03d | ||
|
|
67eaa91252 | ||
|
|
911dffccc2 | ||
|
|
3368b7fcc5 | ||
|
|
1ad7cae303 | ||
|
|
b7d04384fb | ||
|
|
ea32d28d0b | ||
|
|
ad70e4b996 | ||
|
|
c320ebce86 | ||
|
|
01c81f5a0b | ||
|
|
66c722ec00 | ||
|
|
af38857d07 | ||
|
|
5a1a02d212 | ||
|
|
bc96b5cd3e | ||
|
|
c44e834c01 | ||
|
|
4273bf6587 | ||
|
|
3329a544a4 | ||
|
|
075784498c | ||
|
|
03b68a7f6f | ||
|
|
dc614c96c3 | ||
|
|
f77f705942 | ||
|
|
aa9cc58b49 | ||
|
|
9de4dcf4b1 | ||
|
|
eae3d091f8 | ||
|
|
5f499123df | ||
|
|
a6c16ab45a | ||
|
|
c060a55740 | ||
|
|
8447998ce6 | ||
|
|
99bc0ffcb6 | ||
|
|
dea5feaa1e | ||
|
|
ebea88f60f | ||
|
|
5717b6050e | ||
|
|
8eb60e9398 | ||
|
|
4db2dc0592 | ||
|
|
ba1daa4b17 | ||
|
|
69700bce2a | ||
|
|
9dc0db4eae | ||
|
|
8aeef01bd4 | ||
|
|
3fff3925b2 | ||
|
|
72c0ecbc5d | ||
|
|
785c8056f9 | ||
|
|
48ef856d02 | ||
|
|
c052ecf8c0 | ||
|
|
64ae9bfe27 | ||
|
|
7b028f61d6 | ||
|
|
5d3f2105f0 | ||
|
|
a4c57cf41c | ||
|
|
e8fa6d793f | ||
|
|
8fa6c3ad1e | ||
|
|
2044657fb6 | ||
|
|
8c216d0aa6 | ||
|
|
b80f22bf08 | ||
|
|
4b0414c61b | ||
|
|
3c43382148 | ||
|
|
00e081fcad | ||
|
|
8cc8e5f171 | ||
|
|
b449205b6f | ||
|
|
bbe88eba3d | ||
|
|
f271778905 | ||
|
|
fdefa91208 | ||
|
|
909eb7cde3 | ||
|
|
1b3598182b | ||
|
|
031d190da2 | ||
|
|
744cb05253 | ||
|
|
b1b2b10ee5 | ||
|
|
6efb6aebdf | ||
|
|
a633c2558a | ||
|
|
88cd3bea89 | ||
|
|
1ec83d1398 | ||
|
|
adf46aaeca | ||
|
|
43669d3652 | ||
|
|
bc356c6daf | ||
|
|
b090424510 | ||
|
|
3fd2b883de | ||
|
|
e3e29ed79b | ||
|
|
be4e820c0a | ||
|
|
d7e1aa2161 | ||
|
|
f214cc54c6 | ||
|
|
31157da8bb | ||
|
|
d54baa4293 | ||
|
|
e3e4ac027f | ||
|
|
c8023cd828 | ||
|
|
9770948c45 | ||
|
|
6b62e2152f | ||
|
|
88a223e2d9 | ||
|
|
74f28ad610 | ||
|
|
085b37b2ed | ||
|
|
ea273ba4b6 | ||
|
|
f3b14030b1 | ||
|
|
c565d94d41 | ||
|
|
d054164a4b | ||
|
|
cd0679c3b2 | ||
|
|
1be60149f9 | ||
|
|
b48e271ced | ||
|
|
2bcb1dcb90 | ||
|
|
c8d472beb7 | ||
|
|
18689e4f00 | ||
|
|
440c73431e | ||
|
|
de634687fa | ||
|
|
6d0a753d2d | ||
|
|
c43b24c0db | ||
|
|
7df7ffcc69 | ||
|
|
cca73eabe0 | ||
|
|
db7f8d9cbd | ||
|
|
a53ff85a66 | ||
|
|
46a7f39be6 | ||
|
|
89801adc76 | ||
|
|
a405880a89 | ||
|
|
bd5c4207bc | ||
|
|
3564bc56e4 | ||
|
|
6f18f867c0 | ||
|
|
1ae1b5abf1 | ||
|
|
f8a920a2cb | ||
|
|
b497efc0c1 | ||
|
|
dfb36a48f9 | ||
|
|
0e471c665d | ||
|
|
f76b2f7c72 | ||
|
|
4915d7d4a3 | ||
|
|
16e3861b41 | ||
|
|
b57855b6ba | ||
|
|
6edd19e416 | ||
|
|
4ef61c71bf | ||
|
|
6a5f0d3e50 | ||
|
|
9b20221587 | ||
|
|
70b540e67f | ||
|
|
f76b26e5d7 | ||
|
|
19b6d3c999 | ||
|
|
49955e2dc8 | ||
|
|
cd6a4d0cd2 | ||
|
|
4f1cd6c8bc | ||
|
|
29fe12ef57 | ||
|
|
5116d62488 | ||
|
|
6387309f01 | ||
|
|
bb27307e25 | ||
|
|
0ad3baeea4 | ||
|
|
635d0f2a7c | ||
|
|
5f49f63e8f | ||
|
|
45dd54dfb3 | ||
|
|
bcf35813d8 | ||
|
|
327b514216 | ||
|
|
96f67109fe | ||
|
|
50d42f9fc9 | ||
|
|
e248a47a1f | ||
|
|
5d3e4bd0f8 | ||
|
|
3b3f0a84be | ||
|
|
9b55e982b3 | ||
|
|
712f1013f4 | ||
|
|
eb4bab70d1 | ||
|
|
d970c4e020 | ||
|
|
825157f998 | ||
|
|
c41f1797e8 | ||
|
|
f871e71823 | ||
|
|
a270b515d2 | ||
|
|
b90920e63a | ||
|
|
4def9c7ab1 | ||
|
|
79f102ecc5 | ||
|
|
1bdc56d251 | ||
|
|
d1d793f9e7 | ||
|
|
1c661f0a5d | ||
|
|
9db70222c0 | ||
|
|
42b16f1fbd | ||
|
|
34d4fac6e8 | ||
|
|
f63a290d34 | ||
|
|
68867c135d | ||
|
|
7ae55731fb | ||
|
|
cd24067ce7 | ||
|
|
3f1f65e4a3 | ||
|
|
0095487773 | ||
|
|
7d2e67b95d | ||
|
|
b0db7045f4 | ||
|
|
bfdab3a518 | ||
|
|
fc49c374bf | ||
|
|
4b776ca7bf | ||
|
|
0f58efa3cc | ||
|
|
0d3a8e5410 | ||
|
|
c6d3d72ce9 | ||
|
|
fc651c65ad | ||
|
|
9b86427884 | ||
|
|
849713eaea | ||
|
|
52db6d7b6a | ||
|
|
0434cd6bf8 | ||
|
|
dbab8591bf | ||
|
|
065649d1df | ||
|
|
2d2e0cdfeb | ||
|
|
c3e8f307b7 | ||
|
|
e03f1ef713 | ||
|
|
eb4f73b582 | ||
|
|
1609d1c2b0 | ||
|
|
3480620eca | ||
|
|
e694af304e | ||
|
|
581c04e66e | ||
|
|
2e737288ef | ||
|
|
18a1d51c19 | ||
|
|
db7ec7fe95 | ||
|
|
d619546735 | ||
|
|
b78b449895 | ||
|
|
f53198aec5 | ||
|
|
fa1728210a | ||
|
|
90674cefc4 | ||
|
|
24d4a21007 | ||
|
|
b4ad4e831d | ||
|
|
886d872241 | ||
|
|
0ef01b868e | ||
|
|
46f89771a5 | ||
|
|
055f473964 | ||
|
|
f3850dab24 | ||
|
|
86870c40a5 | ||
|
|
dbc33f9fe4 | ||
|
|
1f95fda03c | ||
|
|
1724f54b12 | ||
|
|
4b0132ed90 | ||
|
|
d219faafd0 | ||
|
|
6d19f60049 | ||
|
|
a8f1b23769 | ||
|
|
89cb93be67 | ||
|
|
bfe9aba3a8 | ||
|
|
5265ddd27c | ||
|
|
5e118f5e17 | ||
|
|
a522e8262a | ||
|
|
028bfd8ada | ||
|
|
d1ba1b8831 | ||
|
|
2a7c79235d | ||
|
|
ebaf94a5ec | ||
|
|
5c9b930737 | ||
|
|
9483582479 | ||
|
|
cd7b23a537 | ||
|
|
97609976e4 | ||
|
|
4262f1f9cd | ||
|
|
eb6237d913 | ||
|
|
fcf2edefe8 | ||
|
|
a7a9ef52f0 | ||
|
|
d8ad50fcf8 | ||
|
|
3a974ab51f | ||
|
|
9834830bda | ||
|
|
e673558179 | ||
|
|
bd17353576 | ||
|
|
4f0403d315 | ||
|
|
0232e7b212 | ||
|
|
68655dd92b | ||
|
|
28ffd08fbd | ||
|
|
4b92eb7912 | ||
|
|
6f76822785 | ||
|
|
165bc85dfa | ||
|
|
fdcb42caf2 | ||
|
|
7d5fcb22a8 | ||
|
|
c2beac9bfa | ||
|
|
49344d0f3c | ||
|
|
18b6ddca70 | ||
|
|
e901b5dd64 | ||
|
|
bf11a02d44 | ||
|
|
15f0295142 | ||
|
|
5c665053d2 | ||
|
|
cddf378b51 | ||
|
|
96bfb98c87 | ||
|
|
d0f85d69ab | ||
|
|
3374827e66 | ||
|
|
96d8fc6d21 | ||
|
|
1fd19db0f2 | ||
|
|
2ef717cd72 | ||
|
|
1868cee073 | ||
|
|
351742e88e | ||
|
|
bd67caaeb8 | ||
|
|
0f39521750 | ||
|
|
7fde4a379a | ||
|
|
5cc7e6f2bc | ||
|
|
f2f4a8d62b | ||
|
|
16f9eb32c9 | ||
|
|
3567b7d735 | ||
|
|
23a181c33a | ||
|
|
74b6bfca28 | ||
|
|
ef1074e7ba | ||
|
|
b02d7a3df2 | ||
|
|
6c3d6f25ac | ||
|
|
de4b9887b7 | ||
|
|
b7c9eabf8f | ||
|
|
ed43c51428 | ||
|
|
69bc454cc0 | ||
|
|
83b87cf9cb | ||
|
|
0f061764e6 | ||
|
|
77a6b8152e | ||
|
|
6a5e76512f | ||
|
|
24bad668bd | ||
|
|
a670961b99 | ||
|
|
f3896d3c78 | ||
|
|
04e9e57dad | ||
|
|
2bccff6ae6 | ||
|
|
3afa857965 | ||
|
|
3441da2bd5 | ||
|
|
898972d040 | ||
|
|
b0d0f18da2 | ||
|
|
1d3a828f55 | ||
|
|
310bb1ea10 | ||
|
|
7f8deb280a | ||
|
|
3204527b6f | ||
|
|
0354e2b5fc | ||
|
|
07dac7c20e | ||
|
|
bf09ad27b9 | ||
|
|
af3bbb3db8 | ||
|
|
f520af9250 | ||
|
|
df590b7083 | ||
|
|
9ec7b8d776 | ||
|
|
18580ced5a | ||
|
|
8dc6b1be29 | ||
|
|
649839c539 | ||
|
|
7401b9bbb0 | ||
|
|
068967fd74 | ||
|
|
20c07143aa | ||
|
|
fafa6e5191 | ||
|
|
327a986944 | ||
|
|
666cc8f81b | ||
|
|
7c81ae2fa4 | ||
|
|
8224019e23 | ||
|
|
b334d82e76 | ||
|
|
e28f416746 | ||
|
|
cd821c3d86 | ||
|
|
42fd096ac3 | ||
|
|
bff4a10355 | ||
|
|
bd52a7856d | ||
|
|
01fb89f378 | ||
|
|
4abe76816d | ||
|
|
e19283e387 | ||
|
|
03286746a0 | ||
|
|
e7ce4dddec | ||
|
|
cd9829bcae | ||
|
|
132f8d53a9 | ||
|
|
abb74ab2cf | ||
|
|
3d97cd1aa0 | ||
|
|
809f712e80 | ||
|
|
88877c7874 | ||
|
|
749f17efbe | ||
|
|
3ef1b424b1 | ||
|
|
bd0185f825 | ||
|
|
f86ed401b2 | ||
|
|
b9d01eb9d8 | ||
|
|
08a0d108b0 | ||
|
|
30b3c20c80 | ||
|
|
d56885c3f9 | ||
|
|
822a52b5b8 | ||
|
|
d8eb1d07f2 | ||
|
|
34956af6a2 | ||
|
|
1f15d0ba20 | ||
|
|
c4798df9dc | ||
|
|
a1fdc00a01 | ||
|
|
d85e7a2b0f | ||
|
|
c78727f15f | ||
|
|
dd1d85e3e4 | ||
|
|
e29c907188 | ||
|
|
450aec3191 | ||
|
|
c672086b8f | ||
|
|
ae3a3a795d | ||
|
|
2fa200b347 | ||
|
|
7d750a42ab | ||
|
|
f61f93a85d | ||
|
|
e0c38b59c1 | ||
|
|
198034ae67 | ||
|
|
10107a14fc | ||
|
|
0e18040bee | ||
|
|
ab92d8bdd3 | ||
|
|
6bf70f5b47 | ||
|
|
59dfa9fabb | ||
|
|
f4a48d5326 | ||
|
|
af5f0d9f85 | ||
|
|
ab6fa602cc | ||
|
|
a15b0c7cc8 | ||
|
|
86bffa503c | ||
|
|
511b331735 | ||
|
|
78d101dd80 | ||
|
|
70dc93cd09 | ||
|
|
fed8b95199 | ||
|
|
e8d8fb5af8 | ||
|
|
d98038ecf7 | ||
|
|
5ea3713a22 | ||
|
|
0d4cc8a505 | ||
|
|
9d0dc9f06d | ||
|
|
261b89792b | ||
|
|
089f0b0e18 | ||
|
|
53e7fbed0e | ||
|
|
988d118478 | ||
|
|
df7be9b51f | ||
|
|
dead95adad | ||
|
|
d69ad9ef9a | ||
|
|
b65bbb03a8 | ||
|
|
83d3ca01fe | ||
|
|
e7732b03f8 | ||
|
|
b742335ffb | ||
|
|
262a17659b | ||
|
|
191e24398a | ||
|
|
ae2a23f0aa | ||
|
|
59944eadf4 | ||
|
|
5208b090dd | ||
|
|
c14b18d24e | ||
|
|
01e2e6a19d | ||
|
|
71ca117931 | ||
|
|
bee7fef71a | ||
|
|
24b8105dcb | ||
|
|
a01e066dae | ||
|
|
e93f94f87c | ||
|
|
eb052cca32 | ||
|
|
b4c1b8c954 | ||
|
|
5d1b6a7d2a | ||
|
|
12bd685fe7 | ||
|
|
3616a18286 | ||
|
|
db6b3489de | ||
|
|
049f5f4123 | ||
|
|
b553f29b71 | ||
|
|
ea6e8ee74e | ||
|
|
6559603147 | ||
|
|
ab8839c07f | ||
|
|
2c83f6e5a5 | ||
|
|
fa4a4a0ca0 | ||
|
|
e9f0e1d7af | ||
|
|
c9cf4f8c9b | ||
|
|
89e20ef82a | ||
|
|
bab579f6f9 | ||
|
|
e26b1dac22 | ||
|
|
23d9c77305 | ||
|
|
8e49b4b400 | ||
|
|
e434e5df76 | ||
|
|
f9136dbf42 | ||
|
|
f144f66e88 | ||
|
|
58f6cf5411 | ||
|
|
d966013b69 | ||
|
|
8261d95a4b | ||
|
|
0ec7cbdd64 | ||
|
|
ab37570e9b | ||
|
|
7a61bb6cdc | ||
|
|
5cf920c78e | ||
|
|
f1a5ca14bc | ||
|
|
01aef56066 | ||
|
|
a1ca6e68bc | ||
|
|
e08e4645b1 | ||
|
|
1452b65879 | ||
|
|
bd2ae75b08 | ||
|
|
ed9cd05619 | ||
|
|
fdbe47a061 | ||
|
|
a4b326cd44 | ||
|
|
7e2c66a82e | ||
|
|
0913057d0d | ||
|
|
85cb8a72ca | ||
|
|
9d75d537cc | ||
|
|
c1a2d05803 | ||
|
|
a0e05bb588 | ||
|
|
d8d3b77d5f | ||
|
|
ab4dce2af3 | ||
|
|
f0588eed10 | ||
|
|
99d6ee3554 | ||
|
|
3e00a40918 | ||
|
|
1d97510869 | ||
|
|
db3a804d15 | ||
|
|
c83613ab04 | ||
|
|
42b7bb02c2 | ||
|
|
c18739e057 | ||
|
|
4ea4bf43e5 | ||
|
|
417571fe8d | ||
|
|
24a2527fb2 | ||
|
|
c8b94ec829 | ||
|
|
8dfbda5e35 | ||
|
|
a9fb68223a | ||
|
|
9d69afaa81 | ||
|
|
5e1ff9b88a | ||
|
|
9bb6d9326c | ||
|
|
b00389f19f | ||
|
|
a4eb8cbece | ||
|
|
9463a07e9d | ||
|
|
763a6c5d78 | ||
|
|
b89ad2e128 | ||
|
|
747a1a73c4 | ||
|
|
ab99da9e7a | ||
|
|
8969742139 | ||
|
|
c5002778c9 | ||
|
|
97b7e81908 | ||
|
|
323d553d5e | ||
|
|
fe13d021c1 | ||
|
|
aa11d7e42e | ||
|
|
8bca8d1cb5 | ||
|
|
ca5021d090 | ||
|
|
cbd899983e | ||
|
|
7529499f30 | ||
|
|
b69fe1bdc1 | ||
|
|
424f18e52b | ||
|
|
3a53fa88cb | ||
|
|
a1a2275794 | ||
|
|
354596bc3d | ||
|
|
b9b34a4bbe | ||
|
|
8e8a2a114c | ||
|
|
b6667f2fb8 | ||
|
|
ef6a36d5e2 | ||
|
|
70e385e892 | ||
|
|
a74a6b0d0f | ||
|
|
998b950f6f | ||
|
|
9e54e4f296 | ||
|
|
1fb65d2628 | ||
|
|
a7811cd10f | ||
|
|
9e3c36d48c | ||
|
|
57db7d3936 | ||
|
|
98dfccce1a | ||
|
|
2eb0959215 | ||
|
|
64f1535ae4 | ||
|
|
1665fe9ec0 | ||
|
|
ac054bee35 | ||
|
|
92c7c64a19 | ||
|
|
16c4c749e9 | ||
|
|
8dddd3c519 | ||
|
|
f48ba98c22 | ||
|
|
9a86f800c7 | ||
|
|
3a2e636f1f | ||
|
|
d87439cf0a | ||
|
|
0d637e0a2c | ||
|
|
153b751738 | ||
|
|
bb6cc79c80 | ||
|
|
e67bfb55fe | ||
|
|
c0212f937e | ||
|
|
e448928194 | ||
|
|
7c6b6a02a0 | ||
|
|
79f6903a7d | ||
|
|
800881fec8 | ||
|
|
d47bc0ea29 | ||
|
|
a9876a0cec | ||
|
|
064ceb6c12 | ||
|
|
f6bce0d41b | ||
|
|
31d572a8b6 | ||
|
|
354112c8b3 | ||
|
|
cc561a6586 | ||
|
|
8cbb30711f | ||
|
|
ed1d88b1c8 | ||
|
|
ed37c60257 | ||
|
|
ae2a99a645 | ||
|
|
88c24308b2 | ||
|
|
8a86a92504 | ||
|
|
7d87114d69 | ||
|
|
4c76588493 | ||
|
|
3a6778eee7 | ||
|
|
474a2c9e2e | ||
|
|
fdf36cfb62 | ||
|
|
7ee8799b3d | ||
|
|
8f03460821 | ||
|
|
275638339f | ||
|
|
e86e946463 | ||
|
|
4d77af307c | ||
|
|
ec6f947379 | ||
|
|
5b977bb0b9 | ||
|
|
535a95b199 | ||
|
|
775ebc5de4 | ||
|
|
b756faf83c | ||
|
|
269df338e4 | ||
|
|
2827bef4b9 | ||
|
|
3d0e7b86b7 | ||
|
|
5c5fb9c8c8 | ||
|
|
8ae7b30df8 | ||
|
|
52d201ac93 | ||
|
|
326b3bfe62 | ||
|
|
98d037890e | ||
|
|
6146ef6ac3 | ||
|
|
117328caf7 | ||
|
|
06b4607769 | ||
|
|
6d2ffc59da | ||
|
|
e91984a2d6 | ||
|
|
9f657bf2ab | ||
|
|
0c9475afaf | ||
|
|
675fa06ba9 | ||
|
|
65bc4e18b0 | ||
|
|
9d4ecfe283 | ||
|
|
b2a664dbd0 | ||
|
|
e80793c71b | ||
|
|
f3f02fbc28 | ||
|
|
b469fddae5 | ||
|
|
550904f64a | ||
|
|
6fd8a4c957 | ||
|
|
e0f5ab6d6d | ||
|
|
bb8e96da34 | ||
|
|
2a47fa25dd | ||
|
|
3a78329fba | ||
|
|
51879a5003 | ||
|
|
3b9646436f | ||
|
|
0de0042591 | ||
|
|
4b57de43be | ||
|
|
f7846f6bc6 | ||
|
|
cc92d8ab69 | ||
|
|
62ac36d436 | ||
|
|
afe5bed6fc | ||
|
|
a3c956bf04 | ||
|
|
17d703bf56 | ||
|
|
87b58f2ab8 | ||
|
|
2e660714aa | ||
|
|
5d983eebf0 | ||
|
|
2639c615e8 | ||
|
|
e92f1c8e16 | ||
|
|
6bc8274e2d | ||
|
|
a26b59a233 | ||
|
|
6505738fbf | ||
|
|
10c11e3c56 | ||
|
|
4aacdf3a37 | ||
|
|
6a4cbd5c97 | ||
|
|
0f907d9f99 | ||
|
|
8409bd7d93 | ||
|
|
6123ae9744 | ||
|
|
74751c77c6 | ||
|
|
bd5a681a2b | ||
|
|
c2aa0d15cc | ||
|
|
9bcc0bb175 | ||
|
|
dd1c35dfb3 | ||
|
|
003416e324 | ||
|
|
05a44984a3 | ||
|
|
03a5f8ec90 | ||
|
|
b632778c62 | ||
|
|
0eb4940cd3 | ||
|
|
b964913af0 | ||
|
|
31e12c31ed | ||
|
|
e65c125e01 | ||
|
|
f08bd9310d | ||
|
|
7517493b07 | ||
|
|
898f1d86a9 | ||
|
|
873cd20dba | ||
|
|
982a984ad4 | ||
|
|
8ba3ef0d7f | ||
|
|
94b8642eec | ||
|
|
43ed8bcf49 | ||
|
|
95a6a8ee1f | ||
|
|
444eff637b | ||
|
|
d2e230c0cb | ||
|
|
195f3326fc | ||
|
|
fefbddcc92 | ||
|
|
bb2e9902c9 | ||
|
|
555786d906 | ||
|
|
c5926e71ab | ||
|
|
0e0d68e6d2 | ||
|
|
cc3658591c | ||
|
|
8b9030bda6 | ||
|
|
fe1a718926 | ||
|
|
4cbc67683d | ||
|
|
c308742582 | ||
|
|
029b568f5c | ||
|
|
4bfe3ab62d | ||
|
|
377e2a9c79 | ||
|
|
f0192b3d4f | ||
|
|
b7a15692d5 | ||
|
|
cac05219b4 | ||
|
|
5732f9e15d | ||
|
|
8378b9265a | ||
|
|
0ba2121283 | ||
|
|
ec78edcd7a | ||
|
|
de1b368ae8 | ||
|
|
0bc3ab989b | ||
|
|
b3a23fe9c0 | ||
|
|
b53c9ac6fd | ||
|
|
5de39dd131 | ||
|
|
7a08005e53 | ||
|
|
6f3ce820d3 | ||
|
|
cc9cd837b3 | ||
|
|
170175a4cb | ||
|
|
95cb1fcdfa | ||
|
|
81489a70a2 | ||
|
|
ea7f455ca7 | ||
|
|
0056a2c2c7 | ||
|
|
6c6bbca60f | ||
|
|
de7ff0439b | ||
|
|
930f491b3f | ||
|
|
8fde01c50f | ||
|
|
c144955530 | ||
|
|
176161be01 | ||
|
|
0fdc0bf7ce | ||
|
|
ca72e0cbfb | ||
|
|
e5212aa687 | ||
|
|
959e494b1c | ||
|
|
6cf2e0407e | ||
|
|
77d31e32ce | ||
|
|
0176344bf8 | ||
|
|
f311b0e0c3 | ||
|
|
9b631a3e21 | ||
|
|
c43922bdc1 | ||
|
|
3fdc992846 | ||
|
|
30a2e935fd | ||
|
|
d432fa0664 | ||
|
|
e11cc9d9f0 | ||
|
|
ed2d16d775 | ||
|
|
96c1321772 | ||
|
|
1d9ba33b21 | ||
|
|
b6766cbaa6 | ||
|
|
215ef2a20d | ||
|
|
7efc5b3174 | ||
|
|
9f3ca243e2 | ||
|
|
0b3746454e | ||
|
|
c64115661c | ||
|
|
9c5fea1656 | ||
|
|
c6f7d4d4f9 | ||
|
|
8ab1f82e29 | ||
|
|
f947fd8fdf | ||
|
|
7f460f243c | ||
|
|
1ffbda71f7 | ||
|
|
52a001d7cd | ||
|
|
c80d2c094e | ||
|
|
abba5d8870 | ||
|
|
cf69381c32 | ||
|
|
597dd3123d | ||
|
|
342da1e039 | ||
|
|
dfe0bd5825 | ||
|
|
40b9474896 | ||
|
|
64ddc54325 | ||
|
|
9d2ed8fd9a | ||
|
|
b0740e7af7 | ||
|
|
ec5abbe2cb | ||
|
|
7ee7e9897e | ||
|
|
91d35cb671 | ||
|
|
0064517e99 | ||
|
|
e05aa69674 | ||
|
|
e9ffe18674 | ||
|
|
3f0bce90ea | ||
|
|
d220a17679 | ||
|
|
a310347420 | ||
|
|
a7096b876f | ||
|
|
184e846592 | ||
|
|
88b02b60a4 | ||
|
|
87f8af7977 | ||
|
|
388619661b | ||
|
|
f9326359af | ||
|
|
f5693273a6 | ||
|
|
1b237b5615 | ||
|
|
8eaea5feb1 | ||
|
|
7aa624c8ed | ||
|
|
ed866810d6 | ||
|
|
4fde212445 | ||
|
|
a11e013668 | ||
|
|
4bab379986 | ||
|
|
71b3089ae6 | ||
|
|
7e81bcb5be | ||
|
|
2496b7c2c5 | ||
|
|
9aeb148ea9 | ||
|
|
8e7c4f2b2c | ||
|
|
60201b4ac3 | ||
|
|
169a7fd064 | ||
|
|
bfba14106e | ||
|
|
f6b22f0ff2 | ||
|
|
313d2f956c | ||
|
|
a0ae5e7dcf | ||
|
|
30c070a60c | ||
|
|
5bf2daa734 | ||
|
|
af0faf6436 | ||
|
|
0333aad4fb | ||
|
|
abee3e2cf2 | ||
|
|
86fc6bb452 | ||
|
|
b1681772b0 | ||
|
|
6aef8a7b14 | ||
|
|
5306c090c0 | ||
|
|
248799229d | ||
|
|
d84d258d5c | ||
|
|
751c4f3ce8 | ||
|
|
b52f8d5ce9 | ||
|
|
94823b93cd | ||
|
|
b2039f5741 | ||
|
|
0fd0c62c96 | ||
|
|
ce66fa1aa6 | ||
|
|
a955b85620 | ||
|
|
0c3908de28 | ||
|
|
aed27d6fc4 | ||
|
|
f2e232d6cf | ||
|
|
5311189ec2 | ||
|
|
719ad602ce | ||
|
|
66831ca814 | ||
|
|
323ae164f2 | ||
|
|
082924fe82 | ||
|
|
86b8d6d7e7 | ||
|
|
dafc082838 | ||
|
|
f0128e0f5d | ||
|
|
c04322c3a0 | ||
|
|
b1463a6d5b | ||
|
|
13a532eed0 | ||
|
|
625f74fbc5 | ||
|
|
d23efe4154 | ||
|
|
0ef56aab3a | ||
|
|
e2f1415820 | ||
|
|
d17747490f | ||
|
|
1866de2908 | ||
|
|
ffd5ce2f90 | ||
|
|
83624452a4 | ||
|
|
b7b35c3ea1 | ||
|
|
fe5c5bf6fa | ||
|
|
705e2759dc | ||
|
|
4a6e8cada0 | ||
|
|
dcb30a19e4 | ||
|
|
6e846705ec | ||
|
|
9d018e0886 | ||
|
|
c4f6ea71b4 | ||
|
|
4549b8305e | ||
|
|
ed10be50ea | ||
|
|
3a6f0c4c7b | ||
|
|
1ea32c79e3 | ||
|
|
3612d96029 | ||
|
|
cd4e5a21f6 | ||
|
|
aaf3c915bc | ||
|
|
3bd9014b5a | ||
|
|
ab209d950b | ||
|
|
e92413a53d | ||
|
|
fb74a7f99b | ||
|
|
96b9442c29 | ||
|
|
7db5ff25f0 | ||
|
|
a20d067d62 | ||
|
|
c85b5dce14 | ||
|
|
70ab66889b | ||
|
|
3acf776efe | ||
|
|
0430a94f31 | ||
|
|
044c3b186d | ||
|
|
620a63f09c | ||
|
|
b76933f26d | ||
|
|
3d94e6fb75 | ||
|
|
925f9a3c3e | ||
|
|
1fae8ad4d6 | ||
|
|
1860de9529 | ||
|
|
3dcce9ea5d | ||
|
|
4809c8db27 | ||
|
|
c14297aa51 | ||
|
|
0ccfdc6ef4 | ||
|
|
45ad93778d | ||
|
|
f1d683abb0 | ||
|
|
8fad01156b | ||
|
|
b1c7f2a3c5 | ||
|
|
f2c0468487 | ||
|
|
89110b21f1 | ||
|
|
79f176221a | ||
|
|
56ebeffda1 | ||
|
|
0fe5d63220 | ||
|
|
43d18cd6f2 | ||
|
|
ffcb91ef05 | ||
|
|
d42de7d96a | ||
|
|
04cf207105 | ||
|
|
b404274e26 | ||
|
|
011d52a246 | ||
|
|
2e01f71e95 | ||
|
|
17aa045349 | ||
|
|
264e6e5e81 | ||
|
|
b5a15cbbbb | ||
|
|
a8ee5ee79a | ||
|
|
d7be938767 | ||
|
|
00ecb18efb | ||
|
|
0880664a58 | ||
|
|
a5641ee557 | ||
|
|
ac4d9601d9 | ||
|
|
597cd2462c | ||
|
|
a4aabcfbcc | ||
|
|
58839ae503 | ||
|
|
85a0edc131 | ||
|
|
8aedcff494 | ||
|
|
78581d99ae | ||
|
|
8cf6e07a6b | ||
|
|
7f44343ec7 | ||
|
|
bb78cfcaf6 | ||
|
|
3464fa8ea7 | ||
|
|
23c427944f | ||
|
|
b0943da09f | ||
|
|
dd20f0c7c7 | ||
|
|
4093a23fb3 | ||
|
|
c5c9d6e1fd | ||
|
|
3c88c64cac | ||
|
|
55dacc62dc | ||
|
|
0056adae8e | ||
|
|
7c9dd702c4 | ||
|
|
8e73755566 | ||
|
|
21da5c8be8 | ||
|
|
8900e613b2 | ||
|
|
6e37546336 | ||
|
|
4b4aec1e32 | ||
|
|
b356696d1e | ||
|
|
3dd75fc51e | ||
|
|
d6a0823d57 | ||
|
|
eb7e8752ed | ||
|
|
201666365f | ||
|
|
04ba2c29dd | ||
|
|
8b2750389d | ||
|
|
586657d973 | ||
|
|
7e0f491a73 | ||
|
|
8e62e6a6a3 | ||
|
|
45ab932d3c | ||
|
|
eb295e16e9 | ||
|
|
deec409f02 | ||
|
|
246c5c4c55 | ||
|
|
352750a247 | ||
|
|
4abb66f06a | ||
|
|
7840391061 | ||
|
|
5cf2d24098 | ||
|
|
14781b3f7b | ||
|
|
04beb32199 | ||
|
|
57c3f00f1d | ||
|
|
f021974c73 | ||
|
|
b97ab7c054 | ||
|
|
a930af9656 | ||
|
|
b74d0bce71 | ||
|
|
0a5f73d2a6 | ||
|
|
94d02606f6 | ||
|
|
274618b899 | ||
|
|
e77d23e908 | ||
|
|
db878badae | ||
|
|
c723bee425 | ||
|
|
6cf055501b | ||
|
|
7152615e3c | ||
|
|
b7bbdfa3e3 | ||
|
|
1262855d05 | ||
|
|
1cea4d9766 | ||
|
|
627c23ec15 | ||
|
|
d6d447c6bf | ||
|
|
1852c48e93 | ||
|
|
78f8a6b7db | ||
|
|
63f7d1aac5 | ||
|
|
c5a1bfdd62 | ||
|
|
13627a83cf | ||
|
|
88023852b3 | ||
|
|
5adb6378e2 | ||
|
|
619cc77823 | ||
|
|
fab8cdde35 | ||
|
|
730eda864f | ||
|
|
1309c77f3c | ||
|
|
35e503a2ae | ||
|
|
a82951f85e | ||
|
|
5ef782a04b | ||
|
|
78d1bf814f | ||
|
|
4dcc33f7b7 | ||
|
|
79514e0a51 | ||
|
|
f2c78c794a | ||
|
|
435e27d02c | ||
|
|
b4640aecb0 | ||
|
|
6915c97a51 | ||
|
|
7e6996813a | ||
|
|
fd787fd3fb | ||
|
|
17aadda1c5 | ||
|
|
68335024ea | ||
|
|
c5cf140961 | ||
|
|
6764c39bfb | ||
|
|
59c6f58e77 | ||
|
|
6a6a9f5a9e | ||
|
|
697f65c07e | ||
|
|
f59a2e5144 | ||
|
|
f161ba5718 | ||
|
|
467d5e596d | ||
|
|
b66cf34975 | ||
|
|
528a7ec7e5 | ||
|
|
3cee15aef0 | ||
|
|
677e2739a6 | ||
|
|
79bf0f674c | ||
|
|
8376abcfaa | ||
|
|
14201f8747 | ||
|
|
c34d26670f | ||
|
|
3c669c6e93 | ||
|
|
e7896f9ec2 | ||
|
|
1a17587d3a | ||
|
|
c23e066d63 | ||
|
|
aee4bfd240 | ||
|
|
2ca0a14dfd | ||
|
|
c9afbbc573 | ||
|
|
6967092a39 | ||
|
|
2fc17edfd1 | ||
|
|
e5f04b9dd8 | ||
|
|
72cea36b4c | ||
|
|
cb3dc07da4 | ||
|
|
7a6adba398 | ||
|
|
52ac010d6f | ||
|
|
285085ab14 | ||
|
|
ed088c2d8e | ||
|
|
4e33c323df | ||
|
|
e4f1492744 | ||
|
|
922d234c45 | ||
|
|
05edb94249 | ||
|
|
f6de2e066e | ||
|
|
8204c5d631 | ||
|
|
4d9ce8419d | ||
|
|
f47ddb5330 | ||
|
|
1fab6e5396 | ||
|
|
f77b370ee9 | ||
|
|
30e46ef672 | ||
|
|
bdeab22d57 | ||
|
|
982ad348a4 | ||
|
|
296d3a8330 | ||
|
|
1ad13506f8 | ||
|
|
8887fdf227 | ||
|
|
8ac94578cb | ||
|
|
adcf8f9b0d | ||
|
|
6b7f08d27b | ||
|
|
14fa2a7e5f | ||
|
|
f9d1f8ad39 | ||
|
|
86fb8f57da | ||
|
|
84d87ba5bc | ||
|
|
922b1e783b | ||
|
|
a1e68ea71f | ||
|
|
af025bb76b | ||
|
|
16f2d66b82 | ||
|
|
b5205e10aa | ||
|
|
c53ca172ef | ||
|
|
4cdf42a6d8 | ||
|
|
bdae6431b7 | ||
|
|
a8e1e7c09f | ||
|
|
1e4bbaa979 | ||
|
|
b00f28399b | ||
|
|
232c668a45 | ||
|
|
242435a0af | ||
|
|
5e093dbac8 | ||
|
|
e84c299d77 | ||
|
|
680511621c | ||
|
|
a4a44f735f | ||
|
|
bbfc4f2e20 | ||
|
|
6498ef9d25 | ||
|
|
c833196faa | ||
|
|
0f84b1fd9f | ||
|
|
ad39ca31b2 | ||
|
|
9bccd08531 | ||
|
|
db1ca78fbb | ||
|
|
70e2484d99 | ||
|
|
4f81138bde | ||
|
|
a16cc34f8d | ||
|
|
69cffe5b3d | ||
|
|
4c53c6fe56 | ||
|
|
87748980ea | ||
|
|
9bc6a15581 | ||
|
|
3e4eb458d3 | ||
|
|
8d643fddcf | ||
|
|
67da1c6184 | ||
|
|
1957fc0b77 | ||
|
|
baebf06dc0 | ||
|
|
078aa4ab88 | ||
|
|
97d82994cc | ||
|
|
0f2d7c05a9 | ||
|
|
2ad01ba158 | ||
|
|
4c454f3793 | ||
|
|
987fb97fad | ||
|
|
104bdf0e37 | ||
|
|
9846133f97 | ||
|
|
fa087ca733 | ||
|
|
9cb661df86 | ||
|
|
6a20277b7e | ||
|
|
46e54fb8db | ||
|
|
b0fc8aa0a3 | ||
|
|
6caa434cd0 | ||
|
|
c85cffbed1 | ||
|
|
2377ca8e02 | ||
|
|
5a90d2fd19 | ||
|
|
9ca4606cf5 | ||
|
|
4b648ac0d0 | ||
|
|
d3ae9e5c35 | ||
|
|
584452adc9 | ||
|
|
8303a6f8a5 | ||
|
|
a107493942 | ||
|
|
0c79206e62 | ||
|
|
6fbd8843e8 | ||
|
|
f6ac6d8c60 | ||
|
|
03768c587c | ||
|
|
04be4cad57 | ||
|
|
5ad0284c92 | ||
|
|
8471ae512b | ||
|
|
388fd05e90 | ||
|
|
7aac404238 | ||
|
|
faf6bff61b | ||
|
|
b644f8d4aa | ||
|
|
d091f169ad | ||
|
|
a1e9aef5dc | ||
|
|
94bd45a1f9 | ||
|
|
aa00273a97 | ||
|
|
077db29072 | ||
|
|
266702d3ff | ||
|
|
bdfcfed7fe | ||
|
|
0513511b4b | ||
|
|
6dba94e69d | ||
|
|
c088dfbf64 | ||
|
|
8a95ba99ac | ||
|
|
9abaa18ba0 | ||
|
|
16d57cead7 | ||
|
|
bccad0fe6e | ||
|
|
31bbd66497 | ||
|
|
2d38f37be7 | ||
|
|
ebb48c5a6d | ||
|
|
5de377d535 | ||
|
|
719dedeebf | ||
|
|
9567ab2aab | ||
|
|
b9077e5112 | ||
|
|
b9fac2d6c9 | ||
|
|
5fa664b59f | ||
|
|
307cc62a6a | ||
|
|
ab3bfa3018 | ||
|
|
480cee7fec | ||
|
|
924b0c2b24 | ||
|
|
5db3c59ff0 | ||
|
|
ff8b593438 | ||
|
|
0f9197a1f0 | ||
|
|
ac6bda02de | ||
|
|
eef49aa7c3 | ||
|
|
2b84919759 | ||
|
|
7b56fbd453 | ||
|
|
b62ac638f8 | ||
|
|
074004d57f | ||
|
|
d36a93b050 | ||
|
|
4abffd87f8 | ||
|
|
a6b83d7e58 | ||
|
|
679dda68ea | ||
|
|
4952487937 | ||
|
|
d7a52e797e | ||
|
|
23e5282b0f | ||
|
|
978f0382b9 | ||
|
|
b598384f22 | ||
|
|
fb9d69e191 | ||
|
|
2125d3cd49 | ||
|
|
348e400be3 | ||
|
|
a236e24b25 | ||
|
|
4eae63c898 | ||
|
|
9cd931225d | ||
|
|
65232f6c47 | ||
|
|
c82895612b | ||
|
|
e50feeb9cd | ||
|
|
d10f91538f | ||
|
|
2327997910 | ||
|
|
469e610c15 | ||
|
|
7ab59f3cbe | ||
|
|
8eb8a7ea2d | ||
|
|
1d014a5848 | ||
|
|
a29a0f9e20 | ||
|
|
4b866d2d72 | ||
|
|
76024f5ddd | ||
|
|
d20673cc3e | ||
|
|
e68f960928 | ||
|
|
68586850f4 | ||
|
|
7c8845e425 | ||
|
|
66ad7be601 | ||
|
|
ecfd39825f | ||
|
|
3028b0c0ba | ||
|
|
dad68786ce | ||
|
|
feb94a3982 | ||
|
|
13e0c45b03 | ||
|
|
6078046efa | ||
|
|
0c27a8e793 | ||
|
|
27d71dc05d | ||
|
|
b078b66db9 | ||
|
|
bb20f92af8 | ||
|
|
616a4142d2 | ||
|
|
6e47bbbff6 | ||
|
|
01fab2b75e | ||
|
|
09182267c9 | ||
|
|
6b88c08796 | ||
|
|
485bfbc093 | ||
|
|
82367dd6d6 | ||
|
|
5bc3597c70 | ||
|
|
06113b1cee | ||
|
|
93c2e4fcd0 | ||
|
|
c2129f98bb | ||
|
|
896d760236 | ||
|
|
d5adae6be2 | ||
|
|
be681c7005 | ||
|
|
c9aa7223f0 | ||
|
|
6520e39814 | ||
|
|
5944174c24 | ||
|
|
c6202f2a4c | ||
|
|
6c4331a97f | ||
|
|
710ace21e4 | ||
|
|
dd8119105c | ||
|
|
ecfd5d46f9 | ||
|
|
f88455c011 | ||
|
|
8250a06d90 | ||
|
|
710d23dece | ||
|
|
d23cf6ac1b | ||
|
|
0f1798c7ce | ||
|
|
1e2362aa56 | ||
|
|
0a054b88a7 | ||
|
|
ee8af858b2 | ||
|
|
86f8a440f3 | ||
|
|
4b3069bed9 | ||
|
|
4953a7f855 | ||
|
|
2471baf5af | ||
|
|
2f59c0523a | ||
|
|
88b81b7d51 | ||
|
|
05e445a934 | ||
|
|
fa66721f81 | ||
|
|
cfd63c2c1d | ||
|
|
4e1b960a06 | ||
|
|
de8ebbdfd0 | ||
|
|
a4ddf8e3e9 | ||
|
|
b47286f947 | ||
|
|
af4a9ea590 | ||
|
|
c7f25d0c9d | ||
|
|
50aa821110 | ||
|
|
a35139fddb | ||
|
|
be7715fe42 | ||
|
|
3d9df2118b | ||
|
|
3e3ac32159 | ||
|
|
d089e9dbb0 | ||
|
|
e20578b4b7 | ||
|
|
779427702d | ||
|
|
0a523a93ba | ||
|
|
5f3ededf9a | ||
|
|
fee52d8931 | ||
|
|
3f98b5dc15 | ||
|
|
5dad71b935 | ||
|
|
e235fe1f46 | ||
|
|
c1f99063dd | ||
|
|
2bb0677cef | ||
|
|
caa004756d | ||
|
|
6653fba315 | ||
|
|
67f64b406c | ||
|
|
56f46a1e9e | ||
|
|
348acdedcc | ||
|
|
c6442cdab8 | ||
|
|
0568ea0c72 | ||
|
|
5ba2440a70 | ||
|
|
4564ce65e8 | ||
|
|
21585033d9 | ||
|
|
3cb55fe3ef | ||
|
|
d459403bb5 | ||
|
|
47b4b7caa2 | ||
|
|
53717ae948 | ||
|
|
8b555c0dbe | ||
|
|
81c1280c20 | ||
|
|
93bb3a6040 | ||
|
|
67aeae5717 | ||
|
|
a1eb97dbe7 | ||
|
|
f9ee1e1f87 | ||
|
|
47580f01a7 | ||
|
|
105e52d5ac | ||
|
|
d60e7d9e0b | ||
|
|
9b9af06f53 | ||
|
|
1abf538ecd | ||
|
|
473bb3a1c3 | ||
|
|
49b9b139f2 | ||
|
|
e34e806cad | ||
|
|
565220fc99 | ||
|
|
b5aaf2fddb | ||
|
|
9df5da312e | ||
|
|
3c3cc88042 | ||
|
|
397f133751 | ||
|
|
e110acd59c | ||
|
|
4ed541d65d | ||
|
|
baf1466ee2 | ||
|
|
abf447f5da | ||
|
|
c68ae24807 | ||
|
|
7b121172fe | ||
|
|
c9eff0f745 | ||
|
|
0ae72246c3 | ||
|
|
c1401f0eac | ||
|
|
8ea0c75081 | ||
|
|
e0a101c8db | ||
|
|
3162ec6864 | ||
|
|
b7a1bfb072 | ||
|
|
c6d8af9024 | ||
|
|
6157ca9e3b | ||
|
|
1cde4e16cb | ||
|
|
4bc2d08017 | ||
|
|
2511b7f850 | ||
|
|
8e283e6a1c | ||
|
|
c29146ee25 | ||
|
|
2840cf3146 | ||
|
|
98440415c4 | ||
|
|
44622140af | ||
|
|
463c0920db | ||
|
|
272f27625e | ||
|
|
962cb6cd82 | ||
|
|
62f60ec815 | ||
|
|
eaf0a7226f | ||
|
|
7585420593 | ||
|
|
68fe3e214a | ||
|
|
fa43163386 | ||
|
|
96625be5b1 | ||
|
|
df3eb01bc6 | ||
|
|
7a4092db32 | ||
|
|
edda3adead | ||
|
|
cf6321de5c | ||
|
|
2a44f3c0e2 | ||
|
|
500eb55aa7 | ||
|
|
e10d5a17c4 | ||
|
|
f36d1f32b1 | ||
|
|
0256dc416c | ||
|
|
e77e428ba3 | ||
|
|
3ad9a75284 | ||
|
|
3355b1c5ab | ||
|
|
9ad33aac0f | ||
|
|
d9ad6bc684 | ||
|
|
043dfb5a8b | ||
|
|
c2a218f067 | ||
|
|
2aefd88e5e | ||
|
|
87223f8df1 | ||
|
|
794ad6b042 | ||
|
|
0105d466bb | ||
|
|
9e28502620 | ||
|
|
c958999476 | ||
|
|
903e0bdc3d | ||
|
|
408d35b25b | ||
|
|
01cf822f67 | ||
|
|
055750e49e | ||
|
|
088aa9b81b | ||
|
|
1008f88f23 | ||
|
|
0e4ca3554e | ||
|
|
221b901a81 | ||
|
|
3b3e0ad377 | ||
|
|
2b3145f497 | ||
|
|
32bc08b986 | ||
|
|
834adb48eb | ||
|
|
5403ce9d44 | ||
|
|
80910efb00 | ||
|
|
5cadf1224f | ||
|
|
fa804557ed | ||
|
|
dbd6efc987 | ||
|
|
03f02079d8 | ||
|
|
54ef96eaa1 | ||
|
|
7343cf757b | ||
|
|
fb69f34821 | ||
|
|
f50464956b | ||
|
|
71886b503e | ||
|
|
7606445e1e | ||
|
|
774a48103b | ||
|
|
a9469fed78 | ||
|
|
6e5787a9e1 | ||
|
|
0654796f82 | ||
|
|
63ddd56507 | ||
|
|
ac12d94448 | ||
|
|
9f845173de | ||
|
|
1aa9bde676 | ||
|
|
8c06f24cf4 | ||
|
|
a6625b0325 | ||
|
|
106b74d901 | ||
|
|
7b7d51dcee | ||
|
|
53012ee386 | ||
|
|
dcf1b7a6d8 | ||
|
|
49cdc7bf79 | ||
|
|
8abf92420a | ||
|
|
b2294d405e | ||
|
|
5d708e3195 | ||
|
|
dde3a49925 | ||
|
|
639abb53ff | ||
|
|
7a511eec7c | ||
|
|
05e7b33376 | ||
|
|
2d8b10888d | ||
|
|
4fdaece1df | ||
|
|
6bce3cc847 | ||
|
|
b8c9760275 | ||
|
|
7c0c845a3d | ||
|
|
678adda106 | ||
|
|
180a7cd505 | ||
|
|
68f0053b9b | ||
|
|
5139f8a38f | ||
|
|
68ff049691 | ||
|
|
30836c6714 | ||
|
|
1ce86f7e63 | ||
|
|
ec4f44f215 | ||
|
|
3b48c18e9a | ||
|
|
db3a6e3076 | ||
|
|
4848a4c078 | ||
|
|
8f550a67d6 | ||
|
|
fb01545c1b | ||
|
|
2f572dc3ac | ||
|
|
da8126d62e | ||
|
|
c3993c3e6e | ||
|
|
587fb09f4d | ||
|
|
dc6b457e2d | ||
|
|
64606f5cb8 | ||
|
|
eca616f9a9 | ||
|
|
4f25bfcde3 | ||
|
|
03a437fb7f | ||
|
|
9e4a56e936 | ||
|
|
b39f3daf97 | ||
|
|
158d2a9ea9 | ||
|
|
96c53be358 | ||
|
|
56459dcf5a | ||
|
|
5c370d13ae | ||
|
|
ed61e4f968 | ||
|
|
e23fdc09b9 | ||
|
|
f6ca0e0ec4 | ||
|
|
bec616d924 | ||
|
|
1b03192d09 | ||
|
|
9b455654c7 | ||
|
|
1af9dde7bb | ||
|
|
fcb607399d | ||
|
|
d181269171 | ||
|
|
cb6d7d96b3 | ||
|
|
3ffdc6aa79 | ||
|
|
130d711640 | ||
|
|
dae2419cef | ||
|
|
b4e2eb76b5 | ||
|
|
e4768096b2 | ||
|
|
505531f8e5 | ||
|
|
47f5768474 | ||
|
|
898c4a1a40 | ||
|
|
57e6beb904 | ||
|
|
e09080436b | ||
|
|
6862cda387 | ||
|
|
5c4ac0a0fa | ||
|
|
8e577eedf0 | ||
|
|
442d171cfc | ||
|
|
df85c00175 | ||
|
|
3af610bb73 | ||
|
|
2708f00556 | ||
|
|
510a5a8d09 | ||
|
|
2b184e6ce7 | ||
|
|
a68df54ffe | ||
|
|
a8233b492a | ||
|
|
20cbdef83c | ||
|
|
13a1ae1069 | ||
|
|
7fd63d30c9 | ||
|
|
6396545364 | ||
|
|
d7b03dd947 | ||
|
|
a1d20a7b7c | ||
|
|
433c49e6be | ||
|
|
3eea564cba | ||
|
|
a6b6ade573 | ||
|
|
70658b952c | ||
|
|
2b8130d2e7 | ||
|
|
969d218519 | ||
|
|
af7f7baa57 | ||
|
|
387e521019 | ||
|
|
0da5ddbe6c | ||
|
|
cfa1c4c076 | ||
|
|
9460812be5 | ||
|
|
a2c4ffc1a9 | ||
|
|
260c67ba8d | ||
|
|
8c41a24bb7 | ||
|
|
60399cfb01 | ||
|
|
3294495bda | ||
|
|
1583b1e0a3 | ||
|
|
7f635d46e1 | ||
|
|
55b38b499a | ||
|
|
8b13cd2dad | ||
|
|
fa824c9ebd | ||
|
|
c418ddfd1c | ||
|
|
c753839df7 | ||
|
|
ae1df7e2a1 | ||
|
|
b341df4098 | ||
|
|
9339bdb428 | ||
|
|
8d79248c0b | ||
|
|
140b432364 | ||
|
|
75e45dbc52 | ||
|
|
63c6207d71 | ||
|
|
b6dd3e0e82 | ||
|
|
dca5fc6a4b | ||
|
|
a0765b7169 | ||
|
|
ea7b9b432a | ||
|
|
4c57e37807 | ||
|
|
fc526ae232 | ||
|
|
dc46c8b5ea | ||
|
|
5f78d2d059 | ||
|
|
0cf894567f | ||
|
|
651c4a9955 | ||
|
|
9bfab5d899 | ||
|
|
99b24b7ad1 | ||
|
|
db9025dcea | ||
|
|
b3729ad078 | ||
|
|
709812d307 | ||
|
|
fd7f0282a5 | ||
|
|
39be921ae8 | ||
|
|
d1c9d55158 | ||
|
|
0f887d3e7e | ||
|
|
67a89e2578 | ||
|
|
038933e978 | ||
|
|
ca2003b644 | ||
|
|
d68e69ffdf | ||
|
|
db1b73ca6e | ||
|
|
e69739be72 | ||
|
|
c33681e3be | ||
|
|
7c04d9ea7c | ||
|
|
b97454dbde | ||
|
|
1ba5442d0c | ||
|
|
7e59b91723 | ||
|
|
9b88efec36 | ||
|
|
9678ef523a | ||
|
|
fe3664e8fa | ||
|
|
3ed2656935 | ||
|
|
dc354330fb | ||
|
|
24cefaeeff | ||
|
|
897d7d035d | ||
|
|
b4132946c9 | ||
|
|
7e3a2a2875 | ||
|
|
c28e8cd732 | ||
|
|
e39e86966c | ||
|
|
90b2f6444d | ||
|
|
8a754af137 | ||
|
|
340e10ff6d | ||
|
|
37517af695 | ||
|
|
33fcf6105a | ||
|
|
8cf9af3024 | ||
|
|
eed8409e4b | ||
|
|
bd193e4be2 | ||
|
|
87c73392eb |
No files matched your search
@@ -1,6 +1,3 @@
|
||||
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
|
||||
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle
|
||||
|
||||
name: Gradle Package
|
||||
|
||||
on: [ push, pull_request ]
|
||||
@@ -14,20 +11,45 @@ jobs:
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 8
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: '8'
|
||||
distribution: 'adopt'
|
||||
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
|
||||
settings-path: ${{ github.workspace }} # location for the settings.xml file
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Build with Gradle
|
||||
run: gradle :clean :build
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'adopt'
|
||||
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
|
||||
settings-path: ${{ github.workspace }} # location for the settings.xml file
|
||||
|
||||
- name: Upload build artifacts
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: packetevents-dev-build.jar
|
||||
path: build/libs
|
||||
- name: Build with Gradle
|
||||
run: chmod +x gradlew && ./gradlew build
|
||||
|
||||
- name: Upload build artifacts api
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: api-build
|
||||
path: api/build/libs
|
||||
|
||||
- name: Upload build artifacts spigot
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: spigot-build
|
||||
path: spigot/build/libs
|
||||
|
||||
- name: Upload build artifacts netty-common
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: netty-common-build
|
||||
path: netty-common/build/libs
|
||||
|
||||
- name: Upload build artifacts bungeecord
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: bungeecord-build
|
||||
path: bungeecord/build/libs
|
||||
|
||||
- name: Upload build artifacts velocity
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: velocity-build
|
||||
path: velocity/build/libs
|
||||
+93
-85
@@ -1,78 +1,18 @@
|
||||
#
|
||||
# JetBrains
|
||||
#
|
||||
|
||||
# User-specific stuff
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/shelf
|
||||
/.idea
|
||||
|
||||
# Generated files
|
||||
.idea/**/contentModel.xml
|
||||
|
||||
# Sensitive or high-churn files
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
.idea/**/dbnavigator.xml
|
||||
|
||||
# Gradle
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
|
||||
# Gradle and Maven with auto-import
|
||||
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||
# since they will be recreated, and may cause churn. Uncomment if using
|
||||
# auto-import.
|
||||
# .idea/artifacts
|
||||
# .idea/compiler.xml
|
||||
# .idea/jarRepositories.xml
|
||||
# .idea/modules.xml
|
||||
# .idea/*.iml
|
||||
# .idea/modules
|
||||
# *.iml
|
||||
# *.ipr
|
||||
|
||||
# CMake
|
||||
cmake-build-*/
|
||||
|
||||
# Mongo Explorer plugin
|
||||
.idea/**/mongoSettings.xml
|
||||
|
||||
# File-based project format
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Cursive Clojure plugin
|
||||
.idea/replstate.xml
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
# Editor-based Rest Client
|
||||
.idea/httpRequests
|
||||
|
||||
# Android studio 3.1+ serialized cache file
|
||||
.idea/caches/build_file_checksums.ser
|
||||
|
||||
|
||||
#
|
||||
# Java
|
||||
#
|
||||
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
@@ -82,9 +22,6 @@ fabric.properties
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
@@ -97,21 +34,92 @@ fabric.properties
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
|
||||
#
|
||||
# Maven
|
||||
#
|
||||
target/
|
||||
pom.xml.tag
|
||||
pom.xml.releaseBackup
|
||||
pom.xml.versionsBackup
|
||||
pom.xml.next
|
||||
release.properties
|
||||
dependency-reduced-pom.xml
|
||||
buildNumber.properties
|
||||
.mvn/timing.properties
|
||||
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
|
||||
.mvn/wrapper/maven-wrapper.jar
|
||||
/src/main/resources/
|
||||
/.gradle/
|
||||
*~
|
||||
|
||||
# temporary files which can be created if a process still has a handle open of a deleted file
|
||||
.fuse_hidden*
|
||||
|
||||
# KDE directory preferences
|
||||
.directory
|
||||
|
||||
# Linux trash folder which might appear on any partition or disk
|
||||
.Trash-*
|
||||
|
||||
# .nfs files are created when an open file is removed but is still being accessed
|
||||
.nfs*
|
||||
|
||||
# General
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
|
||||
# Windows thumbnail cache files
|
||||
Thumbs.db
|
||||
Thumbs.db:encryptable
|
||||
ehthumbs.db
|
||||
ehthumbs_vista.db
|
||||
|
||||
# Dump file
|
||||
*.stackdump
|
||||
|
||||
# Folder config file
|
||||
[Dd]esktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
|
||||
.gradle
|
||||
build/
|
||||
bin/
|
||||
|
||||
# Ignore Gradle GUI config
|
||||
gradle-app.setting
|
||||
|
||||
# Cache of project
|
||||
.gradletasknamecache
|
||||
|
||||
**/build/
|
||||
|
||||
# Common working directory
|
||||
run/
|
||||
|
||||
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
|
||||
!gradle-wrapper.jar
|
||||
/src/main/resources/plugin.yml
|
||||
/.idea/
|
||||
/build/
|
||||
.vscode/
|
||||
.project
|
||||
.settings/
|
||||
.classpath
|
||||
@@ -1,23 +1,33 @@
|
||||
# packetevents
|
||||
|
||||
[](https://github.com/retrooper/packetevents/blob/master/LICENSE)
|
||||
[](https://jitpack.io/#retrooper/packetevents)
|
||||
[](https://github.com/retrooper/packetevents/blob/2.0/LICENSE) [](https://github.com/retrooper/packetevents/actions) [](https://discord.gg/prqzNg9tRU)
|
||||
|
||||
PacketEvents is a powerful packet library. Our packet wrappers are efficient and easy to use. We support many protocol versions. (1.8+)
|
||||
PacketEvents is a fast and efficient multi-platform packet processing library. Our packet wrappers are easy to use with multi-version support. With our API you can write code that runs on Spigot, BungeeCord, Velocity, and Fabric! Switch to PacketEvents today by joining \
|
||||
our [Discord Server](https://discord.me/packetevents) for help.
|
||||
|
||||
### Resources
|
||||
* [SpigotMC](https://www.spigotmc.org/resources/packetevents-api.80279/)
|
||||
* [JavaDoc](https://packetevents.github.io/javadocs)
|
||||
* [Discord](https://discord.me/packetevents)
|
||||
### Links
|
||||
* [Find release builds on Modrinth](https://modrinth.com/plugin/packetevents)
|
||||
* [Find development builds on Jenkins](https://ci.codemc.io/job/retrooper/job/packetevents)
|
||||
* [View documentation on our JavaDocs Page](https://packetevents.github.io/javadocs)
|
||||
|
||||
### Setup
|
||||
[Learn more](https://github.com/retrooper/packetevents/wiki/1.-Setup)
|
||||
[How to Setup PacketEvents](https://github.com/retrooper/packetevents/wiki/Depending-on-pre%E2%80%90built-PacketEvents)
|
||||
|
||||
### Examples / How to use PacketEvents
|
||||
[Example repository](https://github.com/retrooper/packetevents-example)
|
||||
|
||||
### Sponsorships
|
||||
[](https://www.ej-technologies.com/products/jprofiler/overview.html)
|
||||
|
||||
### Statistics
|
||||
PacketEvents collects statistics anonymously using bStats. It helps give us an overview of what platforms use our project. If you really don't like, you can turn it off.
|
||||
PacketEvents optionally collects statistics using [bStats](https://bstats.org/)\
|
||||
Check out our [bStats page](https://bstats.org/plugin/bukkit/packetevents/11327)
|
||||
|
||||
### Credit
|
||||
PacketEvents uses an injector that is extremely similar to ViaVersion's injector. I have included license and copyright holder notice in the files taken from ViaVersion. Thank you ViaVersion.
|
||||
### Credit to these projects
|
||||
[wiki.vg/Protocol](https://wiki.vg/Protocol)\
|
||||
[netty](https://github.com/netty/netty)\
|
||||
[gson](https://github.com/google/gson)\
|
||||
[adventure](https://github.com/KyoriPowered/adventure)\
|
||||
[ViaVersion](https://github.com/ViaVersion/ViaVersion)\
|
||||
[ProtocolSupport](https://github.com/ProtocolSupport/ProtocolSupport)\
|
||||
[MCProtocolLib](https://github.com/GeyserMC/MCProtocolLib/)
|
||||
@@ -0,0 +1,23 @@
|
||||
// papermc repo + disableAutoTargetJvm needed for mockbukkit
|
||||
repositories {
|
||||
maven { url 'https://repo.papermc.io/repository/maven-public/' }
|
||||
}
|
||||
|
||||
java {
|
||||
disableAutoTargetJvm()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(adventureDependencies)
|
||||
|
||||
testImplementation(adventureDependencies)
|
||||
testImplementation(project(":netty-common"))
|
||||
testImplementation("com.github.seeseemelk:MockBukkit-v1.20:3.9.0")
|
||||
testImplementation("org.slf4j:slf4j-simple:2.0.7")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.0")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.10.0")
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
+15
-13
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 retrooper and contributors
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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
|
||||
@@ -16,21 +16,23 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.github.retrooper.packetevents.packetwrappers.play.in.itemname;
|
||||
package com.github.retrooper.packetevents;
|
||||
|
||||
import io.github.retrooper.packetevents.packetwrappers.NMSPacket;
|
||||
import io.github.retrooper.packetevents.packetwrappers.WrappedPacket;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
public class WrappedPacketInItemName extends WrappedPacket {
|
||||
public WrappedPacketInItemName(NMSPacket packet) {
|
||||
super(packet);
|
||||
public final class PacketEvents {
|
||||
private static PacketEventsAPI<?> API;
|
||||
|
||||
//Put these variable names anywhere else, they are really only for the injectors
|
||||
@ApiStatus.Internal
|
||||
public static String IDENTIFIER, ENCODER_NAME, DECODER_NAME, CONNECTION_HANDLER_NAME, SERVER_CHANNEL_HANDLER_NAME,
|
||||
TIMEOUT_HANDLER_NAME;
|
||||
|
||||
public static PacketEventsAPI<?> getAPI() {
|
||||
return API;
|
||||
}
|
||||
|
||||
public String getItemName() {
|
||||
return readString(0);
|
||||
}
|
||||
|
||||
public void setItemName(String itemName) {
|
||||
writeString(0, itemName);
|
||||
public static void setAPI(PacketEventsAPI<?> api) {
|
||||
API = api;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents;
|
||||
|
||||
import com.github.retrooper.packetevents.event.EventManager;
|
||||
import com.github.retrooper.packetevents.injector.ChannelInjector;
|
||||
import com.github.retrooper.packetevents.manager.player.PlayerManager;
|
||||
import com.github.retrooper.packetevents.manager.protocol.ProtocolManager;
|
||||
import com.github.retrooper.packetevents.manager.server.ServerManager;
|
||||
import com.github.retrooper.packetevents.netty.NettyManager;
|
||||
import com.github.retrooper.packetevents.settings.PacketEventsSettings;
|
||||
import com.github.retrooper.packetevents.util.LogManager;
|
||||
import com.github.retrooper.packetevents.util.PEVersion;
|
||||
import com.github.retrooper.packetevents.util.updatechecker.UpdateChecker;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public abstract class PacketEventsAPI<T> {
|
||||
private static final EventManager EVENT_MANAGER = new EventManager();
|
||||
private static final PacketEventsSettings SETTINGS = new PacketEventsSettings();
|
||||
private static final UpdateChecker UPDATE_CHECKER = new UpdateChecker();
|
||||
private final Logger LOGGER = Logger.getLogger(PacketEventsAPI.class.getName());
|
||||
private static final LogManager LOG_MANAGER = new LogManager();
|
||||
//TODO UPDATE
|
||||
private static final PEVersion VERSION = new PEVersion(2, 2, 1);
|
||||
|
||||
public EventManager getEventManager() {
|
||||
return EVENT_MANAGER;
|
||||
}
|
||||
|
||||
public PacketEventsSettings getSettings() {
|
||||
return SETTINGS;
|
||||
}
|
||||
|
||||
public UpdateChecker getUpdateChecker() {
|
||||
return UPDATE_CHECKER;
|
||||
}
|
||||
|
||||
public PEVersion getVersion() {
|
||||
return VERSION;
|
||||
}
|
||||
|
||||
public Logger getLogger() {
|
||||
return LOGGER;
|
||||
}
|
||||
|
||||
public LogManager getLogManager() {
|
||||
return LOG_MANAGER;
|
||||
}
|
||||
|
||||
public abstract void load();
|
||||
|
||||
public abstract boolean isLoaded();
|
||||
|
||||
public abstract void init();
|
||||
|
||||
public abstract boolean isInitialized();
|
||||
|
||||
public abstract void terminate();
|
||||
|
||||
public abstract T getPlugin();
|
||||
|
||||
public abstract ServerManager getServerManager();
|
||||
|
||||
public abstract ProtocolManager getProtocolManager();
|
||||
|
||||
public abstract PlayerManager getPlayerManager();
|
||||
|
||||
public abstract NettyManager getNettyManager();
|
||||
|
||||
public abstract ChannelInjector getInjector();
|
||||
}
|
||||
+9
-9
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 retrooper and contributors
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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
|
||||
@@ -16,23 +16,23 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.github.retrooper.packetevents.event.eventtypes;
|
||||
package com.github.retrooper.packetevents.event;
|
||||
|
||||
import io.github.retrooper.packetevents.event.PacketEvent;
|
||||
import io.github.retrooper.packetevents.event.PacketListenerAbstract;
|
||||
import io.github.retrooper.packetevents.event.impl.PacketPlayReceiveEvent;
|
||||
import com.github.retrooper.packetevents.event.PacketEvent;
|
||||
import com.github.retrooper.packetevents.event.PacketListenerAbstract;
|
||||
|
||||
/**
|
||||
* The {@link PacketEvent} implements this interface.
|
||||
* Every inbuilt event should implement the {@link #call(PacketListenerAbstract)} method.
|
||||
* Every inbuilt event should implement the {@link #call(PacketListenerCommon)} method.
|
||||
* If you are making a custom event, don't implement this.
|
||||
* The {@link PacketListenerAbstract#onPacketEventExternal(PacketEvent)} method is called for every event that is not in-built.
|
||||
* The {@link PacketListenerCommon#onPacketEventExternal(PacketEvent)} method is called for every event that is not in-built.
|
||||
* including custom events.
|
||||
*
|
||||
* @author retrooper
|
||||
* @see PacketPlayReceiveEvent
|
||||
* @since 1.8
|
||||
*/
|
||||
public interface CallableEvent {
|
||||
void call(PacketListenerAbstract listener);
|
||||
default void call(PacketListenerCommon listener) {
|
||||
listener.onPacketEventExternal((PacketEvent) this);
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 retrooper and contributors
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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
|
||||
@@ -16,9 +16,9 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.github.retrooper.packetevents.event.eventtypes;
|
||||
package com.github.retrooper.packetevents.event;
|
||||
|
||||
import io.github.retrooper.packetevents.event.impl.PacketPlayReceiveEvent;
|
||||
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
|
||||
|
||||
/**
|
||||
* Every event that supports cancellation should implement this interface.
|
||||
@@ -26,11 +26,11 @@ import io.github.retrooper.packetevents.event.impl.PacketPlayReceiveEvent;
|
||||
* in deciding whether the event will cancel.
|
||||
* This means an event with a lower priority than the higher priority one would not be able to decide.
|
||||
* Cancelling the event means the action assosiated with the event will be cancelled.
|
||||
* For example, cancelling the {@link PacketPlayReceiveEvent}
|
||||
* For example, cancelling the {@link PacketReceiveEvent}
|
||||
* will prevent minecraft from processing the incoming packet.
|
||||
*
|
||||
* @author retrooper
|
||||
* @see PacketPlayReceiveEvent
|
||||
* @see PacketReceiveEvent
|
||||
* @since 1.7
|
||||
*/
|
||||
public interface CancellableEvent {
|
||||
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.event;
|
||||
|
||||
import com.github.retrooper.packetevents.PacketEvents;
|
||||
import com.github.retrooper.packetevents.exception.InvalidHandshakeException;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class EventManager {
|
||||
private final Map<Byte, Set<PacketListenerCommon>> listenersMap = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* Call the PacketEvent.
|
||||
* This method processes the event on all the registered dynamic packet event listeners.
|
||||
* The {@link PacketListenerPriority#LOWEST} prioritized listeners will be processing first,
|
||||
* the {@link PacketListenerPriority#MONITOR} will be processing last and can
|
||||
* be the final decider whether the event has been cancelled or not.
|
||||
*
|
||||
* @param event {@link PacketEvent}
|
||||
*/
|
||||
public void callEvent(PacketEvent event) {
|
||||
callEvent(event, null);
|
||||
}
|
||||
|
||||
public void callEvent(PacketEvent event, @Nullable Runnable postCallListenerAction) {
|
||||
for (byte priority = PacketListenerPriority.LOWEST.getId(); priority <= PacketListenerPriority.MONITOR.getId(); priority++) {
|
||||
Set<PacketListenerCommon> listeners = listenersMap.get(priority);
|
||||
if (listeners != null) {
|
||||
for (PacketListenerCommon listener : listeners) {
|
||||
try {
|
||||
event.call(listener);
|
||||
} catch (Exception t) {
|
||||
// ignore handshake exceptions
|
||||
if (t.getClass() != InvalidHandshakeException.class) {
|
||||
PacketEvents.getAPI().getLogger().log(Level.WARNING, "PacketEvents caught an unhandled exception while calling your listener.", t);
|
||||
}
|
||||
}
|
||||
if (postCallListenerAction != null) {
|
||||
postCallListenerAction.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// For performance reasons, we don't want to re-encode the packet if it's not needed.
|
||||
if (event instanceof ProtocolPacketEvent && !((ProtocolPacketEvent<?>) event).needsReEncode()) {
|
||||
((ProtocolPacketEvent<?>) event).setLastUsedWrapper(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public PacketListenerCommon registerListener(PacketListener listener, PacketListenerPriority priority) {
|
||||
PacketListenerCommon packetListenerAbstract = listener.asAbstract(priority);
|
||||
return registerListener(packetListenerAbstract);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the dynamic packet event listener.
|
||||
*
|
||||
* @param listener {@link PacketListenerCommon}
|
||||
*/
|
||||
public PacketListenerCommon registerListener(PacketListenerCommon listener) {
|
||||
byte priority = listener.getPriority().getId();
|
||||
Set<PacketListenerCommon> listenerSet = listenersMap.get(priority);
|
||||
if (listenerSet == null) {
|
||||
listenerSet = ConcurrentHashMap.newKeySet();
|
||||
}
|
||||
listenerSet.add(listener);
|
||||
listenersMap.put(priority, listenerSet);
|
||||
return listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register multiple dynamic packet event listeners with one method.
|
||||
*
|
||||
* @param listeners {@link PacketListenerCommon}
|
||||
*/
|
||||
public PacketListenerCommon[] registerListeners(PacketListenerCommon... listeners) {
|
||||
for (PacketListenerCommon listener : listeners) {
|
||||
registerListener(listener);
|
||||
}
|
||||
return listeners;
|
||||
}
|
||||
|
||||
public void unregisterListener(PacketListenerCommon listener) {
|
||||
Set<PacketListenerCommon> listenerSet = listenersMap.get(listener.getPriority().getId());
|
||||
if (listenerSet == null) return;
|
||||
listenerSet.remove(listener);
|
||||
}
|
||||
|
||||
public void unregisterListeners(PacketListenerCommon... listeners) {
|
||||
for (PacketListenerCommon listener : listeners) {
|
||||
unregisterListener(listener);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Unregister all dynamic packet event listeners.
|
||||
*/
|
||||
public void unregisterAllListeners() {
|
||||
listenersMap.clear();
|
||||
}
|
||||
}
|
||||
+22
-18
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 retrooper and contributors
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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
|
||||
@@ -16,10 +16,11 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.github.retrooper.packetevents.event;
|
||||
package com.github.retrooper.packetevents.event;
|
||||
|
||||
|
||||
import io.github.retrooper.packetevents.event.eventtypes.CallableEvent;
|
||||
import com.github.retrooper.packetevents.PacketEvents;
|
||||
import com.github.retrooper.packetevents.util.TimeStampMode;
|
||||
|
||||
/**
|
||||
* An event in both of PacketEvents' event systems.
|
||||
@@ -28,7 +29,23 @@ import io.github.retrooper.packetevents.event.eventtypes.CallableEvent;
|
||||
* @since 1.2.6
|
||||
*/
|
||||
public abstract class PacketEvent implements CallableEvent {
|
||||
private long timestamp = System.currentTimeMillis();
|
||||
private final long timestamp;
|
||||
|
||||
public PacketEvent() {
|
||||
TimeStampMode timeStampMode = PacketEvents.getAPI().getSettings()
|
||||
.getTimeStampMode();
|
||||
switch (timeStampMode) {
|
||||
case MILLIS:
|
||||
timestamp = System.currentTimeMillis();
|
||||
break;
|
||||
case NANO:
|
||||
timestamp = System.nanoTime();
|
||||
break;
|
||||
//AKA NONE:
|
||||
default:
|
||||
timestamp = 0L;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Timestamp of when the PacketEvent was created.
|
||||
@@ -40,20 +57,7 @@ public abstract class PacketEvent implements CallableEvent {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for the timestamp.
|
||||
*
|
||||
* @param timestamp Packet timestamp in milliseconds.
|
||||
*/
|
||||
public void setTimestamp(final long timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
public void callPacketEventExternal(final PacketListenerAbstract listener) {
|
||||
public void callPacketEventExternal(PacketListenerCommon listener) {
|
||||
listener.onPacketEventExternal(this);
|
||||
}
|
||||
|
||||
public boolean isInbuilt() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+2
-12
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 retrooper and contributors
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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
|
||||
@@ -16,24 +16,14 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.github.retrooper.packetevents.event.annotation;
|
||||
package com.github.retrooper.packetevents.event;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* This is what you override your event listener with on the old event system.
|
||||
* You can specify the event priority of the listener method.
|
||||
*
|
||||
* @author retrooper
|
||||
* @since 1.0
|
||||
* @deprecated Was used for the old event system, the new one doesn't need this anymore.
|
||||
*/
|
||||
@Target({ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Deprecated
|
||||
public @interface PacketHandler {
|
||||
byte priority() default 2; //NORMAL priority value
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.event;
|
||||
|
||||
public interface PacketListener {
|
||||
default PacketListenerAbstract asAbstract(PacketListenerPriority priority) {
|
||||
return new PacketListenerAbstract(priority) {
|
||||
@Override
|
||||
public void onUserConnect(UserConnectEvent event) {
|
||||
PacketListener.this.onUserConnect(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserLogin(UserLoginEvent event) {
|
||||
PacketListener.this.onUserLogin(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserDisconnect(UserDisconnectEvent event) {
|
||||
PacketListener.this.onUserDisconnect(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacketReceive(PacketReceiveEvent event) {
|
||||
PacketListener.this.onPacketReceive(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacketSend(PacketSendEvent event) {
|
||||
PacketListener.this.onPacketSend(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacketEventExternal(PacketEvent event) {
|
||||
PacketListener.this.onPacketEventExternal(event);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
default void onUserConnect(UserConnectEvent event) {
|
||||
}
|
||||
|
||||
default void onUserLogin(UserLoginEvent event) {
|
||||
}
|
||||
|
||||
default void onUserDisconnect(UserDisconnectEvent event) {
|
||||
}
|
||||
|
||||
default void onPacketReceive(PacketReceiveEvent event) {
|
||||
}
|
||||
|
||||
default void onPacketSend(PacketSendEvent event) {
|
||||
}
|
||||
|
||||
default void onPacketEventExternal(PacketEvent event) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.event;
|
||||
|
||||
public abstract class PacketListenerAbstract extends PacketListenerCommon {
|
||||
public PacketListenerAbstract(PacketListenerPriority priority) {
|
||||
super(priority);
|
||||
}
|
||||
|
||||
public PacketListenerAbstract() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacketReceive(PacketReceiveEvent event) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacketSend(PacketSendEvent event) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.event;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Abstract packet listener.
|
||||
*
|
||||
* @author retrooper
|
||||
* @since 1.8
|
||||
*/
|
||||
public abstract class PacketListenerCommon {
|
||||
private final PacketListenerPriority priority;
|
||||
|
||||
public PacketListenerCommon(PacketListenerPriority priority) {
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
public PacketListenerCommon() {
|
||||
this.priority = PacketListenerPriority.NORMAL;
|
||||
}
|
||||
|
||||
public PacketListenerPriority getPriority() {
|
||||
return priority;
|
||||
}
|
||||
|
||||
public void onUserConnect(UserConnectEvent event) {
|
||||
}
|
||||
|
||||
public void onUserLogin(UserLoginEvent event) {
|
||||
}
|
||||
|
||||
public void onUserDisconnect(UserDisconnectEvent event) {
|
||||
}
|
||||
|
||||
void onPacketReceive(PacketReceiveEvent event) {
|
||||
}
|
||||
|
||||
void onPacketSend(PacketSendEvent event) {
|
||||
}
|
||||
|
||||
public void onPacketEventExternal(PacketEvent event) {
|
||||
}
|
||||
|
||||
}
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 retrooper and contributors
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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
|
||||
@@ -16,7 +16,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.github.retrooper.packetevents.event;
|
||||
package com.github.retrooper.packetevents.event;
|
||||
|
||||
/**
|
||||
* The priority of packet listeners affect the order they will be invoked in.
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.event;
|
||||
|
||||
import com.github.retrooper.packetevents.event.simple.*;
|
||||
import com.github.retrooper.packetevents.exception.PacketProcessException;
|
||||
import com.github.retrooper.packetevents.manager.server.ServerVersion;
|
||||
import com.github.retrooper.packetevents.netty.buffer.ByteBufHelper;
|
||||
import com.github.retrooper.packetevents.protocol.PacketSide;
|
||||
import com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon;
|
||||
import com.github.retrooper.packetevents.protocol.player.User;
|
||||
|
||||
public class PacketReceiveEvent extends ProtocolPacketEvent<Object> {
|
||||
protected PacketReceiveEvent(Object channel, User user, Object player, Object rawByteBuf,
|
||||
boolean autoProtocolTranslation) throws PacketProcessException {
|
||||
super(PacketSide.CLIENT, channel, user, player, rawByteBuf, autoProtocolTranslation);
|
||||
}
|
||||
|
||||
protected PacketReceiveEvent(int packetID, PacketTypeCommon packetType,
|
||||
ServerVersion serverVersion,
|
||||
Object channel, User user, Object player,
|
||||
Object byteBuf) throws PacketProcessException {
|
||||
super(packetID, packetType, serverVersion,
|
||||
channel, user, player, byteBuf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void call(PacketListenerCommon listener) {
|
||||
listener.onPacketReceive(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketReceiveEvent clone() {
|
||||
try {
|
||||
Object clonedBuffer = ByteBufHelper.retainedDuplicate(getByteBuf());
|
||||
return new PacketReceiveEvent(getPacketId(), getPacketType(), getServerVersion(),
|
||||
getChannel(), getUser(), getPlayer(), clonedBuffer);
|
||||
} catch (PacketProcessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.event;
|
||||
|
||||
import com.github.retrooper.packetevents.event.simple.PacketHandshakeSendEvent;
|
||||
import com.github.retrooper.packetevents.exception.PacketProcessException;
|
||||
import com.github.retrooper.packetevents.manager.server.ServerVersion;
|
||||
import com.github.retrooper.packetevents.netty.buffer.ByteBufHelper;
|
||||
import com.github.retrooper.packetevents.protocol.PacketSide;
|
||||
import com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon;
|
||||
import com.github.retrooper.packetevents.protocol.player.User;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PacketSendEvent extends ProtocolPacketEvent<Object> {
|
||||
private List<Runnable> tasksAfterSend = null;
|
||||
|
||||
protected PacketSendEvent(Object channel, User user, Object player, Object rawByteBuf,
|
||||
boolean autoProtocolTranslation) throws PacketProcessException {
|
||||
super(PacketSide.SERVER, channel, user, player, rawByteBuf, autoProtocolTranslation);
|
||||
}
|
||||
|
||||
protected PacketSendEvent(int packetID, PacketTypeCommon packetType,
|
||||
ServerVersion serverVersion,
|
||||
Object channel, User user,
|
||||
Object player, Object byteBuf) throws PacketProcessException {
|
||||
super(packetID, packetType,
|
||||
serverVersion,
|
||||
channel, user, player, byteBuf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void call(PacketListenerCommon listener) {
|
||||
listener.onPacketSend(this);
|
||||
}
|
||||
|
||||
|
||||
public List<Runnable> getTasksAfterSend() {
|
||||
if (tasksAfterSend == null) {
|
||||
tasksAfterSend = new ArrayList<>();
|
||||
}
|
||||
return tasksAfterSend;
|
||||
}
|
||||
|
||||
public boolean hasTasksAfterSend() {
|
||||
return tasksAfterSend != null && !tasksAfterSend.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketSendEvent clone() {
|
||||
try {
|
||||
Object clonedBuffer = ByteBufHelper.retainedDuplicate(getByteBuf());
|
||||
return new PacketSendEvent(getPacketId(), getPacketType(), getServerVersion(),
|
||||
getChannel(), getUser(), getPlayer(), clonedBuffer);
|
||||
} catch (PacketProcessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+4
-8
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 retrooper and contributors
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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
|
||||
@@ -16,23 +16,19 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.github.retrooper.packetevents.event.eventtypes;
|
||||
|
||||
import io.github.retrooper.packetevents.event.impl.PacketPlayReceiveEvent;
|
||||
import org.bukkit.entity.Player;
|
||||
package com.github.retrooper.packetevents.event;
|
||||
|
||||
/**
|
||||
* Every event that has an associated player is recommended to implement this interface.
|
||||
*
|
||||
* @author retrooper
|
||||
* @see PacketPlayReceiveEvent
|
||||
* @since 1.6.9
|
||||
*/
|
||||
public interface PlayerEvent {
|
||||
public interface PlayerEvent<T> {
|
||||
/**
|
||||
* Associated player.
|
||||
*
|
||||
* @return Player.
|
||||
*/
|
||||
Player getPlayer();
|
||||
T getPlayer();
|
||||
}
|
||||
@@ -0,0 +1,234 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.event;
|
||||
|
||||
import com.github.retrooper.packetevents.PacketEvents;
|
||||
import com.github.retrooper.packetevents.exception.InvalidDisconnectPacketSend;
|
||||
import com.github.retrooper.packetevents.exception.PacketProcessException;
|
||||
import com.github.retrooper.packetevents.manager.server.ServerVersion;
|
||||
import com.github.retrooper.packetevents.netty.buffer.ByteBufHelper;
|
||||
import com.github.retrooper.packetevents.netty.buffer.UnpooledByteBufAllocationHelper;
|
||||
import com.github.retrooper.packetevents.netty.channel.ChannelHelper;
|
||||
import com.github.retrooper.packetevents.protocol.ConnectionState;
|
||||
import com.github.retrooper.packetevents.protocol.PacketSide;
|
||||
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
|
||||
import com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon;
|
||||
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
|
||||
import com.github.retrooper.packetevents.protocol.player.User;
|
||||
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class ProtocolPacketEvent<T> extends PacketEvent implements PlayerEvent<T>, CancellableEvent, UserEvent {
|
||||
private final Object channel;
|
||||
private final ConnectionState connectionState;
|
||||
private final User user;
|
||||
private final T player;
|
||||
private Object byteBuf;
|
||||
private final int packetID;
|
||||
private final PacketTypeCommon packetType;
|
||||
private ServerVersion serverVersion;
|
||||
private boolean cancel;
|
||||
private PacketWrapper<?> lastUsedWrapper;
|
||||
private List<Runnable> postTasks = null;
|
||||
private boolean cloned;
|
||||
private boolean needsReEncode = PacketEvents.getAPI().getSettings().reEncodeByDefault();
|
||||
|
||||
public ProtocolPacketEvent(PacketSide packetSide, Object channel,
|
||||
User user, T player, Object byteBuf,
|
||||
boolean autoProtocolTranslation) throws PacketProcessException {
|
||||
this.channel = channel;
|
||||
this.user = user;
|
||||
this.player = player;
|
||||
if (autoProtocolTranslation || user.getClientVersion() == null) {
|
||||
this.serverVersion = PacketEvents.getAPI().getServerManager().getVersion();
|
||||
} else {
|
||||
//TODO Optimize
|
||||
this.serverVersion = user.getClientVersion().toServerVersion();
|
||||
}
|
||||
|
||||
this.byteBuf = byteBuf;
|
||||
int size = ByteBufHelper.readableBytes(byteBuf);
|
||||
if (size == 0) {
|
||||
throw new PacketProcessException("Trying to process a packet, but it has no content. (Size=0)");
|
||||
}
|
||||
try {
|
||||
this.packetID = ByteBufHelper.readVarInt(byteBuf);
|
||||
} catch (Exception e) {
|
||||
throw new PacketProcessException("Failed to read the Packet ID of a packet. (Size: " + size + ")");
|
||||
}
|
||||
ClientVersion version = serverVersion.toClientVersion();
|
||||
ConnectionState state = packetSide == PacketSide.CLIENT ? user.getDecoderState() : user.getEncoderState();
|
||||
this.packetType = PacketType.getById(packetSide, state,
|
||||
version, packetID);
|
||||
if (this.packetType == null) {
|
||||
// mojang messed up and keeps sending disconnect packets in the wrong protocol state
|
||||
if (PacketType.getById(packetSide, ConnectionState.PLAY, version, packetID) == PacketType.Play.Server.DISCONNECT) {
|
||||
throw new InvalidDisconnectPacketSend();
|
||||
}
|
||||
throw new PacketProcessException("Failed to map the Packet ID " + packetID + " to a PacketType constant. Bound: " + packetSide.getOpposite() + ", Connection state: " + user.getDecoderState() + ", Server version: " + serverVersion.getReleaseName());
|
||||
}
|
||||
this.connectionState = state;
|
||||
}
|
||||
|
||||
public ProtocolPacketEvent(int packetID, PacketTypeCommon packetType, ServerVersion serverVersion, Object channel,
|
||||
User user, T player, Object byteBuf) {
|
||||
this.channel = channel;
|
||||
this.user = user;
|
||||
this.player = player;
|
||||
this.serverVersion = serverVersion;
|
||||
this.byteBuf = byteBuf;
|
||||
this.packetID = packetID;
|
||||
this.packetType = packetType;
|
||||
|
||||
this.connectionState = (packetType != null && packetType.getSide() == PacketSide.SERVER)
|
||||
? user.getEncoderState() : user.getDecoderState();
|
||||
cloned = true;
|
||||
}
|
||||
|
||||
public void markForReEncode(boolean needsReEncode) {
|
||||
this.needsReEncode = needsReEncode;
|
||||
}
|
||||
|
||||
public boolean needsReEncode() {
|
||||
return needsReEncode;
|
||||
}
|
||||
|
||||
|
||||
public boolean isClone() {
|
||||
return cloned;
|
||||
}
|
||||
|
||||
public Object getChannel() {
|
||||
return channel;
|
||||
}
|
||||
|
||||
public InetSocketAddress getSocketAddress() {
|
||||
return (InetSocketAddress) ChannelHelper.remoteAddress(channel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
public ConnectionState getConnectionState() {
|
||||
return connectionState;
|
||||
}
|
||||
|
||||
//TODO Possibly put clientversion inside User class and remove here
|
||||
@Deprecated
|
||||
public ClientVersion getClientVersion() {
|
||||
return user.getClientVersion();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setClientVersion(@NotNull ClientVersion clientVersion) {
|
||||
PacketEvents.getAPI().getLogManager().debug("Setting client version with deprecated method " + clientVersion.getReleaseName());
|
||||
user.setClientVersion(clientVersion);
|
||||
}
|
||||
|
||||
public ServerVersion getServerVersion() {
|
||||
return serverVersion;
|
||||
}
|
||||
|
||||
public void setServerVersion(@NotNull ServerVersion serverVersion) {
|
||||
this.serverVersion = serverVersion;
|
||||
}
|
||||
|
||||
public Object getByteBuf() {
|
||||
return byteBuf;
|
||||
}
|
||||
|
||||
public void setByteBuf(Object byteBuf) {
|
||||
this.byteBuf = byteBuf;
|
||||
}
|
||||
|
||||
public int getPacketId() {
|
||||
return packetID;
|
||||
}
|
||||
|
||||
public PacketTypeCommon getPacketType() {
|
||||
return packetType;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public String getPacketName() {
|
||||
return ((Enum<?>) packetType).name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return this.cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean val) {
|
||||
this.cancel = val;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public PacketWrapper<?> getLastUsedWrapper() {
|
||||
return lastUsedWrapper;
|
||||
}
|
||||
|
||||
public void setLastUsedWrapper(@Nullable PacketWrapper<?> lastUsedWrapper) {
|
||||
this.lastUsedWrapper = lastUsedWrapper;
|
||||
}
|
||||
|
||||
public List<Runnable> getPostTasks() {
|
||||
if (postTasks == null) {
|
||||
postTasks = new ArrayList<>();
|
||||
}
|
||||
return postTasks;
|
||||
}
|
||||
|
||||
public boolean hasPostTasks() {
|
||||
return postTasks != null && !postTasks.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProtocolPacketEvent<?> clone() {
|
||||
return this instanceof PacketReceiveEvent ? ((PacketReceiveEvent) this).clone()
|
||||
: ((PacketSendEvent) this).clone();
|
||||
}
|
||||
|
||||
public void cleanUp() {
|
||||
if (isClone()) {
|
||||
ByteBufHelper.release(byteBuf);
|
||||
}
|
||||
}
|
||||
|
||||
public Object getFullBufferClone() {
|
||||
byte[] data = ByteBufHelper.copyBytes(getByteBuf());
|
||||
Object buffer = UnpooledByteBufAllocationHelper.buffer();
|
||||
ByteBufHelper.writeVarInt(buffer, getPacketId());
|
||||
ByteBufHelper.writeBytes(buffer, data);
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.event;
|
||||
|
||||
import com.github.retrooper.packetevents.event.simple.*;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class SimplePacketListenerAbstract extends PacketListenerCommon {
|
||||
public SimplePacketListenerAbstract(PacketListenerPriority priority) {
|
||||
super(priority);
|
||||
}
|
||||
|
||||
public SimplePacketListenerAbstract() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
void onPacketReceive(PacketReceiveEvent event) {
|
||||
if (event instanceof PacketHandshakeReceiveEvent) {
|
||||
onPacketHandshakeReceive((PacketHandshakeReceiveEvent) event);
|
||||
} else if (event instanceof PacketStatusReceiveEvent) {
|
||||
onPacketStatusReceive((PacketStatusReceiveEvent) event);
|
||||
} else if (event instanceof PacketLoginReceiveEvent) {
|
||||
onPacketLoginReceive((PacketLoginReceiveEvent) event);
|
||||
}
|
||||
else if (event instanceof PacketConfigReceiveEvent) {
|
||||
onPacketConfigReceive((PacketConfigReceiveEvent) event);
|
||||
}
|
||||
else if (event instanceof PacketPlayReceiveEvent) {
|
||||
onPacketPlayReceive((PacketPlayReceiveEvent) event);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
void onPacketSend(PacketSendEvent event) {
|
||||
if (event instanceof PacketStatusSendEvent) {
|
||||
onPacketStatusSend((PacketStatusSendEvent) event);
|
||||
} else if (event instanceof PacketLoginSendEvent) {
|
||||
onPacketLoginSend((PacketLoginSendEvent) event);
|
||||
}
|
||||
else if (event instanceof PacketConfigSendEvent) {
|
||||
onPacketConfigSend((PacketConfigSendEvent) event);
|
||||
}
|
||||
else if (event instanceof PacketPlaySendEvent) {
|
||||
onPacketPlaySend((PacketPlaySendEvent) event);
|
||||
}
|
||||
}
|
||||
|
||||
public void onPacketHandshakeReceive(PacketHandshakeReceiveEvent event) {
|
||||
}
|
||||
|
||||
public void onPacketStatusReceive(PacketStatusReceiveEvent event) {
|
||||
}
|
||||
|
||||
public void onPacketStatusSend(PacketStatusSendEvent event) {
|
||||
}
|
||||
|
||||
public void onPacketLoginReceive(PacketLoginReceiveEvent event) {
|
||||
}
|
||||
|
||||
public void onPacketLoginSend(PacketLoginSendEvent event) {
|
||||
}
|
||||
|
||||
public void onPacketConfigReceive(PacketConfigReceiveEvent event) {
|
||||
}
|
||||
|
||||
public void onPacketConfigSend(PacketConfigSendEvent event) {
|
||||
}
|
||||
|
||||
public void onPacketPlayReceive(PacketPlayReceiveEvent event) {
|
||||
}
|
||||
|
||||
public void onPacketPlaySend(PacketPlaySendEvent event) {
|
||||
}
|
||||
}
|
||||
+19
-10
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 retrooper and contributors
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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
|
||||
@@ -16,17 +16,21 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.github.retrooper.packetevents.event.eventtypes;
|
||||
package com.github.retrooper.packetevents.event;
|
||||
|
||||
import io.github.retrooper.packetevents.packetwrappers.NMSPacket;
|
||||
import com.github.retrooper.packetevents.protocol.player.User;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
public abstract class CancellableNMSPacketEvent extends NMSPacketEvent implements CancellableEvent {
|
||||
public class UserConnectEvent extends PacketEvent implements CancellableEvent, UserEvent{
|
||||
private final User user;
|
||||
private boolean cancelled;
|
||||
|
||||
public CancellableNMSPacketEvent(Object channel, NMSPacket packet) {
|
||||
super(channel, packet);
|
||||
public UserConnectEvent(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -35,7 +39,12 @@ public abstract class CancellableNMSPacketEvent extends NMSPacketEvent implement
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean value) {
|
||||
cancelled = value;
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void call(PacketListenerCommon listener) {
|
||||
listener.onUserConnect(this);
|
||||
}
|
||||
}
|
||||
+14
-11
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 retrooper and contributors
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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
|
||||
@@ -16,21 +16,24 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.github.retrooper.packetevents.packetwrappers.play.in.trsel;
|
||||
package com.github.retrooper.packetevents.event;
|
||||
|
||||
import io.github.retrooper.packetevents.packetwrappers.NMSPacket;
|
||||
import io.github.retrooper.packetevents.packetwrappers.WrappedPacket;
|
||||
import com.github.retrooper.packetevents.protocol.player.User;
|
||||
|
||||
public class WrappedPacketInTrSel extends WrappedPacket {
|
||||
public WrappedPacketInTrSel(NMSPacket packet) {
|
||||
super(packet);
|
||||
public class UserDisconnectEvent extends PacketEvent implements UserEvent {
|
||||
private final User user;
|
||||
|
||||
public UserDisconnectEvent(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public int getSlot() {
|
||||
return readInt(0);
|
||||
@Override
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setSlot(int slot) {
|
||||
writeInt(0, slot);
|
||||
@Override
|
||||
public void call(PacketListenerCommon listener) {
|
||||
listener.onUserDisconnect(this);
|
||||
}
|
||||
}
|
||||
+8
-6
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 retrooper and contributors
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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
|
||||
@@ -16,14 +16,16 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.github.retrooper.packetevents.packetwrappers.api;
|
||||
package com.github.retrooper.packetevents.event;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.player.User;
|
||||
|
||||
/**
|
||||
* Packet-Wrappers that can be sent to clients.
|
||||
* Event that involves users.
|
||||
*
|
||||
* @author retrooper
|
||||
* //TODO since javadoc annotation
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public interface SendableWrapper {
|
||||
Object asNMSPacket() throws Exception;
|
||||
public interface UserEvent {
|
||||
User getUser();
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.event;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.player.User;
|
||||
|
||||
public class UserLoginEvent extends PacketEvent implements CallableEvent, UserEvent, PlayerEvent<Object> {
|
||||
private final User user;
|
||||
private final Object player;
|
||||
|
||||
public UserLoginEvent(User user, Object player) {
|
||||
this.user = user;
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void call(PacketListenerCommon listener) {
|
||||
listener.onUserLogin(this);
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.event.simple;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
|
||||
import com.github.retrooper.packetevents.exception.PacketProcessException;
|
||||
import com.github.retrooper.packetevents.manager.server.ServerVersion;
|
||||
import com.github.retrooper.packetevents.netty.buffer.ByteBufHelper;
|
||||
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
|
||||
import com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon;
|
||||
import com.github.retrooper.packetevents.protocol.player.User;
|
||||
|
||||
public class PacketConfigReceiveEvent extends PacketReceiveEvent {
|
||||
|
||||
public PacketConfigReceiveEvent(Object channel, User user,
|
||||
Object player, Object rawByteBuf,
|
||||
boolean autoProtocolTranslation) throws PacketProcessException {
|
||||
super(channel, user, player, rawByteBuf, autoProtocolTranslation);
|
||||
}
|
||||
|
||||
protected PacketConfigReceiveEvent(int packetId, PacketTypeCommon packetType,
|
||||
ServerVersion serverVersion,
|
||||
Object channel,
|
||||
User user, Object player, Object byteBuf) throws PacketProcessException {
|
||||
super(packetId, packetType, serverVersion, channel, user, player, byteBuf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketConfigReceiveEvent clone() {
|
||||
try {
|
||||
Object clonedBuffer = ByteBufHelper.retainedDuplicate(getByteBuf());
|
||||
return new PacketConfigReceiveEvent(getPacketId(), getPacketType(), getServerVersion(),
|
||||
getChannel(), getUser(), getPlayer(), clonedBuffer);
|
||||
} catch (PacketProcessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public PacketType.Configuration.Client getPacketType() {
|
||||
return (PacketType.Configuration.Client) super.getPacketType();
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.event.simple;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketSendEvent;
|
||||
import com.github.retrooper.packetevents.exception.PacketProcessException;
|
||||
import com.github.retrooper.packetevents.manager.server.ServerVersion;
|
||||
import com.github.retrooper.packetevents.netty.buffer.ByteBufHelper;
|
||||
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
|
||||
import com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon;
|
||||
import com.github.retrooper.packetevents.protocol.player.User;
|
||||
|
||||
public class PacketConfigSendEvent extends PacketSendEvent {
|
||||
|
||||
public PacketConfigSendEvent(Object channel, User user,
|
||||
Object player, Object rawByteBuf,
|
||||
boolean autoProtocolTranslation) throws PacketProcessException {
|
||||
super(channel, user, player, rawByteBuf, autoProtocolTranslation);
|
||||
}
|
||||
|
||||
protected PacketConfigSendEvent(int packetId, PacketTypeCommon packetType,
|
||||
ServerVersion serverVersion,
|
||||
Object channel,
|
||||
User user, Object player, Object byteBuf) throws PacketProcessException {
|
||||
super(packetId, packetType, serverVersion, channel, user, player, byteBuf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketConfigSendEvent clone() {
|
||||
try {
|
||||
Object clonedBuffer = ByteBufHelper.retainedDuplicate(getByteBuf());
|
||||
return new PacketConfigSendEvent(getPacketId(), getPacketType(), getServerVersion(),
|
||||
getChannel(), getUser(), getPlayer(), clonedBuffer);
|
||||
} catch (PacketProcessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public PacketType.Configuration.Server getPacketType() {
|
||||
return (PacketType.Configuration.Server) super.getPacketType();
|
||||
}
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.event.simple;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
|
||||
import com.github.retrooper.packetevents.exception.PacketProcessException;
|
||||
import com.github.retrooper.packetevents.manager.server.ServerVersion;
|
||||
import com.github.retrooper.packetevents.netty.buffer.ByteBufHelper;
|
||||
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
|
||||
import com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon;
|
||||
import com.github.retrooper.packetevents.protocol.player.User;
|
||||
|
||||
public class PacketHandshakeReceiveEvent extends PacketReceiveEvent {
|
||||
public PacketHandshakeReceiveEvent(Object channel, User user,
|
||||
Object player, Object rawByteBuf,
|
||||
boolean autoProtocolTranslation) throws PacketProcessException {
|
||||
super(channel, user, player, rawByteBuf, autoProtocolTranslation);
|
||||
}
|
||||
|
||||
protected PacketHandshakeReceiveEvent(int packetId, PacketTypeCommon packetType,
|
||||
ServerVersion serverVersion,
|
||||
Object channel,
|
||||
User user, Object player, Object byteBuf) throws PacketProcessException {
|
||||
super(packetId, packetType, serverVersion, channel, user, player, byteBuf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketHandshakeReceiveEvent clone() {
|
||||
try {
|
||||
Object clonedBuffer = ByteBufHelper.retainedDuplicate(getByteBuf());
|
||||
return new PacketHandshakeReceiveEvent(getPacketId(), getPacketType(), getServerVersion(),
|
||||
getChannel(), getUser(), getPlayer(), clonedBuffer);
|
||||
} catch (PacketProcessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public PacketType.Handshaking.Client getPacketType() {
|
||||
return (PacketType.Handshaking.Client) super.getPacketType();
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package com.github.retrooper.packetevents.event.simple;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketSendEvent;
|
||||
import com.github.retrooper.packetevents.exception.PacketProcessException;
|
||||
import com.github.retrooper.packetevents.manager.server.ServerVersion;
|
||||
import com.github.retrooper.packetevents.netty.buffer.ByteBufHelper;
|
||||
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
|
||||
import com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon;
|
||||
import com.github.retrooper.packetevents.protocol.player.User;
|
||||
|
||||
public class PacketHandshakeSendEvent extends PacketSendEvent {
|
||||
public PacketHandshakeSendEvent(Object channel, User user,
|
||||
Object player, Object rawByteBuf,
|
||||
boolean autoProtocolTranslation) throws PacketProcessException {
|
||||
super(channel, user, player, rawByteBuf, autoProtocolTranslation);
|
||||
}
|
||||
|
||||
protected PacketHandshakeSendEvent(int packetId, PacketTypeCommon packetType,
|
||||
ServerVersion serverVersion,
|
||||
Object channel,
|
||||
User user, Object player, Object byteBuf) throws PacketProcessException {
|
||||
super(packetId, packetType, serverVersion, channel, user, player, byteBuf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketHandshakeSendEvent clone() {
|
||||
try {
|
||||
Object clonedBuffer = ByteBufHelper.retainedDuplicate(getByteBuf());
|
||||
return new PacketHandshakeSendEvent(getPacketId(), getPacketType(), getServerVersion(),
|
||||
getChannel(), getUser(), getPlayer(), clonedBuffer);
|
||||
} catch (PacketProcessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public PacketType.Handshaking.Client getPacketType() {
|
||||
return (PacketType.Handshaking.Client) super.getPacketType();
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.event.simple;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
|
||||
import com.github.retrooper.packetevents.exception.PacketProcessException;
|
||||
import com.github.retrooper.packetevents.manager.server.ServerVersion;
|
||||
import com.github.retrooper.packetevents.netty.buffer.ByteBufHelper;
|
||||
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
|
||||
import com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon;
|
||||
import com.github.retrooper.packetevents.protocol.player.User;
|
||||
|
||||
public class PacketLoginReceiveEvent extends PacketReceiveEvent {
|
||||
public PacketLoginReceiveEvent(Object channel, User user, Object player,
|
||||
Object rawByteBuf,
|
||||
boolean autoProtocolTranslation) throws PacketProcessException {
|
||||
super(channel, user, player, rawByteBuf, autoProtocolTranslation);
|
||||
}
|
||||
|
||||
protected PacketLoginReceiveEvent(int packetId, PacketTypeCommon packetType,
|
||||
ServerVersion serverVersion,
|
||||
Object channel,
|
||||
User user, Object player, Object byteBuf) throws PacketProcessException {
|
||||
super(packetId, packetType, serverVersion, channel, user, player, byteBuf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketLoginReceiveEvent clone() {
|
||||
try {
|
||||
Object clonedBuffer = ByteBufHelper.retainedDuplicate(getByteBuf());
|
||||
return new PacketLoginReceiveEvent(getPacketId(), getPacketType(), getServerVersion(),
|
||||
getChannel(), getUser(), getPlayer(), clonedBuffer);
|
||||
} catch (PacketProcessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public PacketType.Login.Client getPacketType() {
|
||||
return (PacketType.Login.Client) super.getPacketType();
|
||||
}
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.event.simple;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketSendEvent;
|
||||
import com.github.retrooper.packetevents.exception.PacketProcessException;
|
||||
import com.github.retrooper.packetevents.manager.server.ServerVersion;
|
||||
import com.github.retrooper.packetevents.netty.buffer.ByteBufHelper;
|
||||
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
|
||||
import com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon;
|
||||
import com.github.retrooper.packetevents.protocol.player.User;
|
||||
|
||||
public class PacketLoginSendEvent extends PacketSendEvent {
|
||||
public PacketLoginSendEvent(Object channel, User user, Object player, Object rawByteBuf,
|
||||
boolean autoProtocolTranslation) throws PacketProcessException {
|
||||
super(channel, user, player, rawByteBuf, autoProtocolTranslation);
|
||||
}
|
||||
|
||||
protected PacketLoginSendEvent(int packetId, PacketTypeCommon packetType,
|
||||
ServerVersion serverVersion,
|
||||
Object channel,
|
||||
User user, Object player, Object byteBuf) throws PacketProcessException {
|
||||
super(packetId, packetType, serverVersion, channel, user, player, byteBuf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketLoginSendEvent clone() {
|
||||
try {
|
||||
Object clonedBuffer = ByteBufHelper.retainedDuplicate(getByteBuf());
|
||||
return new PacketLoginSendEvent(getPacketId(), getPacketType(), getServerVersion(),
|
||||
getChannel(), getUser(), getPlayer(), clonedBuffer);
|
||||
} catch (PacketProcessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public PacketType.Login.Server getPacketType() {
|
||||
return (PacketType.Login.Server) super.getPacketType();
|
||||
}
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.event.simple;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
|
||||
import com.github.retrooper.packetevents.exception.PacketProcessException;
|
||||
import com.github.retrooper.packetevents.manager.server.ServerVersion;
|
||||
import com.github.retrooper.packetevents.netty.buffer.ByteBufHelper;
|
||||
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
|
||||
import com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon;
|
||||
import com.github.retrooper.packetevents.protocol.player.User;
|
||||
|
||||
public class PacketPlayReceiveEvent extends PacketReceiveEvent {
|
||||
public PacketPlayReceiveEvent(Object channel, User user,
|
||||
Object player, Object rawByteBuf,
|
||||
boolean autoProtocolTranslation) throws PacketProcessException {
|
||||
super(channel, user, player, rawByteBuf, autoProtocolTranslation);
|
||||
}
|
||||
|
||||
protected PacketPlayReceiveEvent(int packetId, PacketTypeCommon packetType,
|
||||
ServerVersion serverVersion,
|
||||
Object channel,
|
||||
User user, Object player, Object byteBuf) throws PacketProcessException {
|
||||
super(packetId, packetType, serverVersion, channel, user, player, byteBuf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketPlayReceiveEvent clone() {
|
||||
try {
|
||||
Object clonedBuffer = ByteBufHelper.retainedDuplicate(getByteBuf());
|
||||
return new PacketPlayReceiveEvent(getPacketId(), getPacketType(), getServerVersion(),
|
||||
getChannel(), getUser(), getPlayer(), clonedBuffer);
|
||||
} catch (PacketProcessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public PacketType.Play.Client getPacketType() {
|
||||
return (PacketType.Play.Client) super.getPacketType();
|
||||
}
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.event.simple;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketSendEvent;
|
||||
import com.github.retrooper.packetevents.exception.PacketProcessException;
|
||||
import com.github.retrooper.packetevents.manager.server.ServerVersion;
|
||||
import com.github.retrooper.packetevents.netty.buffer.ByteBufHelper;
|
||||
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
|
||||
import com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon;
|
||||
import com.github.retrooper.packetevents.protocol.player.User;
|
||||
|
||||
public class PacketPlaySendEvent extends PacketSendEvent {
|
||||
public PacketPlaySendEvent(Object channel, User user,
|
||||
Object player, Object rawByteBuf,
|
||||
boolean autoProtocolTranslation) throws PacketProcessException {
|
||||
super(channel, user, player, rawByteBuf, autoProtocolTranslation);
|
||||
}
|
||||
|
||||
protected PacketPlaySendEvent(int packetId, PacketTypeCommon packetType,
|
||||
ServerVersion serverVersion,
|
||||
Object channel,
|
||||
User user, Object player, Object byteBuf) throws PacketProcessException {
|
||||
super(packetId, packetType, serverVersion, channel, user, player, byteBuf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketPlaySendEvent clone() {
|
||||
try {
|
||||
Object clonedBuffer = ByteBufHelper.retainedDuplicate(getByteBuf());
|
||||
return new PacketPlaySendEvent(getPacketId(), getPacketType(), getServerVersion(),
|
||||
getChannel(), getUser(), getPlayer(), clonedBuffer);
|
||||
} catch (PacketProcessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public PacketType.Play.Server getPacketType() {
|
||||
return (PacketType.Play.Server) super.getPacketType();
|
||||
}
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.event.simple;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
|
||||
import com.github.retrooper.packetevents.exception.PacketProcessException;
|
||||
import com.github.retrooper.packetevents.manager.server.ServerVersion;
|
||||
import com.github.retrooper.packetevents.netty.buffer.ByteBufHelper;
|
||||
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
|
||||
import com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon;
|
||||
import com.github.retrooper.packetevents.protocol.player.User;
|
||||
|
||||
public class PacketStatusReceiveEvent extends PacketReceiveEvent {
|
||||
public PacketStatusReceiveEvent(Object channel, User user,
|
||||
Object player, Object rawByteBuf,
|
||||
boolean autoProtocolTranslation) throws PacketProcessException {
|
||||
super(channel, user, player, rawByteBuf, autoProtocolTranslation);
|
||||
}
|
||||
|
||||
protected PacketStatusReceiveEvent(int packetId, PacketTypeCommon packetType,
|
||||
ServerVersion serverVersion,
|
||||
Object channel,
|
||||
User user, Object player, Object byteBuf) throws PacketProcessException {
|
||||
super(packetId, packetType, serverVersion, channel, user, player, byteBuf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketStatusReceiveEvent clone() {
|
||||
try {
|
||||
Object clonedBuffer = ByteBufHelper.retainedDuplicate(getByteBuf());
|
||||
return new PacketStatusReceiveEvent(getPacketId(), getPacketType(), getServerVersion(),
|
||||
getChannel(), getUser(), getPlayer(), clonedBuffer);
|
||||
} catch (PacketProcessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public PacketType.Status.Client getPacketType() {
|
||||
return (PacketType.Status.Client) super.getPacketType();
|
||||
}
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.event.simple;
|
||||
|
||||
import com.github.retrooper.packetevents.event.PacketSendEvent;
|
||||
import com.github.retrooper.packetevents.exception.PacketProcessException;
|
||||
import com.github.retrooper.packetevents.manager.server.ServerVersion;
|
||||
import com.github.retrooper.packetevents.netty.buffer.ByteBufHelper;
|
||||
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
|
||||
import com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon;
|
||||
import com.github.retrooper.packetevents.protocol.player.User;
|
||||
|
||||
public class PacketStatusSendEvent extends PacketSendEvent {
|
||||
public PacketStatusSendEvent(Object channel, User user, Object player, Object rawByteBuf,
|
||||
boolean autoProtocolTranslation) throws PacketProcessException {
|
||||
super(channel, user, player, rawByteBuf, autoProtocolTranslation);
|
||||
}
|
||||
|
||||
protected PacketStatusSendEvent(int packetId, PacketTypeCommon packetType,
|
||||
ServerVersion serverVersion,
|
||||
Object channel,
|
||||
User user, Object player, Object byteBuf) throws PacketProcessException {
|
||||
super(packetId, packetType, serverVersion, channel, user, player, byteBuf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketStatusSendEvent clone() {
|
||||
try {
|
||||
Object clonedBuffer = ByteBufHelper.retainedDuplicate(getByteBuf());
|
||||
return new PacketStatusSendEvent(getPacketId(), getPacketType(), getServerVersion(),
|
||||
getChannel(), getUser(), getPlayer(), clonedBuffer);
|
||||
} catch (PacketProcessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public PacketType.Status.Server getPacketType() {
|
||||
return (PacketType.Status.Server) super.getPacketType();
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package com.github.retrooper.packetevents.exception;
|
||||
|
||||
public class CancelPacketException extends RuntimeException {
|
||||
public static final CancelPacketException INSTANCE = new CancelPacketException();
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package com.github.retrooper.packetevents.exception;
|
||||
|
||||
public class InvalidDisconnectPacketSend extends RuntimeException {
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package com.github.retrooper.packetevents.exception;
|
||||
|
||||
public class InvalidHandshakeException extends RuntimeException {
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.exception;
|
||||
|
||||
public class PacketProcessException extends RuntimeException {
|
||||
public PacketProcessException(String msg, Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
|
||||
public PacketProcessException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public PacketProcessException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
||||
+8
-14
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 retrooper and contributors
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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
|
||||
@@ -16,28 +16,22 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.github.retrooper.packetevents.injector;
|
||||
package com.github.retrooper.packetevents.injector;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import com.github.retrooper.packetevents.protocol.player.User;
|
||||
|
||||
public interface ChannelInjector {
|
||||
default boolean isBound() {
|
||||
default boolean isServerBound() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void inject();
|
||||
|
||||
void eject();
|
||||
void uninject();
|
||||
|
||||
void injectPlayer(Player player);
|
||||
void updateUser(Object channel, User user);
|
||||
|
||||
void ejectPlayer(Player player);
|
||||
void setPlayer(Object channel, Object player);
|
||||
|
||||
boolean hasInjected(Player player);
|
||||
|
||||
void writePacket(Object channel, Object rawNMSPacket);
|
||||
|
||||
void flushPackets(Object channel);
|
||||
|
||||
void sendPacket(Object channel, Object rawNMSPacket);
|
||||
boolean isProxy();
|
||||
}
|
||||
+170
@@ -0,0 +1,170 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.manager;
|
||||
|
||||
import com.github.retrooper.packetevents.PacketEvents;
|
||||
import com.github.retrooper.packetevents.event.PacketListenerAbstract;
|
||||
import com.github.retrooper.packetevents.event.PacketListenerPriority;
|
||||
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
|
||||
import com.github.retrooper.packetevents.event.PacketSendEvent;
|
||||
import com.github.retrooper.packetevents.manager.protocol.ProtocolManager;
|
||||
import com.github.retrooper.packetevents.manager.server.ServerVersion;
|
||||
import com.github.retrooper.packetevents.protocol.ConnectionState;
|
||||
import com.github.retrooper.packetevents.protocol.nbt.NBTCompound;
|
||||
import com.github.retrooper.packetevents.protocol.nbt.NBTList;
|
||||
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
|
||||
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
|
||||
import com.github.retrooper.packetevents.protocol.player.User;
|
||||
import com.github.retrooper.packetevents.protocol.player.UserProfile;
|
||||
import com.github.retrooper.packetevents.wrapper.configuration.server.WrapperConfigServerRegistryData;
|
||||
import com.github.retrooper.packetevents.wrapper.handshaking.client.WrapperHandshakingClientHandshake;
|
||||
import com.github.retrooper.packetevents.wrapper.login.server.WrapperLoginServerLoginSuccess;
|
||||
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerJoinGame;
|
||||
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerRespawn;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
public class InternalPacketListener extends PacketListenerAbstract {
|
||||
|
||||
public InternalPacketListener() {
|
||||
this(PacketListenerPriority.LOWEST);
|
||||
}
|
||||
|
||||
public InternalPacketListener(PacketListenerPriority priority) {
|
||||
super(priority);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacketSend(PacketSendEvent event) {
|
||||
User user = event.getUser();
|
||||
if (event.getPacketType() == PacketType.Login.Server.LOGIN_SUCCESS) {
|
||||
Object channel = event.getChannel();
|
||||
//Process outgoing login success packet
|
||||
WrapperLoginServerLoginSuccess loginSuccess = new WrapperLoginServerLoginSuccess(event);
|
||||
UserProfile profile = loginSuccess.getUserProfile();
|
||||
|
||||
//Update user profile
|
||||
user.getProfile().setUUID(profile.getUUID());
|
||||
user.getProfile().setName(profile.getName());
|
||||
//Texture properties are passed in login success on 1.19
|
||||
user.getProfile().setTextureProperties(profile.getTextureProperties());
|
||||
|
||||
//Map username with channel
|
||||
synchronized (channel) {
|
||||
ProtocolManager.CHANNELS.put(profile.getUUID(), channel);
|
||||
}
|
||||
|
||||
PacketEvents.getAPI().getLogManager().debug("Mapped player UUID with their channel.");
|
||||
|
||||
// Switch the user's connection state to new state, but the variable event.getConnectionState() remains LOGIN
|
||||
// We switch user state immediately to remain in sync with vanilla, allowing you to encode packets immediately
|
||||
boolean proxy = PacketEvents.getAPI().getInjector().isProxy();
|
||||
if (proxy ? event.getUser().getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_20_2)
|
||||
: event.getServerVersion().isNewerThanOrEquals(ServerVersion.V_1_20_2)) {
|
||||
user.setEncoderState(ConnectionState.CONFIGURATION);
|
||||
} else {
|
||||
user.setConnectionState(ConnectionState.PLAY);
|
||||
}
|
||||
}
|
||||
|
||||
// The server sends dimension information in configuration phase >= 1.20.2
|
||||
else if (event.getPacketType() == PacketType.Configuration.Server.REGISTRY_DATA) {
|
||||
WrapperConfigServerRegistryData registryData = new WrapperConfigServerRegistryData(event);
|
||||
|
||||
// Store world data
|
||||
NBTCompound registryDataTag = registryData.getRegistryData();
|
||||
if (registryDataTag != null) {
|
||||
NBTList<NBTCompound> list = registryDataTag
|
||||
.getCompoundTagOrNull("minecraft:dimension_type")
|
||||
.getCompoundListTagOrNull("value");
|
||||
user.setWorldNBT(list);
|
||||
}
|
||||
}
|
||||
|
||||
// The server sends dimension information in login packet for >= 1.17 and < 1.20.2
|
||||
else if (event.getPacketType() == PacketType.Play.Server.JOIN_GAME) {
|
||||
WrapperPlayServerJoinGame joinGame = new WrapperPlayServerJoinGame(event);
|
||||
user.setEntityId(joinGame.getEntityId());
|
||||
user.setDimension(joinGame.getDimension());
|
||||
if (event.getServerVersion().isOlderThanOrEquals(ServerVersion.V_1_16_5)) {
|
||||
return; // Fixed world height, no tags are sent to the client
|
||||
}
|
||||
|
||||
// Store world data
|
||||
NBTCompound dimensionCodec = joinGame.getDimensionCodec();
|
||||
if (dimensionCodec != null) {
|
||||
NBTList<NBTCompound> list = dimensionCodec
|
||||
.getCompoundTagOrNull("minecraft:dimension_type")
|
||||
.getCompoundListTagOrNull("value");
|
||||
user.setWorldNBT(list);
|
||||
}
|
||||
|
||||
// Update world height
|
||||
NBTCompound dimension = user.getWorldNBT(joinGame.getDimension().getDimensionName());
|
||||
if (dimension != null) {
|
||||
NBTCompound worldNBT = dimension.getCompoundTagOrNull("element");
|
||||
user.setMinWorldHeight(worldNBT.getNumberTagOrNull("min_y").getAsInt());
|
||||
user.setTotalWorldHeight(worldNBT.getNumberTagOrNull("height").getAsInt());
|
||||
}
|
||||
}
|
||||
|
||||
// Respawn is used to switch dimensions
|
||||
else if (event.getPacketType() == PacketType.Play.Server.RESPAWN) {
|
||||
WrapperPlayServerRespawn respawn = new WrapperPlayServerRespawn(event);
|
||||
user.setDimension(respawn.getDimension());
|
||||
if (event.getServerVersion().isOlderThanOrEquals(ServerVersion.V_1_16_5)) {
|
||||
return; // Fixed world height, no tags are sent to the client
|
||||
}
|
||||
|
||||
NBTCompound dimension = user.getWorldNBT(respawn.getDimension().getDimensionName());
|
||||
if (dimension != null) {
|
||||
NBTCompound worldNBT = dimension.getCompoundTagOrNull("element"); // This is 1.17+, it always sends the world name
|
||||
user.setMinWorldHeight(worldNBT.getNumberTagOrNull("min_y").getAsInt());
|
||||
user.setTotalWorldHeight(worldNBT.getNumberTagOrNull("height").getAsInt());
|
||||
}
|
||||
} else if (event.getPacketType() == PacketType.Play.Server.CONFIGURATION_START) {
|
||||
user.setEncoderState(ConnectionState.CONFIGURATION);
|
||||
} else if (event.getPacketType() == PacketType.Configuration.Server.CONFIGURATION_END) {
|
||||
user.setEncoderState(ConnectionState.PLAY);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacketReceive(PacketReceiveEvent event) {
|
||||
User user = event.getUser();
|
||||
if (event.getPacketType() == PacketType.Handshaking.Client.HANDSHAKE) {
|
||||
Object channel = event.getChannel();
|
||||
InetSocketAddress address = event.getSocketAddress();
|
||||
WrapperHandshakingClientHandshake handshake = new WrapperHandshakingClientHandshake(event);
|
||||
ConnectionState nextState = handshake.getNextConnectionState();
|
||||
ClientVersion clientVersion = handshake.getClientVersion();
|
||||
//Update client version for this event call(and user)
|
||||
user.setClientVersion(clientVersion);
|
||||
PacketEvents.getAPI().getLogManager().debug("Processed " + address.getHostString() + ":" + address.getPort() + "'s client version. Client Version: " + clientVersion.getReleaseName());
|
||||
//Transition into LOGIN or STATUS connection state immediately, to remain in sync with vanilla
|
||||
user.setConnectionState(nextState);
|
||||
} else if (event.getPacketType() == PacketType.Login.Client.LOGIN_SUCCESS_ACK) {
|
||||
user.setDecoderState(ConnectionState.CONFIGURATION);
|
||||
} else if (event.getPacketType() == PacketType.Play.Client.CONFIGURATION_ACK) {
|
||||
user.setDecoderState(ConnectionState.CONFIGURATION);
|
||||
} else if (event.getPacketType() == PacketType.Configuration.Client.CONFIGURATION_END_ACK) {
|
||||
user.setDecoderState(ConnectionState.PLAY);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.manager.player;
|
||||
|
||||
import com.github.retrooper.packetevents.PacketEvents;
|
||||
import com.github.retrooper.packetevents.protocol.ConnectionState;
|
||||
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
|
||||
import com.github.retrooper.packetevents.protocol.player.User;
|
||||
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface PlayerManager {
|
||||
int getPing(@NotNull Object player);
|
||||
|
||||
@NotNull ClientVersion getClientVersion(@NotNull Object player);
|
||||
|
||||
Object getChannel(@NotNull Object player);
|
||||
|
||||
User getUser(@NotNull Object player);
|
||||
|
||||
default ConnectionState getConnectionState(@NotNull Object player) {
|
||||
return getUser(player).getConnectionState();
|
||||
}
|
||||
|
||||
default void sendPacket(@NotNull Object player, @NotNull Object byteBuf) {
|
||||
PacketEvents.getAPI().getProtocolManager().sendPacket(getChannel(player), byteBuf);
|
||||
}
|
||||
default void sendPacket(@NotNull Object player, @NotNull PacketWrapper<?> wrapper) {
|
||||
PacketEvents.getAPI().getProtocolManager().sendPacket(getChannel(player), wrapper);
|
||||
}
|
||||
|
||||
default void sendPacketSilently(@NotNull Object player, @NotNull Object byteBuf) {
|
||||
PacketEvents.getAPI().getProtocolManager().sendPacketSilently(getChannel(player), byteBuf);
|
||||
}
|
||||
|
||||
default void sendPacketSilently(@NotNull Object player, @NotNull PacketWrapper<?> wrapper) {
|
||||
PacketEvents.getAPI().getProtocolManager().sendPacketSilently(getChannel(player), wrapper);
|
||||
}
|
||||
|
||||
default void writePacket(@NotNull Object player, @NotNull Object byteBuf) {
|
||||
PacketEvents.getAPI().getProtocolManager().writePacket(getChannel(player), byteBuf);
|
||||
}
|
||||
|
||||
default void writePacket(@NotNull Object player, @NotNull PacketWrapper<?> wrapper) {
|
||||
PacketEvents.getAPI().getProtocolManager().writePacket(getChannel(player), wrapper);
|
||||
}
|
||||
|
||||
default void writePacketSilently(@NotNull Object player, @NotNull Object byteBuf) {
|
||||
PacketEvents.getAPI().getProtocolManager().writePacketSilently(getChannel(player), byteBuf);
|
||||
}
|
||||
|
||||
default void writePacketSilently(@NotNull Object player, @NotNull PacketWrapper<?> wrapper) {
|
||||
PacketEvents.getAPI().getProtocolManager().writePacketSilently(getChannel(player), wrapper);
|
||||
}
|
||||
|
||||
default void receivePacket(Object player, Object byteBuf) {
|
||||
PacketEvents.getAPI().getProtocolManager().receivePacket(getChannel(player), byteBuf);
|
||||
}
|
||||
|
||||
default void receivePacket(Object player, PacketWrapper<?> wrapper) {
|
||||
PacketEvents.getAPI().getProtocolManager().receivePacket(getChannel(player), wrapper);
|
||||
}
|
||||
|
||||
default void receivePacketSilently(Object player, Object byteBuf) {
|
||||
PacketEvents.getAPI().getProtocolManager().receivePacketSilently(getChannel(player), byteBuf);
|
||||
}
|
||||
|
||||
default void receivePacketSilently(Object player, PacketWrapper<?> wrapper) {
|
||||
PacketEvents.getAPI().getProtocolManager().receivePacketSilently(getChannel(player), wrapper);
|
||||
}
|
||||
}
|
||||
+166
@@ -0,0 +1,166 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.manager.protocol;
|
||||
|
||||
import com.github.retrooper.packetevents.PacketEvents;
|
||||
import com.github.retrooper.packetevents.netty.channel.ChannelHelper;
|
||||
import com.github.retrooper.packetevents.protocol.ProtocolVersion;
|
||||
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
|
||||
import com.github.retrooper.packetevents.protocol.player.User;
|
||||
import com.github.retrooper.packetevents.util.PacketTransformationUtil;
|
||||
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public interface ProtocolManager {
|
||||
Map<UUID, Object> CHANNELS = new ConcurrentHashMap<>();
|
||||
// Use SocketAddress because ProtocolLib wraps Channels with NettyChannelProxy class
|
||||
Map<Object, User> USERS = new ConcurrentHashMap<>();
|
||||
|
||||
default Collection<User> getUsers() {
|
||||
return USERS.values();
|
||||
}
|
||||
|
||||
default Collection<Object> getChannels() {
|
||||
return CHANNELS.values();
|
||||
}
|
||||
|
||||
//Methods to implement
|
||||
ProtocolVersion getPlatformVersion();
|
||||
void sendPacket(Object channel, Object byteBuf);
|
||||
void sendPacketSilently(Object channel, Object byteBuf);
|
||||
void writePacket(Object channel, Object byteBuf);
|
||||
void writePacketSilently(Object channel, Object byteBuf);
|
||||
void receivePacket(Object channel, Object byteBuf);
|
||||
void receivePacketSilently(Object channel, Object byteBuf);
|
||||
ClientVersion getClientVersion(Object channel);
|
||||
//TODO Define method that accepts an array of channels/set/list of channels.
|
||||
|
||||
default void sendPackets(Object channel, Object... byteBuf) {
|
||||
for (Object buf : byteBuf) {
|
||||
sendPacket(channel, buf);
|
||||
}
|
||||
}
|
||||
|
||||
default void sendPacketsSilently(Object channel, Object... byteBuf) {
|
||||
for (Object buf : byteBuf) {
|
||||
sendPacketSilently(channel, buf);
|
||||
}
|
||||
}
|
||||
|
||||
default void writePackets(Object channel, Object... byteBuf) {
|
||||
for (Object buf : byteBuf) {
|
||||
writePacket(channel, buf);
|
||||
}
|
||||
}
|
||||
|
||||
default void writePacketsSilently(Object channel, Object... byteBuf) {
|
||||
for (Object buf : byteBuf) {
|
||||
writePacketSilently(channel, buf);
|
||||
}
|
||||
}
|
||||
|
||||
default void receivePackets(Object channel, Object... byteBuf) {
|
||||
for (Object buf : byteBuf) {
|
||||
receivePacket(channel, buf);
|
||||
}
|
||||
}
|
||||
|
||||
default void receivePacketsSilently(Object channel, Object... byteBuf) {
|
||||
for (Object buf : byteBuf) {
|
||||
receivePacketSilently(channel, buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
default void setClientVersion(Object channel, ClientVersion version) {
|
||||
getUser(channel).setClientVersion(version);
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
default Object[] transformWrappers(PacketWrapper<?> wrapper, Object channel, boolean outgoing) {
|
||||
//It is possible that our packet transformer util decides to transform one wrapper into multiple packets.
|
||||
//(Correcting some mistakes on your end)
|
||||
PacketWrapper<?>[] wrappers = PacketTransformationUtil.transform(wrapper);
|
||||
Object[] buffers = new Object[wrappers.length];
|
||||
for (int i = 0; i < wrappers.length; i++) {
|
||||
wrappers[i].prepareForSend(channel, outgoing);
|
||||
buffers[i] = wrappers[i].buffer;
|
||||
// Fix race condition when sending packets to multiple people (due to when the buffer is freed)
|
||||
wrappers[i].buffer = null;
|
||||
}
|
||||
return buffers;
|
||||
}
|
||||
|
||||
default void sendPacket(Object channel, PacketWrapper<?> wrapper) {
|
||||
Object[] transformed = transformWrappers(wrapper, channel, true);
|
||||
sendPackets(channel, transformed);
|
||||
}
|
||||
|
||||
default void sendPacketSilently(Object channel, PacketWrapper<?> wrapper) {
|
||||
Object[] transformed = transformWrappers(wrapper, channel, true);
|
||||
sendPacketsSilently(channel, transformed);
|
||||
}
|
||||
|
||||
default void writePacket(Object channel, PacketWrapper<?> wrapper) {
|
||||
Object[] transformed = transformWrappers(wrapper, channel, true);
|
||||
writePackets(channel, transformed);
|
||||
}
|
||||
|
||||
default void writePacketSilently(Object channel, PacketWrapper<?> wrapper) {
|
||||
Object[] transformed = transformWrappers(wrapper, channel, true);
|
||||
writePacketsSilently(channel, transformed);
|
||||
}
|
||||
|
||||
default void receivePacket(Object channel, PacketWrapper<?> wrapper) {
|
||||
Object[] transformed = transformWrappers(wrapper, channel, false);
|
||||
receivePackets(channel, transformed);
|
||||
}
|
||||
|
||||
default void receivePacketSilently(Object channel, PacketWrapper<?> wrapper) {
|
||||
Object[] transformed = transformWrappers(wrapper, channel, false);
|
||||
receivePacketsSilently(channel, transformed);
|
||||
}
|
||||
|
||||
default User getUser(Object channel) {
|
||||
Object pipeline = ChannelHelper.getPipeline(channel);
|
||||
return USERS.get(pipeline);
|
||||
}
|
||||
|
||||
default User removeUser(Object channel) {
|
||||
Object pipeline = ChannelHelper.getPipeline(channel);
|
||||
return USERS.remove(pipeline);
|
||||
}
|
||||
|
||||
default void setUser(Object channel, User user) {
|
||||
synchronized (channel) {
|
||||
Object pipeline = ChannelHelper.getPipeline(channel);
|
||||
USERS.put(pipeline, user);
|
||||
}
|
||||
PacketEvents.getAPI().getInjector().updateUser(channel, user);
|
||||
}
|
||||
|
||||
default Object getChannel(UUID uuid) {
|
||||
return CHANNELS.get(uuid);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.manager.server;
|
||||
|
||||
public interface ServerManager {
|
||||
/**
|
||||
* Get the server version.
|
||||
*
|
||||
* @return Get Server Version
|
||||
*/
|
||||
ServerVersion getVersion();
|
||||
|
||||
/**
|
||||
* Get the operating system of the local machine
|
||||
*
|
||||
* @return Get Operating System
|
||||
*/
|
||||
default SystemOS getOS() {
|
||||
return SystemOS.getOS();
|
||||
}
|
||||
}
|
||||
+214
@@ -0,0 +1,214 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.manager.server;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Server Version.
|
||||
* This is a nice wrapper over minecraft's protocol versions.
|
||||
* You won't have to memorize the protocol version, just memorize the server version you see in the launcher.
|
||||
*
|
||||
* @author retrooper
|
||||
* @see <a href="https://wiki.vg/Protocol_version_numbers">https://wiki.vg/Protocol_version_numbers</a>
|
||||
* @since 1.6.9
|
||||
*/
|
||||
public enum ServerVersion {
|
||||
//TODO Rename to MinecraftVersion?
|
||||
V_1_7_10(5),
|
||||
V_1_8(47), V_1_8_3(47), V_1_8_8(47),
|
||||
V_1_9(107), V_1_9_2(109), V_1_9_4(110),
|
||||
//1.10 and 1.10.1 are redundant
|
||||
V_1_10(210), V_1_10_1(210), V_1_10_2(210),
|
||||
V_1_11(315), V_1_11_2(316),
|
||||
V_1_12(335), V_1_12_1(338), V_1_12_2(340),
|
||||
V_1_13(393), V_1_13_1(401), V_1_13_2(404),
|
||||
V_1_14(477), V_1_14_1(480), V_1_14_2(485), V_1_14_3(490), V_1_14_4(498),
|
||||
V_1_15(573), V_1_15_1(575), V_1_15_2(578),
|
||||
V_1_16(735), V_1_16_1(736), V_1_16_2(751), V_1_16_3(753), V_1_16_4(754), V_1_16_5(754),
|
||||
V_1_17(755), V_1_17_1(756),
|
||||
V_1_18(757), V_1_18_1(757), V_1_18_2(758),
|
||||
//1.19.1 and 1.19.2 have the same protocol version
|
||||
V_1_19(759), V_1_19_1(760), V_1_19_2(760), V_1_19_3(761), V_1_19_4(762),
|
||||
//1.20 and 1.20.1 have the same protocol version. 1.20.3 and 1.20.4 have the same protocol version.
|
||||
V_1_20(763), V_1_20_1(763), V_1_20_2(764), V_1_20_3(765), V_1_20_4(765),
|
||||
//TODO UPDATE Add server version constant
|
||||
ERROR(-1, true);
|
||||
|
||||
private static final ServerVersion[] VALUES = values();
|
||||
private static final ServerVersion[] REVERSED_VALUES;
|
||||
|
||||
static {
|
||||
REVERSED_VALUES = values();
|
||||
int i = 0;
|
||||
int j = REVERSED_VALUES.length - 1;
|
||||
ServerVersion tmp;
|
||||
while (j > i) {
|
||||
tmp = REVERSED_VALUES[j];
|
||||
REVERSED_VALUES[j--] = REVERSED_VALUES[i];
|
||||
REVERSED_VALUES[i++] = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
private final int protocolVersion;
|
||||
private final String name;
|
||||
private ClientVersion toClientVersion;
|
||||
|
||||
ServerVersion(int protocolVersion) {
|
||||
this.protocolVersion = protocolVersion;
|
||||
this.name = name().substring(2).replace("_", ".");
|
||||
}
|
||||
|
||||
ServerVersion(int protocolVersion, boolean isNotRelease) {
|
||||
this.protocolVersion = protocolVersion;
|
||||
if (isNotRelease) {
|
||||
this.name = name();
|
||||
} else {
|
||||
this.name = name().substring(2).replace("_", ".");
|
||||
}
|
||||
}
|
||||
|
||||
public static ServerVersion[] reversedValues() {
|
||||
return REVERSED_VALUES;
|
||||
}
|
||||
|
||||
public static ServerVersion getLatest() {
|
||||
return REVERSED_VALUES[1];
|
||||
}
|
||||
|
||||
public static ServerVersion getOldest() {
|
||||
return VALUES[0];
|
||||
}
|
||||
|
||||
//TODO Optimize
|
||||
@Deprecated
|
||||
public static ServerVersion getById(int protocolVersion) {
|
||||
for (ServerVersion version : VALUES) {
|
||||
if (version.protocolVersion == protocolVersion) {
|
||||
return version;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ClientVersion toClientVersion() {
|
||||
if (toClientVersion == null) {
|
||||
toClientVersion = ClientVersion.getById(protocolVersion);
|
||||
}
|
||||
return toClientVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the release name of this server version.
|
||||
* For example, for the V_1_18 enum constant, it would return "1.18".
|
||||
*
|
||||
* @return Release name
|
||||
*/
|
||||
public String getReleaseName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this server version's protocol version.
|
||||
*
|
||||
* @return Protocol version.
|
||||
*/
|
||||
public int getProtocolVersion() {
|
||||
return protocolVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this server version newer than the compared server version?
|
||||
* This method simply checks if this server version's protocol version is greater than
|
||||
* the compared server version's protocol version.
|
||||
*
|
||||
* @param target Compared server version.
|
||||
* @return Is this server version newer than the compared server version.
|
||||
*/
|
||||
public boolean isNewerThan(ServerVersion target) {
|
||||
return this.ordinal() > target.ordinal();
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this server version older than the compared server version?
|
||||
* This method simply checks if this server version's protocol version is less than
|
||||
* the compared server version's protocol version.
|
||||
*
|
||||
* @param target Compared server version.
|
||||
* @return Is this server version older than the compared server version.
|
||||
*/
|
||||
public boolean isOlderThan(ServerVersion target) {
|
||||
return this.ordinal() < target.ordinal();
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this server version newer than or equal to the compared server version?
|
||||
* This method simply checks if this server version's protocol version is greater than or equal to
|
||||
* the compared server version's protocol version.
|
||||
*
|
||||
* @param target Compared server version.
|
||||
* @return Is this server version newer than or equal to the compared server version.
|
||||
*/
|
||||
public boolean isNewerThanOrEquals(ServerVersion target) {
|
||||
return this.ordinal() >= target.ordinal();
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this server version older than or equal to the compared server version?
|
||||
* This method simply checks if this server version's protocol version is older than or equal to
|
||||
* the compared server version's protocol version.
|
||||
*
|
||||
* @param target Compared server version.
|
||||
* @return Is this server version older than or equal to the compared server version.
|
||||
*/
|
||||
public boolean isOlderThanOrEquals(ServerVersion target) {
|
||||
return this.ordinal() <= target.ordinal();
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this server version newer than, older than or equal to the compared server version?
|
||||
* This method simply checks if this server version's protocol version is greater than, less than or equal to
|
||||
* the compared server version's protocol version.
|
||||
*
|
||||
* @param comparison Comparison type.
|
||||
* @param targetVersion Compared server version.
|
||||
* @return true or false, based on the comparison type.
|
||||
* @see #isNewerThan(ServerVersion)
|
||||
* @see #isNewerThanOrEquals(ServerVersion)
|
||||
* @see #isOlderThan(ServerVersion)
|
||||
* @see #isOlderThanOrEquals(ServerVersion)
|
||||
*/
|
||||
public boolean is(@NotNull VersionComparison comparison, @NotNull ServerVersion targetVersion) {
|
||||
switch (comparison) {
|
||||
case EQUALS:
|
||||
return protocolVersion == targetVersion.protocolVersion;
|
||||
case NEWER_THAN:
|
||||
return isNewerThan(targetVersion);
|
||||
case NEWER_THAN_OR_EQUALS:
|
||||
return isNewerThanOrEquals(targetVersion);
|
||||
case OLDER_THAN:
|
||||
return isOlderThan(targetVersion);
|
||||
case OLDER_THAN_OR_EQUALS:
|
||||
return isOlderThanOrEquals(targetVersion);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
-21
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 retrooper and contributors
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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
|
||||
@@ -16,7 +16,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.github.retrooper.packetevents.utils.server;
|
||||
package com.github.retrooper.packetevents.manager.server;
|
||||
|
||||
/**
|
||||
* System Operating system.
|
||||
@@ -27,9 +27,7 @@ package io.github.retrooper.packetevents.utils.server;
|
||||
public enum SystemOS {
|
||||
|
||||
WINDOWS, MACOS, LINUX, OTHER;
|
||||
|
||||
private static final SystemOS[] VALUES = values();
|
||||
private static SystemOS value;
|
||||
private static SystemOS CACHE;
|
||||
|
||||
/**
|
||||
* Get the server's operating system.
|
||||
@@ -39,7 +37,7 @@ public enum SystemOS {
|
||||
*/
|
||||
public static SystemOS getOSNoCache() {
|
||||
final String os = System.getProperty("os.name").toLowerCase();
|
||||
for (SystemOS sysos : VALUES) {
|
||||
for (SystemOS sysos : values()) {
|
||||
if (os.contains(sysos.name().toLowerCase())) {
|
||||
return sysos;
|
||||
}
|
||||
@@ -54,22 +52,10 @@ public enum SystemOS {
|
||||
* @return Operating System.
|
||||
*/
|
||||
public static SystemOS getOS() {
|
||||
if (value == null) {
|
||||
value = getOSNoCache();
|
||||
if (CACHE == null) {
|
||||
CACHE = getOSNoCache();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the server's operating system.
|
||||
* This method will CACHE for you.
|
||||
*
|
||||
* @return Operating System.
|
||||
* @deprecated Use {@link #getOS()}, method renamed.
|
||||
*/
|
||||
@Deprecated
|
||||
public static SystemOS getOperatingSystem() {
|
||||
return getOS();
|
||||
return CACHE;
|
||||
}
|
||||
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.manager.server;
|
||||
|
||||
/**
|
||||
* This enum contains all possible comparison types for server versions.
|
||||
*/
|
||||
public enum VersionComparison {
|
||||
/*
|
||||
The server version equals the compared server version.
|
||||
*/
|
||||
EQUALS,
|
||||
/*
|
||||
The server version is newer than the compared server version.
|
||||
*/
|
||||
NEWER_THAN,
|
||||
/*
|
||||
The server version is newer than or equal to the compared server version.
|
||||
*/
|
||||
NEWER_THAN_OR_EQUALS,
|
||||
/*
|
||||
The server version is older than the compared server version.
|
||||
*/
|
||||
OLDER_THAN,
|
||||
/*
|
||||
The server version is older than or equal to the compared server version.
|
||||
*/
|
||||
OLDER_THAN_OR_EQUALS;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.netty;
|
||||
|
||||
import com.github.retrooper.packetevents.netty.buffer.ByteBufAllocationOperator;
|
||||
import com.github.retrooper.packetevents.netty.buffer.ByteBufOperator;
|
||||
import com.github.retrooper.packetevents.netty.channel.ChannelOperator;
|
||||
|
||||
public interface NettyManager {
|
||||
ChannelOperator getChannelOperator();
|
||||
|
||||
ByteBufOperator getByteBufOperator();
|
||||
|
||||
ByteBufAllocationOperator getByteBufAllocationOperator();
|
||||
}
|
||||
+10
-6
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 retrooper and contributors
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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
|
||||
@@ -16,12 +16,16 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.github.retrooper.packetevents.utils.immutableset;
|
||||
package com.github.retrooper.packetevents.netty.buffer;
|
||||
|
||||
abstract class ImmutableSetAbstract<T> {
|
||||
public abstract boolean contains(T element);
|
||||
public interface ByteBufAllocationOperator {
|
||||
Object wrappedBuffer(byte[] bytes);
|
||||
|
||||
public abstract void add(T element);
|
||||
Object copiedBuffer(byte[] bytes);
|
||||
|
||||
public abstract void addAll(T... element);
|
||||
Object buffer();
|
||||
|
||||
Object directBuffer();
|
||||
|
||||
Object compositeBuffer();
|
||||
}
|
||||
@@ -0,0 +1,265 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.netty.buffer;
|
||||
|
||||
import com.github.retrooper.packetevents.PacketEvents;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
public class ByteBufHelper {
|
||||
public static int capacity(Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().capacity(buffer);
|
||||
}
|
||||
|
||||
public static Object capacity(Object buffer, int capacity) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().capacity(buffer, capacity);
|
||||
}
|
||||
|
||||
public static int readerIndex(Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().readerIndex(buffer);
|
||||
}
|
||||
|
||||
public static Object readerIndex(Object buffer, int readerIndex) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().readerIndex(buffer, readerIndex);
|
||||
}
|
||||
|
||||
public static int writerIndex(Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().writerIndex(buffer);
|
||||
}
|
||||
|
||||
public static Object writerIndex(Object buffer, int writerIndex) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().writerIndex(buffer, writerIndex);
|
||||
}
|
||||
|
||||
public static int readableBytes(Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().readableBytes(buffer);
|
||||
}
|
||||
|
||||
public static int writableBytes(Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().writableBytes(buffer);
|
||||
}
|
||||
|
||||
public static Object clear(Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().clear(buffer);
|
||||
}
|
||||
|
||||
public static String toString(Object buffer, int index, int length, Charset charset) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().toString(buffer, index, length, charset);
|
||||
}
|
||||
|
||||
public static byte readByte(Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().readByte(buffer);
|
||||
}
|
||||
|
||||
public static void writeByte(Object buffer, int value) {
|
||||
PacketEvents.getAPI().getNettyManager().getByteBufOperator().writeByte(buffer, value);
|
||||
}
|
||||
|
||||
public static boolean readBoolean(Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().readBoolean(buffer);
|
||||
}
|
||||
|
||||
public static void writeBoolean(Object buffer, boolean value) {
|
||||
PacketEvents.getAPI().getNettyManager().getByteBufOperator().writeBoolean(buffer, value);
|
||||
}
|
||||
|
||||
public static short readUnsignedByte(Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().readUnsignedByte(buffer);
|
||||
}
|
||||
|
||||
public static char readChar(Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().readChar(buffer);
|
||||
}
|
||||
|
||||
public static void writeChar(Object buffer, int value) {
|
||||
PacketEvents.getAPI().getNettyManager().getByteBufOperator().writeChar(buffer, value);
|
||||
}
|
||||
|
||||
public static short readShort(Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().readShort(buffer);
|
||||
}
|
||||
|
||||
public static int readUnsignedShort(Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().readUnsignedShort(buffer);
|
||||
}
|
||||
|
||||
public static void writeShort(Object buffer, int value) {
|
||||
PacketEvents.getAPI().getNettyManager().getByteBufOperator().writeShort(buffer, value);
|
||||
}
|
||||
|
||||
public static int readInt(Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().readInt(buffer);
|
||||
}
|
||||
|
||||
public static void writeInt(Object buffer, int value) {
|
||||
PacketEvents.getAPI().getNettyManager().getByteBufOperator().writeInt(buffer, value);
|
||||
}
|
||||
|
||||
public static long readUnsignedInt(Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().readUnsignedInt(buffer);
|
||||
}
|
||||
|
||||
public static long readLong(Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().readLong(buffer);
|
||||
}
|
||||
|
||||
public static void writeLong(Object buffer, long value) {
|
||||
PacketEvents.getAPI().getNettyManager().getByteBufOperator().writeLong(buffer, value);
|
||||
}
|
||||
|
||||
public static float readFloat(Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().readFloat(buffer);
|
||||
}
|
||||
|
||||
public static void writeFloat(Object buffer, float value) {
|
||||
PacketEvents.getAPI().getNettyManager().getByteBufOperator().writeFloat(buffer, value);
|
||||
}
|
||||
|
||||
public static double readDouble(Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().readDouble(buffer);
|
||||
}
|
||||
|
||||
public static void writeDouble(Object buffer, double value) {
|
||||
PacketEvents.getAPI().getNettyManager().getByteBufOperator().writeDouble(buffer, value);
|
||||
}
|
||||
|
||||
public static Object getBytes(Object buffer, int index, byte[] destination) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().getBytes(buffer, index, destination);
|
||||
}
|
||||
|
||||
public static short getUnsignedByte(Object buffer, int index) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().getUnsignedByte(buffer, index);
|
||||
}
|
||||
|
||||
public static boolean isReadable(Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().isReadable(buffer);
|
||||
}
|
||||
|
||||
public static Object copy(Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().copy(buffer);
|
||||
}
|
||||
|
||||
public static Object duplicate(Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().duplicate(buffer);
|
||||
}
|
||||
|
||||
public static boolean hasArray(Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().hasArray(buffer);
|
||||
}
|
||||
|
||||
public static byte[] array(Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().array(buffer);
|
||||
}
|
||||
|
||||
public static Object retain(Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().retain(buffer);
|
||||
}
|
||||
|
||||
public static Object retainedDuplicate(Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().retainedDuplicate(buffer);
|
||||
}
|
||||
|
||||
public static Object readSlice(Object buffer, int length) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().readSlice(buffer, length);
|
||||
}
|
||||
|
||||
public static Object readBytes(Object buffer, byte[] destination, int destinationIndex, int length) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().readBytes(buffer, destination, destinationIndex, length);
|
||||
}
|
||||
|
||||
public static Object readBytes(Object buffer, int length) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().readBytes(buffer, length);
|
||||
}
|
||||
|
||||
public static Object writeBytes(Object buffer, Object src) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().writeBytes(buffer, src);
|
||||
}
|
||||
|
||||
public static void readBytes(Object buffer, byte[] bytes) {
|
||||
PacketEvents.getAPI().getNettyManager().getByteBufOperator().readBytes(buffer, bytes);
|
||||
}
|
||||
|
||||
public static void writeBytes(Object buffer, byte[] bytes) {
|
||||
PacketEvents.getAPI().getNettyManager().getByteBufOperator().writeBytes(buffer, bytes);
|
||||
}
|
||||
|
||||
public static void writeBytes(Object buffer, byte[] bytes, int offset, int length) {
|
||||
PacketEvents.getAPI().getNettyManager().getByteBufOperator().writeBytes(buffer, bytes, offset, length);
|
||||
}
|
||||
|
||||
public static boolean release(Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().release(buffer);
|
||||
}
|
||||
|
||||
public static int refCnt(Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().refCnt(buffer);
|
||||
}
|
||||
|
||||
public static Object skipBytes(Object buffer, int length) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().skipBytes(buffer, length);
|
||||
}
|
||||
|
||||
public static Object markReaderIndex(Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().markReaderIndex(buffer);
|
||||
}
|
||||
|
||||
public static Object resetReaderIndex(Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().resetReaderIndex(buffer);
|
||||
}
|
||||
|
||||
public static Object markWriterIndex(Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().markWriterIndex(buffer);
|
||||
}
|
||||
|
||||
public static Object resetWriterIndex(Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufOperator().resetWriterIndex(buffer);
|
||||
}
|
||||
|
||||
public static int readVarInt(Object buffer) {
|
||||
int value = 0;
|
||||
int length = 0;
|
||||
byte currentByte;
|
||||
do {
|
||||
currentByte = readByte(buffer);
|
||||
value |= (currentByte & 0x7F) << (length * 7);
|
||||
length++;
|
||||
if (length > 5) {
|
||||
throw new RuntimeException("VarInt is too large. Must be smaller than 5 bytes.");
|
||||
}
|
||||
} while ((currentByte & 0x80) == 0x80);
|
||||
return value;
|
||||
}
|
||||
|
||||
public static void writeVarInt(Object buffer, int value) {
|
||||
while (true) {
|
||||
if ((value & ~0x7F) == 0) {
|
||||
writeByte(buffer, value);
|
||||
return;
|
||||
}
|
||||
writeByte(buffer, (value & 0x7F) | 0x80);
|
||||
value >>>= 7;
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] copyBytes(Object buffer) {
|
||||
byte[] bytes = new byte[readableBytes(buffer)];
|
||||
getBytes(buffer, readerIndex(buffer), bytes);
|
||||
return bytes;
|
||||
}
|
||||
}
|
||||
+232
@@ -0,0 +1,232 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.netty.buffer;
|
||||
|
||||
import java.io.*;
|
||||
//TODO give netty credit
|
||||
public class ByteBufInputStream extends InputStream implements DataInput {
|
||||
private final Object buffer;
|
||||
private final int startIndex;
|
||||
private final int endIndex;
|
||||
private final boolean releaseOnClose;
|
||||
private final StringBuilder lineBuf;
|
||||
private boolean closed;
|
||||
|
||||
public ByteBufInputStream(Object buffer) {
|
||||
this(buffer, ByteBufHelper.readableBytes(buffer));
|
||||
}
|
||||
|
||||
public ByteBufInputStream(Object buffer, int length) {
|
||||
this(buffer, length, false);
|
||||
}
|
||||
|
||||
public ByteBufInputStream(Object buffer, boolean releaseOnClose) {
|
||||
this(buffer, ByteBufHelper.readableBytes(buffer), releaseOnClose);
|
||||
}
|
||||
|
||||
public ByteBufInputStream(Object buffer, int length, boolean releaseOnClose) {
|
||||
this.lineBuf = new StringBuilder();
|
||||
if (buffer == null) {
|
||||
throw new NullPointerException("buffer");
|
||||
} else if (length < 0) {
|
||||
if (releaseOnClose) {
|
||||
ByteBufHelper.release(buffer);
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException("length: " + length);
|
||||
} else if (length > ByteBufHelper.readableBytes(buffer)) {
|
||||
if (releaseOnClose) {
|
||||
ByteBufHelper.release(buffer);
|
||||
}
|
||||
|
||||
throw new IndexOutOfBoundsException("Too many bytes to be read - Needs " + length + ", maximum is " + ByteBufHelper.readableBytes(buffer));
|
||||
} else {
|
||||
this.releaseOnClose = releaseOnClose;
|
||||
this.buffer = buffer;
|
||||
this.startIndex = ByteBufHelper.readerIndex(buffer);
|
||||
this.endIndex = this.startIndex + length;
|
||||
ByteBufHelper.markReaderIndex(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
public int readBytes() {
|
||||
return ByteBufHelper.readerIndex(buffer) - this.startIndex;
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
try {
|
||||
super.close();
|
||||
} finally {
|
||||
if (this.releaseOnClose && !this.closed) {
|
||||
this.closed = true;
|
||||
ByteBufHelper.release(buffer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int available() throws IOException {
|
||||
return this.endIndex - ByteBufHelper.readerIndex(buffer);
|
||||
}
|
||||
|
||||
public void mark(int readlimit) {
|
||||
ByteBufHelper.markReaderIndex(buffer);
|
||||
}
|
||||
|
||||
public boolean markSupported() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public int read() throws IOException {
|
||||
return !(ByteBufHelper.isReadable(buffer)) ? -1 : ByteBufHelper.readByte(buffer) & 255;
|
||||
}
|
||||
|
||||
|
||||
public int read(byte[] b, int off, int len) throws IOException {
|
||||
int available = this.available();
|
||||
if (available == 0) {
|
||||
return -1;
|
||||
} else {
|
||||
len = Math.min(available, len);
|
||||
ByteBufHelper.readBytes(buffer, b, off, len);
|
||||
return len;
|
||||
}
|
||||
}
|
||||
|
||||
public void reset() throws IOException {
|
||||
ByteBufHelper.resetReaderIndex(buffer);
|
||||
}
|
||||
|
||||
public long skip(long n) throws IOException {
|
||||
return n > 2147483647L ? (long) this.skipBytes(2147483647) : (long) this.skipBytes((int) n);
|
||||
}
|
||||
|
||||
public boolean readBoolean() throws IOException {
|
||||
this.checkAvailable(1);
|
||||
return this.read() != 0;
|
||||
}
|
||||
|
||||
public byte[] readBytes(int len) {
|
||||
byte[] bytes = new byte[len];
|
||||
ByteBufHelper.readBytes(buffer, bytes);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public byte readByte() throws IOException {
|
||||
if (!(ByteBufHelper.isReadable(buffer))) {
|
||||
throw new EOFException();
|
||||
} else {
|
||||
return ByteBufHelper.readByte(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
public char readChar() throws IOException {
|
||||
return (char) this.readShort();
|
||||
}
|
||||
|
||||
public double readDouble() throws IOException {
|
||||
return Double.longBitsToDouble(this.readLong());
|
||||
}
|
||||
|
||||
public float readFloat() throws IOException {
|
||||
return Float.intBitsToFloat(this.readInt());
|
||||
}
|
||||
|
||||
public void readFully(byte[] b) throws IOException {
|
||||
this.readFully(b, 0, b.length);
|
||||
}
|
||||
|
||||
public void readFully(byte[] b, int off, int len) throws IOException {
|
||||
this.checkAvailable(len);
|
||||
ByteBufHelper.readBytes(buffer, b, off, len);
|
||||
}
|
||||
|
||||
public int readInt() throws IOException {
|
||||
this.checkAvailable(4);
|
||||
return ByteBufHelper.readInt(buffer);
|
||||
}
|
||||
|
||||
public String readLine() throws IOException {
|
||||
this.lineBuf.setLength(0);
|
||||
|
||||
while (ByteBufHelper.isReadable(buffer)) {
|
||||
int c = ByteBufHelper.readUnsignedByte(buffer);
|
||||
switch (c) {
|
||||
case 13:
|
||||
if (ByteBufHelper.isReadable(buffer)
|
||||
&& (char) ByteBufHelper.getUnsignedByte(buffer, ByteBufHelper.readerIndex(buffer)) == '\n') {
|
||||
ByteBufHelper.skipBytes(buffer, 1);
|
||||
}
|
||||
case 10:
|
||||
return this.lineBuf.toString();
|
||||
default:
|
||||
this.lineBuf.append((char) c);
|
||||
}
|
||||
}
|
||||
|
||||
return this.lineBuf.length() > 0 ? this.lineBuf.toString() : null;
|
||||
}
|
||||
|
||||
public long readLong() throws IOException {
|
||||
this.checkAvailable(8);
|
||||
return ByteBufHelper.readLong(buffer);
|
||||
}
|
||||
|
||||
public long[] readLongs(int size) throws IOException {
|
||||
long[] array = new long[size];
|
||||
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
array[i] = readLong();
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
public short readShort() throws IOException {
|
||||
this.checkAvailable(2);
|
||||
return ByteBufHelper.readShort(buffer);
|
||||
}
|
||||
|
||||
public String readUTF() throws IOException {
|
||||
return DataInputStream.readUTF(this);
|
||||
}
|
||||
|
||||
public int readUnsignedByte() throws IOException {
|
||||
return this.readByte() & 255;
|
||||
}
|
||||
|
||||
public int readUnsignedShort() throws IOException {
|
||||
return this.readShort() & '\uffff';
|
||||
}
|
||||
|
||||
public int skipBytes(int n) throws IOException {
|
||||
int nBytes = Math.min(this.available(), n);
|
||||
ByteBufHelper.skipBytes(buffer, nBytes);
|
||||
return nBytes;
|
||||
}
|
||||
|
||||
private void checkAvailable(int fieldSize) throws IOException {
|
||||
if (fieldSize < 0) {
|
||||
throw new IndexOutOfBoundsException("fieldSize cannot be a negative number");
|
||||
} else if (fieldSize > this.available()) {
|
||||
throw new EOFException("fieldSize is too long! Length is " + fieldSize + ", but maximum is " + this.available());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.netty.buffer;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
public interface ByteBufOperator {
|
||||
int capacity(Object buffer);
|
||||
Object capacity(Object buffer, int capacity);
|
||||
int readerIndex(Object buffer);
|
||||
Object readerIndex(Object buffer, int readerIndex);
|
||||
|
||||
int writerIndex(Object buffer);
|
||||
Object writerIndex(Object buffer, int writerIndex);
|
||||
|
||||
int readableBytes(Object buffer);
|
||||
int writableBytes(Object buffer);
|
||||
Object clear(Object buffer);
|
||||
|
||||
byte readByte(Object buffer);
|
||||
short readShort(Object buffer);
|
||||
int readInt(Object buffer);
|
||||
long readUnsignedInt(Object buffer);
|
||||
long readLong(Object buffer);
|
||||
|
||||
void writeByte(Object buffer, int value);
|
||||
void writeShort(Object buffer, int value);
|
||||
void writeInt(Object buffer, int value);
|
||||
void writeLong(Object buffer, long value);
|
||||
|
||||
Object getBytes(Object buffer, int index, byte[] destination);
|
||||
short getUnsignedByte(Object buffer, int index);
|
||||
|
||||
boolean isReadable(Object buffer);
|
||||
Object copy(Object buffer);
|
||||
Object duplicate(Object buffer);
|
||||
boolean hasArray(Object buffer);
|
||||
byte[] array(Object buffer);
|
||||
Object retain(Object buffer);
|
||||
Object retainedDuplicate(Object buffer);
|
||||
Object readSlice(Object buffer, int length);
|
||||
Object readBytes(Object buffer, byte[] destination, int destinationIndex, int length);
|
||||
Object readBytes(Object buffer, int length);
|
||||
void readBytes(Object buffer, byte[] bytes);
|
||||
|
||||
Object writeBytes(Object buffer, Object src);
|
||||
Object writeBytes(Object buffer, byte[] bytes);
|
||||
Object writeBytes(Object buffer, byte[] bytes, int offset, int length);
|
||||
|
||||
boolean release(Object buffer);
|
||||
int refCnt(Object buffer);
|
||||
Object skipBytes(Object buffer, int length);
|
||||
String toString(Object buffer, int index, int length, Charset charset);
|
||||
Object markReaderIndex(Object buffer);
|
||||
Object resetReaderIndex(Object buffer);
|
||||
Object markWriterIndex(Object buffer);
|
||||
Object resetWriterIndex(Object buffer);
|
||||
|
||||
default float readFloat(Object buffer) {
|
||||
return Float.intBitsToFloat(readInt(buffer));
|
||||
}
|
||||
|
||||
default void writeFloat(Object buffer, float value) {
|
||||
writeInt(buffer, Float.floatToIntBits(value));
|
||||
}
|
||||
|
||||
default double readDouble(Object buffer) {
|
||||
return Double.longBitsToDouble(readLong(buffer));
|
||||
}
|
||||
|
||||
default void writeDouble(Object buffer, double value) {
|
||||
writeLong(buffer, Double.doubleToLongBits(value));
|
||||
}
|
||||
|
||||
default char readChar(Object buffer) {
|
||||
return (char) readShort(buffer);
|
||||
}
|
||||
|
||||
default void writeChar(Object buffer, int value) {
|
||||
writeShort(buffer, value);
|
||||
}
|
||||
|
||||
//Use writeShort to write
|
||||
default int readUnsignedShort(Object buffer) {
|
||||
return readShort(buffer) & '\uffff';
|
||||
}
|
||||
|
||||
//Use writeByte to write
|
||||
default short readUnsignedByte(Object buffer) {
|
||||
return (short) (this.readByte(buffer) & 255);
|
||||
}
|
||||
|
||||
default boolean readBoolean(Object buffer) {
|
||||
return readByte(buffer) != 0;
|
||||
}
|
||||
|
||||
default void writeBoolean(Object buffer, boolean value) {
|
||||
writeByte(buffer, value ? 1 : 0);
|
||||
}
|
||||
}
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
//TODO Give netty credit
|
||||
|
||||
package com.github.retrooper.packetevents.netty.buffer;
|
||||
|
||||
import java.io.DataOutput;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
public class ByteBufOutputStream extends OutputStream implements DataOutput {
|
||||
private final Object buffer;
|
||||
private final int startIndex;
|
||||
private final DataOutputStream utf8out = new DataOutputStream(this);
|
||||
|
||||
public ByteBufOutputStream(Object buffer) {
|
||||
if (buffer == null) {
|
||||
throw new NullPointerException("buffer");
|
||||
} else {
|
||||
this.buffer = buffer;
|
||||
this.startIndex = ByteBufHelper.writerIndex(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
public int writtenBytes() {
|
||||
return ByteBufHelper.writerIndex(buffer) - this.startIndex;
|
||||
}
|
||||
|
||||
public void write(byte[] b, int off, int len) throws IOException {
|
||||
if (len != 0) {
|
||||
ByteBufHelper.writeBytes(buffer, b, off, len);
|
||||
}
|
||||
}
|
||||
|
||||
public void write(byte[] b) throws IOException {
|
||||
ByteBufHelper.writeBytes(buffer, b);
|
||||
}
|
||||
|
||||
public void write(int b) throws IOException {
|
||||
ByteBufHelper.writeByte(buffer, b);
|
||||
}
|
||||
|
||||
public void writeBoolean(boolean v) throws IOException {
|
||||
ByteBufHelper.writeBoolean(buffer, v);
|
||||
}
|
||||
|
||||
public void writeByte(int v) throws IOException {
|
||||
ByteBufHelper.writeByte(buffer, v);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void writeBytes(String s) throws IOException {
|
||||
throw new IllegalStateException("This operation is not supported!");
|
||||
}
|
||||
|
||||
public void writeChar(int v) throws IOException {
|
||||
ByteBufHelper.writeChar(buffer, v);
|
||||
}
|
||||
|
||||
public void writeChars(String s) throws IOException {
|
||||
int len = s.length();
|
||||
|
||||
for (int i = 0; i < len; ++i) {
|
||||
ByteBufHelper.writeChar(buffer, s.charAt(i));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void writeDouble(double v) throws IOException {
|
||||
ByteBufHelper.writeDouble(buffer, v);
|
||||
}
|
||||
|
||||
public void writeFloat(float v) throws IOException {
|
||||
ByteBufHelper.writeFloat(buffer, v);
|
||||
}
|
||||
|
||||
public void writeInt(int v) throws IOException {
|
||||
ByteBufHelper.writeInt(buffer, v);
|
||||
}
|
||||
|
||||
public void writeLong(long v) throws IOException {
|
||||
ByteBufHelper.writeLong(buffer, v);
|
||||
}
|
||||
|
||||
public void writeShort(int v) throws IOException {
|
||||
ByteBufHelper.writeShort(buffer, v);
|
||||
}
|
||||
|
||||
public void writeUTF(String s) throws IOException {
|
||||
this.utf8out.writeUTF(s);
|
||||
}
|
||||
|
||||
public Object buffer() {
|
||||
return this.buffer;
|
||||
}
|
||||
}
|
||||
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.netty.buffer;
|
||||
|
||||
import com.github.retrooper.packetevents.PacketEvents;
|
||||
|
||||
public class UnpooledByteBufAllocationHelper {
|
||||
public static Object wrappedBuffer(byte[] bytes) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufAllocationOperator().wrappedBuffer(bytes);
|
||||
}
|
||||
|
||||
public static Object copiedBuffer(byte[] bytes) {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufAllocationOperator().copiedBuffer(bytes);
|
||||
}
|
||||
|
||||
public static Object buffer() {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufAllocationOperator().buffer();
|
||||
}
|
||||
|
||||
public static Object directBuffer() {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufAllocationOperator().directBuffer();
|
||||
}
|
||||
|
||||
public static Object compositeBuffer() {
|
||||
return PacketEvents.getAPI().getNettyManager().getByteBufAllocationOperator().compositeBuffer();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.netty.channel;
|
||||
|
||||
import com.github.retrooper.packetevents.PacketEvents;
|
||||
|
||||
import java.net.SocketAddress;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class ChannelHelper {
|
||||
public static SocketAddress remoteAddress(Object channel) {
|
||||
return PacketEvents.getAPI().getNettyManager().getChannelOperator().remoteAddress(channel);
|
||||
}
|
||||
|
||||
public static SocketAddress localAddress(Object channel) {
|
||||
return PacketEvents.getAPI().getNettyManager().getChannelOperator().localAddress(channel);
|
||||
}
|
||||
|
||||
public static boolean isOpen(Object channel) {
|
||||
return PacketEvents.getAPI().getNettyManager().getChannelOperator().isOpen(channel);
|
||||
}
|
||||
|
||||
public static Object close(Object channel) {
|
||||
return PacketEvents.getAPI().getNettyManager().getChannelOperator().close(channel);
|
||||
}
|
||||
|
||||
public static Object write(Object channel, Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getChannelOperator().write(channel, buffer);
|
||||
}
|
||||
|
||||
public static Object flush(Object channel) {
|
||||
return PacketEvents.getAPI().getNettyManager().getChannelOperator().flush(channel);
|
||||
}
|
||||
|
||||
public static Object writeAndFlush(Object channel, Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getChannelOperator().writeAndFlush(channel, buffer);
|
||||
}
|
||||
|
||||
public static Object fireChannelRead(Object channel, Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getChannelOperator().fireChannelRead(channel, buffer);
|
||||
}
|
||||
|
||||
public static Object writeInContext(Object channel, String ctx, Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getChannelOperator().writeInContext(channel, ctx, buffer);
|
||||
}
|
||||
|
||||
public static Object flushInContext(Object channel, String ctx) {
|
||||
return PacketEvents.getAPI().getNettyManager().getChannelOperator().flushInContext(channel, ctx);
|
||||
}
|
||||
|
||||
public static Object writeAndFlushInContext(Object channel, String ctx, Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getChannelOperator().writeAndFlushInContext(channel, ctx, buffer);
|
||||
}
|
||||
|
||||
public static Object fireChannelReadInContext(Object channel, String ctx, Object buffer) {
|
||||
return PacketEvents.getAPI().getNettyManager().getChannelOperator().fireChannelReadInContext(channel, ctx, buffer);
|
||||
}
|
||||
|
||||
public static List<String> pipelineHandlerNames(Object channel) {
|
||||
return PacketEvents.getAPI().getNettyManager().getChannelOperator().pipelineHandlerNames(channel);
|
||||
}
|
||||
|
||||
public static String pipelineHandlerNamesAsString(Object channel) {
|
||||
return Arrays.toString(pipelineHandlerNames(channel).toArray(new String[0]));
|
||||
}
|
||||
|
||||
public static Object getPipeline(Object channel) {
|
||||
return PacketEvents.getAPI().getNettyManager().getChannelOperator().getPipeline(channel);
|
||||
}
|
||||
|
||||
public static Object getPipelineHandler(Object channel, String name) {
|
||||
return PacketEvents.getAPI().getNettyManager().getChannelOperator().getPipelineHandler(channel, name);
|
||||
}
|
||||
|
||||
public static Object getPipelineContext(Object channel, String handlerName) {
|
||||
return PacketEvents.getAPI().getNettyManager().getChannelOperator().getPipelineContext(channel, handlerName);
|
||||
}
|
||||
|
||||
public static Object pooledByteBuf(Object channel) {
|
||||
return PacketEvents.getAPI().getNettyManager().getChannelOperator().pooledByteBuf(channel);
|
||||
}
|
||||
|
||||
public static void runInEventLoop(Object channel, Runnable runnable) {
|
||||
PacketEvents.getAPI().getNettyManager().getChannelOperator().runInEventLoop(channel, runnable);
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.netty.channel;
|
||||
|
||||
import java.net.SocketAddress;
|
||||
import java.util.List;
|
||||
|
||||
public interface ChannelOperator {
|
||||
SocketAddress remoteAddress(Object channel);
|
||||
|
||||
SocketAddress localAddress(Object channel);
|
||||
|
||||
boolean isOpen(Object channel);
|
||||
|
||||
Object close(Object channel);
|
||||
|
||||
Object write(Object channel, Object buffer);
|
||||
|
||||
Object flush(Object channel);
|
||||
|
||||
Object writeAndFlush(Object channel, Object buffer);
|
||||
|
||||
Object fireChannelRead(Object channel, Object buffer);
|
||||
|
||||
Object writeInContext(Object channel, String ctx, Object buffer);
|
||||
|
||||
Object flushInContext(Object channel, String ctx);
|
||||
|
||||
Object writeAndFlushInContext(Object channel, String ctx, Object buffer);
|
||||
|
||||
Object fireChannelReadInContext(Object channel, String ctx, Object buffer);
|
||||
|
||||
List<String> pipelineHandlerNames(Object channel);
|
||||
|
||||
Object getPipelineHandler(Object channel, String name);
|
||||
|
||||
Object getPipelineContext(Object channel, String name);
|
||||
|
||||
Object getPipeline(Object channel);
|
||||
|
||||
void runInEventLoop(Object channel, Runnable runnable);
|
||||
|
||||
Object pooledByteBuf(Object channel);
|
||||
}
|
||||
+12
-10
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 retrooper and contributors
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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
|
||||
@@ -16,17 +16,19 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.github.retrooper.packetevents.utils.player;
|
||||
//TODO Remove this enum, use Bukkit's GameMode enum everywhere.
|
||||
package com.github.retrooper.packetevents.protocol;
|
||||
|
||||
/**
|
||||
* Representation of a player's game mode.
|
||||
*
|
||||
* @author retrooper
|
||||
* @since 1.8
|
||||
*/
|
||||
public enum GameMode {
|
||||
SURVIVAL,
|
||||
CREATIVE,
|
||||
ADVENTURE,
|
||||
SPECTATOR
|
||||
public enum ConnectionState {
|
||||
HANDSHAKING, STATUS, LOGIN, PLAY, CONFIGURATION;
|
||||
|
||||
public static ConnectionState getById(int id) {
|
||||
if (id >= values().length || id < 0) {
|
||||
return null;
|
||||
}
|
||||
return values()[id];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol;
|
||||
|
||||
public enum PacketSide {
|
||||
CLIENT, SERVER;
|
||||
|
||||
public PacketSide getOpposite() {
|
||||
if (this == CLIENT) {
|
||||
return SERVER;
|
||||
}
|
||||
else {
|
||||
return CLIENT;
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
-4
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 retrooper and contributors
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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
|
||||
@@ -16,8 +16,9 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.github.retrooper.packetevents.injector;
|
||||
|
||||
public interface LateInjector extends ChannelInjector {
|
||||
package com.github.retrooper.packetevents.protocol;
|
||||
|
||||
//TODO
|
||||
public enum ProtocolVersion {
|
||||
UNKNOWN
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package com.github.retrooper.packetevents.protocol.chat;
|
||||
|
||||
public enum ChatCompletionAction {
|
||||
ADD,
|
||||
REMOVE,
|
||||
SET;
|
||||
|
||||
private static final ChatCompletionAction[] VALUES = values();
|
||||
|
||||
public static ChatCompletionAction fromId(int id) {
|
||||
return VALUES[id];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.chat;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.mapper.MappedEntity;
|
||||
|
||||
public interface ChatType extends MappedEntity {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.chat;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
|
||||
import com.github.retrooper.packetevents.resources.ResourceLocation;
|
||||
import com.github.retrooper.packetevents.util.TypesBuilder;
|
||||
import com.github.retrooper.packetevents.util.TypesBuilderData;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class ChatTypes {
|
||||
private static final Map<String, ChatType> CHAT_TYPE_MAP = new HashMap<>();
|
||||
//Key - mappings version, value - map with chat type ids and chat types
|
||||
private static final Map<Byte, Map<Integer, ChatType>> CHAT_TYPE_ID_MAP = new HashMap<>();
|
||||
private static final TypesBuilder TYPES_BUILDER = new TypesBuilder("chat/chat_type_mappings",
|
||||
ClientVersion.V_1_18_2,
|
||||
ClientVersion.V_1_19,
|
||||
ClientVersion.V_1_19_1);
|
||||
|
||||
static {
|
||||
TYPES_BUILDER.unloadFileMappings();
|
||||
}
|
||||
|
||||
public static ChatType define(String key) {
|
||||
TypesBuilderData data = TYPES_BUILDER.define(key);
|
||||
ChatType chatType = new ChatType() {
|
||||
private final int[] ids = data.getData();
|
||||
|
||||
@Override
|
||||
public ResourceLocation getName() {
|
||||
return data.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getId(ClientVersion version) {
|
||||
int index = TYPES_BUILDER.getDataIndex(version);
|
||||
return ids[index];
|
||||
}
|
||||
};
|
||||
CHAT_TYPE_MAP.put(chatType.getName().toString(), chatType);
|
||||
for (ClientVersion version : TYPES_BUILDER.getVersions()) {
|
||||
int index = TYPES_BUILDER.getDataIndex(version);
|
||||
Map<Integer, ChatType> typeIdMap = CHAT_TYPE_ID_MAP.computeIfAbsent((byte) index, k -> new HashMap<>());
|
||||
typeIdMap.put(chatType.getId(version), chatType);
|
||||
}
|
||||
return chatType;
|
||||
}
|
||||
|
||||
//with minecraft:key
|
||||
public static ChatType getByName(String name) {
|
||||
return CHAT_TYPE_MAP.get(name);
|
||||
}
|
||||
|
||||
public static ChatType getById(ClientVersion version, int id) {
|
||||
int index = TYPES_BUILDER.getDataIndex(version);
|
||||
return CHAT_TYPE_ID_MAP.get((byte) index).get(id);
|
||||
}
|
||||
|
||||
public static final ChatType CHAT = define("chat");
|
||||
public static final ChatType SAY_COMMAND = define("say_command");
|
||||
public static final ChatType MSG_COMMAND_INCOMING = define("msg_command_incoming");
|
||||
public static final ChatType MSG_COMMAND_OUTGOING = define("msg_command_outgoing");
|
||||
public static final ChatType TEAM_MSG_COMMAND_INCOMING = define("team_msg_command_incoming");
|
||||
public static final ChatType TEAM_MSG_COMMAND_OUTGOING = define("team_msg_command_outgoing");
|
||||
public static final ChatType EMOTE_COMMAND = define("emote_command");
|
||||
public static final ChatType RAW = define("raw");
|
||||
|
||||
@Deprecated
|
||||
public static final ChatType SYSTEM = define("system");
|
||||
@Deprecated
|
||||
public static final ChatType GAME_INFO = define("game_info");
|
||||
@Deprecated
|
||||
public static final ChatType MSG_COMMAND = define("msg_command");
|
||||
@Deprecated
|
||||
public static final ChatType TEAM_MSG_COMMAND = define("team_msg_command");
|
||||
}
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
package com.github.retrooper.packetevents.protocol.chat;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.BitSet;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class LastSeenMessages {
|
||||
public static final LastSeenMessages EMPTY = new LastSeenMessages(new ArrayList<>());
|
||||
|
||||
private final List<Entry> entries;
|
||||
|
||||
public LastSeenMessages(List<Entry> entries) {
|
||||
this.entries = entries;
|
||||
}
|
||||
|
||||
public void updateHash(DataOutput output) throws IOException {
|
||||
for (Entry entry : this.entries) {
|
||||
UUID uuid = entry.getUUID();
|
||||
byte[] lastVerifier = entry.getLastVerifier();
|
||||
output.writeByte(70);
|
||||
output.writeLong(uuid.getMostSignificantBits());
|
||||
output.writeLong(uuid.getLeastSignificantBits());
|
||||
output.write(lastVerifier);
|
||||
}
|
||||
}
|
||||
|
||||
public List<Entry> getEntries() {
|
||||
return entries;
|
||||
}
|
||||
|
||||
public static class Packed {
|
||||
private List<MessageSignature.Packed> packedMessageSignatures;
|
||||
|
||||
public Packed(List<MessageSignature.Packed> packedMessageSignatures) {
|
||||
this.packedMessageSignatures = packedMessageSignatures;
|
||||
}
|
||||
|
||||
public List<MessageSignature.Packed> getPackedMessageSignatures() {
|
||||
return packedMessageSignatures;
|
||||
}
|
||||
|
||||
public void setPackedMessageSignatures(List<MessageSignature.Packed> packedMessageSignatures) {
|
||||
this.packedMessageSignatures = packedMessageSignatures;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Entry {
|
||||
private final UUID uuid;
|
||||
private final byte[] signature;
|
||||
|
||||
public Entry(UUID uuid, byte[] lastVerifier) {
|
||||
this.uuid = uuid;
|
||||
this.signature = lastVerifier;
|
||||
}
|
||||
|
||||
public UUID getUUID() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public byte[] getLastVerifier() {
|
||||
return signature;
|
||||
}
|
||||
}
|
||||
|
||||
public static class LegacyUpdate {
|
||||
private final LastSeenMessages lastSeenMessages;
|
||||
private final @Nullable Entry lastReceived;
|
||||
|
||||
public LegacyUpdate(LastSeenMessages lastSeenMessages, @Nullable Entry lastReceived) {
|
||||
this.lastSeenMessages = lastSeenMessages;
|
||||
this.lastReceived = lastReceived;
|
||||
}
|
||||
|
||||
public LastSeenMessages getLastSeenMessages() {
|
||||
return lastSeenMessages;
|
||||
}
|
||||
|
||||
public @Nullable Entry getLastReceived() {
|
||||
return lastReceived;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Update {
|
||||
private final int offset;
|
||||
private final BitSet acknowledged;
|
||||
|
||||
public Update(int offset, BitSet acknowledged) {
|
||||
this.offset = offset;
|
||||
this.acknowledged = acknowledged;
|
||||
}
|
||||
|
||||
public int getOffset() {
|
||||
return offset;
|
||||
}
|
||||
|
||||
public BitSet getAcknowledged() {
|
||||
return acknowledged;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.chat;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class MessageSender {
|
||||
private @NotNull UUID uuid;
|
||||
private @Nullable Component displayName;
|
||||
private @Nullable Component teamName;
|
||||
|
||||
public MessageSender(@NotNull UUID uuid, @Nullable Component displayName, @Nullable Component teamName) {
|
||||
this.uuid = uuid;
|
||||
this.displayName = displayName;
|
||||
this.teamName = teamName;
|
||||
}
|
||||
|
||||
public MessageSender(@Nullable Component displayName, @Nullable Component teamName) {
|
||||
this(new UUID(0L, 0L), displayName, teamName);
|
||||
}
|
||||
|
||||
public MessageSender() {
|
||||
this(null, null);
|
||||
}
|
||||
|
||||
public UUID getUUID() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUUID(@NotNull UUID uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public @Nullable Component getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public void setDisplayName(@Nullable Component displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public @Nullable Component getTeamName() {
|
||||
return teamName;
|
||||
}
|
||||
|
||||
public void setTeamName(@Nullable Component teamName) {
|
||||
this.teamName = teamName;
|
||||
}
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2023 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.chat;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class MessageSignature {
|
||||
private byte[] bytes;
|
||||
|
||||
public MessageSignature(byte[] bytes) {
|
||||
this.bytes = bytes;
|
||||
}
|
||||
|
||||
public byte[] getBytes() {
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public void setBytes(byte[] bytes) {
|
||||
this.bytes = bytes;
|
||||
}
|
||||
|
||||
public static class Packed {
|
||||
private int id;
|
||||
private @Nullable MessageSignature fullSignature;
|
||||
|
||||
public Packed(@Nullable MessageSignature fullSignature) {
|
||||
this.id = -1;
|
||||
this.fullSignature = fullSignature;
|
||||
}
|
||||
|
||||
public Packed(int id) {
|
||||
this.id = id;
|
||||
this.fullSignature = null;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Optional<MessageSignature> getFullSignature() {
|
||||
return Optional.ofNullable(fullSignature);
|
||||
}
|
||||
|
||||
public void setFullSignature(@Nullable MessageSignature fullSignature) {
|
||||
this.fullSignature = fullSignature;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.chat;
|
||||
|
||||
import com.github.retrooper.packetevents.resources.ResourceLocation;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class Node {
|
||||
private byte flags;
|
||||
private List<Integer> children;
|
||||
private Optional<Integer> redirectNodeIndex;
|
||||
private Optional<String> name;
|
||||
private Optional<Integer> parserID;
|
||||
private Optional<List<Object>> properties;
|
||||
private Optional<ResourceLocation> suggestionsType;
|
||||
|
||||
public Node(byte flags, List<Integer> children, @Nullable Integer redirectNodeIndex, @Nullable String name, @Nullable Integer parserID, @Nullable List<Object> properties, @Nullable ResourceLocation suggestionsType) {
|
||||
this.flags = flags;
|
||||
this.children = children;
|
||||
this.redirectNodeIndex = Optional.ofNullable(redirectNodeIndex);
|
||||
this.name = Optional.ofNullable(name);
|
||||
this.parserID = Optional.ofNullable(parserID);
|
||||
this.properties = Optional.ofNullable(properties);
|
||||
this.suggestionsType = Optional.ofNullable(suggestionsType);
|
||||
}
|
||||
|
||||
public byte getFlags() {
|
||||
return flags;
|
||||
}
|
||||
|
||||
public void setFlags(byte flags) {
|
||||
this.flags = flags;
|
||||
}
|
||||
|
||||
public List<Integer> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<Integer> children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
public Optional<Integer> getRedirectNodeIndex() {
|
||||
return redirectNodeIndex;
|
||||
}
|
||||
|
||||
public void setRedirectNodeIndex(Optional<Integer> redirectNodeIndex) {
|
||||
this.redirectNodeIndex = redirectNodeIndex;
|
||||
}
|
||||
|
||||
public Optional<String> getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(Optional<String> name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Optional<Integer> getParserID() {
|
||||
return parserID;
|
||||
}
|
||||
|
||||
public void setParserID(Optional<Integer> parserID) {
|
||||
this.parserID = parserID;
|
||||
}
|
||||
|
||||
public Optional<List<Object>> getProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
public void setProperties(Optional<List<Object>> properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
public Optional<ResourceLocation> getSuggestionsType() {
|
||||
return suggestionsType;
|
||||
}
|
||||
|
||||
public void setSuggestionsType(Optional<ResourceLocation> suggestionsType) {
|
||||
this.suggestionsType = suggestionsType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.chat;
|
||||
|
||||
import com.github.retrooper.packetevents.resources.ResourceLocation;
|
||||
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class Parsers {
|
||||
private static final List<Parser> parsers = Arrays.asList(
|
||||
new Parser("brigadier:bool", null, null),
|
||||
new Parser("brigadier:float",
|
||||
packetWrapper -> {
|
||||
byte flags = packetWrapper.readByte();
|
||||
float min = (flags & 0x01) != 0 ? packetWrapper.readFloat() : -Float.MAX_VALUE;
|
||||
float max = (flags & 0x02) != 0 ? packetWrapper.readFloat() : Float.MAX_VALUE;
|
||||
return Arrays.asList(flags, min, max);
|
||||
},
|
||||
(packetWrapper, properties) -> {
|
||||
byte flags = (byte) properties.get(0);
|
||||
packetWrapper.writeByte(flags);
|
||||
if ((flags & 0x01) != 0) packetWrapper.writeFloat((float) properties.get(1));
|
||||
if ((flags & 0x02) != 0) packetWrapper.writeFloat((float) properties.get(2));
|
||||
}
|
||||
),
|
||||
new Parser("brigadier:double",
|
||||
packetWrapper -> {
|
||||
byte flags = packetWrapper.readByte();
|
||||
double min = (flags & 0x01) != 0 ? packetWrapper.readDouble() : -Double.MAX_VALUE;
|
||||
double max = (flags & 0x02) != 0 ? packetWrapper.readDouble() : Double.MAX_VALUE;
|
||||
return Arrays.asList(flags, min, max);
|
||||
},
|
||||
(packetWrapper, properties) -> {
|
||||
byte flags = (byte) properties.get(0);
|
||||
packetWrapper.writeByte(flags);
|
||||
if ((flags & 0x01) != 0) packetWrapper.writeDouble((double) properties.get(1));
|
||||
if ((flags & 0x02) != 0) packetWrapper.writeDouble((double) properties.get(2));
|
||||
}
|
||||
),
|
||||
new Parser("brigadier:integer",
|
||||
packetWrapper -> {
|
||||
byte flags = packetWrapper.readByte();
|
||||
int min = (flags & 0x01) != 0 ? packetWrapper.readInt() : Integer.MIN_VALUE;
|
||||
int max = (flags & 0x02) != 0 ? packetWrapper.readInt() : Integer.MAX_VALUE;
|
||||
return Arrays.asList(flags, min, max);
|
||||
},
|
||||
(packetWrapper, properties) -> {
|
||||
byte flags = (byte) properties.get(0);
|
||||
packetWrapper.writeByte(flags);
|
||||
if ((flags & 0x01) != 0) packetWrapper.writeInt((int) properties.get(1));
|
||||
if ((flags & 0x02) != 0) packetWrapper.writeInt((int) properties.get(2));
|
||||
}
|
||||
),
|
||||
new Parser("brigadier:long",
|
||||
packetWrapper -> {
|
||||
byte flags = packetWrapper.readByte();
|
||||
long min = (flags & 0x01) != 0 ? packetWrapper.readLong() : Long.MIN_VALUE;
|
||||
long max = (flags & 0x02) != 0 ? packetWrapper.readLong() : Long.MAX_VALUE;
|
||||
return Arrays.asList(flags, min, max);
|
||||
},
|
||||
(packetWrapper, properties) -> {
|
||||
byte flags = (byte) properties.get(0);
|
||||
packetWrapper.writeByte(flags);
|
||||
if ((flags & 0x01) != 0) packetWrapper.writeLong((long) properties.get(1));
|
||||
if ((flags & 0x02) != 0) packetWrapper.writeLong((long) properties.get(2));
|
||||
}
|
||||
),
|
||||
new Parser("brigadier:string",
|
||||
packetWrapper -> Collections.singletonList(packetWrapper.readVarInt()),
|
||||
(packetWrapper, properties) -> packetWrapper.writeVarInt((Integer) properties.get(0))
|
||||
),
|
||||
new Parser("minecraft:entity",
|
||||
packetWrapper -> Collections.singletonList(packetWrapper.readByte()),
|
||||
(packetWrapper, properties) -> packetWrapper.writeByte(((Byte) properties.get(0)).intValue())
|
||||
),
|
||||
new Parser("minecraft:game_profile", null, null),
|
||||
new Parser("minecraft:block_pos", null, null),
|
||||
new Parser("minecraft:column_pos", null, null),
|
||||
new Parser("minecraft:vec3", null, null),
|
||||
new Parser("minecraft:vec2", null, null),
|
||||
new Parser("minecraft:block_state", null, null),
|
||||
new Parser("minecraft:block_predicate", null, null),
|
||||
new Parser("minecraft:item_stack", null, null),
|
||||
new Parser("minecraft:item_predicate", null, null),
|
||||
new Parser("minecraft:color", null, null),
|
||||
new Parser("minecraft:component", null, null),
|
||||
new Parser("minecraft:style", null, null),
|
||||
new Parser("minecraft:message", null, null),
|
||||
new Parser("minecraft:nbt", null, null),
|
||||
new Parser("minecraft:nbt_tag", null, null),
|
||||
new Parser("minecraft:nbt_path", null, null),
|
||||
new Parser("minecraft:objective", null, null),
|
||||
new Parser("minecraft:objective_criteria", null, null),
|
||||
new Parser("minecraft:operation", null, null),
|
||||
new Parser("minecraft:particle", null, null),
|
||||
new Parser("minecraft:angle", null, null),
|
||||
new Parser("minecraft:rotation", null, null),
|
||||
new Parser("minecraft:scoreboard_slot", null, null),
|
||||
new Parser("minecraft:score_holder",
|
||||
packetWrapper -> Collections.singletonList(packetWrapper.readByte()),
|
||||
(packetWrapper, properties) -> packetWrapper.writeByte(((Byte) properties.get(0)).intValue())
|
||||
),
|
||||
new Parser("minecraft:swizzle", null, null),
|
||||
new Parser("minecraft:team", null, null),
|
||||
new Parser("minecraft:item_slot", null, null),
|
||||
new Parser("minecraft:resource_location", null, null),
|
||||
new Parser("minecraft:function", null, null),
|
||||
new Parser("minecraft:entity_anchor", null, null),
|
||||
new Parser("minecraft:int_range", null, null),
|
||||
new Parser("minecraft:float_range", null, null),
|
||||
new Parser("minecraft:dimension", null, null),
|
||||
new Parser("minecraft:gamemode", null, null),
|
||||
new Parser("minecraft:time",
|
||||
packetWrapper -> Collections.singletonList(packetWrapper.readInt()),
|
||||
(packetWrapper, properties) -> packetWrapper.writeInt((int) properties.get(0))
|
||||
),
|
||||
new Parser("minecraft:resource_or_tag",
|
||||
packetWrapper -> Collections.singletonList(packetWrapper.readIdentifier()),
|
||||
(packetWrapper, properties) -> packetWrapper.writeIdentifier((ResourceLocation) properties.get(0))
|
||||
),
|
||||
new Parser("minecraft:resource_or_tag_key",
|
||||
packetWrapper -> Collections.singletonList(packetWrapper.readIdentifier()),
|
||||
(packetWrapper, properties) -> packetWrapper.writeIdentifier((ResourceLocation) properties.get(0))
|
||||
),
|
||||
new Parser("minecraft:resource",
|
||||
packetWrapper -> Collections.singletonList(packetWrapper.readIdentifier()),
|
||||
(packetWrapper, properties) -> packetWrapper.writeIdentifier((ResourceLocation) properties.get(0))
|
||||
),
|
||||
new Parser("minecraft:resource_key",
|
||||
packetWrapper -> Collections.singletonList(packetWrapper.readIdentifier()),
|
||||
(packetWrapper, properties) -> packetWrapper.writeIdentifier((ResourceLocation) properties.get(0))
|
||||
),
|
||||
new Parser("minecraft:template_mirror", null, null),
|
||||
new Parser("minecraft:template_rotation", null, null),
|
||||
new Parser("minecraft:heightmap", null, null),
|
||||
new Parser("minecraft:uuid", null, null)
|
||||
);
|
||||
|
||||
public static List<Parser> getParsers() {
|
||||
return parsers;
|
||||
}
|
||||
|
||||
public static final class Parser {
|
||||
private final String name; //not really needed, just for toString or something
|
||||
private final Optional<Function<PacketWrapper<?>, List<Object>>> read;
|
||||
private final Optional<BiConsumer<PacketWrapper<?>, List<Object>>> write;
|
||||
|
||||
public Parser(String name, @Nullable Function<PacketWrapper<?>, List<Object>> read, @Nullable BiConsumer<PacketWrapper<?>, List<Object>> write) {
|
||||
this.name = name;
|
||||
this.read = Optional.ofNullable(read);
|
||||
this.write = Optional.ofNullable(write);
|
||||
}
|
||||
|
||||
public Optional<List<Object>> readProperties(PacketWrapper<?> packetWrapper) {
|
||||
return read.map(fn -> fn.apply(packetWrapper));
|
||||
}
|
||||
|
||||
public void writeProperties(PacketWrapper<?> packetWrapper, List<Object> properties) {
|
||||
write.ifPresent(fn -> fn.accept(packetWrapper, properties));
|
||||
}
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.chat;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.player.PublicProfileKey;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class RemoteChatSession {
|
||||
private final UUID sessionId;
|
||||
private final PublicProfileKey publicProfileKey;
|
||||
|
||||
public RemoteChatSession(UUID sessionId, PublicProfileKey publicProfileKey) {
|
||||
this.sessionId = sessionId;
|
||||
this.publicProfileKey = publicProfileKey;
|
||||
}
|
||||
|
||||
public UUID getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
public PublicProfileKey getPublicProfileKey() {
|
||||
return publicProfileKey;
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.github.retrooper.packetevents.protocol.chat;
|
||||
|
||||
public class SignedCommandArgument {
|
||||
private String argument;
|
||||
private byte[] signature;
|
||||
|
||||
public SignedCommandArgument(String argument, byte[] signature) {
|
||||
this.argument = argument;
|
||||
this.signature = signature;
|
||||
}
|
||||
|
||||
public String getArgument() {
|
||||
return argument;
|
||||
}
|
||||
|
||||
public void setArgument(String argument) {
|
||||
this.argument = argument;
|
||||
}
|
||||
|
||||
public byte[] getSignature() {
|
||||
return signature;
|
||||
}
|
||||
|
||||
public void setSignature(byte[] signature) {
|
||||
this.signature = signature;
|
||||
}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.chat.filter;
|
||||
|
||||
import java.util.BitSet;
|
||||
|
||||
public class FilterMask {
|
||||
public static final FilterMask FULLY_FILTERED;
|
||||
public static final FilterMask PASS_THROUGH;
|
||||
|
||||
static {
|
||||
FULLY_FILTERED = new FilterMask(new BitSet(0), FilterMaskType.FULLY_FILTERED);
|
||||
PASS_THROUGH = new FilterMask(new BitSet(0), FilterMaskType.PASS_THROUGH);
|
||||
}
|
||||
|
||||
private final BitSet mask;
|
||||
private final FilterMaskType type;
|
||||
|
||||
private FilterMask(BitSet mask, FilterMaskType type) {
|
||||
this.type = type;
|
||||
this.mask = mask;
|
||||
}
|
||||
|
||||
public FilterMask(BitSet mask) {
|
||||
this.type = FilterMaskType.PARTIALLY_FILTERED;
|
||||
this.mask = mask;
|
||||
}
|
||||
|
||||
public BitSet getMask() {
|
||||
return mask;
|
||||
}
|
||||
|
||||
public FilterMaskType getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.chat.filter;
|
||||
|
||||
public enum FilterMaskType {
|
||||
PASS_THROUGH,
|
||||
FULLY_FILTERED,
|
||||
PARTIALLY_FILTERED;
|
||||
|
||||
public static final FilterMaskType[] VALUES = values();
|
||||
|
||||
public int getId() {
|
||||
return ordinal();
|
||||
}
|
||||
|
||||
public static FilterMaskType getById(int id) {
|
||||
return VALUES[id];
|
||||
}
|
||||
}
|
||||
+19
-17
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 retrooper and contributors
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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
|
||||
@@ -16,31 +16,33 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.github.retrooper.packetevents.packetwrappers.play.in.setcreativeslot;
|
||||
package com.github.retrooper.packetevents.protocol.chat.message;
|
||||
|
||||
import io.github.retrooper.packetevents.packetwrappers.NMSPacket;
|
||||
import io.github.retrooper.packetevents.packetwrappers.WrappedPacket;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import com.github.retrooper.packetevents.protocol.chat.ChatType;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
public class WrappedPacketInSetCreativeSlot extends WrappedPacket {
|
||||
public class ChatMessage {
|
||||
private Component chatContent;
|
||||
private ChatType type;
|
||||
|
||||
public WrappedPacketInSetCreativeSlot(final NMSPacket packet) {
|
||||
super(packet);
|
||||
protected ChatMessage(Component chatContent, ChatType type) {
|
||||
this.chatContent = chatContent;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getSlot() {
|
||||
return readInt(0);
|
||||
public Component getChatContent() {
|
||||
return chatContent;
|
||||
}
|
||||
|
||||
public void setSlot(int value) {
|
||||
writeInt(0, value);
|
||||
public ChatType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public ItemStack getClickedItem() {
|
||||
return readItemStack(0);
|
||||
public void setChatContent(Component chatContent) {
|
||||
this.chatContent = chatContent;
|
||||
}
|
||||
|
||||
public void setClickedItem(ItemStack stack) {
|
||||
writeItemStack(0, stack);
|
||||
public void setType(ChatType type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.chat.message;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.chat.ChatType;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
public class ChatMessageLegacy extends ChatMessage {
|
||||
public ChatMessageLegacy(Component chatContent, ChatType type) {
|
||||
super(chatContent, type);
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.chat.message;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.chat.ChatType;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class ChatMessage_v1_16 extends ChatMessage {
|
||||
private UUID senderUUID;
|
||||
|
||||
public ChatMessage_v1_16(Component chatContent, ChatType type, UUID senderUUID) {
|
||||
super(chatContent, type);
|
||||
this.senderUUID = senderUUID;
|
||||
}
|
||||
|
||||
public UUID getSenderUUID() {
|
||||
return senderUUID;
|
||||
}
|
||||
|
||||
public void setSenderUUID(UUID senderUUID) {
|
||||
this.senderUUID = senderUUID;
|
||||
}
|
||||
}
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.chat.message;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.chat.ChatType;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.UUID;
|
||||
//We'll extend ChatMessage_v1_16 for now, hopefully no breaking changes in the future
|
||||
public class ChatMessage_v1_19 extends ChatMessage_v1_16 {
|
||||
private @Nullable Component unsignedChatContent;
|
||||
private Component senderDisplayName;
|
||||
private @Nullable Component teamName;
|
||||
private Instant timestamp;
|
||||
private long salt;
|
||||
private byte[] signature;
|
||||
|
||||
public ChatMessage_v1_19(Component chatContent, @Nullable Component unsignedChatContent, ChatType type,
|
||||
UUID senderUUID, Component senderDisplayName, @Nullable Component teamName, Instant timestamp,
|
||||
long salt, byte[] signature) {
|
||||
super(chatContent, type, senderUUID);
|
||||
this.unsignedChatContent = unsignedChatContent;
|
||||
this.senderDisplayName = senderDisplayName;
|
||||
this.teamName = teamName;
|
||||
this.timestamp = timestamp;
|
||||
this.salt = salt;
|
||||
this.signature = signature;
|
||||
}
|
||||
|
||||
public @Nullable Component getUnsignedChatContent() {
|
||||
return unsignedChatContent;
|
||||
}
|
||||
|
||||
public Component getSenderDisplayName() {
|
||||
return senderDisplayName;
|
||||
}
|
||||
|
||||
public @Nullable Component getTeamName() {
|
||||
return teamName;
|
||||
}
|
||||
|
||||
public Instant getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public long getSalt() {
|
||||
return salt;
|
||||
}
|
||||
|
||||
public byte[] getSignature() {
|
||||
return signature;
|
||||
}
|
||||
|
||||
public void setUnsignedChatContent(@Nullable Component unsignedChatContent) {
|
||||
this.unsignedChatContent = unsignedChatContent;
|
||||
}
|
||||
|
||||
public void setSenderDisplayName(Component senderDisplayName) {
|
||||
this.senderDisplayName = senderDisplayName;
|
||||
}
|
||||
|
||||
public void setTeamName(@Nullable Component teamName) {
|
||||
this.teamName = teamName;
|
||||
}
|
||||
|
||||
public void setTimestamp(Instant timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
public void setSalt(long salt) {
|
||||
this.salt = salt;
|
||||
}
|
||||
|
||||
public void setSignature(byte[] signature) {
|
||||
this.signature = signature;
|
||||
}
|
||||
}
|
||||
+181
@@ -0,0 +1,181 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.chat.message;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.chat.ChatType;
|
||||
import com.github.retrooper.packetevents.protocol.chat.LastSeenMessages;
|
||||
import com.github.retrooper.packetevents.protocol.chat.filter.FilterMask;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.UUID;
|
||||
//We'll extend ChatMessage_v1_16 for now, hopefully no breaking changes in the future
|
||||
public class ChatMessage_v1_19_1 extends ChatMessage_v1_16 {
|
||||
private String plainContent;
|
||||
private @Nullable Component unsignedChatContent;
|
||||
private ChatTypeBoundNetwork chatType;
|
||||
private byte @Nullable [] previousSignature;
|
||||
private byte[] signature;
|
||||
private Instant timestamp;
|
||||
private long salt;
|
||||
private LastSeenMessages lastSeenMessages;
|
||||
private FilterMask filterMask;
|
||||
|
||||
public ChatMessage_v1_19_1(String plainContent, Component decoratedChatContent,
|
||||
@Nullable Component unsignedChatContent,
|
||||
UUID senderUUID, ChatTypeBoundNetwork chatType,
|
||||
byte @Nullable [] previousSignature, byte[] signature,
|
||||
Instant timestamp, long salt,
|
||||
LastSeenMessages lastSeenMessages,
|
||||
FilterMask filterMask) {
|
||||
super(decoratedChatContent, chatType.getType(), senderUUID);
|
||||
this.plainContent = plainContent;
|
||||
this.unsignedChatContent = unsignedChatContent;
|
||||
this.chatType = chatType;
|
||||
this.previousSignature = previousSignature;
|
||||
this.signature = signature;
|
||||
this.timestamp = timestamp;
|
||||
this.salt = salt;
|
||||
this.lastSeenMessages = lastSeenMessages;
|
||||
this.filterMask = filterMask;
|
||||
}
|
||||
|
||||
public String getPlainContent() {
|
||||
return plainContent;
|
||||
}
|
||||
|
||||
public void setPlainContent(String plainContent) {
|
||||
this.plainContent = plainContent;
|
||||
}
|
||||
|
||||
public boolean isChatContentDecorated() {
|
||||
return !getChatContent().equals(Component.text(plainContent));
|
||||
}
|
||||
|
||||
public @Nullable Component getUnsignedChatContent() {
|
||||
return unsignedChatContent;
|
||||
}
|
||||
|
||||
public void setUnsignedChatContent(@Nullable Component unsignedChatContent) {
|
||||
this.unsignedChatContent = unsignedChatContent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChatType getType() {
|
||||
return chatType.getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setType(ChatType type) {
|
||||
chatType.setType(type);
|
||||
}
|
||||
|
||||
public ChatTypeBoundNetwork getChatType() {
|
||||
return chatType;
|
||||
}
|
||||
|
||||
public void setChatType(ChatTypeBoundNetwork type) {
|
||||
this.chatType = type;
|
||||
}
|
||||
|
||||
public byte @Nullable [] getPreviousSignature() {
|
||||
return previousSignature;
|
||||
}
|
||||
|
||||
public void setPreviousSignature(byte @Nullable [] previousSignature) {
|
||||
this.previousSignature = previousSignature;
|
||||
}
|
||||
|
||||
public byte[] getSignature() {
|
||||
return signature;
|
||||
}
|
||||
|
||||
public void setSignature(byte[] signature) {
|
||||
this.signature = signature;
|
||||
}
|
||||
|
||||
public Instant getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public void setTimestamp(Instant timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
public long getSalt() {
|
||||
return salt;
|
||||
}
|
||||
|
||||
public void setSalt(long salt) {
|
||||
this.salt = salt;
|
||||
}
|
||||
|
||||
public LastSeenMessages getLastSeenMessages() {
|
||||
return lastSeenMessages;
|
||||
}
|
||||
|
||||
public void setLastSeenMessages(LastSeenMessages lastSeenMessages) {
|
||||
this.lastSeenMessages = lastSeenMessages;
|
||||
}
|
||||
|
||||
public FilterMask getFilterMask() {
|
||||
return filterMask;
|
||||
}
|
||||
|
||||
public void setFilterMask(FilterMask filterMask) {
|
||||
this.filterMask = filterMask;
|
||||
}
|
||||
|
||||
public static class ChatTypeBoundNetwork {
|
||||
private ChatType type;
|
||||
private Component name;
|
||||
private @Nullable Component targetName;
|
||||
|
||||
public ChatTypeBoundNetwork(ChatType type, Component name, @Nullable Component targetName) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
this.targetName = targetName;
|
||||
}
|
||||
|
||||
public ChatType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(ChatType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Component getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(Component name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public @Nullable Component getTargetName() {
|
||||
return targetName;
|
||||
}
|
||||
|
||||
public void setTargetName(@Nullable Component targetName) {
|
||||
this.targetName = targetName;
|
||||
}
|
||||
}
|
||||
}
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
package com.github.retrooper.packetevents.protocol.chat.message;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.chat.LastSeenMessages;
|
||||
import com.github.retrooper.packetevents.protocol.chat.filter.FilterMask;
|
||||
import com.github.retrooper.packetevents.util.adventure.AdventureSerializer;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
//We'll extend ChatMessage_v1_16 for now, hopefully no breaking changes in the future
|
||||
public class ChatMessage_v1_19_3 extends ChatMessage_v1_16 {
|
||||
int index;
|
||||
byte[] signature;
|
||||
String plainContent;
|
||||
Instant timestamp;
|
||||
long salt;
|
||||
LastSeenMessages.Packed lastSeenMessagesPacked;
|
||||
@Nullable Component unsignedChatContent;
|
||||
FilterMask filterMask;
|
||||
ChatMessage_v1_19_1.ChatTypeBoundNetwork chatType;
|
||||
|
||||
public ChatMessage_v1_19_3(UUID senderUUID, int index, byte[] signature, String plainContent, Instant timestamp, long salt, LastSeenMessages.Packed lastSeenMessagesPacked, @Nullable Component unsignedChatContent, FilterMask filterMask, ChatMessage_v1_19_1.ChatTypeBoundNetwork chatType) {
|
||||
super(Component.text(plainContent), chatType.getType(), senderUUID);
|
||||
this.index = index;
|
||||
this.signature = signature;
|
||||
this.plainContent = plainContent;
|
||||
this.timestamp = timestamp;
|
||||
this.salt = salt;
|
||||
this.lastSeenMessagesPacked = lastSeenMessagesPacked;
|
||||
this.unsignedChatContent = unsignedChatContent;
|
||||
this.filterMask = filterMask;
|
||||
this.chatType = chatType;
|
||||
}
|
||||
|
||||
public int getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
public void setIndex(int index) {
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
public byte[] getSignature() {
|
||||
return signature;
|
||||
}
|
||||
|
||||
public void setSignature(byte[] signature) {
|
||||
this.signature = signature;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getChatContent() {
|
||||
return Component.text(plainContent);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public void setChatContent(Component chatContent) {
|
||||
throw new UnsupportedOperationException("PacketEvents is not able to serialize components to plain-text. Please use the #setPlainContent instead to update the content.");
|
||||
}
|
||||
|
||||
public String getPlainContent() {
|
||||
return plainContent;
|
||||
}
|
||||
|
||||
public void setPlainContent(String plainContent) {
|
||||
this.plainContent = plainContent;
|
||||
}
|
||||
|
||||
public Instant getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public void setTimestamp(Instant timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
public long getSalt() {
|
||||
return salt;
|
||||
}
|
||||
|
||||
public void setSalt(long salt) {
|
||||
this.salt = salt;
|
||||
}
|
||||
|
||||
public LastSeenMessages.Packed getLastSeenMessagesPacked() {
|
||||
return lastSeenMessagesPacked;
|
||||
}
|
||||
|
||||
public void setLastSeenMessagesPacked(LastSeenMessages.Packed lastSeenMessagesPacked) {
|
||||
this.lastSeenMessagesPacked = lastSeenMessagesPacked;
|
||||
}
|
||||
|
||||
public Optional<Component> getUnsignedChatContent() {
|
||||
return Optional.ofNullable(unsignedChatContent);
|
||||
}
|
||||
|
||||
public void setUnsignedChatContent(@Nullable Component unsignedChatContent) {
|
||||
this.unsignedChatContent = unsignedChatContent;
|
||||
}
|
||||
|
||||
public FilterMask getFilterMask() {
|
||||
return filterMask;
|
||||
}
|
||||
|
||||
public void setFilterMask(FilterMask filterMask) {
|
||||
this.filterMask = filterMask;
|
||||
}
|
||||
|
||||
public ChatMessage_v1_19_1.ChatTypeBoundNetwork getChatType() {
|
||||
return chatType;
|
||||
}
|
||||
|
||||
public void setChatType(ChatMessage_v1_19_1.ChatTypeBoundNetwork chatType) {
|
||||
this.chatType = chatType;
|
||||
}
|
||||
}
|
||||
+8
-11
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 retrooper and contributors
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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
|
||||
@@ -16,17 +16,14 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.github.retrooper.packetevents.event.manager;
|
||||
package com.github.retrooper.packetevents.protocol.chat.message.reader;
|
||||
|
||||
/**
|
||||
* Class storing a static instance of the dynamic and the legacy event manager.
|
||||
*
|
||||
* @author retrooper
|
||||
* @since 1.8
|
||||
*/
|
||||
public class PEEventManager implements EventManager {
|
||||
import com.github.retrooper.packetevents.protocol.chat.message.ChatMessage;
|
||||
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public static final EventManagerLegacy EVENT_MANAGER_LEGACY = new EventManagerLegacy();
|
||||
public static final EventManagerModern EVENT_MANAGER_MODERN = new EventManagerModern();
|
||||
public interface ChatMessageProcessor {
|
||||
ChatMessage readChatMessage(@NotNull PacketWrapper<?> wrapper);
|
||||
|
||||
void writeChatMessage(@NotNull PacketWrapper<?> wrapper, @NotNull ChatMessage data);
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.chat.message.reader.impl;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.chat.ChatType;
|
||||
import com.github.retrooper.packetevents.protocol.chat.ChatTypes;
|
||||
import com.github.retrooper.packetevents.protocol.chat.message.ChatMessage;
|
||||
import com.github.retrooper.packetevents.protocol.chat.message.ChatMessageLegacy;
|
||||
import com.github.retrooper.packetevents.protocol.chat.message.reader.ChatMessageProcessor;
|
||||
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ChatMessageProcessorLegacy implements ChatMessageProcessor {
|
||||
@Override
|
||||
public ChatMessage readChatMessage(@NotNull PacketWrapper<?> wrapper) {
|
||||
Component chatContent = wrapper.readComponent();
|
||||
int id = wrapper.readByte();
|
||||
ChatType type = ChatTypes.getById(wrapper.getServerVersion().toClientVersion(), id);
|
||||
return new ChatMessageLegacy(chatContent, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeChatMessage(@NotNull PacketWrapper<?> wrapper, @NotNull ChatMessage data) {
|
||||
wrapper.writeComponent(data.getChatContent());
|
||||
wrapper.writeByte(data.getType().getId(wrapper.getServerVersion().toClientVersion()));
|
||||
}
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.chat.message.reader.impl;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.chat.ChatType;
|
||||
import com.github.retrooper.packetevents.protocol.chat.ChatTypes;
|
||||
import com.github.retrooper.packetevents.protocol.chat.message.ChatMessage;
|
||||
import com.github.retrooper.packetevents.protocol.chat.message.ChatMessage_v1_16;
|
||||
import com.github.retrooper.packetevents.protocol.chat.message.reader.ChatMessageProcessor;
|
||||
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class ChatMessageProcessor_v1_16 implements ChatMessageProcessor {
|
||||
@Override
|
||||
public ChatMessage readChatMessage(@NotNull PacketWrapper<?> wrapper) {
|
||||
Component chatContent = wrapper.readComponent();
|
||||
int id = wrapper.readByte();
|
||||
ChatType type = ChatTypes.getById(wrapper.getServerVersion().toClientVersion(), id);
|
||||
UUID senderUUID = wrapper.readUUID();
|
||||
return new ChatMessage_v1_16(chatContent, type, senderUUID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeChatMessage(@NotNull PacketWrapper<?> wrapper, @NotNull ChatMessage data) {
|
||||
wrapper.writeComponent(data.getChatContent());
|
||||
wrapper.writeByte(data.getType().getId(wrapper.getServerVersion().toClientVersion()));
|
||||
wrapper.writeUUID(((ChatMessage_v1_16) data).getSenderUUID());
|
||||
}
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.chat.message.reader.impl;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.chat.ChatType;
|
||||
import com.github.retrooper.packetevents.protocol.chat.ChatTypes;
|
||||
import com.github.retrooper.packetevents.protocol.chat.message.ChatMessage;
|
||||
import com.github.retrooper.packetevents.protocol.chat.message.ChatMessage_v1_19;
|
||||
import com.github.retrooper.packetevents.protocol.chat.message.reader.ChatMessageProcessor;
|
||||
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ChatMessageProcessor_v1_19 implements ChatMessageProcessor {
|
||||
@Override
|
||||
public ChatMessage readChatMessage(@NotNull PacketWrapper<?> wrapper) {
|
||||
Component chatContent = wrapper.readComponent();
|
||||
Component unsignedChatContent = wrapper.readOptional(PacketWrapper::readComponent);
|
||||
int id = wrapper.readVarInt();
|
||||
ChatType type = ChatTypes.getById(wrapper.getServerVersion().toClientVersion(), id);
|
||||
UUID senderUUID = wrapper.readUUID();
|
||||
Component senderDisplayName = wrapper.readComponent();
|
||||
@Nullable Component teamName = wrapper.readOptional(PacketWrapper::readComponent);
|
||||
Instant timestamp = wrapper.readTimestamp();
|
||||
long salt = wrapper.readLong();
|
||||
byte[] signature = wrapper.readByteArray();
|
||||
return new ChatMessage_v1_19(chatContent, unsignedChatContent, type, senderUUID, senderDisplayName, teamName,
|
||||
timestamp, salt, signature);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeChatMessage(@NotNull PacketWrapper<?> wrapper, @NotNull ChatMessage data) {
|
||||
ChatMessage_v1_19 newData = (ChatMessage_v1_19) data;
|
||||
wrapper.writeComponent(newData.getChatContent());
|
||||
wrapper.writeOptional(newData.getUnsignedChatContent(), PacketWrapper::writeComponent);
|
||||
wrapper.writeVarInt(newData.getType().getId(wrapper.getServerVersion().toClientVersion()));
|
||||
wrapper.writeUUID(newData.getSenderUUID());
|
||||
wrapper.writeComponent(newData.getSenderDisplayName());
|
||||
wrapper.writeOptional(newData.getTeamName(), PacketWrapper::writeComponent);
|
||||
wrapper.writeTimestamp(newData.getTimestamp());
|
||||
wrapper.writeLong(newData.getSalt());
|
||||
wrapper.writeByteArray(newData.getSignature());
|
||||
}
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.chat.message.reader.impl;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.chat.ChatType;
|
||||
import com.github.retrooper.packetevents.protocol.chat.ChatTypes;
|
||||
import com.github.retrooper.packetevents.protocol.chat.LastSeenMessages;
|
||||
import com.github.retrooper.packetevents.protocol.chat.filter.FilterMask;
|
||||
import com.github.retrooper.packetevents.protocol.chat.message.ChatMessage;
|
||||
import com.github.retrooper.packetevents.protocol.chat.message.ChatMessage_v1_19_1;
|
||||
import com.github.retrooper.packetevents.protocol.chat.message.reader.ChatMessageProcessor;
|
||||
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ChatMessageProcessor_v1_19_1 implements ChatMessageProcessor {
|
||||
@Override
|
||||
public ChatMessage readChatMessage(@NotNull PacketWrapper<?> wrapper) {
|
||||
byte[] previousSignature = wrapper.readOptional(PacketWrapper::readByteArray);
|
||||
UUID senderUUID = wrapper.readUUID();
|
||||
byte[] signature = wrapper.readByteArray();
|
||||
String plainContent = wrapper.readString(256);
|
||||
Component chatContent = wrapper.readOptional(PacketWrapper::readComponent);
|
||||
if (chatContent == null && plainContent.isEmpty()) {
|
||||
chatContent = Component.empty();
|
||||
} else if (chatContent == null) {
|
||||
chatContent = Component.text(plainContent);
|
||||
}
|
||||
Instant timestamp = wrapper.readTimestamp();
|
||||
long salt = wrapper.readLong();
|
||||
LastSeenMessages lastSeenMessages = wrapper.readLastSeenMessages();
|
||||
Component unsignedChatContent = wrapper.readOptional(PacketWrapper::readComponent);
|
||||
FilterMask filterMask = wrapper.readFilterMask();
|
||||
ChatMessage_v1_19_1.ChatTypeBoundNetwork chatType = wrapper.readChatTypeBoundNetwork();
|
||||
return new ChatMessage_v1_19_1(plainContent, chatContent, unsignedChatContent, senderUUID, chatType,
|
||||
previousSignature, signature, timestamp, salt, lastSeenMessages, filterMask);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeChatMessage(@NotNull PacketWrapper<?> wrapper, @NotNull ChatMessage data) {
|
||||
ChatMessage_v1_19_1 newData = (ChatMessage_v1_19_1) data;
|
||||
wrapper.writeOptional(newData.getPreviousSignature(), PacketWrapper::writeByteArray);
|
||||
wrapper.writeUUID(newData.getSenderUUID());
|
||||
wrapper.writeByteArray(newData.getSignature());
|
||||
wrapper.writeString(newData.getPlainContent(), 256);
|
||||
wrapper.writeOptional(newData.getChatContent(), PacketWrapper::writeComponent);
|
||||
wrapper.writeTimestamp(newData.getTimestamp());
|
||||
wrapper.writeLong(newData.getSalt());
|
||||
wrapper.writeLastSeenMessages(newData.getLastSeenMessages());
|
||||
wrapper.writeOptional(newData.getUnsignedChatContent(), PacketWrapper::writeComponent);
|
||||
wrapper.writeFilterMask(newData.getFilterMask());
|
||||
wrapper.writeChatTypeBoundNetwork(newData.getChatType());
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
package com.github.retrooper.packetevents.protocol.chat.message.reader.impl;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.chat.LastSeenMessages;
|
||||
import com.github.retrooper.packetevents.protocol.chat.filter.FilterMask;
|
||||
import com.github.retrooper.packetevents.protocol.chat.message.ChatMessage;
|
||||
import com.github.retrooper.packetevents.protocol.chat.message.ChatMessage_v1_19_1;
|
||||
import com.github.retrooper.packetevents.protocol.chat.message.ChatMessage_v1_19_3;
|
||||
import com.github.retrooper.packetevents.protocol.chat.message.reader.ChatMessageProcessor;
|
||||
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ChatMessageProcessor_v1_19_3 implements ChatMessageProcessor {
|
||||
@Override
|
||||
public ChatMessage readChatMessage(@NotNull PacketWrapper<?> wrapper) {
|
||||
UUID senderUUID = wrapper.readUUID();
|
||||
int index = wrapper.readVarInt();
|
||||
byte[] signature = wrapper.readOptional((w) -> w.readBytes(256));
|
||||
String plainContent = wrapper.readString(256);
|
||||
Instant timestamp = wrapper.readTimestamp();
|
||||
long salt = wrapper.readLong();
|
||||
LastSeenMessages.Packed lastSeenMessagesPacked = wrapper.readLastSeenMessagesPacked();
|
||||
Component unsignedChatContent = wrapper.readOptional(PacketWrapper::readComponent);
|
||||
FilterMask filterMask = wrapper.readFilterMask();
|
||||
ChatMessage_v1_19_1.ChatTypeBoundNetwork chatType = wrapper.readChatTypeBoundNetwork();
|
||||
|
||||
return new ChatMessage_v1_19_3(senderUUID, index, signature, plainContent, timestamp, salt, lastSeenMessagesPacked, unsignedChatContent, filterMask, chatType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeChatMessage(@NotNull PacketWrapper<?> wrapper, @NotNull ChatMessage data) {
|
||||
ChatMessage_v1_19_3 newData = (ChatMessage_v1_19_3) data;
|
||||
wrapper.writeUUID(newData.getSenderUUID());
|
||||
wrapper.writeVarInt(newData.getIndex());
|
||||
wrapper.writeOptional(newData.getSignature(), PacketWrapper::writeBytes);
|
||||
wrapper.writeString(newData.getPlainContent());
|
||||
wrapper.writeTimestamp(newData.getTimestamp());
|
||||
wrapper.writeLong(newData.getSalt());
|
||||
wrapper.writeLastSeenMessagesPacked(newData.getLastSeenMessagesPacked());
|
||||
wrapper.writeOptional(newData.getUnsignedChatContent().orElse(null), PacketWrapper::writeComponent);
|
||||
wrapper.writeFilterMask(newData.getFilterMask());
|
||||
wrapper.writeChatTypeBoundNetwork(newData.getChatType());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2024 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.color;
|
||||
|
||||
import net.kyori.adventure.util.RGBLike;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Range;
|
||||
|
||||
public final class Color implements RGBLike {
|
||||
|
||||
private static final int BIT_MASK = 0xFF;
|
||||
|
||||
private final int red, green, blue;
|
||||
|
||||
public Color(@Range(from = 0L, to = 255L) int red, @Range(from = 0L, to = 255L) int green, @Range(from = 0L, to = 255L) int blue) {
|
||||
this.red = red;
|
||||
this.green = green;
|
||||
this.blue = blue;
|
||||
}
|
||||
|
||||
public Color(int rgb) {
|
||||
this((rgb >> 16) & BIT_MASK, (rgb >> 8) & BIT_MASK, rgb & BIT_MASK);
|
||||
}
|
||||
|
||||
public @NotNull Color withRed(@Range(from = 0L, to = 255L) int red) {
|
||||
return new Color(red, green, blue);
|
||||
}
|
||||
|
||||
public @NotNull Color withGreen(@Range(from = 0L, to = 255L) int green) {
|
||||
return new Color(red, green, blue);
|
||||
}
|
||||
|
||||
public @NotNull Color withBlue(@Range(from = 0L, to = 255L) int blue) {
|
||||
return new Color(red, green, blue);
|
||||
}
|
||||
|
||||
public int asRGB() {
|
||||
int rgb = red;
|
||||
rgb = (rgb << 8) + green;
|
||||
return (rgb << 8) + blue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Range(from = 0L, to = 255L) int red() {
|
||||
return red;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Range(from = 0L, to = 255L) int green() {
|
||||
return green;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Range(from = 0L, to = 255L) int blue() {
|
||||
return blue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2024 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.color;
|
||||
|
||||
import net.kyori.adventure.util.RGBLike;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public enum DyeColor implements RGBLike {
|
||||
WHITE(new Color(0xf9fffe), new Color(0xffffff), new Color(0xf0f0f0), 8),
|
||||
|
||||
ORANGE(new Color(0xf9801d), new Color(0xff681f), new Color(0xeb8844), 15),
|
||||
|
||||
MAGENTA(new Color(0xc74ebd), new Color(0xff00ff), new Color(0xc354cd), 16),
|
||||
|
||||
LIGHT_BLUE(new Color(0x3ab3da), new Color(0x9ac0cd), new Color(0x6689d3), 17),
|
||||
|
||||
YELLOW(new Color(0xfed83d), new Color(0xffff00), new Color(0xdecf2a), 18),
|
||||
|
||||
LIME(new Color(0x80c71f), new Color(0xbfff00), new Color(0x41cd34), 19),
|
||||
|
||||
PINK(new Color(0xf38baa), new Color(0xff69b4), new Color(0xd88198), 20),
|
||||
|
||||
GRAY(new Color(0x474f52), new Color(0x808080), new Color(0x434343), 21),
|
||||
|
||||
LIGHT_GRAY(new Color(0x9d9d97), new Color(0xd3d3d3), new Color(0xababab), 22),
|
||||
|
||||
CYAN(new Color(0x169c9c), new Color(0xffff), new Color(0x287697), 23),
|
||||
|
||||
PURPLE(new Color(0x8932b8), new Color(0xa020f0), new Color(0x7b2fbe), 24),
|
||||
|
||||
BLUE(new Color(0x3c44aa), new Color(0xff), new Color(0x253192), 25),
|
||||
|
||||
BROWN(new Color(0x835432), new Color(0x8b4513), new Color(0x51301a), 26),
|
||||
|
||||
GREEN(new Color(0x5e7c16), new Color(0xff00), new Color(0x3b511a), 27),
|
||||
|
||||
RED(new Color(0xb02e26), new Color(0xff0000), new Color(0xb3312c), 28),
|
||||
|
||||
BLACK(new Color(0x1d1d21), new Color(0x0), new Color(0x1e1b1b), 29);
|
||||
|
||||
private final Color textureDiffuseColor;
|
||||
|
||||
private final Color textColor;
|
||||
|
||||
private final Color fireworkColor;
|
||||
|
||||
private final int mapColorId;
|
||||
|
||||
DyeColor(@NotNull Color textureDiffuseColor, @NotNull Color textColor,
|
||||
@NotNull Color fireworkColor, int mapColorId) {
|
||||
this.textureDiffuseColor = textureDiffuseColor;
|
||||
this.textColor = textColor;
|
||||
this.fireworkColor = fireworkColor;
|
||||
this.mapColorId = mapColorId;
|
||||
}
|
||||
|
||||
public @NotNull Color color() {
|
||||
return this.textureDiffuseColor;
|
||||
}
|
||||
|
||||
public @NotNull Color textColor() {
|
||||
return this.textColor;
|
||||
}
|
||||
|
||||
public @NotNull Color fireworkColor() {
|
||||
return this.fireworkColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int red() {
|
||||
return this.textureDiffuseColor.red();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int green() {
|
||||
return this.textureDiffuseColor.green();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int blue() {
|
||||
return this.textureDiffuseColor.blue();
|
||||
}
|
||||
|
||||
public int mapColorId() {
|
||||
return this.mapColorId;
|
||||
}
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.entity.data;
|
||||
|
||||
public class EntityData {
|
||||
private int index;
|
||||
private EntityDataType<?> type;
|
||||
private Object value;
|
||||
|
||||
public EntityData(int index, EntityDataType<?> type, Object value) {
|
||||
this.index = index;
|
||||
this.type = type;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
public void setIndex(int index) {
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
public EntityDataType<?> getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(EntityDataType<?> type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(Object value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.entity.data;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
|
||||
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
|
||||
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class EntityDataType<T> {
|
||||
private final String name;
|
||||
private final int[] ids;
|
||||
private final Function<PacketWrapper<?>, T> dataDeserializer;
|
||||
private final BiConsumer<PacketWrapper<?>, Object> dataSerializer;
|
||||
|
||||
public EntityDataType(String name, int[] ids, Function<PacketWrapper<?>, T> dataDeserializer, BiConsumer<PacketWrapper<?>, Object> dataSerializer) {
|
||||
this.name = name;
|
||||
this.ids = ids;
|
||||
this.dataDeserializer = dataDeserializer;
|
||||
this.dataSerializer = dataSerializer;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getId(ClientVersion version) {
|
||||
int index = EntityDataTypes.TYPES_BUILDER.getDataIndex(version);
|
||||
return ids[index];
|
||||
}
|
||||
|
||||
public Function<PacketWrapper<?>, T> getDataDeserializer() {
|
||||
return dataDeserializer;
|
||||
}
|
||||
|
||||
public BiConsumer<PacketWrapper<?>, Object> getDataSerializer() {
|
||||
return dataSerializer;
|
||||
}
|
||||
}
|
||||
+370
@@ -0,0 +1,370 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.entity.data;
|
||||
|
||||
import com.github.retrooper.packetevents.PacketEvents;
|
||||
import com.github.retrooper.packetevents.manager.server.ServerVersion;
|
||||
import com.github.retrooper.packetevents.protocol.entity.pose.EntityPose;
|
||||
import com.github.retrooper.packetevents.protocol.entity.sniffer.SnifferState;
|
||||
import com.github.retrooper.packetevents.protocol.entity.villager.VillagerData;
|
||||
import com.github.retrooper.packetevents.protocol.item.ItemStack;
|
||||
import com.github.retrooper.packetevents.protocol.nbt.NBTCompound;
|
||||
import com.github.retrooper.packetevents.protocol.particle.Particle;
|
||||
import com.github.retrooper.packetevents.protocol.particle.type.ParticleType;
|
||||
import com.github.retrooper.packetevents.protocol.particle.type.ParticleTypes;
|
||||
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
|
||||
import com.github.retrooper.packetevents.protocol.world.BlockFace;
|
||||
import com.github.retrooper.packetevents.protocol.world.WorldBlockPosition;
|
||||
import com.github.retrooper.packetevents.resources.ResourceLocation;
|
||||
import com.github.retrooper.packetevents.util.Quaternion4f;
|
||||
import com.github.retrooper.packetevents.util.TypesBuilder;
|
||||
import com.github.retrooper.packetevents.util.TypesBuilderData;
|
||||
import com.github.retrooper.packetevents.util.Vector3f;
|
||||
import com.github.retrooper.packetevents.util.Vector3i;
|
||||
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class EntityDataTypes {
|
||||
//1.7 -> 1.18 block_position is just 3 ints, not serialized with a long
|
||||
//short was removed in 1.9+
|
||||
//boolean was added in 1.9
|
||||
//nbt was added in 1.12
|
||||
|
||||
private static final Map<String, EntityDataType<?>> ENTITY_DATA_TYPE_MAP = new HashMap<>();
|
||||
private static final Map<Byte, Map<Integer, EntityDataType<?>>> ENTITY_DATA_TYPE_ID_MAP = new HashMap<>();
|
||||
protected static final TypesBuilder TYPES_BUILDER = new TypesBuilder("entity/entity_data_type_mappings",
|
||||
ClientVersion.V_1_8,
|
||||
ClientVersion.V_1_9,
|
||||
ClientVersion.V_1_11,
|
||||
ClientVersion.V_1_13,
|
||||
ClientVersion.V_1_14,
|
||||
ClientVersion.V_1_19,
|
||||
ClientVersion.V_1_19_3,
|
||||
ClientVersion.V_1_19_4);
|
||||
|
||||
public static final EntityDataType<Byte> BYTE = define("byte", PacketWrapper::readByte, PacketWrapper::writeByte);
|
||||
|
||||
public static final EntityDataType<Short> SHORT = define("short", PacketWrapper::readShort, PacketWrapper::writeShort);
|
||||
|
||||
public static final EntityDataType<Integer> INT = define("int", wrapper -> {
|
||||
if (wrapper.getServerVersion().isNewerThanOrEquals(ServerVersion.V_1_9)) {
|
||||
return wrapper.readVarInt();
|
||||
} else {
|
||||
return wrapper.readInt();
|
||||
}
|
||||
}, (wrapper, value) -> {
|
||||
if (wrapper.getServerVersion().isNewerThanOrEquals(ServerVersion.V_1_9)) {
|
||||
wrapper.writeVarInt(value);
|
||||
} else {
|
||||
wrapper.writeInt(value);
|
||||
}
|
||||
});
|
||||
|
||||
public static final EntityDataType<Long> LONG = define("long", PacketWrapper::readVarLong, PacketWrapper::writeVarLong);
|
||||
|
||||
public static final EntityDataType<Float> FLOAT = define("float", PacketWrapper::readFloat, PacketWrapper::writeFloat);
|
||||
|
||||
public static final EntityDataType<String> STRING = define("string", PacketWrapper::readString, PacketWrapper::writeString);
|
||||
|
||||
@Deprecated
|
||||
public static final EntityDataType<String> COMPONENT = define("component", PacketWrapper::readComponentJSON, PacketWrapper::writeComponentJSON);
|
||||
public static final EntityDataType<Component> ADV_COMPONENT = define("component", PacketWrapper::readComponent, PacketWrapper::writeComponent);
|
||||
|
||||
@Deprecated
|
||||
public static final EntityDataType<Optional<String>> OPTIONAL_COMPONENT = define("optional_component", readOptionalComponentJSONDeserializer(), writeOptionalComponentJSONSerializer());
|
||||
public static final EntityDataType<Optional<Component>> OPTIONAL_ADV_COMPONENT = define("optional_component", readOptionalComponentDeserializer(), writeOptionalComponentSerializer());
|
||||
|
||||
public static final EntityDataType<ItemStack> ITEMSTACK = define("itemstack", PacketWrapper::readItemStack, PacketWrapper::writeItemStack);
|
||||
|
||||
public static final EntityDataType<Optional<ItemStack>> OPTIONAL_ITEMSTACK = define("optional_itemstack",
|
||||
(PacketWrapper<?> wrapper) -> Optional.of(wrapper.readItemStack()),
|
||||
(PacketWrapper<?> wrapper, Optional<ItemStack> value) -> wrapper.writeItemStack(value.orElse(null)));
|
||||
|
||||
public static final EntityDataType<Boolean> BOOLEAN = define("boolean", PacketWrapper::readBoolean, PacketWrapper::writeBoolean);
|
||||
|
||||
public static final EntityDataType<Vector3f> ROTATION = define("rotation",
|
||||
(PacketWrapper<?> wrapper) -> new Vector3f(wrapper.readFloat(), wrapper.readFloat(), wrapper.readFloat()),
|
||||
(PacketWrapper<?> wrapper, Vector3f value) -> {
|
||||
wrapper.writeFloat(value.x);
|
||||
wrapper.writeFloat(value.y);
|
||||
wrapper.writeFloat(value.z);
|
||||
});
|
||||
|
||||
public static final EntityDataType<Vector3i> BLOCK_POSITION = define("block_position", (PacketWrapper<?> wrapper) -> {
|
||||
if (wrapper.getServerVersion().isNewerThanOrEquals(ServerVersion.V_1_9)) {
|
||||
return wrapper.readBlockPosition();
|
||||
} else {
|
||||
int x = wrapper.readInt();
|
||||
int y = wrapper.readInt();
|
||||
int z = wrapper.readInt();
|
||||
return new Vector3i(x, y, z);
|
||||
}
|
||||
}, (wrapper, blockPosition) -> {
|
||||
if (wrapper.getServerVersion().isNewerThanOrEquals(ServerVersion.V_1_9)) {
|
||||
wrapper.writeBlockPosition(blockPosition);
|
||||
} else {
|
||||
wrapper.writeInt(blockPosition.getX());
|
||||
wrapper.writeInt(blockPosition.getY());
|
||||
wrapper.writeInt(blockPosition.getZ());
|
||||
}
|
||||
});
|
||||
|
||||
public static final EntityDataType<Optional<Vector3i>> OPTIONAL_BLOCK_POSITION = define("optional_block_position",
|
||||
readOptionalBlockPositionDeserializer(), writeOptionalBlockPositionSerializer());
|
||||
|
||||
public static final EntityDataType<BlockFace> BLOCK_FACE = define("block_face", (PacketWrapper<?> wrapper) -> {
|
||||
int id = wrapper.readVarInt();
|
||||
return BlockFace.getBlockFaceByValue(id);
|
||||
},
|
||||
(PacketWrapper<?> wrapper, BlockFace value) -> wrapper.writeVarInt(value.getFaceValue()));
|
||||
|
||||
public static final EntityDataType<Optional<UUID>> OPTIONAL_UUID = define("optional_uuid",
|
||||
(PacketWrapper<?> wrapper) -> Optional.ofNullable(wrapper.readOptional(PacketWrapper::readUUID)),
|
||||
(PacketWrapper<?> wrapper, Optional<UUID> value) ->
|
||||
wrapper.writeOptional(value.orElse(null), PacketWrapper::writeUUID));
|
||||
|
||||
public static final EntityDataType<Integer> BLOCK_STATE = define("block_state",
|
||||
readIntDeserializer(), writeIntSerializer());
|
||||
|
||||
public static final EntityDataType<Integer> OPTIONAL_BLOCK_STATE = define("optional_block_state", readIntDeserializer(), writeIntSerializer());
|
||||
|
||||
public static final EntityDataType<NBTCompound> NBT = define("nbt", PacketWrapper::readNBT, PacketWrapper::writeNBT);
|
||||
|
||||
public static final EntityDataType<Particle> PARTICLE = define("particle", wrapper -> {
|
||||
int id = wrapper.readVarInt();
|
||||
ParticleType type = ParticleTypes.getById(PacketEvents.getAPI().getServerManager().getVersion().toClientVersion(), id);
|
||||
return new Particle(type, type.readDataFunction().apply(wrapper));
|
||||
}, (wrapper, particle) -> {
|
||||
wrapper.writeVarInt(particle.getType().getId(PacketEvents.getAPI().getServerManager().getVersion().toClientVersion()));
|
||||
particle.getType().writeDataFunction().accept(wrapper, particle.getData());
|
||||
});
|
||||
|
||||
public static final EntityDataType<VillagerData> VILLAGER_DATA = define("villager_data", PacketWrapper::readVillagerData, PacketWrapper::writeVillagerData);
|
||||
|
||||
public static final EntityDataType<Optional<Integer>> OPTIONAL_INT = define("optional_int", (PacketWrapper<?> wrapper) -> {
|
||||
int i = wrapper.readVarInt();
|
||||
return i == 0 ? Optional.empty() : Optional.of(i - 1);
|
||||
}, (PacketWrapper<?> wrapper, Optional<Integer> value) -> {
|
||||
wrapper.writeVarInt(value.orElse(-1) + 1);
|
||||
});
|
||||
|
||||
public static final EntityDataType<EntityPose> ENTITY_POSE = define("entity_pose", (PacketWrapper<?> wrapper) -> {
|
||||
int id = wrapper.readVarInt();
|
||||
return EntityPose.getById(wrapper.getServerVersion().toClientVersion(), id);
|
||||
}, (PacketWrapper<?> wrapper, EntityPose value) -> wrapper.writeVarInt(value.getId(wrapper.getServerVersion().toClientVersion())));
|
||||
|
||||
public static final EntityDataType<Integer> CAT_VARIANT = define("cat_variant_type", readIntDeserializer(), writeIntSerializer());
|
||||
|
||||
public static final EntityDataType<Integer> FROG_VARIANT = define("frog_variant_type", readIntDeserializer(), writeIntSerializer());
|
||||
|
||||
public static final EntityDataType<Optional<WorldBlockPosition>> OPTIONAL_GLOBAL_POSITION = define("optional_global_position",
|
||||
(PacketWrapper<?> wrapper) -> Optional.ofNullable(wrapper.readOptional(w -> new WorldBlockPosition(new ResourceLocation(w.readString(32767)), w.readBlockPosition()))),
|
||||
(PacketWrapper<?> wrapper, Optional<WorldBlockPosition> value) -> wrapper.writeOptional(value.orElse(null), (w, globalPos) -> {
|
||||
w.writeString(globalPos.getWorld().toString());
|
||||
w.writeBlockPosition(globalPos.getBlockPosition());
|
||||
}));
|
||||
|
||||
public static final EntityDataType<Integer> PAINTING_VARIANT_TYPE = define("painting_variant_type", readIntDeserializer(), writeIntSerializer());
|
||||
|
||||
public static final EntityDataType<SnifferState> SNIFFER_STATE = define("sniffer_state", (PacketWrapper<?> wrapper) -> {
|
||||
int id = wrapper.readVarInt();
|
||||
return SnifferState.values()[id];
|
||||
}, (PacketWrapper<?> wrapper, SnifferState value) -> wrapper.writeVarInt(value.ordinal()));
|
||||
|
||||
|
||||
public static final EntityDataType<Vector3f> VECTOR3F = define("vector3f",
|
||||
(PacketWrapper<?> wrapper) -> new Vector3f(wrapper.readFloat(), wrapper.readFloat(), wrapper.readFloat()),
|
||||
(PacketWrapper<?> wrapper, Vector3f value) -> {
|
||||
wrapper.writeFloat(value.x);
|
||||
wrapper.writeFloat(value.y);
|
||||
wrapper.writeFloat(value.z);
|
||||
});
|
||||
|
||||
public static final EntityDataType<Quaternion4f> QUATERNION = define("quaternion",
|
||||
(PacketWrapper<?> wrapper) -> new Quaternion4f(wrapper.readFloat(), wrapper.readFloat(), wrapper.readFloat(), wrapper.readFloat()),
|
||||
(PacketWrapper<?> wrapper, Quaternion4f value) -> {
|
||||
wrapper.writeFloat(value.getX());
|
||||
wrapper.writeFloat(value.getY());
|
||||
wrapper.writeFloat(value.getZ());
|
||||
wrapper.writeFloat(value.getW());
|
||||
});
|
||||
|
||||
public static EntityDataType<?> getById(ClientVersion version, int id) {
|
||||
int index = TYPES_BUILDER.getDataIndex(version);
|
||||
Map<Integer, EntityDataType<?>> typeIdMap = ENTITY_DATA_TYPE_ID_MAP.get((byte) index);
|
||||
return typeIdMap.get(id);
|
||||
}
|
||||
|
||||
public static EntityDataType<?> getByName(String name) {
|
||||
return ENTITY_DATA_TYPE_MAP.get(name);
|
||||
}
|
||||
|
||||
public static <T> EntityDataType<T> define(String name, Function<PacketWrapper<?>, T> deserializer, BiConsumer<PacketWrapper<?>, T> serializer) {
|
||||
TypesBuilderData data = TYPES_BUILDER.define(name);
|
||||
EntityDataType<T> type = new EntityDataType<>(name, data.getData(), deserializer,
|
||||
(BiConsumer<PacketWrapper<?>, Object>) serializer);
|
||||
ENTITY_DATA_TYPE_MAP.put(type.getName(), type);
|
||||
for (ClientVersion version : TYPES_BUILDER.getVersions()) {
|
||||
int index = TYPES_BUILDER.getDataIndex(version);
|
||||
if (index == -1) continue;
|
||||
Map<Integer, EntityDataType<?>> typeIdMap = ENTITY_DATA_TYPE_ID_MAP
|
||||
.computeIfAbsent((byte) index, k -> new HashMap<>());
|
||||
typeIdMap.put(type.getId(version), type);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
private static <T> Function<PacketWrapper<?>, T> readIntDeserializer() {
|
||||
if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9)) {
|
||||
return (PacketWrapper<?> wrapper) -> (T) ((Object) wrapper.readVarInt());
|
||||
} else {
|
||||
return (PacketWrapper<?> wrapper) -> (T) ((Object) wrapper.readInt());
|
||||
}
|
||||
}
|
||||
|
||||
private static <T> BiConsumer<PacketWrapper<?>, T> writeIntSerializer() {
|
||||
return (PacketWrapper<?> wrapper, T value) -> {
|
||||
int output = 0;
|
||||
if (value instanceof Byte) {
|
||||
output = ((Byte) value).intValue();
|
||||
} else if (value instanceof Short) {
|
||||
output = ((Short) value).intValue();
|
||||
} else if (value instanceof Integer) {
|
||||
output = (Integer) value;
|
||||
} else if (value instanceof Long) {
|
||||
output = ((Long) value).intValue();
|
||||
}
|
||||
if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9)) {
|
||||
wrapper.writeVarInt(output);
|
||||
} else {
|
||||
wrapper.writeInt(output);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
private static Function<PacketWrapper<?>, Optional<String>> readOptionalComponentJSONDeserializer() {
|
||||
return (PacketWrapper<?> wrapper) -> {
|
||||
if (wrapper.readBoolean()) {
|
||||
return Optional.of(wrapper.readComponentJSON());
|
||||
} else {
|
||||
return Optional.empty();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
private static BiConsumer<PacketWrapper<?>, Optional<String>> writeOptionalComponentJSONSerializer() {
|
||||
return (PacketWrapper<?> wrapper, Optional<String> value) -> {
|
||||
if (value != null && value.isPresent()) {
|
||||
wrapper.writeBoolean(true);
|
||||
wrapper.writeComponentJSON(value.get());
|
||||
} else {
|
||||
wrapper.writeBoolean(false);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static Function<PacketWrapper<?>, Optional<Component>> readOptionalComponentDeserializer() {
|
||||
return (PacketWrapper<?> wrapper) -> {
|
||||
if (wrapper.readBoolean()) {
|
||||
return Optional.of(wrapper.readComponent());
|
||||
} else {
|
||||
return Optional.empty();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static BiConsumer<PacketWrapper<?>, Optional<Component>> writeOptionalComponentSerializer() {
|
||||
return (PacketWrapper<?> wrapper, Optional<Component> value) -> {
|
||||
if (value != null && value.isPresent()) {
|
||||
wrapper.writeBoolean(true);
|
||||
wrapper.writeComponent(value.get());
|
||||
} else {
|
||||
wrapper.writeBoolean(false);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static <T> Function<PacketWrapper<?>, T> readOptionalBlockPositionDeserializer() {
|
||||
if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9)) {
|
||||
return (PacketWrapper<?> wrapper) -> {
|
||||
if (wrapper.readBoolean()) {
|
||||
return (T) Optional.of(wrapper.readBlockPosition());
|
||||
} else {
|
||||
return (T) Optional.empty();
|
||||
}
|
||||
};
|
||||
} else {
|
||||
return (PacketWrapper<?> wrapper) -> {
|
||||
if (wrapper.readBoolean()) {
|
||||
int x = wrapper.readInt();
|
||||
int y = wrapper.readInt();
|
||||
int z = wrapper.readInt();
|
||||
return (T) Optional.of(new Vector3i(x, y, z));
|
||||
} else {
|
||||
return (T) Optional.empty();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private static <T> BiConsumer<PacketWrapper<?>, T> writeOptionalBlockPositionSerializer() {
|
||||
if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9)) {
|
||||
return (PacketWrapper<?> wrapper, T value) -> {
|
||||
if (value instanceof Optional) {
|
||||
Optional<?> optional = (Optional<?>) value;
|
||||
if (optional.isPresent()) {
|
||||
wrapper.writeBoolean(true);
|
||||
wrapper.writeBlockPosition((Vector3i) optional.get());
|
||||
} else {
|
||||
wrapper.writeBoolean(false);
|
||||
}
|
||||
} else {
|
||||
wrapper.writeBoolean(false);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
return (PacketWrapper<?> wrapper, T value) -> {
|
||||
if (value instanceof Optional) {
|
||||
Optional<?> optional = (Optional<?>) value;
|
||||
if (optional.isPresent()) {
|
||||
wrapper.writeBoolean(true);
|
||||
Vector3i position = (Vector3i) optional.get();
|
||||
wrapper.writeInt(position.getX());
|
||||
wrapper.writeInt(position.getY());
|
||||
wrapper.writeInt(position.getZ());
|
||||
} else {
|
||||
wrapper.writeBoolean(false);
|
||||
}
|
||||
} else {
|
||||
wrapper.writeBoolean(false);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package com.github.retrooper.packetevents.protocol.entity.data;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This is an interface that provides a list of entity data.
|
||||
* This allows custom addon libraries to implement metadata classes for various entities
|
||||
* which can then be used in our API.
|
||||
* @since 2.1.0
|
||||
*/
|
||||
public interface EntityMetadataProvider {
|
||||
/**
|
||||
* PacketEvents is retrieving the metadata of this specific entity.
|
||||
* PacketEvents provides you with the protocol version that the library is running on
|
||||
* to allow you tu specify different metadata depending on the version.
|
||||
* You are free to ignore it at the cost of your features not working on all versions.
|
||||
* @param version The protocol version of the format we expect the metadata to be in.
|
||||
* @return Metadata (list of entity data)
|
||||
*/
|
||||
List<EntityData> entityData(ClientVersion version);
|
||||
|
||||
/**
|
||||
* Similar to {@link #entityData(ClientVersion)} but does not provide a protocol version.
|
||||
* It is not advised to use nor implement this.
|
||||
* It is deprecated because it restricts you by not providing you the format in which the metadata should be.
|
||||
* @return Metadata (list of entity data)
|
||||
* @deprecated Does not specify format of metadata, therefore not advised to use this. It will assume the current latest version.
|
||||
*/
|
||||
@Deprecated
|
||||
default List<EntityData> entityData() {
|
||||
return entityData(ClientVersion.getLatest());
|
||||
}
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.entity.pose;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
|
||||
|
||||
public enum EntityPose {
|
||||
STANDING,
|
||||
FALL_FLYING,
|
||||
SLEEPING,
|
||||
SWIMMING,
|
||||
SPIN_ATTACK,
|
||||
CROUCHING,
|
||||
LONG_JUMPING,
|
||||
DYING,
|
||||
CROAKING,
|
||||
USING_TONGUE,
|
||||
SITTING,
|
||||
ROARING,
|
||||
SNIFFING,
|
||||
EMERGING,
|
||||
DIGGING,
|
||||
//Added in 1.20.4
|
||||
SLIDING,
|
||||
SHOOTING,
|
||||
INHALING;
|
||||
|
||||
public int getId(ClientVersion version) {
|
||||
if (this == DYING && version.isOlderThan(ClientVersion.V_1_17)) {
|
||||
return 6;
|
||||
}
|
||||
if (this.ordinal() >= 11 && version.isOlderThan(ClientVersion.V_1_19_3)) {
|
||||
return this.ordinal() - 1;
|
||||
}
|
||||
return ordinal();
|
||||
}
|
||||
|
||||
public static EntityPose getById(ClientVersion version, int id) {
|
||||
// The LONG_JUMPING pose was added in 1.17, shifting things by 1
|
||||
if (id == 6 && version.isOlderThan(ClientVersion.V_1_17)) {
|
||||
return DYING;
|
||||
}
|
||||
// The SITTING pose was added in 1.19.3, shifting Warden's poses by 1
|
||||
if (id >= 10 && version.isOlderThan(ClientVersion.V_1_19_3)) {
|
||||
id++;
|
||||
}
|
||||
return values()[id];
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.entity.sniffer;
|
||||
|
||||
public enum SnifferState {
|
||||
IDLING,
|
||||
FEELING_HAPPY,
|
||||
SCENTING,
|
||||
SNIFFING,
|
||||
SEARCHING,
|
||||
DIGGING,
|
||||
RISING
|
||||
}
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.entity.transform;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.entity.type.EntityType;
|
||||
import com.github.retrooper.packetevents.protocol.nbt.NBTCompound;
|
||||
import com.github.retrooper.packetevents.protocol.player.UserProfile;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class EntityTransformType {
|
||||
public static final EntityTransformType IDENTITY = new EntityTransformType(null, 1.0F, null);
|
||||
|
||||
private @Nullable TypeModifier typeModifier;
|
||||
private float scale;
|
||||
private @Nullable UserProfile playerSkin;
|
||||
|
||||
//Scale must be between 0.1F and 16.0F
|
||||
public EntityTransformType(@Nullable TypeModifier typeModifier, float scale, @Nullable UserProfile playerSkin) {
|
||||
this.typeModifier = typeModifier;
|
||||
this.scale = scale;
|
||||
this.playerSkin = playerSkin;
|
||||
}
|
||||
|
||||
public Optional<TypeModifier> getTypeModifier() {
|
||||
return Optional.ofNullable(typeModifier);
|
||||
}
|
||||
|
||||
public void setTypeModifier(@Nullable TypeModifier typeModifier) {
|
||||
this.typeModifier = typeModifier;
|
||||
}
|
||||
|
||||
public float getScale() {
|
||||
return scale;
|
||||
}
|
||||
|
||||
public void setScale(float scale) {
|
||||
this.scale = scale;
|
||||
}
|
||||
|
||||
public Optional<UserProfile> getPlayerSkin() {
|
||||
return Optional.ofNullable(playerSkin);
|
||||
}
|
||||
|
||||
public void setPlayerSkin(@Nullable UserProfile playerSkin) {
|
||||
this.playerSkin = playerSkin;
|
||||
}
|
||||
|
||||
public static class TypeModifier {
|
||||
private EntityType entityType;
|
||||
private @Nullable NBTCompound tag;
|
||||
|
||||
public TypeModifier(EntityType entityType, @Nullable NBTCompound tag) {
|
||||
this.entityType = entityType;
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public EntityType getEntityType() {
|
||||
return entityType;
|
||||
}
|
||||
|
||||
public void setEntityType(EntityType entityType) {
|
||||
this.entityType = entityType;
|
||||
}
|
||||
|
||||
public Optional<NBTCompound> getTag() {
|
||||
return Optional.ofNullable(tag);
|
||||
}
|
||||
|
||||
public void setTag(@Nullable NBTCompound tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.entity.type;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.mapper.LegacyMappedEntity;
|
||||
import com.github.retrooper.packetevents.protocol.mapper.MappedEntity;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public interface EntityType extends MappedEntity, LegacyMappedEntity {
|
||||
Optional<EntityType> getParent();
|
||||
}
|
||||
+317
@@ -0,0 +1,317 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.entity.type;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
|
||||
import com.github.retrooper.packetevents.resources.ResourceLocation;
|
||||
import com.github.retrooper.packetevents.util.TypesBuilder;
|
||||
import com.github.retrooper.packetevents.util.TypesBuilderData;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
public class EntityTypes {
|
||||
private static final Map<String, EntityType> ENTITY_TYPE_MAP = new HashMap<>();
|
||||
//Key - mappings version, value - map with entity type ids and entity types
|
||||
private static final Map<Byte, Map<Integer, EntityType>> ENTITY_TYPE_ID_MAP = new HashMap<>();
|
||||
private static final Map<Byte, Map<Integer, EntityType>> LEGACY_ENTITY_TYPE_ID_MAP = new HashMap<>();
|
||||
private static final TypesBuilder TYPES_BUILDER = new TypesBuilder("entity/entity_type_mappings",
|
||||
ClientVersion.V_1_10,
|
||||
ClientVersion.V_1_11,
|
||||
ClientVersion.V_1_12,
|
||||
ClientVersion.V_1_13,
|
||||
ClientVersion.V_1_14,
|
||||
ClientVersion.V_1_15,
|
||||
ClientVersion.V_1_16,
|
||||
ClientVersion.V_1_16_2,
|
||||
ClientVersion.V_1_17,
|
||||
ClientVersion.V_1_19,
|
||||
ClientVersion.V_1_19_3,
|
||||
ClientVersion.V_1_19_4,
|
||||
ClientVersion.V_1_20_3);
|
||||
private static final TypesBuilder LEGACY_TYPES_BUILDER = new TypesBuilder("entity/legacy_entity_type_mappings",
|
||||
ClientVersion.V_1_8,
|
||||
ClientVersion.V_1_9,
|
||||
ClientVersion.V_1_10,
|
||||
ClientVersion.V_1_11,
|
||||
ClientVersion.V_1_12,
|
||||
ClientVersion.V_1_13);
|
||||
|
||||
|
||||
static {
|
||||
TYPES_BUILDER.unloadFileMappings();
|
||||
LEGACY_TYPES_BUILDER.unloadFileMappings();
|
||||
}
|
||||
|
||||
public static EntityType define(String key, @Nullable EntityType parent) {
|
||||
TypesBuilderData data = TYPES_BUILDER.define(key);
|
||||
TypesBuilderData legacyData = LEGACY_TYPES_BUILDER.define(key);
|
||||
Optional<EntityType> optParent = Optional.ofNullable(parent);
|
||||
EntityType entityType = new EntityType() {
|
||||
private final int[] ids = data.getData();
|
||||
private final int[] legacyIds = legacyData.getData();
|
||||
|
||||
@Override
|
||||
public Optional<EntityType> getParent() {
|
||||
return optParent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLegacyId(ClientVersion version) {
|
||||
if (version.isNewerThanOrEquals(ClientVersion.V_1_14)) {
|
||||
return -1;
|
||||
}
|
||||
int index = LEGACY_TYPES_BUILDER.getDataIndex(version);
|
||||
return legacyIds[index];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getName() {
|
||||
return data.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getId(ClientVersion version) {
|
||||
int index = TYPES_BUILDER.getDataIndex(version);
|
||||
return ids[index];
|
||||
}
|
||||
};
|
||||
ENTITY_TYPE_MAP.put(entityType.getName().toString(), entityType);
|
||||
for (ClientVersion version : TYPES_BUILDER.getVersions()) {
|
||||
int index = TYPES_BUILDER.getDataIndex(version);
|
||||
Map<Integer, EntityType> typeIdMap = ENTITY_TYPE_ID_MAP.computeIfAbsent((byte) index, k -> new HashMap<>());
|
||||
typeIdMap.put(entityType.getId(version), entityType);
|
||||
}
|
||||
|
||||
for (ClientVersion version : LEGACY_TYPES_BUILDER.getVersions()) {
|
||||
int index = LEGACY_TYPES_BUILDER.getDataIndex(version);
|
||||
Map<Integer, EntityType> legacyTypeIdMap = LEGACY_ENTITY_TYPE_ID_MAP.computeIfAbsent((byte) index, k -> new HashMap<>());
|
||||
legacyTypeIdMap.put(entityType.getLegacyId(version), entityType);
|
||||
}
|
||||
|
||||
return entityType;
|
||||
}
|
||||
|
||||
public static boolean isTypeInstanceOf(EntityType type, EntityType parent) {
|
||||
while (type != null) {
|
||||
if (type == parent) {
|
||||
return true;
|
||||
}
|
||||
if (type.getParent().isPresent()) {
|
||||
type = type.getParent().get();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//with minecraft:key
|
||||
public static EntityType getByName(String name) {
|
||||
return ENTITY_TYPE_MAP.get(name);
|
||||
}
|
||||
|
||||
public static EntityType getById(ClientVersion version, int id) {
|
||||
int index = TYPES_BUILDER.getDataIndex(version);
|
||||
return ENTITY_TYPE_ID_MAP.get((byte) index).get(id);
|
||||
}
|
||||
|
||||
public static EntityType getByLegacyId(ClientVersion version, int id) {
|
||||
if (version.isNewerThanOrEquals(ClientVersion.V_1_14)) {
|
||||
return null;
|
||||
}
|
||||
int index = LEGACY_TYPES_BUILDER.getDataIndex(version);
|
||||
return LEGACY_ENTITY_TYPE_ID_MAP.get((byte) index).get(id);
|
||||
}
|
||||
|
||||
// Credit to ViaVersion for these categories
|
||||
public static final EntityType ENTITY = define("entity", null);
|
||||
public static final EntityType LIVINGENTITY = define("livingentity", ENTITY);
|
||||
public static final EntityType ABSTRACT_INSENTIENT = define("abstract_insentient", LIVINGENTITY);
|
||||
public static final EntityType ABSTRACT_CREATURE = define("abstract_creature", ABSTRACT_INSENTIENT);
|
||||
public static final EntityType ABSTRACT_AGEABLE = define("abstract_ageable", ABSTRACT_CREATURE);
|
||||
public static final EntityType ABSTRACT_ANIMAL = define("abstract_animal", ABSTRACT_AGEABLE);
|
||||
public static final EntityType ABSTRACT_TAMEABLE_ANIMAL = define("abstract_tameable_animal", ABSTRACT_ANIMAL);
|
||||
public static final EntityType ABSTRACT_PARROT = define("abstract_parrot", ABSTRACT_TAMEABLE_ANIMAL);
|
||||
public static final EntityType ABSTRACT_HORSE = define("abstract_horse", ABSTRACT_ANIMAL);
|
||||
public static final EntityType CHESTED_HORSE = define("chested_horse", ABSTRACT_HORSE);
|
||||
public static final EntityType ABSTRACT_GOLEM = define("abstract_golem", ABSTRACT_CREATURE);
|
||||
public static final EntityType ABSTRACT_FISHES = define("abstract_fishes", ABSTRACT_CREATURE);
|
||||
public static final EntityType ABSTRACT_MONSTER = define("abstract_monster", ABSTRACT_CREATURE);
|
||||
public static final EntityType ABSTRACT_PIGLIN = define("abstract_piglin", ABSTRACT_MONSTER);
|
||||
public static final EntityType ABSTRACT_ILLAGER_BASE = define("abstract_illager_base", ABSTRACT_MONSTER);
|
||||
public static final EntityType ABSTRACT_EVO_ILLU_ILLAGER = define("abstract_evo_illu_illager", ABSTRACT_ILLAGER_BASE);
|
||||
public static final EntityType ABSTRACT_SKELETON = define("abstract_skeleton", ABSTRACT_MONSTER);
|
||||
public static final EntityType ABSTRACT_FLYING = define("abstract_flying", ABSTRACT_INSENTIENT);
|
||||
public static final EntityType ABSTRACT_AMBIENT = define("abstract_ambient", ABSTRACT_INSENTIENT);
|
||||
public static final EntityType ABSTRACT_WATERMOB = define("abstract_watermob", ABSTRACT_INSENTIENT);
|
||||
public static final EntityType ABSTRACT_HANGING = define("abstract_hanging", ENTITY);
|
||||
public static final EntityType ABSTRACT_LIGHTNING = define("abstract_lightning", ENTITY);
|
||||
public static final EntityType ABSTRACT_ARROW = define("abstract_arrow", ENTITY);
|
||||
public static final EntityType ABSTRACT_FIREBALL = define("abstract_fireball", ENTITY);
|
||||
public static final EntityType PROJECTILE_ABSTRACT = define("projectile_abstract", ENTITY);
|
||||
public static final EntityType MINECART_ABSTRACT = define("minecart_abstract", ENTITY);
|
||||
public static final EntityType CHESTED_MINECART_ABSTRACT = define("chested_minecart_abstract", MINECART_ABSTRACT);
|
||||
public static final EntityType AREA_EFFECT_CLOUD = define("area_effect_cloud", ENTITY);
|
||||
public static final EntityType ARMOR_STAND = define("armor_stand", LIVINGENTITY);
|
||||
public static final EntityType ALLAY = define("allay", ABSTRACT_CREATURE);
|
||||
public static final EntityType ARROW = define("arrow", ABSTRACT_ARROW);
|
||||
public static final EntityType AXOLOTL = define("axolotl", ABSTRACT_ANIMAL);
|
||||
public static final EntityType BAT = define("bat", ABSTRACT_AMBIENT);
|
||||
public static final EntityType BEE = define("bee", ABSTRACT_INSENTIENT);
|
||||
public static final EntityType BLAZE = define("blaze", ABSTRACT_MONSTER);
|
||||
public static final EntityType BOAT = define("boat", ENTITY);
|
||||
public static final EntityType CHEST_BOAT = define("chest_boat", BOAT);
|
||||
public static final EntityType CAT = define("cat", ABSTRACT_TAMEABLE_ANIMAL);
|
||||
public static final EntityType CAMEL = define("camel", ABSTRACT_HORSE);
|
||||
public static final EntityType SPIDER = define("spider", ABSTRACT_MONSTER);
|
||||
public static final EntityType CAVE_SPIDER = define("cave_spider", SPIDER);
|
||||
public static final EntityType CHICKEN = define("chicken", ABSTRACT_ANIMAL);
|
||||
public static final EntityType COD = define("cod", ABSTRACT_FISHES);
|
||||
public static final EntityType COW = define("cow", ABSTRACT_ANIMAL);
|
||||
public static final EntityType CREEPER = define("creeper", ABSTRACT_MONSTER);
|
||||
public static final EntityType DOLPHIN = define("dolphin", ABSTRACT_INSENTIENT);
|
||||
public static final EntityType DONKEY = define("donkey", CHESTED_HORSE);
|
||||
public static final EntityType DRAGON_FIREBALL = define("dragon_fireball", ABSTRACT_FIREBALL);
|
||||
public static final EntityType ZOMBIE = define("zombie", ABSTRACT_MONSTER);
|
||||
public static final EntityType DROWNED = define("drowned", ZOMBIE);
|
||||
public static final EntityType GUARDIAN = define("guardian", ABSTRACT_MONSTER);
|
||||
public static final EntityType ELDER_GUARDIAN = define("elder_guardian", GUARDIAN);
|
||||
public static final EntityType END_CRYSTAL = define("end_crystal", ENTITY);
|
||||
public static final EntityType ENDER_DRAGON = define("ender_dragon", ABSTRACT_INSENTIENT);
|
||||
public static final EntityType ENDERMAN = define("enderman", ABSTRACT_MONSTER);
|
||||
public static final EntityType ENDERMITE = define("endermite", ABSTRACT_MONSTER);
|
||||
public static final EntityType EVOKER = define("evoker", ABSTRACT_EVO_ILLU_ILLAGER);
|
||||
public static final EntityType EVOKER_FANGS = define("evoker_fangs", ENTITY);
|
||||
public static final EntityType EXPERIENCE_ORB = define("experience_orb", ENTITY);
|
||||
public static final EntityType EYE_OF_ENDER = define("eye_of_ender", ENTITY);
|
||||
public static final EntityType FALLING_BLOCK = define("falling_block", ENTITY);
|
||||
public static final EntityType FIREWORK_ROCKET = define("firework_rocket", ENTITY);
|
||||
public static final EntityType FOX = define("fox", ABSTRACT_ANIMAL);
|
||||
public static final EntityType FROG = define("frog", ABSTRACT_ANIMAL);
|
||||
public static final EntityType GHAST = define("ghast", ABSTRACT_FLYING);
|
||||
public static final EntityType GIANT = define("giant", ABSTRACT_MONSTER);
|
||||
public static final EntityType ITEM_FRAME = define("item_frame", ABSTRACT_HANGING);
|
||||
public static final EntityType GLOW_ITEM_FRAME = define("glow_item_frame", ITEM_FRAME);
|
||||
public static final EntityType SQUID = define("squid", ABSTRACT_WATERMOB);
|
||||
public static final EntityType GLOW_SQUID = define("glow_squid", SQUID);
|
||||
public static final EntityType GOAT = define("goat", ABSTRACT_ANIMAL);
|
||||
public static final EntityType HOGLIN = define("hoglin", ABSTRACT_ANIMAL);
|
||||
public static final EntityType HORSE = define("horse", ABSTRACT_HORSE);
|
||||
public static final EntityType HUSK = define("husk", ZOMBIE);
|
||||
public static final EntityType ILLUSIONER = define("illusioner", ABSTRACT_EVO_ILLU_ILLAGER);
|
||||
public static final EntityType IRON_GOLEM = define("iron_golem", ABSTRACT_GOLEM);
|
||||
public static final EntityType ITEM = define("item", ENTITY);
|
||||
public static final EntityType FIREBALL = define("fireball", ABSTRACT_FIREBALL);
|
||||
public static final EntityType LEASH_KNOT = define("leash_knot", ABSTRACT_HANGING);
|
||||
public static final EntityType LIGHTNING_BOLT = define("lightning_bolt", ABSTRACT_LIGHTNING);
|
||||
public static final EntityType LLAMA = define("llama", CHESTED_HORSE);
|
||||
public static final EntityType LLAMA_SPIT = define("llama_spit", ENTITY);
|
||||
public static final EntityType SLIME = define("slime", ABSTRACT_INSENTIENT);
|
||||
public static final EntityType MAGMA_CUBE = define("magma_cube", SLIME);
|
||||
public static final EntityType MARKER = define("marker", ENTITY);
|
||||
public static final EntityType MINECART = define("minecart", MINECART_ABSTRACT);
|
||||
public static final EntityType CHEST_MINECART = define("chest_minecart", CHESTED_MINECART_ABSTRACT);
|
||||
public static final EntityType COMMAND_BLOCK_MINECART = define("command_block_minecart", MINECART_ABSTRACT);
|
||||
public static final EntityType FURNACE_MINECART = define("furnace_minecart", MINECART_ABSTRACT);
|
||||
public static final EntityType HOPPER_MINECART = define("hopper_minecart", CHESTED_MINECART_ABSTRACT);
|
||||
public static final EntityType SPAWNER_MINECART = define("spawner_minecart", MINECART_ABSTRACT);
|
||||
public static final EntityType TNT_MINECART = define("tnt_minecart", MINECART_ABSTRACT);
|
||||
public static final EntityType MULE = define("mule", CHESTED_HORSE);
|
||||
public static final EntityType MOOSHROOM = define("mooshroom", COW);
|
||||
public static final EntityType OCELOT = define("ocelot", ABSTRACT_TAMEABLE_ANIMAL);
|
||||
public static final EntityType PAINTING = define("painting", ABSTRACT_HANGING);
|
||||
public static final EntityType PANDA = define("panda", ABSTRACT_INSENTIENT);
|
||||
public static final EntityType PARROT = define("parrot", ABSTRACT_PARROT);
|
||||
public static final EntityType PHANTOM = define("phantom", ABSTRACT_FLYING);
|
||||
public static final EntityType PIG = define("pig", ABSTRACT_ANIMAL);
|
||||
public static final EntityType PIGLIN = define("piglin", ABSTRACT_PIGLIN);
|
||||
public static final EntityType PIGLIN_BRUTE = define("piglin_brute", ABSTRACT_PIGLIN);
|
||||
public static final EntityType PILLAGER = define("pillager", ABSTRACT_ILLAGER_BASE);
|
||||
public static final EntityType POLAR_BEAR = define("polar_bear", ABSTRACT_ANIMAL);
|
||||
public static final EntityType TNT = define("tnt", ENTITY);
|
||||
public static final EntityType PUFFERFISH = define("pufferfish", ABSTRACT_FISHES);
|
||||
public static final EntityType RABBIT = define("rabbit", ABSTRACT_ANIMAL);
|
||||
public static final EntityType RAVAGER = define("ravager", ABSTRACT_MONSTER);
|
||||
public static final EntityType SALMON = define("salmon", ABSTRACT_FISHES);
|
||||
public static final EntityType SHEEP = define("sheep", ABSTRACT_ANIMAL);
|
||||
public static final EntityType SHULKER = define("shulker", ABSTRACT_GOLEM); // yes this is correct
|
||||
public static final EntityType SHULKER_BULLET = define("shulker_bullet", ENTITY);
|
||||
public static final EntityType SILVERFISH = define("silverfish", ABSTRACT_MONSTER);
|
||||
public static final EntityType SKELETON = define("skeleton", ABSTRACT_SKELETON);
|
||||
public static final EntityType SKELETON_HORSE = define("skeleton_horse", ABSTRACT_HORSE);
|
||||
public static final EntityType SMALL_FIREBALL = define("small_fireball", ABSTRACT_FIREBALL);
|
||||
public static final EntityType SNOW_GOLEM = define("snow_golem", ABSTRACT_GOLEM);
|
||||
public static final EntityType SNOWBALL = define("snowball", PROJECTILE_ABSTRACT);
|
||||
public static final EntityType SPECTRAL_ARROW = define("spectral_arrow", ABSTRACT_ARROW);
|
||||
public static final EntityType STRAY = define("stray", ABSTRACT_SKELETON);
|
||||
public static final EntityType STRIDER = define("strider", ABSTRACT_ANIMAL);
|
||||
public static final EntityType EGG = define("egg", PROJECTILE_ABSTRACT);
|
||||
public static final EntityType ENDER_PEARL = define("ender_pearl", PROJECTILE_ABSTRACT);
|
||||
public static final EntityType EXPERIENCE_BOTTLE = define("experience_bottle", PROJECTILE_ABSTRACT);
|
||||
public static final EntityType POTION = define("potion", PROJECTILE_ABSTRACT);
|
||||
public static final EntityType TADPOLE = define("tadpole", ABSTRACT_FISHES);
|
||||
@Deprecated // Exists only in 1.9 and 1.10
|
||||
public static final EntityType TIPPED_ARROW = define("tipped_arrow", ARROW);
|
||||
public static final EntityType TRIDENT = define("trident", ABSTRACT_ARROW);
|
||||
public static final EntityType TRADER_LLAMA = define("trader_llama", CHESTED_HORSE);
|
||||
public static final EntityType TROPICAL_FISH = define("tropical_fish", ABSTRACT_FISHES);
|
||||
public static final EntityType TURTLE = define("turtle", ABSTRACT_ANIMAL);
|
||||
public static final EntityType VEX = define("vex", ABSTRACT_MONSTER);
|
||||
public static final EntityType VILLAGER = define("villager", ABSTRACT_AGEABLE);
|
||||
public static final EntityType VINDICATOR = define("vindicator", ABSTRACT_ILLAGER_BASE);
|
||||
public static final EntityType WANDERING_TRADER = define("wandering_trader", ABSTRACT_AGEABLE);
|
||||
public static final EntityType WARDEN = define("warden", ABSTRACT_MONSTER);
|
||||
public static final EntityType WITCH = define("witch", ABSTRACT_MONSTER);
|
||||
public static final EntityType WITHER = define("wither", ABSTRACT_MONSTER);
|
||||
public static final EntityType WITHER_SKELETON = define("wither_skeleton", ABSTRACT_SKELETON);
|
||||
public static final EntityType WITHER_SKULL = define("wither_skull", ABSTRACT_FIREBALL);
|
||||
public static final EntityType WOLF = define("wolf", ABSTRACT_TAMEABLE_ANIMAL);
|
||||
public static final EntityType ZOGLIN = define("zoglin", ABSTRACT_MONSTER);
|
||||
public static final EntityType ZOMBIE_HORSE = define("zombie_horse", ABSTRACT_HORSE);
|
||||
public static final EntityType ZOMBIE_VILLAGER = define("zombie_villager", ZOMBIE);
|
||||
public static final EntityType ZOMBIFIED_PIGLIN = define("zombified_piglin", ZOMBIE);
|
||||
public static final EntityType PLAYER = define("player", LIVINGENTITY);
|
||||
public static final EntityType FISHING_BOBBER = define("fishing_bobber", ENTITY);
|
||||
public static final EntityType ENDER_SIGNAL = define("ender_signal", ENTITY);
|
||||
public static final EntityType THROWN_EXP_BOTTLE = define("thrown_exp_bottle", PROJECTILE_ABSTRACT);
|
||||
public static final EntityType PRIMED_TNT = define("primed_tnt", ENTITY);
|
||||
public static final EntityType FIREWORK = define("firework", ENTITY);
|
||||
public static final EntityType MINECART_COMMAND = define("minecart_command", MINECART_ABSTRACT);
|
||||
public static final EntityType MINECART_RIDEABLE = define("minecart_rideable", MINECART_ABSTRACT);
|
||||
public static final EntityType MINECART_CHEST = define("minecart_chest", MINECART_ABSTRACT);
|
||||
public static final EntityType MINECART_FURNACE = define("minecart_furnace", MINECART_ABSTRACT);
|
||||
public static final EntityType MINECART_TNT = define("minecart_tnt", MINECART_ABSTRACT);
|
||||
public static final EntityType MINECART_HOPPER = define("minecart_hopper", MINECART_ABSTRACT);
|
||||
public static final EntityType MINECART_MOB_SPAWNER = define("minecart_mob_spawner", MINECART_ABSTRACT);
|
||||
|
||||
// Added in 1.19.4
|
||||
public static final EntityType DISPLAY = define("display", ENTITY);
|
||||
public static final EntityType BLOCK_DISPLAY = define("block_display", DISPLAY);
|
||||
public static final EntityType ITEM_DISPLAY = define("item_display", DISPLAY);
|
||||
public static final EntityType TEXT_DISPLAY = define("text_display", DISPLAY);
|
||||
public static final EntityType INTERACTION = define("interaction", DISPLAY);
|
||||
public static final EntityType SNIFFER = define("sniffer", ABSTRACT_ANIMAL);
|
||||
|
||||
// Added in 1.20.3
|
||||
public static final EntityType BREEZE = define("breeze", ABSTRACT_MONSTER);
|
||||
public static final EntityType WIND_CHARGE = define("wind_charge", PROJECTILE_ABSTRACT);
|
||||
}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.entity.villager;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.entity.villager.level.VillagerLevel;
|
||||
import com.github.retrooper.packetevents.protocol.entity.villager.profession.VillagerProfession;
|
||||
import com.github.retrooper.packetevents.protocol.entity.villager.profession.VillagerProfessions;
|
||||
import com.github.retrooper.packetevents.protocol.entity.villager.type.VillagerType;
|
||||
import com.github.retrooper.packetevents.protocol.entity.villager.type.VillagerTypes;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class VillagerData {
|
||||
|
||||
private VillagerType type;
|
||||
private VillagerProfession profession;
|
||||
private int level;
|
||||
|
||||
public VillagerData(VillagerType type, VillagerProfession profession, VillagerLevel level) {
|
||||
this(type, profession, level.getId());
|
||||
}
|
||||
|
||||
public VillagerData(VillagerType type, VillagerProfession profession, int level) {
|
||||
this.type = type;
|
||||
this.profession = profession;
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public VillagerData(int typeId, int professionId, int level) {
|
||||
this(VillagerTypes.getById(typeId), VillagerProfessions.getById(professionId), level);
|
||||
}
|
||||
|
||||
public VillagerType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(VillagerType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public VillagerProfession getProfession() {
|
||||
return profession;
|
||||
}
|
||||
|
||||
public void setProfession(VillagerProfession profession) {
|
||||
this.profession = profession;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return this.level;
|
||||
}
|
||||
|
||||
public @Nullable VillagerLevel getVillagerLevel() {
|
||||
return VillagerLevel.getById(this.level);
|
||||
}
|
||||
|
||||
public void setLevel(int level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public void setLevel(VillagerLevel level) {
|
||||
this.level = level.getId();
|
||||
}
|
||||
}
|
||||
+21
-14
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 retrooper and contributors
|
||||
* Copyright (C) 2024 retrooper and contributors
|
||||
*
|
||||
* 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
|
||||
@@ -16,22 +16,29 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.github.retrooper.packetevents.event.eventtypes;
|
||||
package com.github.retrooper.packetevents.protocol.entity.villager.level;
|
||||
|
||||
import io.github.retrooper.packetevents.event.impl.PacketPlayReceiveEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Every event that allows you to schedule a task that will run after the action associated with the event.
|
||||
*
|
||||
* @author retrooper
|
||||
* @since 1.8
|
||||
*/
|
||||
public interface PostTaskEvent {
|
||||
boolean isPostTaskAvailable();
|
||||
public enum VillagerLevel {
|
||||
|
||||
@Nullable Runnable getPostTask();
|
||||
NOVICE,
|
||||
APPRENTICE,
|
||||
JOURNEYMAN,
|
||||
EXPERT,
|
||||
MASTER;
|
||||
|
||||
void setPostTask(@NotNull Runnable postTask);
|
||||
private static final VillagerLevel[] VALUES = values();
|
||||
|
||||
public static @Nullable VillagerLevel getById(int id) {
|
||||
if (id >= 1 && id <= VALUES.length) {
|
||||
return VALUES[id - 1];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return this.ordinal() + 1;
|
||||
}
|
||||
}
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.entity.villager.profession;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.mapper.StaticMappedEntity;
|
||||
|
||||
public interface VillagerProfession extends StaticMappedEntity {
|
||||
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.entity.villager.profession;
|
||||
|
||||
import com.github.retrooper.packetevents.resources.ResourceLocation;
|
||||
import com.github.retrooper.packetevents.util.TypesBuilder;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class VillagerProfessions {
|
||||
private static final Map<String, VillagerProfession> VILLAGER_PROFESSION_MAP = new HashMap<>();
|
||||
private static final Map<Byte, VillagerProfession> VILLAGER_PROFESSION_ID_MAP = new HashMap<>();
|
||||
|
||||
public static VillagerProfession define(int id, String name) {
|
||||
ResourceLocation location = new ResourceLocation(name);
|
||||
VillagerProfession type = new VillagerProfession() {
|
||||
@Override
|
||||
public ResourceLocation getName() {
|
||||
return location;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
};
|
||||
VILLAGER_PROFESSION_MAP.put(type.getName().toString(), type);
|
||||
VILLAGER_PROFESSION_ID_MAP.put((byte) type.getId(), type);
|
||||
return type;
|
||||
}
|
||||
|
||||
public static VillagerProfession getById(int id) {
|
||||
return VILLAGER_PROFESSION_ID_MAP.get((byte)id);
|
||||
}
|
||||
|
||||
public static VillagerProfession getByName(String name) {
|
||||
return VILLAGER_PROFESSION_MAP.get(name);
|
||||
}
|
||||
|
||||
public static final VillagerProfession NONE = define(0, "minecraft:none");
|
||||
public static final VillagerProfession ARMORER = define(1, "minecraft:armorer");
|
||||
public static final VillagerProfession BUTCHER = define(2, "minecraft:butcher");
|
||||
public static final VillagerProfession CARTOGRAPHER = define(3, "minecraft:cartographer");
|
||||
public static final VillagerProfession CLERIC = define(4, "minecraft:cleric");
|
||||
public static final VillagerProfession FARMER = define(5, "minecraft:farmer");
|
||||
public static final VillagerProfession FISHERMAN = define(6, "minecraft:fisherman");
|
||||
public static final VillagerProfession FLETCHER = define(7, "minecraft:fletcher");
|
||||
public static final VillagerProfession LEATHERWORKER = define(8, "minecraft:leatherworker");
|
||||
public static final VillagerProfession LIBRARIAN = define(9, "minecraft:librarian");
|
||||
public static final VillagerProfession MASON = define(10, "minecraft:mason");
|
||||
public static final VillagerProfession NITWIT = define(11, "minecraft:nitwit");
|
||||
public static final VillagerProfession SHEPHERD = define(12, "minecraft:shepherd");
|
||||
public static final VillagerProfession TOOLSMITH = define(13, "minecraft:toolsmith");
|
||||
public static final VillagerProfession WEAPONSMITH = define(14, "minecraft:weaponsmith");
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.entity.villager.type;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.mapper.StaticMappedEntity;
|
||||
|
||||
public interface VillagerType extends StaticMappedEntity {
|
||||
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.entity.villager.type;
|
||||
|
||||
import com.github.retrooper.packetevents.resources.ResourceLocation;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class VillagerTypes {
|
||||
private static final Map<String, VillagerType> VILLAGER_TYPE_MAP = new HashMap<>();
|
||||
private static final Map<Byte, VillagerType> VILLAGER_TYPE_ID_MAP = new HashMap<>();
|
||||
|
||||
|
||||
public static VillagerType define(int id, String name) {
|
||||
ResourceLocation location = new ResourceLocation(name);
|
||||
VillagerType type = new VillagerType() {
|
||||
@Override
|
||||
public ResourceLocation getName() {
|
||||
return location;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
};
|
||||
VILLAGER_TYPE_MAP.put(type.getName().toString(), type);
|
||||
VILLAGER_TYPE_ID_MAP.put((byte)type.getId(), type);
|
||||
return type;
|
||||
}
|
||||
|
||||
public static VillagerType getById(int id) {
|
||||
return VILLAGER_TYPE_ID_MAP.get((byte)id);
|
||||
}
|
||||
|
||||
|
||||
public static VillagerType getByName(String name) {
|
||||
return VILLAGER_TYPE_MAP.get(name);
|
||||
}
|
||||
|
||||
public static final VillagerType DESERT = define(0, "minecraft:desert");
|
||||
public static final VillagerType JUNGLE = define(1, "minecraft:jungle");
|
||||
public static final VillagerType PLAINS = define(2, "minecraft:plains");
|
||||
public static final VillagerType SAVANNA = define(3, "minecraft:savanna");
|
||||
public static final VillagerType SNOW = define(4, "minecraft:snow");
|
||||
public static final VillagerType SWAMP = define(5, "minecraft:swamp");
|
||||
public static final VillagerType TAIGA = define(6, "minecraft:taiga");
|
||||
}
|
||||
@@ -0,0 +1,340 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2022 retrooper and contributors
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.item;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.item.enchantment.Enchantment;
|
||||
import com.github.retrooper.packetevents.protocol.item.enchantment.type.EnchantmentType;
|
||||
import com.github.retrooper.packetevents.protocol.item.enchantment.type.EnchantmentTypes;
|
||||
import com.github.retrooper.packetevents.protocol.item.type.ItemType;
|
||||
import com.github.retrooper.packetevents.protocol.item.type.ItemTypes;
|
||||
import com.github.retrooper.packetevents.protocol.nbt.*;
|
||||
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class ItemStack {
|
||||
public static final ItemStack EMPTY = new ItemStack(ItemTypes.AIR, 0, new NBTCompound(), 0);
|
||||
private final ItemType type;
|
||||
private int amount;
|
||||
@Nullable
|
||||
private NBTCompound nbt;
|
||||
private int legacyData = -1;
|
||||
|
||||
private boolean cachedIsEmpty = false;
|
||||
|
||||
private ItemStack(ItemType type, int amount, @Nullable NBTCompound nbt, int legacyData) {
|
||||
this.type = type;
|
||||
this.amount = amount;
|
||||
this.nbt = nbt;
|
||||
this.legacyData = legacyData;
|
||||
updateCachedEmptyStatus();
|
||||
}
|
||||
|
||||
public int getMaxStackSize() {
|
||||
return getType().getMaxAmount();
|
||||
}
|
||||
|
||||
public boolean isStackable() {
|
||||
return this.getMaxStackSize() > 1 && (!this.isDamageableItem() || !this.isDamaged());
|
||||
}
|
||||
|
||||
public boolean isDamageableItem() {
|
||||
if (!this.cachedIsEmpty && this.getType().getMaxDurability() > 0) {
|
||||
NBTCompound tag = this.getNBT();
|
||||
return tag == null || !tag.getBoolean("Unbreakable");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isDamaged() {
|
||||
return this.isDamageableItem() && this.getDamageValue() > 0;
|
||||
}
|
||||
|
||||
public int getDamageValue() {
|
||||
if (nbt == null) return 0;
|
||||
NBTInt damage = this.nbt.getTagOfTypeOrNull("Damage", NBTInt.class);
|
||||
return damage == null ? 0 : damage.getAsInt();
|
||||
}
|
||||
|
||||
public void setDamageValue(int damage) {
|
||||
this.getOrCreateTag().setTag("Damage", new NBTInt(Math.max(0, damage)));
|
||||
}
|
||||
|
||||
public int getMaxDamage() {
|
||||
return this.getType().getMaxDurability();
|
||||
}
|
||||
|
||||
public NBTCompound getOrCreateTag() {
|
||||
if (this.nbt == null) {
|
||||
this.nbt = new NBTCompound();
|
||||
}
|
||||
|
||||
return this.nbt;
|
||||
}
|
||||
|
||||
private void updateCachedEmptyStatus() {
|
||||
cachedIsEmpty = isEmpty();
|
||||
}
|
||||
|
||||
public ItemType getType() {
|
||||
return cachedIsEmpty ? ItemTypes.AIR : type;
|
||||
}
|
||||
|
||||
public int getAmount() {
|
||||
return cachedIsEmpty ? 0 : amount;
|
||||
}
|
||||
|
||||
public void shrink(int amount) {
|
||||
this.setAmount(this.getAmount() - amount);
|
||||
}
|
||||
|
||||
public void grow(int amount) {
|
||||
this.setAmount(this.getAmount() + amount);
|
||||
}
|
||||
|
||||
public void setAmount(int amount) {
|
||||
this.amount = amount;
|
||||
updateCachedEmptyStatus();
|
||||
}
|
||||
|
||||
public ItemStack split(int toTake) {
|
||||
int i = Math.min(toTake, getAmount());
|
||||
ItemStack itemstack = this.copy();
|
||||
itemstack.setAmount(i);
|
||||
this.shrink(i);
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
public ItemStack copy() {
|
||||
return cachedIsEmpty ? EMPTY : new ItemStack(type, amount, nbt == null ? null : nbt.copy(), legacyData);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public NBTCompound getNBT() {
|
||||
return nbt;
|
||||
}
|
||||
|
||||
public void setNBT(NBTCompound nbt) {
|
||||
this.nbt = nbt;
|
||||
}
|
||||
|
||||
public int getLegacyData() {
|
||||
return legacyData;
|
||||
}
|
||||
|
||||
public void setLegacyData(int legacyData) {
|
||||
this.legacyData = legacyData;
|
||||
}
|
||||
|
||||
public boolean isEnchantable(ClientVersion version) {
|
||||
if (getType() == ItemTypes.BOOK) return getAmount() == 1;
|
||||
if (getType() == ItemTypes.ENCHANTED_BOOK) return false;
|
||||
return getMaxStackSize() == 1 && canBeDepleted() && !isEnchanted(version);
|
||||
}
|
||||
|
||||
public boolean isEnchanted(ClientVersion version) {
|
||||
String tagName = getEnchantmentsTagName(version);
|
||||
return !isEmpty() && this.nbt != null && this.nbt.getCompoundListTagOrNull(tagName) != null && !this.nbt.getCompoundListTagOrNull(tagName).getTags().isEmpty();
|
||||
}
|
||||
|
||||
private List<Enchantment> getEnchantments(@Nullable NBTCompound nbt, ClientVersion version) {
|
||||
String tagName = getEnchantmentsTagName(version);
|
||||
|
||||
if (nbt == null || nbt.getCompoundListTagOrNull(tagName) == null)
|
||||
return new ArrayList<>(0);
|
||||
|
||||
NBTList<NBTCompound> nbtList = nbt.getCompoundListTagOrNull(tagName);
|
||||
List<NBTCompound> compounds = nbtList.getTags();
|
||||
List<Enchantment> enchantments = new ArrayList<>(compounds.size());
|
||||
|
||||
for (NBTCompound compound : compounds) {
|
||||
EnchantmentType type = getEnchantmentTypeFromTag(compound, version);
|
||||
|
||||
if (type != null) {
|
||||
NBTShort levelTag = compound.getTagOfTypeOrNull("lvl", NBTShort.class);
|
||||
int level = levelTag.getAsInt();
|
||||
Enchantment enchantment = Enchantment.builder().type(type).level(level).build();
|
||||
enchantments.add(enchantment);
|
||||
}
|
||||
}
|
||||
|
||||
return enchantments;
|
||||
}
|
||||
|
||||
public List<Enchantment> getEnchantments(ClientVersion version) {
|
||||
return getEnchantments(this.nbt, version);
|
||||
}
|
||||
|
||||
public int getEnchantmentLevel(EnchantmentType enchantment, ClientVersion version) {
|
||||
if (isEnchanted(version)) {
|
||||
// isEnchanted() is true, so we can assume that nbt is not null
|
||||
assert nbt != null;
|
||||
String tagName = getEnchantmentsTagName(version);
|
||||
for (NBTCompound base : nbt.getCompoundListTagOrNull(tagName).getTags()) {
|
||||
EnchantmentType type = getEnchantmentTypeFromTag(base, version);
|
||||
if (enchantment == type) {
|
||||
NBTShort nbtShort = base.getTagOfTypeOrNull("lvl", NBTShort.class);
|
||||
if (nbtShort == null) return 0; // this might need to be set to 1
|
||||
return nbtShort.getAsInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static EnchantmentType getEnchantmentTypeFromTag(NBTCompound tag, ClientVersion version) {
|
||||
if (version.isNewerThanOrEquals(ClientVersion.V_1_13)) {
|
||||
String id = tag.getStringTagValueOrNull("id");
|
||||
return EnchantmentTypes.getByName(id);
|
||||
} else {
|
||||
NBTShort idTag = tag.getTagOfTypeOrNull("id", NBTShort.class);
|
||||
return EnchantmentTypes.getById(version, idTag.getAsInt());
|
||||
}
|
||||
}
|
||||
|
||||
public void setEnchantments(List<Enchantment> enchantments, ClientVersion version) {
|
||||
nbt = getOrCreateTag(); // Create tag if null
|
||||
String tagName = getEnchantmentsTagName(version);
|
||||
if (enchantments.isEmpty()) {
|
||||
//Let us clear the enchantments
|
||||
if (nbt.getTagOrNull(tagName) != null) {
|
||||
nbt.removeTag(tagName);
|
||||
}
|
||||
} else {
|
||||
List<NBTCompound> list = new ArrayList<>();
|
||||
for (Enchantment enchantment : enchantments) {
|
||||
NBTCompound compound = new NBTCompound();
|
||||
if (version.isNewerThanOrEquals(ClientVersion.V_1_13)) {
|
||||
compound.setTag("id", new NBTString(enchantment.getType().getName().toString()));
|
||||
} else {
|
||||
compound.setTag("id", new NBTShort((short) enchantment.getType().getId(version)));
|
||||
}
|
||||
|
||||
compound.setTag("lvl", new NBTShort((short) enchantment.getLevel()));
|
||||
list.add(compound);
|
||||
}
|
||||
assert nbt != null; // NBT was created in getOrCreateTag()
|
||||
nbt.setTag(tagName, new NBTList<>(NBTType.COMPOUND, list));
|
||||
}
|
||||
}
|
||||
|
||||
public String getEnchantmentsTagName(ClientVersion version) {
|
||||
String tagName = version.isNewerThanOrEquals(ClientVersion.V_1_13) ? "Enchantments" : "ench";
|
||||
if (type == ItemTypes.ENCHANTED_BOOK) {
|
||||
tagName = "StoredEnchantments";
|
||||
}
|
||||
return tagName;
|
||||
}
|
||||
|
||||
public boolean canBeDepleted() {
|
||||
return this.getType().getMaxDurability() > 0;
|
||||
}
|
||||
|
||||
public boolean is(ItemType type) {
|
||||
return this.getType() == type;
|
||||
}
|
||||
|
||||
public static boolean isSameItemSameTags(ItemStack stack, ItemStack otherStack) {
|
||||
return stack.is(otherStack.getType()) && ItemStack.tagMatches(stack, otherStack);
|
||||
}
|
||||
|
||||
public static boolean tagMatches(ItemStack left, ItemStack right) {
|
||||
if (left == right) {
|
||||
return true;
|
||||
}
|
||||
if (left == null) {
|
||||
return right.isEmpty();
|
||||
}
|
||||
if (right == null) {
|
||||
return left.isEmpty();
|
||||
}
|
||||
return Objects.equals(left.nbt, right.nbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj instanceof ItemStack) {
|
||||
ItemStack itemStack = (ItemStack) obj;
|
||||
return getType().equals(itemStack.getType())
|
||||
&& amount == itemStack.amount
|
||||
&& Objects.equals(nbt, itemStack.nbt)
|
||||
&& legacyData == itemStack.legacyData;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (cachedIsEmpty) {
|
||||
return "ItemStack[null]";
|
||||
} else {
|
||||
String identifier = type == null ? "null" : type.getName().toString();
|
||||
int maxAmount = getType().getMaxAmount();
|
||||
return "ItemStack[type=" + identifier + ", amount=" + amount + "/" + maxAmount
|
||||
+ ", nbt tag names: " + (nbt != null ? nbt.getTagNames() : "[null]") + ", legacyData=" + legacyData + "]";
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return type == null || type == ItemTypes.AIR || amount <= 0;
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private ItemType type;
|
||||
private int amount = 1;
|
||||
private NBTCompound nbt = null;
|
||||
private int legacyData = -1;
|
||||
|
||||
public Builder type(ItemType type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder amount(int amount) {
|
||||
this.amount = amount;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder nbt(NBTCompound nbt) {
|
||||
this.nbt = nbt;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder legacyData(int legacyData) {
|
||||
this.legacyData = legacyData;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemStack build() {
|
||||
return new ItemStack(type, amount, nbt, legacyData);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loaded 100 of 809 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user