Compare commits
1875
Commits
1.6
...
version-dynamic
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
58f6cf5411 | ||
|
|
d966013b69 | ||
|
|
8261d95a4b | ||
|
|
0ec7cbdd64 | ||
|
|
01aef56066 | ||
|
|
a1ca6e68bc | ||
|
|
bd2ae75b08 | ||
|
|
ed9cd05619 | ||
|
|
fdbe47a061 | ||
|
|
a4b326cd44 | ||
|
|
7e2c66a82e | ||
|
|
0913057d0d | ||
|
|
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 | ||
|
|
341f6632f5 | ||
|
|
0cf894567f | ||
|
|
2cf93d6e17 | ||
|
|
651c4a9955 | ||
|
|
9bfab5d899 | ||
|
|
99b24b7ad1 | ||
|
|
db9025dcea | ||
|
|
4bbf43e83e | ||
|
|
bcd60977f5 | ||
|
|
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 | ||
|
|
3c899e41b5 | ||
|
|
3653c9b07a | ||
|
|
340e10ff6d | ||
|
|
c667980997 | ||
|
|
37517af695 | ||
|
|
33fcf6105a | ||
|
|
8cf9af3024 | ||
|
|
eed8409e4b | ||
|
|
bd193e4be2 | ||
|
|
87c73392eb | ||
|
|
df29b947a6 | ||
|
|
55c3b9a446 | ||
|
|
76ad95c63a | ||
|
|
e7235f1ef7 | ||
|
|
1e26293c51 | ||
|
|
84f9bbf207 | ||
|
|
40e13755ff | ||
|
|
093c45609c | ||
|
|
06d4333524 | ||
|
|
78773c3a7b | ||
|
|
bd36cae8d0 | ||
|
|
2babb1ac44 | ||
|
|
e29a15db7e | ||
|
|
bb87ce9e77 | ||
|
|
b2b7687b33 | ||
|
|
d182f9bd5b | ||
|
|
ab4dba254d | ||
|
|
380b1e9a73 | ||
|
|
395cb6a6b7 | ||
|
|
e3a6bec0ae | ||
|
|
8cd52c4f4d | ||
|
|
ef758b4ee3 | ||
|
|
a75ad0e58e | ||
|
|
2d282bee8e | ||
|
|
4b30678d6b | ||
|
|
70ae66df17 | ||
|
|
0a98140a1c | ||
|
|
2ce25c24ee | ||
|
|
f27688c89f | ||
|
|
e287e63c58 | ||
|
|
6a44c3edbf | ||
|
|
cd28ced0c7 | ||
|
|
b05496db09 | ||
|
|
c914ccbb90 | ||
|
|
a236fb5523 | ||
|
|
1768ea518e | ||
|
|
0c7f185174 | ||
|
|
2d8cf55985 | ||
|
|
15e746687a | ||
|
|
ee9a870144 | ||
|
|
932ef480b5 | ||
|
|
41125cee92 | ||
|
|
a9585a1117 | ||
|
|
5aaee6fb63 | ||
|
|
8722dd0c34 | ||
|
|
267468f731 | ||
|
|
610975b957 | ||
|
|
f09617b2c2 | ||
|
|
96a3de9744 | ||
|
|
78f88fcede | ||
|
|
612a9c318f | ||
|
|
d1bf9a09ae | ||
|
|
6e01c76e24 | ||
|
|
ccf401ff6d | ||
|
|
6b86d7fdc6 | ||
|
|
de3988ca29 | ||
|
|
0b35e5ae5f | ||
|
|
007f1030a9 | ||
|
|
938f9184b2 | ||
|
|
4c0c57ace6 | ||
|
|
af4906396b | ||
|
|
3a68338da4 | ||
|
|
bb195f28ec | ||
|
|
bd0d9cc528 | ||
|
|
39756e4490 | ||
|
|
d406506189 | ||
|
|
9de94b79be | ||
|
|
5cded7923a | ||
|
|
8c6adafebc | ||
|
|
39cd41a2d3 | ||
|
|
37feadb421 | ||
|
|
34c079d757 | ||
|
|
bd52d59801 | ||
|
|
015038c9b6 | ||
|
|
18a5656991 | ||
|
|
bedecfd575 | ||
|
|
7aca5a9f13 | ||
|
|
344bb27fbf | ||
|
|
74dd8b74b5 | ||
|
|
1e113a0938 | ||
|
|
a0a010e842 | ||
|
|
8be91a0dc3 | ||
|
|
14405dfb7f | ||
|
|
ddd427ef91 | ||
|
|
026c0aae23 | ||
|
|
cc9153940e | ||
|
|
cb31a355be | ||
|
|
5c9b6fa4b4 | ||
|
|
d38176c5d3 | ||
|
|
92f14105f7 | ||
|
|
d141674bd7 | ||
|
|
1576639567 | ||
|
|
e9cd689f71 | ||
|
|
eee2628166 | ||
|
|
84710d4161 | ||
|
|
1d46ad9622 | ||
|
|
4424b1b0f3 | ||
|
|
739471e562 | ||
|
|
a74eb55c71 | ||
|
|
09ccb8d7b4 | ||
|
|
88e9453b73 | ||
|
|
29f8a3204f | ||
|
|
5324aab746 | ||
|
|
46d5b150f6 | ||
|
|
f0b81ac532 | ||
|
|
faa5f3b4de | ||
|
|
f63c1b2aa6 | ||
|
|
1f324f9307 | ||
|
|
b958dac7ae | ||
|
|
f95314cd37 | ||
|
|
43eaa0869c | ||
|
|
7e430a1eac | ||
|
|
39acdf9235 | ||
|
|
e38944e39f | ||
|
|
5c3051f297 | ||
|
|
c1b8bf17b8 | ||
|
|
b1f64155dc | ||
|
|
32a5a34fd8 | ||
|
|
40c8c11125 | ||
|
|
0c2e8dd128 | ||
|
|
189185e8e1 | ||
|
|
4e4c0fc343 | ||
|
|
06a2b5af53 | ||
|
|
632d87d940 | ||
|
|
41cd5fde29 | ||
|
|
eef6347f2c | ||
|
|
68dae87d2e | ||
|
|
901e45c490 | ||
|
|
be7d66d14c | ||
|
|
8b798f5ea0 | ||
|
|
926252b8ca | ||
|
|
31469898d9 | ||
|
|
cf4913ff0a | ||
|
|
915b9152d4 | ||
|
|
9e0f190264 | ||
|
|
5c4d40e09b | ||
|
|
b8bf1038e7 | ||
|
|
1f8f900d91 | ||
|
|
531e2af0cf | ||
|
|
448415458c | ||
|
|
bd191ec914 | ||
|
|
dc1d3dd3fc | ||
|
|
15fcc9f11a | ||
|
|
ca7b5758b7 | ||
|
|
c4376d582f | ||
|
|
b3e7ef2792 | ||
|
|
542864cac1 | ||
|
|
6169947284 | ||
|
|
bdff7436a5 | ||
|
|
a8f8bbaa53 | ||
|
|
80034ed4b8 | ||
|
|
caa8cfb40b | ||
|
|
41d45a562e | ||
|
|
0d284e674a | ||
|
|
677d30ef55 | ||
|
|
76d60f0d7a | ||
|
|
b93950074d | ||
|
|
319737a20a | ||
|
|
1e0090e82a | ||
|
|
2a4c08bb3f | ||
|
|
0e72a1e944 | ||
|
|
d998f388f7 | ||
|
|
6ff830f245 | ||
|
|
f44a5b3599 | ||
|
|
8ae21853c9 | ||
|
|
bd5e8b8ed5 | ||
|
|
a0dc82aba4 | ||
|
|
3e8d255ac7 | ||
|
|
bb0f70cb44 | ||
|
|
e680d2b8f7 | ||
|
|
9dacbe2f36 | ||
|
|
74dde71db1 | ||
|
|
f1bc3d6f4a | ||
|
|
0fa893f949 | ||
|
|
2699a1e8f9 | ||
|
|
78b2eb07f5 | ||
|
|
49c1287664 | ||
|
|
83b3a10069 | ||
|
|
8aed1fda53 | ||
|
|
5f40eec0d3 | ||
|
|
104b894f50 | ||
|
|
bcba33a7cb | ||
|
|
4275c39d8a | ||
|
|
ae3adefd82 | ||
|
|
6e28602b73 | ||
|
|
584d3edb13 | ||
|
|
978ce4629a | ||
|
|
33cfa93f84 | ||
|
|
d5a29365b4 | ||
|
|
e12870b542 | ||
|
|
75301b188a | ||
|
|
be91a955dc | ||
|
|
8eb6ae03eb | ||
|
|
7bf4c081b3 | ||
|
|
55b6f2cbce | ||
|
|
e97dcf2ae3 | ||
|
|
3affffb42e | ||
|
|
ddcb92d04c | ||
|
|
4413aca711 | ||
|
|
c4307fa777 | ||
|
|
f4ada314ba | ||
|
|
dbbc40879a | ||
|
|
8d3f86722c | ||
|
|
09466af902 | ||
|
|
851d19f57d | ||
|
|
a4ede8dfcf | ||
|
|
1c48790a03 | ||
|
|
26bc3274fe | ||
|
|
805e2ad335 | ||
|
|
8b6c6d7b35 | ||
|
|
7bec3ae062 | ||
|
|
defddefb48 | ||
|
|
5201b18fe7 | ||
|
|
c449e8ced1 | ||
|
|
f22d593173 | ||
|
|
5a3ce13d93 | ||
|
|
ecd0d63dc2 | ||
|
|
066791b283 | ||
|
|
f05bf26293 | ||
|
|
75391bebde | ||
|
|
d413f9e41b | ||
|
|
efdc66739f | ||
|
|
adf652978f | ||
|
|
29e8e9020d | ||
|
|
64da1a54fa | ||
|
|
37740d072f | ||
|
|
6496f1402a | ||
|
|
e661ee75d7 | ||
|
|
dbd9df8c71 | ||
|
|
bb8027bcaf | ||
|
|
c7096d8b35 | ||
|
|
36b80763e3 | ||
|
|
bc861089b0 | ||
|
|
e5a43a8826 | ||
|
|
1e1b609eb7 | ||
|
|
957c8876cc | ||
|
|
2902ef8ba4 | ||
|
|
de07adb46a | ||
|
|
f3dbb6dd4c | ||
|
|
b954e68f29 | ||
|
|
8e09c54143 | ||
|
|
5e88678c52 | ||
|
|
60ad9f476d | ||
|
|
5b4579c67c | ||
|
|
d502de76dd | ||
|
|
eb5e21eb1b | ||
|
|
d747974950 | ||
|
|
ef8fe9161f | ||
|
|
50ede8bf24 | ||
|
|
81f90a955c | ||
|
|
0252dbf1b8 | ||
|
|
cd230ca35d | ||
|
|
4852e4bfca | ||
|
|
0ed112b6fc | ||
|
|
3db6390efb | ||
|
|
57aa65cb76 | ||
|
|
746be8a0cf | ||
|
|
0ea484bdb1 | ||
|
|
072dbfbbb4 | ||
|
|
58faab9f54 | ||
|
|
16d9a0c6a6 | ||
|
|
c2f55aa048 | ||
|
|
bcb8d0e785 | ||
|
|
a881496e2b | ||
|
|
e4913cb841 | ||
|
|
781278a2c5 | ||
|
|
f1bbcd61ed | ||
|
|
42bdc1f1ca | ||
|
|
710508ae1e | ||
|
|
f826363d01 | ||
|
|
7d048c21b3 | ||
|
|
0710f214c5 | ||
|
|
3c4298dcea | ||
|
|
efbfb7e29c | ||
|
|
0aeff7cab8 | ||
|
|
be340a9812 | ||
|
|
7122f1194c | ||
|
|
e8df865b3c | ||
|
|
9e38883dcd | ||
|
|
1d955cac6e | ||
|
|
106b7c6d75 | ||
|
|
e70609bbc2 | ||
|
|
e1e0735688 | ||
|
|
51a417cebd | ||
|
|
c98c4e7d38 | ||
|
|
042b55af62 | ||
|
|
ab8885eb6e | ||
|
|
069980d567 | ||
|
|
e6e3835846 | ||
|
|
bdb83dfd86 | ||
|
|
628730d484 | ||
|
|
7aefa35623 | ||
|
|
8964a0ac5d | ||
|
|
128ff6c60b | ||
|
|
1bc2bbc905 | ||
|
|
3f9977fd1c | ||
|
|
6f5bc43179 | ||
|
|
89cba54262 | ||
|
|
081c2fece1 | ||
|
|
0b9f646650 | ||
|
|
07ca8ac282 | ||
|
|
cb798d6fd0 | ||
|
|
5b06f2005c | ||
|
|
c07960814c | ||
|
|
a1b75243f3 | ||
|
|
9f9ca79f90 | ||
|
|
241f5ed707 | ||
|
|
276653975d | ||
|
|
ff985e4eee | ||
|
|
65c28b4c90 | ||
|
|
e994c34689 | ||
|
|
0eed580e72 | ||
|
|
88ccbdbbe7 | ||
|
|
4604981e7d | ||
|
|
bf990c0a20 | ||
|
|
cfebc47853 | ||
|
|
4a72e70506 | ||
|
|
edc07a38ae | ||
|
|
a4daa60a7f | ||
|
|
e3f7b6888c | ||
|
|
62bb1a501b | ||
|
|
92fab840c5 | ||
|
|
515a4a4f8c | ||
|
|
7518b9335e | ||
|
|
6221ff0b8b | ||
|
|
bacc1cd878 | ||
|
|
5144bd6199 | ||
|
|
a80770b8f7 | ||
|
|
1caca9fd96 | ||
|
|
59aa347e4e | ||
|
|
a22ce57287 | ||
|
|
bac63c57e7 | ||
|
|
78171c583d | ||
|
|
3821c6e98a | ||
|
|
e0c71e7c86 | ||
|
|
d9d054c0cd | ||
|
|
82304e4f45 | ||
|
|
cbc510f5a4 | ||
|
|
58040a338b | ||
|
|
9e5cba423d | ||
|
|
19cdd85b65 | ||
|
|
a6872ffc3c | ||
|
|
92ad799276 | ||
|
|
28770edcdd | ||
|
|
0f5180ad07 | ||
|
|
b2c126ecf9 | ||
|
|
aab7266bcb | ||
|
|
dc5eab1980 | ||
|
|
ddfc803603 | ||
|
|
5de43429a3 | ||
|
|
513421f3d0 | ||
|
|
04ca446d44 | ||
|
|
d8cfd826c0 | ||
|
|
30689a74bd | ||
|
|
957adbb3a2 | ||
|
|
e59ff04f2b | ||
|
|
3511099f78 | ||
|
|
7dc6f89585 | ||
|
|
e899b0cebb | ||
|
|
40ba25d011 | ||
|
|
43e5e0200a | ||
|
|
7906ac7fa9 | ||
|
|
706f5331b6 | ||
|
|
3e13ea6aaa | ||
|
|
fb13834048 | ||
|
|
3e8bd7f649 | ||
|
|
dfc898e0bf | ||
|
|
38fc0cf4be | ||
|
|
7204b85664 | ||
|
|
c0642a69a1 | ||
|
|
251e01f6e7 | ||
|
|
612a7b50cf | ||
|
|
c4d04d10d7 | ||
|
|
e87bfe0ef9 | ||
|
|
6d87a03412 | ||
|
|
13bea01eac | ||
|
|
9a8126cc1e | ||
|
|
45f705e351 | ||
|
|
1c3577a5e7 | ||
|
|
a2aedf680a | ||
|
|
14cfb6b8c5 | ||
|
|
5e98e8a192 | ||
|
|
bb65610e74 | ||
|
|
19ccfb87e3 | ||
|
|
514298b942 | ||
|
|
b59f0c5613 | ||
|
|
267480b563 | ||
|
|
a50a5f8f89 | ||
|
|
f06cd69b27 | ||
|
|
c0bf7f7069 | ||
|
|
d884c5324d | ||
|
|
16caeeee89 | ||
|
|
17e5d84907 | ||
|
|
fe4037b850 | ||
|
|
564f65d2d2 | ||
|
|
2a944d9376 | ||
|
|
3dc1bbc671 | ||
|
|
1a141b114e | ||
|
|
f9e7589d87 | ||
|
|
f77ab58b3b | ||
|
|
a3e744d883 | ||
|
|
8680f0f43b | ||
|
|
a981caa386 | ||
|
|
06644f5fe6 | ||
|
|
bcb79a0ac5 | ||
|
|
b6c48d95db | ||
|
|
f28092bccb | ||
|
|
a566b6f8cb | ||
|
|
ba7e178cb1 | ||
|
|
b88ac0191e | ||
|
|
f864eeb646 | ||
|
|
cc2f810be3 | ||
|
|
d41da16c56 | ||
|
|
9d3390b1bb | ||
|
|
3fe96333e1 | ||
|
|
a17c782c2e | ||
|
|
2f9a2ce435 | ||
|
|
d78776be6f | ||
|
|
e23d1a87f6 | ||
|
|
b27f86c073 | ||
|
|
2a5f5448a4 | ||
|
|
c84472270e | ||
|
|
e3b667d5b2 | ||
|
|
7079c50deb | ||
|
|
b3e07b9188 | ||
|
|
41427d8698 | ||
|
|
6e2177e27c | ||
|
|
25bba6e306 | ||
|
|
64c0c79edd | ||
|
|
9f6e79cb16 | ||
|
|
917959743e | ||
|
|
577660b58c | ||
|
|
4377d85a05 | ||
|
|
fb8fcf7d50 | ||
|
|
faf8e4664c | ||
|
|
7e52b8e979 | ||
|
|
55ab2fa043 | ||
|
|
560a1b5e2f | ||
|
|
db61b202c0 | ||
|
|
ebc697dd89 | ||
|
|
784d99c03d | ||
|
|
d48ab480c9 | ||
|
|
052f1108c3 | ||
|
|
b42f5b68ca | ||
|
|
3926c48114 | ||
|
|
0a5f2d2b8e | ||
|
|
57f80b5196 | ||
|
|
7ac3b7e65b | ||
|
|
4ce2f88d4a | ||
|
|
374025f5bf | ||
|
|
450da1ce3f | ||
|
|
4a5cfd141a | ||
|
|
56ea329b5c | ||
|
|
3104cda55e | ||
|
|
111b28ba7e | ||
|
|
7754a6e183 | ||
|
|
2d2063cac2 | ||
|
|
494edfa095 | ||
|
|
e3a9d4e6de | ||
|
|
c8f766735a | ||
|
|
83899c8fac | ||
|
|
99d56a520e | ||
|
|
c1b2caad8b | ||
|
|
53cd0feba3 | ||
|
|
e83945d875 | ||
|
|
31def9a711 | ||
|
|
b4514dca63 | ||
|
|
add5f9853d | ||
|
|
419c08780f | ||
|
|
d39b50b02c | ||
|
|
2d8b2ae523 | ||
|
|
3e5366f374 | ||
|
|
2b10325f7f | ||
|
|
4c5fdf6dce | ||
|
|
8a8616c124 | ||
|
|
8095e506e4 | ||
|
|
e067208755 | ||
|
|
f9bf042178 | ||
|
|
23db4a6506 | ||
|
|
2e0468ed74 | ||
|
|
e932fb5707 | ||
|
|
337551119b | ||
|
|
7ec7336b9a | ||
|
|
a136729532 | ||
|
|
2da41d03ef | ||
|
|
3c65754fca | ||
|
|
688931aa7e | ||
|
|
e5338caa29 | ||
|
|
b45bc73396 | ||
|
|
918d5b89ef | ||
|
|
9f06d583ab | ||
|
|
1c87cf7982 | ||
|
|
75f7eaf74f | ||
|
|
a4f4163412 | ||
|
|
ef529b7949 | ||
|
|
6e52acb677 | ||
|
|
826695a677 | ||
|
|
e403469e52 | ||
|
|
084acb8894 | ||
|
|
948e260460 | ||
|
|
f4efdea4b2 | ||
|
|
1cb7730c3c | ||
|
|
5b558b50e2 | ||
|
|
00986f2341 | ||
|
|
b83e8887ff | ||
|
|
7bfadfa233 | ||
|
|
a3f75f1237 | ||
|
|
1e21d3f6ea | ||
|
|
73d0c6ea7d | ||
|
|
278b27da6b | ||
|
|
fbb0692f80 | ||
|
|
f4307ab524 | ||
|
|
cafda14c89 | ||
|
|
2e7e81be9f | ||
|
|
83b5697d40 | ||
|
|
e0a1c39e54 | ||
|
|
6608203ddc | ||
|
|
1f811ba90e | ||
|
|
70f33f56e8 | ||
|
|
39c2a157c4 | ||
|
|
761352cbbc | ||
|
|
44016e1a03 | ||
|
|
a2233c434a | ||
|
|
fb4863cbe9 | ||
|
|
e60d50a957 | ||
|
|
c53d69d03c | ||
|
|
9e294d7185 | ||
|
|
e9cd983131 | ||
|
|
e6798d4901 | ||
|
|
1c0e8cdd91 | ||
|
|
a3f9fc9cb3 | ||
|
|
808bbabff1 | ||
|
|
4a5e579256 | ||
|
|
7c74d22700 | ||
|
|
cf11930f05 | ||
|
|
f814d20cbb | ||
|
|
6313fca6fa | ||
|
|
f0bcfc62c8 | ||
|
|
cf930c6013 | ||
|
|
052a65f6ef | ||
|
|
4078418376 | ||
|
|
68e8d4f788 | ||
|
|
be6e0ce222 | ||
|
|
67dd097a0f | ||
|
|
ed9007da44 | ||
|
|
81632cdf6d | ||
|
|
727e02a235 | ||
|
|
39e105c69c | ||
|
|
1a2145b413 | ||
|
|
05a981de6e | ||
|
|
79c07642a2 | ||
|
|
e2352fe3bf | ||
|
|
2d9ac56f2e | ||
|
|
8e1d70b6be | ||
|
|
7c6a675173 | ||
|
|
feeff01654 | ||
|
|
0e53005867 | ||
|
|
98b4ee2bac | ||
|
|
efc2dc1c54 | ||
|
|
827c974908 | ||
|
|
05b9c8efca | ||
|
|
42a9745196 | ||
|
|
5a283b7ffa | ||
|
|
59d25df76b | ||
|
|
c42a00ddcf | ||
|
|
b3e06caf7c | ||
|
|
a0b84c0552 | ||
|
|
e8be5eb8ba | ||
|
|
2531988a59 | ||
|
|
7204b06870 | ||
|
|
6289543ea5 | ||
|
|
6a1ce5e234 | ||
|
|
bd1e4e7e6d | ||
|
|
feda5b96b6 | ||
|
|
809396ff21 | ||
|
|
2428487eb1 | ||
|
|
df0c769111 | ||
|
|
5e0cd75bb0 | ||
|
|
b21e6b4a67 | ||
|
|
bfc3aa7ad8 | ||
|
|
72458ddfd2 | ||
|
|
a8a04b137b | ||
|
|
4e11df1fc7 | ||
|
|
c3ab35bd6b | ||
|
|
af1025da1f | ||
|
|
f2ce9eacb1 | ||
|
|
27307e034b | ||
|
|
808357735f | ||
|
|
ece8b6d395 | ||
|
|
8643e14900 | ||
|
|
cbfd52d926 | ||
|
|
e266e43d19 | ||
|
|
c9d58e08c9 | ||
|
|
24eda2b3a5 | ||
|
|
38c4f3234d | ||
|
|
e94b6f24dc | ||
|
|
85dab8eb7a | ||
|
|
5fb8634880 | ||
|
|
e551421867 | ||
|
|
3dfb1ce0b5 | ||
|
|
aca321c332 | ||
|
|
e0f4891a72 | ||
|
|
08b207d80a | ||
|
|
6121349a6f | ||
|
|
2b58a9ad97 | ||
|
|
8e922a7676 | ||
|
|
7967b6851f | ||
|
|
18b37abf5b | ||
|
|
53b713f574 | ||
|
|
655f162272 | ||
|
|
686c50a7bb | ||
|
|
a88e95e116 | ||
|
|
7c583bf8ec | ||
|
|
c3911483a5 | ||
|
|
f37d7f4040 | ||
|
|
c39c9691a8 | ||
|
|
a1c591a616 | ||
|
|
999e21bf77 | ||
|
|
c8e5a37472 | ||
|
|
c6fffca506 | ||
|
|
f1206a1fc6 | ||
|
|
29a4280b50 | ||
|
|
552f63a27f | ||
|
|
612608181d | ||
|
|
8e652f0c44 | ||
|
|
4a3e89d713 | ||
|
|
3dd6d1e0b9 | ||
|
|
f42e1ad71d | ||
|
|
b44f36185a | ||
|
|
1621adad02 | ||
|
|
d2682242ae | ||
|
|
0b26fe3266 | ||
|
|
0354ddf765 | ||
|
|
82e0d01c29 | ||
|
|
57b68f185c | ||
|
|
8f9b8c0433 | ||
|
|
27ced0fc36 | ||
|
|
1d383a7d37 | ||
|
|
ae81019fd8 | ||
|
|
d05019adac | ||
|
|
1d45ec916c | ||
|
|
7328fc9381 | ||
|
|
89f21b927f | ||
|
|
04c33929cd | ||
|
|
fa2aab5e74 | ||
|
|
ebc81c0986 | ||
|
|
c6348e0dc9 | ||
|
|
f84d3000f4 | ||
|
|
7ddfc681cc | ||
|
|
cdb67c80c0 | ||
|
|
ed78c9d746 | ||
|
|
b7128d5f33 | ||
|
|
ba0b32ffdb | ||
|
|
3b420a4c28 | ||
|
|
5abc9c7154 | ||
|
|
c5f377476c | ||
|
|
105ea434da | ||
|
|
f0196bdab9 | ||
|
|
982d1ee9a0 | ||
|
|
a7bbb20f60 | ||
|
|
2ca79017e2 | ||
|
|
c4a3d26d96 | ||
|
|
93292fb2f2 | ||
|
|
3a9be091ea | ||
|
|
92f3944049 | ||
|
|
27f90655f1 | ||
|
|
4b868392e6 | ||
|
|
ebb1ba990d | ||
|
|
b4bb72e236 | ||
|
|
e876ebe078 | ||
|
|
d6af873b9d | ||
|
|
c10d309180 | ||
|
|
c33ab2c52c | ||
|
|
ec6cef3526 | ||
|
|
c61738bbab | ||
|
|
00990a49f9 | ||
|
|
72a199ce48 | ||
|
|
ac585f7c81 | ||
|
|
a8b286c6fc | ||
|
|
364747986b | ||
|
|
b51c3ad20a | ||
|
|
df8c77291d | ||
|
|
9dde0e54fe | ||
|
|
72f1b2bf02 | ||
|
|
332782e99c | ||
|
|
9f7e49b453 | ||
|
|
e17f53ca3c | ||
|
|
5fc1abaff2 | ||
|
|
a9ad25d3fc | ||
|
|
bf3c0cda46 | ||
|
|
e9680c287d | ||
|
|
e05dda9ea6 | ||
|
|
7db442682e | ||
|
|
61911ac09a | ||
|
|
381dc28831 | ||
|
|
1686d38f0b | ||
|
|
509b93968d | ||
|
|
1458331e3f | ||
|
|
d5777a55f0 | ||
|
|
d7c4d2c425 | ||
|
|
a268687cea | ||
|
|
d679e43058 | ||
|
|
1f609f8732 | ||
|
|
30e9d38bf2 | ||
|
|
922342345d | ||
|
|
80c8c5453b | ||
|
|
ba72ec37c6 | ||
|
|
9bfb696c9d | ||
|
|
4a9848f51d | ||
|
|
383eacc814 | ||
|
|
860b80e2c2 | ||
|
|
0259bc8d9d | ||
|
|
37238e1226 | ||
|
|
c51880941b | ||
|
|
451bbe7597 | ||
|
|
d99e20d95e | ||
|
|
5eca22a9df | ||
|
|
c4d6b26986 | ||
|
|
197acc4d2f | ||
|
|
da5a5cf15a | ||
|
|
0797df24d2 | ||
|
|
7fca4ac8d6 | ||
|
|
0516513c67 | ||
|
|
4603794436 | ||
|
|
a5bbe4047b | ||
|
|
770a2d3287 | ||
|
|
3bd4b82d94 | ||
|
|
218b2d7782 | ||
|
|
76a08e6c12 | ||
|
|
4d28a58dcb | ||
|
|
9347e7a133 | ||
|
|
33ed5ff904 | ||
|
|
291994d388 | ||
|
|
f6ea9675bf | ||
|
|
cc303f56a4 | ||
|
|
290bd0a8fe | ||
|
|
a8573cc8e1 | ||
|
|
814bd941c0 | ||
|
|
d3f6d32848 | ||
|
|
5e1b82ea8a | ||
|
|
e49cae5d67 | ||
|
|
8168bb2085 | ||
|
|
621a7c98b9 | ||
|
|
28da2aafc4 | ||
|
|
e89e6fac28 | ||
|
|
a5e067af9e | ||
|
|
04de7fd5ea | ||
|
|
815428f35b | ||
|
|
833f569150 | ||
|
|
6b227d55aa | ||
|
|
57a6c26c07 | ||
|
|
b2da168f6a | ||
|
|
4c1e14af57 | ||
|
|
5f9e82617f | ||
|
|
9868facdde | ||
|
|
d45f8bddac | ||
|
|
e4b086e7e5 | ||
|
|
7afe3c63cd | ||
|
|
5103acf414 | ||
|
|
70b763b5a3 | ||
|
|
e1370b803f | ||
|
|
ac3ca0ddf7 | ||
|
|
15bec5525a | ||
|
|
0e8dcb6a40 | ||
|
|
836efcfa03 | ||
|
|
774e6decf3 | ||
|
|
839265e0b9 | ||
|
|
32c94c85f1 | ||
|
|
a36df67f6f | ||
|
|
cdb46f476c | ||
|
|
96e5e7393e | ||
|
|
130001a44c | ||
|
|
1328ea81e8 | ||
|
|
a42153cff9 | ||
|
|
79929f5700 | ||
|
|
8c3726c165 | ||
|
|
51a58f79a5 | ||
|
|
8691304925 | ||
|
|
9fef95d96e | ||
|
|
4d42a23510 | ||
|
|
787df36fe0 | ||
|
|
a59ea40e12 | ||
|
|
fdb3a23acc | ||
|
|
60d24ac3c1 | ||
|
|
7634540bd7 | ||
|
|
0a475e4242 | ||
|
|
ff3b66b22e | ||
|
|
8be5f5bfa6 | ||
|
|
8d887335e2 | ||
|
|
553f429a53 | ||
|
|
a4a8b36665 | ||
|
|
49d46b79df | ||
|
|
08a2b92bcf | ||
|
|
f32dafc3ee | ||
|
|
84e391ffc8 | ||
|
|
26a369af89 | ||
|
|
56c752b487 | ||
|
|
890fcadac2 | ||
|
|
27f09f6627 | ||
|
|
e5b89271ee | ||
|
|
48ef0e7852 | ||
|
|
192851b03f | ||
|
|
dd30876e70 | ||
|
|
ce2603549b | ||
|
|
c645124e55 | ||
|
|
3c3a00b7bb | ||
|
|
d34e152b98 | ||
|
|
d5454b918a | ||
|
|
427a0fff4a | ||
|
|
7fc446321d | ||
|
|
3f85f4998b | ||
|
|
4799fb67c4 | ||
|
|
5ed9038f7b | ||
|
|
8c1cd4b824 | ||
|
|
50a09de212 | ||
|
|
e66710f5ed | ||
|
|
33131f4fcd | ||
|
|
9834787279 | ||
|
|
227b569138 | ||
|
|
ad1a8a3dba | ||
|
|
262c470031 | ||
|
|
4c9b9be23f | ||
|
|
d1c04d39d2 | ||
|
|
afbe7b44b6 | ||
|
|
f76f1687fb |
No files matched your search
@@ -0,0 +1,5 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: retrooper
|
||||
custom: ['https://paypal.me/retrooperdev']
|
||||
@@ -0,0 +1,38 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Report bugs to help us improve our software.
|
||||
title: ""
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**Software brand**
|
||||
Please let us know what software you are using.
|
||||
Eg. Spigot 1.18.2, Paper 1.18.2, Tuinity 1.18.2, Pufferfish 1.18.2, etc...
|
||||
Make sure to mention the version of the software.
|
||||
|
||||
**Plugins**
|
||||
Please give us a list of your plugins. Sometimes we run into incompatibilities. Having an overview of the plugins on your server can really help identify the problem quicker.
|
||||
Eg. ViaVersion, ProtocolLib, HolographicDisplays
|
||||
You may also provide a screenshot.
|
||||
|
||||
**How To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
*Example:*
|
||||
1. Join with the 1.18.2 vanilla minecraft client.
|
||||
2. Spam
|
||||
3. ....
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
@@ -0,0 +1,21 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: FEATURE REQUEST
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered to solve your solution without
|
||||
us adding this as a feature?**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
@@ -0,0 +1,67 @@
|
||||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# We have attempted to detect the languages in your repository. Please check
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master, dev ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ master, dev ]
|
||||
schedule:
|
||||
- cron: '39 0 * * 0'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'java' ]
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
||||
# Learn more:
|
||||
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v1
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
||||
@@ -0,0 +1,54 @@
|
||||
name: Gradle Package
|
||||
|
||||
on: [ push, pull_request ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
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
|
||||
|
||||
- name: Build with Gradle
|
||||
run: gradle shadowJar
|
||||
|
||||
- name: Upload build artifacts api
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: api-build
|
||||
path: api/build/libs
|
||||
|
||||
- name: Upload build artifacts spigot
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: spigot-build
|
||||
path: spigot/build/libs
|
||||
|
||||
- name: Upload build artifacts netty-common
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: netty-common-build
|
||||
path: netty-common/build/libs
|
||||
|
||||
- name: Upload build artifacts bungeecord
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: bungeecord-build
|
||||
path: bungeecord/build/libs
|
||||
|
||||
- name: Upload build artifacts velocity
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: velocity-build
|
||||
path: velocity/build/libs
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
# User-specific stuff
|
||||
/.idea
|
||||
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
|
||||
*~
|
||||
|
||||
# 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/
|
||||
|
||||
# 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/
|
||||
@@ -1,21 +1,674 @@
|
||||
MIT License
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (c) 2020 retrooper
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
Preamble
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 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 <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
@@ -1,20 +1,33 @@
|
||||
# packetevents by retrooper
|
||||
|
||||
A lightweight spigot packetlistener & packetsender coded by retrooper.
|
||||
|
||||
## About
|
||||
|
||||
This packetlistener is **only** supported on spigot servers and has been tested to work on these spigot forks: PaperSpigot, Tuinity
|
||||
|
||||
* No dependencies
|
||||
|
||||
* Licensed under the MIT license
|
||||
|
||||
[](https://opensource.org/licenses/MIT)
|
||||
|
||||
Our discord server: https://discord.me/packetevents
|
||||
# packetevents
|
||||
|
||||
[](https://github.com/retrooper/packetevents/blob/dev/LICENSE)
|
||||
[](https://jitpack.io/#retrooper/packetevents)
|
||||
|
||||
[](https://jitci.com/gh/retrooper/packetevents)
|
||||
PacketEvents is a powerful packet library. Our packet wrappers are efficient and easy to use. With our API, you can write code that runs on many platforms including Spigot, BungeeCord, Velocity, and even client-sided Fabric!
|
||||
|
||||
### Resources
|
||||
* [SpigotMC](https://www.spigotmc.org/resources/packetevents-api.80279/)
|
||||
* [JavaDocs](https://packetevents.github.io/javadocs)
|
||||
* [Discord](https://discord.me/packetevents)
|
||||
|
||||
### Setup
|
||||
[Learn more](https://github.com/retrooper/packetevents/wiki/Setup)
|
||||
|
||||
### Contributing
|
||||
[Learn more](https://github.com/retrooper/packetevents/wiki/Contributing)
|
||||
|
||||
### Sponsorships
|
||||
[](https://www.ej-technologies.com/products/jprofiler/overview.html)
|
||||
|
||||
### Statistics
|
||||
PacketEvents optionally collects statistics using [bStats](https://bstats.org/)\
|
||||
Check out our [bStats page](https://bstats.org/plugin/bukkit/packetevents/11327)
|
||||
|
||||
### Credit to
|
||||
[wiki.vg/Protocol](https://wiki.vg/Protocol)
|
||||
[adventure](https://github.com/KyoriPowered/adventure)
|
||||
[gson](https://github.com/google/gson)
|
||||
[ViaVersion](https://github.com/ViaVersion/ViaVersion)
|
||||
[ProtocolSupport](https://github.com/ProtocolSupport/ProtocolSupport)
|
||||
[MCProtocolLib](https://github.com/GeyserMC/MCProtocolLib/)
|
||||
[netty](https://github.com/netty/netty)
|
||||
@@ -0,0 +1,4 @@
|
||||
# Table of contents
|
||||
|
||||
* [Initial page](README.md)
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
dependencies {
|
||||
compileOnly(adventureDependencies)
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
public final class PacketEvents {
|
||||
private static PacketEventsAPI<?> API;
|
||||
|
||||
//Put these variable names anywhere else, they are really only for the injectors
|
||||
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 static void setAPI(PacketEventsAPI<?> api) {
|
||||
API = api;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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();
|
||||
private static final PEVersion VERSION = new PEVersion(2, 0, 0);
|
||||
|
||||
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();
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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.PacketEvent;
|
||||
import com.github.retrooper.packetevents.event.PacketListenerAbstract;
|
||||
|
||||
/**
|
||||
* The {@link PacketEvent} implements this interface.
|
||||
* Every inbuilt event should implement the {@link #call(PacketListenerCommon)} method.
|
||||
* If you are making a custom event, don't implement this.
|
||||
* The {@link PacketListenerCommon#onPacketEventExternal(PacketEvent)} method is called for every event that is not in-built.
|
||||
* including custom events.
|
||||
*
|
||||
* @author retrooper
|
||||
* @since 1.8
|
||||
*/
|
||||
public interface CallableEvent {
|
||||
default void call(PacketListenerCommon listener) {
|
||||
listener.onPacketEventExternal((PacketEvent) this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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.PacketReceiveEvent;
|
||||
|
||||
/**
|
||||
* Every event that supports cancellation should implement this interface.
|
||||
* PacketEvents' event system lets the highest priority listener be have the highest priority
|
||||
* 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 PacketReceiveEvent}
|
||||
* will prevent minecraft from processing the incoming packet.
|
||||
*
|
||||
* @author retrooper
|
||||
* @see PacketReceiveEvent
|
||||
* @since 1.7
|
||||
*/
|
||||
public interface CancellableEvent {
|
||||
|
||||
/**
|
||||
* This method returns if the event will be cancelled.
|
||||
*
|
||||
* @return Will the event be cancelled.
|
||||
*/
|
||||
boolean isCancelled();
|
||||
|
||||
/**
|
||||
* Cancel or proceed with the event.
|
||||
*
|
||||
* @param val Is the event cancelled
|
||||
*/
|
||||
void setCancelled(boolean val);
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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 org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class EventManager {
|
||||
private final Map<Byte, HashSet<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++) {
|
||||
HashSet<PacketListenerCommon> listeners = listenersMap.get(priority);
|
||||
if (listeners != null) {
|
||||
for (PacketListenerCommon listener : listeners) {
|
||||
try {
|
||||
event.call(listener);
|
||||
} catch (Throwable t) {
|
||||
PacketEvents.getAPI().getLogger().log(Level.WARNING, "PacketEvents caught an unhandled exception while calling your listener.", t);
|
||||
}
|
||||
if (postCallListenerAction != null) {
|
||||
postCallListenerAction.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (event instanceof ProtocolPacketEvent && PacketEvents.getAPI().getSettings().shouldListenersReadOnly()) {
|
||||
((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();
|
||||
HashSet<PacketListenerCommon> listenerSet = listenersMap.get(priority);
|
||||
if (listenerSet == null) {
|
||||
listenerSet = new HashSet<>();
|
||||
}
|
||||
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) {
|
||||
HashSet<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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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.util.TimeStampMode;
|
||||
|
||||
/**
|
||||
* An event in both of PacketEvents' event systems.
|
||||
*
|
||||
* @author retrooper
|
||||
* @since 1.2.6
|
||||
*/
|
||||
public abstract class PacketEvent implements CallableEvent {
|
||||
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.
|
||||
* Basically timestamp of the packet.
|
||||
*
|
||||
* @return Packet timestamp in milliseconds.
|
||||
*/
|
||||
public long getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public void callPacketEventExternal(PacketListenerCommon listener) {
|
||||
listener.onPacketEventExternal(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target({ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface PacketHandler {
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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) 2021 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) 2021 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) {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
/**
|
||||
* The priority of packet listeners affect the order they will be invoked in.
|
||||
* The lowest priority listeners are invoked first, the most high ones are invoked last.
|
||||
* The most high priority listener has the final decider on an event being cancelled.
|
||||
* This priority can be specified in the PacketListenerAbstract constructor.
|
||||
* If you don't specify a priority in the constructor, it will use the {@link #NORMAL} priority.
|
||||
*
|
||||
* @author retrooper
|
||||
* @since 1.8
|
||||
*/
|
||||
public enum PacketListenerPriority {
|
||||
/**
|
||||
* Listener is of very low importance.
|
||||
* This listener will be ran first.
|
||||
*/
|
||||
LOWEST,
|
||||
|
||||
/**
|
||||
* Listener is of low importance.
|
||||
*/
|
||||
LOW,
|
||||
|
||||
/**
|
||||
* Default listener priority.
|
||||
* Listener is neither important nor unimportant and may run normally.
|
||||
*/
|
||||
NORMAL,
|
||||
|
||||
/**
|
||||
* Listener is of high importance.
|
||||
*/
|
||||
HIGH,
|
||||
|
||||
/**
|
||||
* Listener is of critical importance and wants to decide the cancellation of an event.
|
||||
*/
|
||||
HIGHEST,
|
||||
|
||||
/**
|
||||
* Listener is purely trying to decide the cancellation of an event.
|
||||
* This listener should be ran last.
|
||||
*/
|
||||
MONITOR;
|
||||
|
||||
public static PacketListenerPriority getById(byte id) {
|
||||
return values()[id];
|
||||
}
|
||||
|
||||
public byte getId() {
|
||||
return (byte) ordinal();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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() {
|
||||
if (this instanceof PacketHandshakeReceiveEvent) {
|
||||
return ((PacketHandshakeReceiveEvent)this).clone();
|
||||
}
|
||||
else if (this instanceof PacketStatusReceiveEvent) {
|
||||
return ((PacketStatusReceiveEvent)this).clone();
|
||||
}
|
||||
else if (this instanceof PacketLoginReceiveEvent) {
|
||||
return ((PacketLoginReceiveEvent)this).clone();
|
||||
}
|
||||
else if (this instanceof PacketPlayReceiveEvent) {
|
||||
return ((PacketPlayReceiveEvent)this).clone();
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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.PacketLoginSendEvent;
|
||||
import com.github.retrooper.packetevents.event.simple.PacketPlaySendEvent;
|
||||
import com.github.retrooper.packetevents.event.simple.PacketStatusSendEvent;
|
||||
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 PacketSendEvent extends ProtocolPacketEvent<Object> {
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketSendEvent clone() {
|
||||
if (this instanceof PacketStatusSendEvent) {
|
||||
return ((PacketStatusSendEvent)this).clone();
|
||||
}
|
||||
else if (this instanceof PacketLoginSendEvent) {
|
||||
return ((PacketLoginSendEvent)this).clone();
|
||||
}
|
||||
else if (this instanceof PacketPlaySendEvent) {
|
||||
return ((PacketPlaySendEvent)this).clone();
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
/**
|
||||
* Every event that has an associated player is recommended to implement this interface.
|
||||
*
|
||||
* @author retrooper
|
||||
* @since 1.6.9
|
||||
*/
|
||||
public interface PlayerEvent<T> {
|
||||
/**
|
||||
* Associated player.
|
||||
*
|
||||
* @return Player.
|
||||
*/
|
||||
T getPlayer();
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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.PacketProcessException;
|
||||
import com.github.retrooper.packetevents.manager.server.ServerVersion;
|
||||
import com.github.retrooper.packetevents.netty.buffer.ByteBufHelper;
|
||||
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;
|
||||
|
||||
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();
|
||||
this.packetType = PacketType.getById(packetSide, user.getConnectionState(),
|
||||
version, packetID);
|
||||
if (this.packetType == null) {
|
||||
throw new PacketProcessException("Failed to map the Packet ID " + packetID + " to a PacketType constant. Bound: " + packetSide.getOpposite() + ", Connection state: " + user.getConnectionState() + ", Server version: " + serverVersion.getReleaseName());
|
||||
}
|
||||
this.connectionState = user.getConnectionState();
|
||||
}
|
||||
|
||||
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 = user.getConnectionState();
|
||||
cloned = true;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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 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 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 onPacketPlayReceive(PacketPlayReceiveEvent event) {
|
||||
}
|
||||
|
||||
public void onPacketPlaySend(PacketPlaySendEvent event) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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 UserConnectEvent extends PacketEvent implements CancellableEvent, UserEvent{
|
||||
private final User user;
|
||||
private boolean cancelled;
|
||||
|
||||
public UserConnectEvent(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void call(PacketListenerCommon listener) {
|
||||
listener.onUserConnect(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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 UserDisconnectEvent extends PacketEvent implements UserEvent {
|
||||
private final User user;
|
||||
|
||||
public UserDisconnectEvent(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void call(PacketListenerCommon listener) {
|
||||
listener.onUserDisconnect(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
/**
|
||||
* Event that involves users.
|
||||
*
|
||||
* @author retrooper
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public interface UserEvent {
|
||||
User getUser();
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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);
|
||||
}
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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();
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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) 2021 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) 2021 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) 2021 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) 2021 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) 2021 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();
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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 Exception {
|
||||
public PacketProcessException(String msg, Throwable cause) {
|
||||
super(msg, cause);
|
||||
}
|
||||
|
||||
public PacketProcessException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public PacketProcessException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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.injector;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.ConnectionState;
|
||||
import com.github.retrooper.packetevents.protocol.player.User;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface ChannelInjector {
|
||||
default boolean isServerBound() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void inject();
|
||||
|
||||
void uninject();
|
||||
|
||||
User getUser(Object channel);
|
||||
|
||||
void changeConnectionState(Object channel, @Nullable ConnectionState connectionState);
|
||||
|
||||
void updateUser(Object channel, User user);
|
||||
|
||||
void setPlayer(Object channel, Object player);
|
||||
|
||||
boolean hasPlayer(Object player);
|
||||
}
|
||||
+137
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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.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());
|
||||
|
||||
//Map username with channel
|
||||
ProtocolManager.CHANNELS.put(profile.getName(), channel);
|
||||
PacketEvents.getAPI().getLogManager().debug("Mapped player username with their channel.");
|
||||
|
||||
//Update connection state(injectors might do some adjustments when we transition into PLAY state)
|
||||
//This also updates it for the user instance
|
||||
event.getPostTasks().add(() -> {
|
||||
PacketEvents.getAPI().getInjector().changeConnectionState(channel, ConnectionState.PLAY);
|
||||
PacketEvents.getAPI().getLogManager().debug("Transitioned " + profile.getName() + " into the PLAY state!");
|
||||
});
|
||||
}
|
||||
|
||||
// Join game can be used to update world height, and sets dimension data
|
||||
|
||||
if (event.getPacketType() == PacketType.Play.Server.JOIN_GAME) {
|
||||
WrapperPlayServerJoinGame joinGame = new WrapperPlayServerJoinGame(event);
|
||||
user.setEntityId(joinGame.getEntityId());
|
||||
if (event.getServerVersion().isOlderThanOrEquals(ServerVersion.V_1_16_5)) {
|
||||
return; // Fixed world height, no tags are sent to the client
|
||||
}
|
||||
// Store world height
|
||||
NBTList<NBTCompound> list = joinGame.getDimensionCodec()
|
||||
.getCompoundTagOrNull("minecraft:dimension_type").getCompoundListTagOrNull("value");
|
||||
user.setWorldNBT(list);
|
||||
|
||||
// Update world height
|
||||
NBTCompound worldNBT = user.getWorldNBT(joinGame.getDimension().getType().getName()).getCompoundTagOrNull("element");
|
||||
user.setMinWorldHeight(worldNBT.getNumberTagOrNull("min_y").getAsInt());
|
||||
user.setTotalWorldHeight(worldNBT.getNumberTagOrNull("height").getAsInt());
|
||||
}
|
||||
|
||||
// Respawn is used to switch dimensions
|
||||
if (event.getPacketType() == PacketType.Play.Server.RESPAWN) {
|
||||
if (event.getServerVersion()
|
||||
.isOlderThanOrEquals(ServerVersion.V_1_16_5)) {
|
||||
return; // Fixed world height, no tags are sent to the client
|
||||
}
|
||||
WrapperPlayServerRespawn respawn = new WrapperPlayServerRespawn(event);
|
||||
|
||||
NBTCompound worldNBT = user.getWorldNBT(respawn.getDimension().getType().getName()).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());
|
||||
}
|
||||
}
|
||||
|
||||
@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;
|
||||
try {
|
||||
handshake = new WrapperHandshakingClientHandshake(event);
|
||||
} catch (ArrayIndexOutOfBoundsException exception) {
|
||||
user.closeConnection();
|
||||
PacketEvents.getAPI().getLogManager().debug("Disconnected " + address.getHostString() + ":" + address.getPort() + " for sending an invalid handshaking packet. They might be on an outdated client.");
|
||||
return;
|
||||
}
|
||||
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());
|
||||
event.getPostTasks().add(() -> {
|
||||
//Transition into the LOGIN OR STATUS connection state
|
||||
PacketEvents.getAPI().getInjector().changeConnectionState(channel, nextState);
|
||||
PacketEvents.getAPI().getLogManager().debug("Transitioned " + address.getHostString() + ":" + address.getPort() + " into the " + nextState + " state!");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
+136
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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);
|
||||
|
||||
@NotNull 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 sendPacketAsync(@NotNull Object player, @NotNull Object byteBuf) {
|
||||
PacketEvents.getAPI().getProtocolManager().sendPacketAsync(getChannel(player), byteBuf);
|
||||
}
|
||||
|
||||
default void sendPacket(@NotNull Object player, @NotNull PacketWrapper<?> wrapper) {
|
||||
PacketEvents.getAPI().getProtocolManager().sendPacket(getChannel(player), wrapper);
|
||||
}
|
||||
|
||||
default void sendPacketAsync(@NotNull Object player, @NotNull PacketWrapper<?> wrapper) {
|
||||
PacketEvents.getAPI().getProtocolManager().sendPacketAsync(getChannel(player), wrapper);
|
||||
}
|
||||
|
||||
default void sendPacketSilently(@NotNull Object player, @NotNull Object byteBuf) {
|
||||
PacketEvents.getAPI().getProtocolManager().sendPacketSilently(getChannel(player), byteBuf);
|
||||
}
|
||||
|
||||
default void sendPacketSilentlyAsync(@NotNull Object player, @NotNull Object byteBuf) {
|
||||
PacketEvents.getAPI().getProtocolManager().sendPacketSilentlyAsync(getChannel(player), byteBuf);
|
||||
}
|
||||
|
||||
default void sendPacketSilently(@NotNull Object player, @NotNull PacketWrapper<?> wrapper) {
|
||||
PacketEvents.getAPI().getProtocolManager().sendPacketSilently(getChannel(player), wrapper);
|
||||
}
|
||||
|
||||
default void sendPacketSilentlyAsync(@NotNull Object player, @NotNull PacketWrapper<?> wrapper) {
|
||||
PacketEvents.getAPI().getProtocolManager().sendPacketSilentlyAsync(getChannel(player), wrapper);
|
||||
}
|
||||
|
||||
default void writePacket(@NotNull Object player, @NotNull Object byteBuf) {
|
||||
PacketEvents.getAPI().getProtocolManager().writePacket(getChannel(player), byteBuf);
|
||||
}
|
||||
|
||||
default void writePacketAsync(@NotNull Object player, @NotNull Object byteBuf) {
|
||||
PacketEvents.getAPI().getProtocolManager().writePacketAsync(getChannel(player), byteBuf);
|
||||
}
|
||||
|
||||
default void writePacket(@NotNull Object player, @NotNull PacketWrapper<?> wrapper) {
|
||||
PacketEvents.getAPI().getProtocolManager().writePacket(getChannel(player), wrapper);
|
||||
}
|
||||
|
||||
default void writePacketAsync(@NotNull Object player, @NotNull PacketWrapper<?> wrapper) {
|
||||
PacketEvents.getAPI().getProtocolManager().writePacketAsync(getChannel(player), wrapper);
|
||||
}
|
||||
|
||||
default void writePacketSilently(@NotNull Object player, @NotNull Object byteBuf) {
|
||||
PacketEvents.getAPI().getProtocolManager().writePacketSilently(getChannel(player), byteBuf);
|
||||
}
|
||||
|
||||
default void writePacketSilentlyAsync(@NotNull Object player, @NotNull Object byteBuf) {
|
||||
PacketEvents.getAPI().getProtocolManager().writePacketSilentlyAsync(getChannel(player), byteBuf);
|
||||
}
|
||||
|
||||
default void writePacketSilently(@NotNull Object player, @NotNull PacketWrapper<?> wrapper) {
|
||||
PacketEvents.getAPI().getProtocolManager().writePacketSilently(getChannel(player), wrapper);
|
||||
}
|
||||
|
||||
default void writePacketSilentlyAsync(@NotNull Object player, @NotNull PacketWrapper<?> wrapper) {
|
||||
PacketEvents.getAPI().getProtocolManager().writePacketSilentlyAsync(getChannel(player), wrapper);
|
||||
}
|
||||
|
||||
default void receivePacket(Object player, Object byteBuf) {
|
||||
PacketEvents.getAPI().getProtocolManager().receivePacket(getChannel(player), byteBuf);
|
||||
}
|
||||
|
||||
default void receivePacketAsync(Object player, Object byteBuf) {
|
||||
PacketEvents.getAPI().getProtocolManager().receivePacketAsync(getChannel(player), byteBuf);
|
||||
}
|
||||
|
||||
default void receivePacket(Object player, PacketWrapper<?> wrapper) {
|
||||
PacketEvents.getAPI().getProtocolManager().receivePacket(getChannel(player), wrapper);
|
||||
}
|
||||
|
||||
default void receivePacketAsync(Object player, PacketWrapper<?> wrapper) {
|
||||
PacketEvents.getAPI().getProtocolManager().receivePacketAsync(getChannel(player), wrapper);
|
||||
}
|
||||
|
||||
default void receivePacketSilently(Object player, Object byteBuf) {
|
||||
PacketEvents.getAPI().getProtocolManager().receivePacketSilently(getChannel(player), byteBuf);
|
||||
}
|
||||
|
||||
default void receivePacketSilentlyAsync(Object player, Object byteBuf) {
|
||||
PacketEvents.getAPI().getProtocolManager().receivePacketSilentlyAsync(getChannel(player), byteBuf);
|
||||
}
|
||||
|
||||
default void receivePacketSilently(Object player, PacketWrapper<?> wrapper) {
|
||||
PacketEvents.getAPI().getProtocolManager().receivePacketSilently(getChannel(player), wrapper);
|
||||
}
|
||||
|
||||
default void receivePacketSilentlyAsync(Object player, PacketWrapper<?> wrapper) {
|
||||
PacketEvents.getAPI().getProtocolManager().receivePacketSilentlyAsync(getChannel(player), wrapper);
|
||||
}
|
||||
}
|
||||
+209
@@ -0,0 +1,209 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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.ConnectionState;
|
||||
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.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public interface ProtocolManager {
|
||||
Map<String, Object> CHANNELS = new ConcurrentHashMap<>();
|
||||
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 packet);
|
||||
|
||||
void sendPacketSilently(Object channel, Object packet);
|
||||
|
||||
void writePacket(Object channel, Object packet);
|
||||
|
||||
void writePacketSilently(Object channel, Object packet);
|
||||
|
||||
void receivePacket(Object channel, Object packet);
|
||||
|
||||
void receivePacketSilently(Object channel, Object packet);
|
||||
|
||||
ClientVersion getClientVersion(Object channel);
|
||||
|
||||
default void sendPacketAsync(Object channel, Object byteBuf) {
|
||||
ChannelHelper.runInEventLoop(channel, () -> {
|
||||
sendPacket(channel, byteBuf);
|
||||
});
|
||||
}
|
||||
|
||||
default void sendPacketSilentlyAsync(Object channel, Object byteBuf) {
|
||||
ChannelHelper.runInEventLoop(channel, () -> {
|
||||
sendPacketSilently(channel, byteBuf);
|
||||
});
|
||||
}
|
||||
|
||||
default void writePacketAsync(Object channel, Object byteBuf) {
|
||||
ChannelHelper.runInEventLoop(channel, () -> {
|
||||
writePacket(channel, byteBuf);
|
||||
});
|
||||
}
|
||||
|
||||
default void writePacketSilentlyAsync(Object channel, Object byteBuf) {
|
||||
ChannelHelper.runInEventLoop(channel, () -> {
|
||||
writePacketSilently(channel, byteBuf);
|
||||
});
|
||||
}
|
||||
|
||||
default void receivePacketAsync(Object channel, Object byteBuf) {
|
||||
ChannelHelper.runInEventLoop(channel, () -> {
|
||||
receivePacket(channel, byteBuf);
|
||||
});
|
||||
}
|
||||
|
||||
default void receivePacketSilentlyAsync(Object channel, Object byteBuf) {
|
||||
ChannelHelper.runInEventLoop(channel, () -> {
|
||||
receivePacketSilently(channel, byteBuf);
|
||||
});
|
||||
}
|
||||
|
||||
//TODO Make it clear that this only updates the connection state in our user.
|
||||
//Sometimes you should use getInjector().changeConnectionState because that can allow the injector to make adjustments.
|
||||
//This is very important, especially on Spigot.
|
||||
//As soon as we switch to the play state on spigot, our injector makes some adjustments.
|
||||
default void changeConnectionState(Object channel, ConnectionState connectionState) {
|
||||
getUser(channel).setConnectionState(connectionState);
|
||||
}
|
||||
|
||||
default void setClientVersion(Object channel, ClientVersion version) {
|
||||
getUser(channel).setClientVersion(version);
|
||||
}
|
||||
|
||||
default void sendPacket(Object channel, PacketWrapper<?> wrapper) {
|
||||
PacketWrapper<?>[] wrappers = PacketTransformationUtil.transform(wrapper);
|
||||
for (PacketWrapper<?> packet : wrappers) {
|
||||
packet.prepareForSend();
|
||||
sendPacket(channel, packet.buffer);
|
||||
}
|
||||
}
|
||||
|
||||
default void sendPacketAsync(Object channel, PacketWrapper<?> wrapper) {
|
||||
ChannelHelper.runInEventLoop(channel, () -> {
|
||||
sendPacket(channel, wrapper);
|
||||
});
|
||||
}
|
||||
|
||||
default void sendPacketSilently(Object channel, PacketWrapper<?> wrapper) {
|
||||
PacketWrapper<?>[] wrappers = PacketTransformationUtil.transform(wrapper);
|
||||
for (PacketWrapper<?> packet : wrappers) {
|
||||
packet.prepareForSend();
|
||||
sendPacketSilently(channel, packet.buffer);
|
||||
}
|
||||
}
|
||||
|
||||
default void sendPacketSilentlyAsync(Object channel, PacketWrapper<?> wrapper) {
|
||||
ChannelHelper.runInEventLoop(channel, () -> {
|
||||
sendPacketSilently(channel, wrapper);
|
||||
});
|
||||
}
|
||||
|
||||
default void writePacket(Object channel, PacketWrapper<?> wrapper) {
|
||||
PacketWrapper<?>[] wrappers = PacketTransformationUtil.transform(wrapper);
|
||||
for (PacketWrapper<?> packet : wrappers) {
|
||||
packet.prepareForSend();
|
||||
writePacket(channel, packet.buffer);
|
||||
}
|
||||
}
|
||||
|
||||
default void writePacketAsync(Object channel, PacketWrapper<?> wrapper) {
|
||||
ChannelHelper.runInEventLoop(channel, () -> {
|
||||
writePacket(channel, wrapper);
|
||||
});
|
||||
}
|
||||
|
||||
default void writePacketSilently(Object channel, PacketWrapper<?> wrapper) {
|
||||
PacketWrapper<?>[] wrappers = PacketTransformationUtil.transform(wrapper);
|
||||
for (PacketWrapper<?> packet : wrappers) {
|
||||
packet.prepareForSend();
|
||||
writePacketSilently(channel, packet.buffer);
|
||||
}
|
||||
}
|
||||
|
||||
default void writePacketSilentlyAsync(Object channel, PacketWrapper<?> wrapper) {
|
||||
ChannelHelper.runInEventLoop(channel, () -> {
|
||||
writePacketSilently(channel, wrapper);
|
||||
});
|
||||
}
|
||||
|
||||
default void receivePacket(Object channel, PacketWrapper<?> wrapper) {
|
||||
PacketWrapper<?>[] wrappers = PacketTransformationUtil.transform(wrapper);
|
||||
for (PacketWrapper<?> packet : wrappers) {
|
||||
packet.prepareForSend();
|
||||
receivePacket(channel, packet.buffer);
|
||||
}
|
||||
}
|
||||
|
||||
default void receivePacketAsync(Object channel, PacketWrapper<?> wrapper) {
|
||||
ChannelHelper.runInEventLoop(channel, () -> {
|
||||
receivePacket(channel, wrapper);
|
||||
});
|
||||
}
|
||||
|
||||
default void receivePacketSilently(Object channel, PacketWrapper<?> wrapper) {
|
||||
PacketWrapper<?>[] wrappers = PacketTransformationUtil.transform(wrapper);
|
||||
for (PacketWrapper<?> packet : wrappers) {
|
||||
packet.prepareForSend();
|
||||
receivePacketSilently(channel, packet.buffer);
|
||||
}
|
||||
}
|
||||
|
||||
default void receivePacketSilentlyAsync(Object channel, PacketWrapper<?> wrapper) {
|
||||
ChannelHelper.runInEventLoop(channel, () -> {
|
||||
receivePacketSilently(channel, wrapper);
|
||||
});
|
||||
}
|
||||
|
||||
default User getUser(Object channel) {
|
||||
return USERS.get(channel);
|
||||
}
|
||||
|
||||
default void setUser(Object channel, User user) {
|
||||
USERS.put(channel, user);
|
||||
PacketEvents.getAPI().getInjector().updateUser(channel, user);
|
||||
}
|
||||
|
||||
default Object getChannel(String username) {
|
||||
return CHANNELS.get(username);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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();
|
||||
}
|
||||
}
|
||||
+219
@@ -0,0 +1,219 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
/**
|
||||
* 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 PlatformVersion or LocalVersion or Version?
|
||||
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),
|
||||
//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;
|
||||
|
||||
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 reversedValues()[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() {
|
||||
return ClientVersion.getById(this.protocolVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
/*
|
||||
* Some server versions have the same protocol version in the minecraft protocol.
|
||||
* We still need this method to work in such cases.
|
||||
* We first check if this is the case, if the protocol versions aren't the same, we can just use the protocol versions
|
||||
* to compare the server versions.
|
||||
*/
|
||||
if (target.protocolVersion != protocolVersion || this == target) {
|
||||
return protocolVersion > target.protocolVersion;
|
||||
}
|
||||
|
||||
/*
|
||||
* The server versions unfortunately have the same protocol version.
|
||||
* We need to look at this "reversedValues" variable.
|
||||
* The reversed values variable is an array containing all enum constants in this enum but in a reversed order.
|
||||
* I already made this variable a while ago for a different usage, you can check that out.
|
||||
* The first one we find in the array is the newer version.
|
||||
*/
|
||||
for (ServerVersion version : reversedValues()) {
|
||||
if (version == target) {
|
||||
return false;
|
||||
}
|
||||
if (version == this) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
/*
|
||||
* Some server versions have the same protocol version in the minecraft protocol.
|
||||
* We still need this method to work in such cases.
|
||||
* We first check if this is the case, if the protocol versions aren't the same, we can just use the protocol versions
|
||||
* to compare the server versions.
|
||||
*/
|
||||
if (target.protocolVersion != protocolVersion || this == target) {
|
||||
return protocolVersion < target.protocolVersion;
|
||||
}
|
||||
/*
|
||||
* The server versions unfortunately have the same protocol version.
|
||||
* We look at all enum constants in the ServerVersion enum in the order they have been defined in.
|
||||
* The first one we find in the array is the newer version.
|
||||
*/
|
||||
for (ServerVersion version : VALUES) {
|
||||
if (version == this) {
|
||||
return true;
|
||||
} else if (version == target) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 == target || isNewerThan(target);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 == target || isOlderThan(target);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
/**
|
||||
* System Operating system.
|
||||
*
|
||||
* @author retrooper
|
||||
* @since 1.7
|
||||
*/
|
||||
public enum SystemOS {
|
||||
|
||||
WINDOWS, MACOS, LINUX, OTHER;
|
||||
private static SystemOS CACHE;
|
||||
|
||||
/**
|
||||
* Get the server's operating system.
|
||||
* This method will NOT cache.
|
||||
*
|
||||
* @return Operating System.
|
||||
*/
|
||||
public static SystemOS getOSNoCache() {
|
||||
final String os = System.getProperty("os.name").toLowerCase();
|
||||
for (SystemOS sysos : values()) {
|
||||
if (os.contains(sysos.name().toLowerCase())) {
|
||||
return sysos;
|
||||
}
|
||||
}
|
||||
return OTHER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the server's operating system.
|
||||
* This method will CACHE for you.
|
||||
*
|
||||
* @return Operating System.
|
||||
*/
|
||||
public static SystemOS getOS() {
|
||||
if (CACHE == null) {
|
||||
CACHE = getOSNoCache();
|
||||
}
|
||||
return CACHE;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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();
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
public interface ByteBufAllocationOperator {
|
||||
Object wrappedBuffer(byte[] bytes);
|
||||
|
||||
Object copiedBuffer(byte[] bytes);
|
||||
|
||||
Object buffer();
|
||||
|
||||
Object directBuffer();
|
||||
|
||||
Object compositeBuffer();
|
||||
}
|
||||
@@ -0,0 +1,257 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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 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) 2021 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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 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) 2021 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) 2021 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,95 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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 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 void runInEventLoop(Object channel, Runnable runnable) {
|
||||
PacketEvents.getAPI().getNettyManager().getChannelOperator().runInEventLoop(channel, runnable);
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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;
|
||||
import java.util.Set;
|
||||
|
||||
public interface ChannelOperator {
|
||||
Set<Class<? extends Throwable>> getIgnoredHandlerExceptions();
|
||||
|
||||
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);
|
||||
void runInEventLoop(Object channel, Runnable runnable);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
/**
|
||||
* @author retrooper
|
||||
* @since 1.8
|
||||
*/
|
||||
public enum ConnectionState {
|
||||
HANDSHAKING, STATUS, LOGIN, PLAY;
|
||||
|
||||
public static ConnectionState getById(int id) {
|
||||
return values()[id];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
//TODO
|
||||
public enum ProtocolVersion {
|
||||
UNKNOWN
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
public enum ChatPosition {
|
||||
CHAT,
|
||||
SYSTEM,
|
||||
GAME_INFO;
|
||||
|
||||
public int getId() {
|
||||
return ordinal();
|
||||
}
|
||||
|
||||
public static ChatPosition getById(int id) {
|
||||
return values()[id];
|
||||
}
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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) 2021 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;
|
||||
}
|
||||
}
|
||||
+276
@@ -0,0 +1,276 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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.villager.VillagerData;
|
||||
import com.github.retrooper.packetevents.protocol.item.ItemStack;
|
||||
import com.github.retrooper.packetevents.protocol.item.enchantment.type.EnchantmentType;
|
||||
import com.github.retrooper.packetevents.protocol.nbt.NBTCompound;
|
||||
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
|
||||
import com.github.retrooper.packetevents.protocol.world.BlockFace;
|
||||
import com.github.retrooper.packetevents.util.*;
|
||||
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
|
||||
import com.google.gson.JsonObject;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
import java.util.*;
|
||||
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, //Fix? Why did we not acknoledge 1.13
|
||||
ClientVersion.V_1_16);
|
||||
|
||||
public static final EntityDataType<Byte> BYTE = define("byte", PacketWrapper::readByte, PacketWrapper::writeByte);
|
||||
public static final EntityDataType<Integer> INT = define("int", readIntDeserializer(), writeIntSerializer());
|
||||
public static final EntityDataType<Float> FLOAT = define("float", PacketWrapper::readFloat, PacketWrapper::writeFloat);
|
||||
public static final EntityDataType<String> STRING = define("string", PacketWrapper::readString, PacketWrapper::writeString);
|
||||
public static final EntityDataType<Component> COMPONENT = define("component", PacketWrapper::readComponent, PacketWrapper::writeComponent);
|
||||
public static final EntityDataType<Optional<Component>> OPTIONAL_COMPONENT = define("optional_component", readOptionalComponentDeserializer(), writeOptionalComponentSerializer());
|
||||
public static final EntityDataType<ItemStack> ITEMSTACK = define("itemstack", PacketWrapper::readItemStack, PacketWrapper::writeItemStack);
|
||||
public static final EntityDataType<Optional<Object>> OPTIONAL_BLOCK_STATE = define("optional_block_state", readIntDeserializer(), writeIntSerializer());
|
||||
public static final EntityDataType<Boolean> BOOLEAN = define("boolean", PacketWrapper::readBoolean, PacketWrapper::writeBoolean);
|
||||
public static final EntityDataType<Integer> PARTICLE = define("particle", PacketWrapper::readVarInt, PacketWrapper::writeVarInt);
|
||||
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", readBlockPositionDeserializer(), writeBlockPositionSerializer());
|
||||
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) -> {
|
||||
if (wrapper.readBoolean()) {
|
||||
return Optional.of(wrapper.readUUID());
|
||||
} else {
|
||||
return Optional.empty();
|
||||
}
|
||||
},
|
||||
(PacketWrapper<?> wrapper, Optional<UUID> value) -> {
|
||||
if (value.isPresent()) {
|
||||
wrapper.writeBoolean(true);
|
||||
wrapper.writeUUID(value.get());
|
||||
} else {
|
||||
wrapper.writeBoolean(false);
|
||||
}
|
||||
});
|
||||
|
||||
public static final EntityDataType<NBTCompound> NBT = define("nbt", PacketWrapper::readNBT, PacketWrapper::writeNBT);
|
||||
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())));
|
||||
|
||||
@Deprecated
|
||||
public static final EntityDataType<Short> SHORT = define("short", PacketWrapper::readShort, PacketWrapper::writeShort);
|
||||
|
||||
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);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static <T> Function<PacketWrapper<?>, T> readOptionalComponentDeserializer() {
|
||||
return (PacketWrapper<?> wrapper) -> {
|
||||
if (wrapper.readBoolean()) {
|
||||
return (T) Optional.of(wrapper.readComponent());
|
||||
} else {
|
||||
return (T) Optional.empty();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static <T> BiConsumer<PacketWrapper<?>, T> writeOptionalComponentSerializer() {
|
||||
return (PacketWrapper<?> wrapper, T value) -> {
|
||||
if (value instanceof Optional) {
|
||||
Optional<Component> optional = (Optional<Component>) value;
|
||||
if (optional.isPresent()) {
|
||||
wrapper.writeBoolean(true);
|
||||
wrapper.writeComponent(optional.get());
|
||||
} else {
|
||||
wrapper.writeBoolean(false);
|
||||
}
|
||||
} else {
|
||||
wrapper.writeBoolean(false);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static <T> Function<PacketWrapper<?>, T> readBlockPositionDeserializer() {
|
||||
if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9)) {
|
||||
return (PacketWrapper<?> wrapper) -> (T) wrapper.readBlockPosition();
|
||||
} else {
|
||||
return (PacketWrapper<?> wrapper) -> {
|
||||
int x = wrapper.readInt();
|
||||
int y = wrapper.readInt();
|
||||
int z = wrapper.readInt();
|
||||
return (T) new Vector3i(x, y, z);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private static <T> BiConsumer<PacketWrapper<?>, T> writeBlockPositionSerializer() {
|
||||
if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9)) {
|
||||
return (PacketWrapper<?> wrapper, T value) -> {
|
||||
wrapper.writeBlockPosition((Vector3i) value);
|
||||
};
|
||||
} else {
|
||||
return (PacketWrapper<?> wrapper, T value) -> {
|
||||
Vector3i position = (Vector3i) value;
|
||||
wrapper.writeInt(position.getX());
|
||||
wrapper.writeInt(position.getY());
|
||||
wrapper.writeInt(position.getZ());
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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.provider;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DataProvider {
|
||||
List<EntityData> encode();
|
||||
void decode(List<EntityData> data);
|
||||
}
|
||||
+343
@@ -0,0 +1,343 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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.provider;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
|
||||
import com.github.retrooper.packetevents.protocol.entity.pose.EntityPose;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class EntityDataProvider implements DataProvider {
|
||||
@Nullable
|
||||
private Component customName;
|
||||
|
||||
private boolean customNameVisible;
|
||||
private EntityPose pose = EntityPose.STANDING;
|
||||
private int airTicks;
|
||||
private int ticksFrozenInPowderedSnow = 0;
|
||||
private boolean onFire;
|
||||
private boolean crouching;
|
||||
//Now unused
|
||||
private boolean riding;
|
||||
|
||||
private boolean sprinting;
|
||||
private boolean swimming;
|
||||
private boolean invisible;
|
||||
private boolean glowing;
|
||||
private boolean flyingWithElytra;
|
||||
private boolean silent;
|
||||
private boolean hasGravity = true;
|
||||
|
||||
@Nullable
|
||||
public Component getCustomName() {
|
||||
return customName;
|
||||
}
|
||||
|
||||
public void setCustomName(@Nullable Component customName) {
|
||||
this.customName = customName;
|
||||
}
|
||||
|
||||
public boolean isCustomNameVisible() {
|
||||
return customNameVisible;
|
||||
}
|
||||
|
||||
public void setCustomNameVisible(boolean customNameVisible) {
|
||||
this.customNameVisible = customNameVisible;
|
||||
}
|
||||
|
||||
public EntityPose getPose() {
|
||||
return pose;
|
||||
}
|
||||
|
||||
public void setPose(EntityPose pose) {
|
||||
this.pose = pose;
|
||||
}
|
||||
|
||||
public int getAirTicks() {
|
||||
return airTicks;
|
||||
}
|
||||
|
||||
public void setAirTicks(int airTicks) {
|
||||
this.airTicks = airTicks;
|
||||
}
|
||||
|
||||
public int getTicksFrozenInPowderedSnow() {
|
||||
return ticksFrozenInPowderedSnow;
|
||||
}
|
||||
|
||||
public void setTicksFrozenInPowderedSnow(int ticksFrozenInPowderedSnow) {
|
||||
this.ticksFrozenInPowderedSnow = ticksFrozenInPowderedSnow;
|
||||
}
|
||||
|
||||
public boolean isOnFire() {
|
||||
return onFire;
|
||||
}
|
||||
|
||||
public void setOnFire(boolean onFire) {
|
||||
this.onFire = onFire;
|
||||
}
|
||||
|
||||
public boolean isCrouching() {
|
||||
return crouching;
|
||||
}
|
||||
|
||||
public void setCrouching(boolean crouching) {
|
||||
this.crouching = crouching;
|
||||
}
|
||||
|
||||
public boolean isRiding() {
|
||||
return riding;
|
||||
}
|
||||
|
||||
public void setRiding(boolean riding) {
|
||||
this.riding = riding;
|
||||
}
|
||||
|
||||
public boolean isSprinting() {
|
||||
return sprinting;
|
||||
}
|
||||
|
||||
public void setSprinting(boolean sprinting) {
|
||||
this.sprinting = sprinting;
|
||||
}
|
||||
|
||||
public boolean isSwimming() {
|
||||
return swimming;
|
||||
}
|
||||
|
||||
public void setSwimming(boolean swimming) {
|
||||
this.swimming = swimming;
|
||||
}
|
||||
|
||||
public boolean isInvisible() {
|
||||
return invisible;
|
||||
}
|
||||
|
||||
public void setInvisible(boolean invisible) {
|
||||
this.invisible = invisible;
|
||||
}
|
||||
|
||||
public boolean isGlowing() {
|
||||
return glowing;
|
||||
}
|
||||
|
||||
public void setGlowing(boolean glowing) {
|
||||
this.glowing = glowing;
|
||||
}
|
||||
|
||||
public boolean isFlyingWithElytra() {
|
||||
return flyingWithElytra;
|
||||
}
|
||||
|
||||
public void setFlyingWithElytra(boolean flyingWithElytra) {
|
||||
this.flyingWithElytra = flyingWithElytra;
|
||||
}
|
||||
|
||||
public boolean isSilent() {
|
||||
return silent;
|
||||
}
|
||||
|
||||
public void setSilent(boolean silent) {
|
||||
this.silent = silent;
|
||||
}
|
||||
|
||||
public boolean isHasGravity() {
|
||||
return hasGravity;
|
||||
}
|
||||
|
||||
public void setHasGravity(boolean hasGravity) {
|
||||
this.hasGravity = hasGravity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntityData> encode() {
|
||||
byte mask = 0x00;
|
||||
if (onFire) {
|
||||
mask |= 0x01;
|
||||
}
|
||||
if (crouching) {
|
||||
mask |= 0x02;
|
||||
}
|
||||
//TODO Rethink, should we add this?
|
||||
if (riding) {
|
||||
mask |= 0x04;
|
||||
}
|
||||
if (sprinting) {
|
||||
mask |= 0x08;
|
||||
}
|
||||
if (swimming) {
|
||||
mask |= 0x10;
|
||||
}
|
||||
if (invisible) {
|
||||
mask |= 0x20;
|
||||
}
|
||||
if (glowing) {
|
||||
mask |= 0x40;
|
||||
}
|
||||
if (flyingWithElytra) {
|
||||
mask |= 0x80;
|
||||
}
|
||||
List<EntityData> metadata = new ArrayList<>(8);
|
||||
metadata.add(new EntityData(0, EntityDataTypes.BYTE, mask));
|
||||
metadata.add(new EntityData(1, EntityDataTypes.INT, airTicks));
|
||||
metadata.add(new EntityData(2, EntityDataTypes.OPTIONAL_COMPONENT, Optional.ofNullable(customName)));
|
||||
metadata.add(new EntityData(3, EntityDataTypes.BOOLEAN, customNameVisible));
|
||||
metadata.add(new EntityData(4, EntityDataTypes.BOOLEAN, silent));
|
||||
metadata.add(new EntityData(5, EntityDataTypes.BOOLEAN, !hasGravity));
|
||||
metadata.add(new EntityData(6, EntityDataTypes.ENTITY_POSE, pose));
|
||||
metadata.add(new EntityData(7, EntityDataTypes.INT, ticksFrozenInPowderedSnow));
|
||||
return metadata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(List<EntityData> data) {
|
||||
for (EntityData entityData : data) {
|
||||
switch (entityData.getIndex()) {
|
||||
case 0:
|
||||
byte mask = (byte) entityData.getValue();
|
||||
onFire = (mask & 0x01) != 0;
|
||||
crouching = (mask & 0x02) != 0;
|
||||
riding = (mask & 0x04) != 0;
|
||||
sprinting = (mask & 0x08) != 0;
|
||||
swimming = (mask & 0x10) != 0;
|
||||
invisible = (mask & 0x20) != 0;
|
||||
glowing = (mask & 0x40) != 0;
|
||||
flyingWithElytra = (mask & 0x80) != 0;
|
||||
break;
|
||||
case 1:
|
||||
airTicks = (int) entityData.getValue();
|
||||
break;
|
||||
case 2:
|
||||
customName = ((Optional<Component>) entityData.getValue()).orElse(null);
|
||||
break;
|
||||
case 3:
|
||||
customNameVisible = (boolean) entityData.getValue();
|
||||
break;
|
||||
case 4:
|
||||
silent = (boolean) entityData.getValue();
|
||||
break;
|
||||
case 5:
|
||||
hasGravity = !(boolean) entityData.getValue();
|
||||
break;
|
||||
case 6:
|
||||
pose = (EntityPose) entityData.getValue();
|
||||
break;
|
||||
case 7:
|
||||
ticksFrozenInPowderedSnow = (int) entityData.getValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static EntityBuilder<EntityBuilder> builderEntity() {
|
||||
return new EntityBuilder<>(new EntityDataProvider());
|
||||
}
|
||||
|
||||
public static class EntityBuilder<T extends EntityBuilder> {
|
||||
protected EntityDataProvider provider;
|
||||
|
||||
public EntityBuilder(EntityDataProvider provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
public T customName(@Nullable Component customName) {
|
||||
((EntityDataProvider) provider).setCustomName(customName);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T customNameVisible(boolean customNameVisible) {
|
||||
((EntityDataProvider) provider).setCustomNameVisible(customNameVisible);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T pose(EntityPose pose) {
|
||||
((EntityDataProvider) provider).setPose(pose);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T onFire(boolean onFire) {
|
||||
((EntityDataProvider) provider).setOnFire(onFire);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T crouching(boolean crouching) {
|
||||
((EntityDataProvider) provider).setCrouching(crouching);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T riding(boolean riding) {
|
||||
((EntityDataProvider) provider).setRiding(riding);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T sprinting(boolean sprinting) {
|
||||
((EntityDataProvider) provider).setSprinting(sprinting);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T swimming(boolean swimming) {
|
||||
((EntityDataProvider) provider).setSwimming(swimming);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T invisible(boolean invisible) {
|
||||
((EntityDataProvider) provider).setInvisible(invisible);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T glowing(boolean glowing) {
|
||||
((EntityDataProvider) provider).setGlowing(glowing);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T flyingWithElytra(boolean flyingWithElytra) {
|
||||
((EntityDataProvider) provider).setFlyingWithElytra(flyingWithElytra);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T silent(boolean silent) {
|
||||
((EntityDataProvider) provider).setSilent(silent);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T hasGravity(boolean hasGravity) {
|
||||
((EntityDataProvider) provider).setHasGravity(hasGravity);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T airTicks(int airTicks) {
|
||||
((EntityDataProvider) provider).setAirTicks(airTicks);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T ticksFrozenInPowderedSnow(int ticksFrozenInPowderedSnow) {
|
||||
((EntityDataProvider) provider).setTicksFrozenInPowderedSnow(ticksFrozenInPowderedSnow);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public <K extends EntityDataProvider> K build() {
|
||||
return (K) provider;
|
||||
}
|
||||
}
|
||||
}
|
||||
+232
@@ -0,0 +1,232 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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.provider;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
|
||||
import com.github.retrooper.packetevents.protocol.player.InteractionHand;
|
||||
import com.github.retrooper.packetevents.util.Vector3i;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class LivingEntityDataProvider extends EntityDataProvider {
|
||||
private boolean handActive;
|
||||
private InteractionHand hand = InteractionHand.MAIN_HAND;
|
||||
private boolean isInRiptideSpinAttack;
|
||||
private float health = 1.0f;
|
||||
private int potionEffectColor;
|
||||
private boolean potionEffectAmbient;
|
||||
private int arrowInBodyCount;
|
||||
private int beeStingsInBodyCount;
|
||||
@Nullable
|
||||
private Vector3i sleepingPosition;
|
||||
|
||||
|
||||
public boolean isHandActive() {
|
||||
return handActive;
|
||||
}
|
||||
|
||||
public void setHandActive(boolean handActive) {
|
||||
this.handActive = handActive;
|
||||
}
|
||||
|
||||
public InteractionHand getHand() {
|
||||
return hand;
|
||||
}
|
||||
|
||||
public void setHand(InteractionHand hand) {
|
||||
this.hand = hand;
|
||||
}
|
||||
|
||||
public boolean isInRiptideSpinAttack() {
|
||||
return isInRiptideSpinAttack;
|
||||
}
|
||||
|
||||
public void setInRiptideSpinAttack(boolean inRiptideSpinAttack) {
|
||||
isInRiptideSpinAttack = inRiptideSpinAttack;
|
||||
}
|
||||
|
||||
public float getHealth() {
|
||||
return health;
|
||||
}
|
||||
|
||||
public void setHealth(float health) {
|
||||
this.health = health;
|
||||
}
|
||||
|
||||
public int getPotionEffectColor() {
|
||||
return potionEffectColor;
|
||||
}
|
||||
|
||||
public void setPotionEffectColor(int potionEffectColor) {
|
||||
this.potionEffectColor = potionEffectColor;
|
||||
}
|
||||
|
||||
public boolean isPotionEffectAmbient() {
|
||||
return potionEffectAmbient;
|
||||
}
|
||||
|
||||
public void setPotionEffectAmbient(boolean potionEffectAmbient) {
|
||||
this.potionEffectAmbient = potionEffectAmbient;
|
||||
}
|
||||
|
||||
public int getArrowInBodyCount() {
|
||||
return arrowInBodyCount;
|
||||
}
|
||||
|
||||
public void setArrowInBodyCount(int arrowInBodyCount) {
|
||||
this.arrowInBodyCount = arrowInBodyCount;
|
||||
}
|
||||
|
||||
public int getBeeStingsInBodyCount() {
|
||||
return beeStingsInBodyCount;
|
||||
}
|
||||
|
||||
public void setBeeStingsInBodyCount(int beeStingsInBodyCount) {
|
||||
this.beeStingsInBodyCount = beeStingsInBodyCount;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Vector3i getSleepingPosition() {
|
||||
return sleepingPosition;
|
||||
}
|
||||
|
||||
public void setSleepingPosition(@Nullable Vector3i sleepingPosition) {
|
||||
this.sleepingPosition = sleepingPosition;
|
||||
}
|
||||
|
||||
public static LivingEntityBuilder<LivingEntityBuilder> builderLivingEntity() {
|
||||
return new LivingEntityBuilder<>(new LivingEntityDataProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntityData> encode() {
|
||||
List<EntityData> metadata = super.encode();
|
||||
byte mask = 0x00;
|
||||
if (handActive) {
|
||||
mask |= 0x01;
|
||||
}
|
||||
|
||||
//TODO Confirm
|
||||
if (hand == InteractionHand.OFF_HAND) {
|
||||
mask |= 0x02;
|
||||
}
|
||||
|
||||
if (isInRiptideSpinAttack) {
|
||||
mask |= 0x04;
|
||||
}
|
||||
|
||||
|
||||
metadata.add(new EntityData(8, EntityDataTypes.BYTE, mask));
|
||||
metadata.add(new EntityData(9, EntityDataTypes.FLOAT, health));
|
||||
metadata.add(new EntityData(10, EntityDataTypes.INT, potionEffectColor));
|
||||
metadata.add(new EntityData(11, EntityDataTypes.BOOLEAN, potionEffectAmbient));
|
||||
metadata.add(new EntityData(12, EntityDataTypes.INT, arrowInBodyCount));
|
||||
metadata.add(new EntityData(13, EntityDataTypes.INT, beeStingsInBodyCount));
|
||||
metadata.add(new EntityData(14, EntityDataTypes.OPTIONAL_BLOCK_POSITION, Optional.ofNullable(sleepingPosition)));
|
||||
return metadata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(List<EntityData> data) {
|
||||
super.decode(data);
|
||||
for (EntityData entityData : data) {
|
||||
switch (entityData.getIndex()) {
|
||||
case 8:
|
||||
byte mask = (byte) entityData.getValue();
|
||||
handActive = (mask & 0x01) != 0;
|
||||
//TODO Test, look into
|
||||
hand = (mask & 0x02) != 0 ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND;
|
||||
isInRiptideSpinAttack = (mask & 0x04) != 0;
|
||||
break;
|
||||
case 9:
|
||||
health = (float) entityData.getValue();
|
||||
break;
|
||||
case 10:
|
||||
potionEffectColor = (int) entityData.getValue();
|
||||
break;
|
||||
case 11:
|
||||
potionEffectAmbient = (boolean) entityData.getValue();
|
||||
break;
|
||||
case 12:
|
||||
arrowInBodyCount = (int) entityData.getValue();
|
||||
break;
|
||||
case 13:
|
||||
beeStingsInBodyCount = (int) entityData.getValue();
|
||||
break;
|
||||
case 14:
|
||||
sleepingPosition = ((Optional<Vector3i>) entityData.getValue()).orElse(null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class LivingEntityBuilder<T extends LivingEntityBuilder> extends EntityDataProvider.EntityBuilder<T> {
|
||||
public LivingEntityBuilder(LivingEntityDataProvider livingEntityDataProvider) {
|
||||
super(livingEntityDataProvider);
|
||||
}
|
||||
|
||||
public T handActive(boolean handActive) {
|
||||
((LivingEntityDataProvider) provider).setHandActive(handActive);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T hand(InteractionHand hand) {
|
||||
((LivingEntityDataProvider) provider).setHand(hand);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T isInRiptideSpinAttack(boolean isInRiptideSpinAttack) {
|
||||
((LivingEntityDataProvider) provider).setInRiptideSpinAttack(isInRiptideSpinAttack);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T health(float health) {
|
||||
((LivingEntityDataProvider) provider).setHealth(health);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T potionEffectColor(int potionEffectColor) {
|
||||
((LivingEntityDataProvider) provider).setPotionEffectColor(potionEffectColor);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T potionEffectAmbient(boolean potionEffectAmbient) {
|
||||
((LivingEntityDataProvider) provider).setPotionEffectAmbient(potionEffectAmbient);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T arrowInBodyCount(int arrowInBodyCount) {
|
||||
((LivingEntityDataProvider) provider).setArrowInBodyCount(arrowInBodyCount);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T beeStingsInBodyCount(int beeStingsInBodyCount) {
|
||||
((LivingEntityDataProvider) provider).setBeeStingsInBodyCount(beeStingsInBodyCount);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T sleepingPosition(@Nullable Vector3i sleepingPosition) {
|
||||
((LivingEntityDataProvider) provider).setSleepingPosition(sleepingPosition);
|
||||
return (T) this;
|
||||
}
|
||||
}
|
||||
}
|
||||
+169
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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.provider;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
|
||||
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
|
||||
import com.github.retrooper.packetevents.protocol.nbt.NBTCompound;
|
||||
import com.github.retrooper.packetevents.protocol.player.HumanoidArm;
|
||||
import com.github.retrooper.packetevents.protocol.player.SkinSection;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class PlayerDataProvider extends LivingEntityDataProvider {
|
||||
private float additionalHealth;
|
||||
private int score;
|
||||
private byte skinPartsMask = SkinSection.getMaskBySections(SkinSection.getAllSections());
|
||||
private HumanoidArm mainArm = HumanoidArm.RIGHT;
|
||||
private NBTCompound leftShoulderNBT = new NBTCompound();
|
||||
private NBTCompound rightShoulderNBT = new NBTCompound();
|
||||
|
||||
public float getAdditionalHealth() {
|
||||
return additionalHealth;
|
||||
}
|
||||
|
||||
public void setAdditionalHealth(float additionalHealth) {
|
||||
this.additionalHealth = additionalHealth;
|
||||
}
|
||||
|
||||
public int getScore() {
|
||||
return score;
|
||||
}
|
||||
|
||||
public void setScore(int score) {
|
||||
this.score = score;
|
||||
}
|
||||
|
||||
public byte getSkinPartsMask() {
|
||||
return skinPartsMask;
|
||||
}
|
||||
|
||||
public void setSkinPartsMask(byte skinPartsMask) {
|
||||
this.skinPartsMask = skinPartsMask;
|
||||
}
|
||||
|
||||
public HumanoidArm getMainArm() {
|
||||
return mainArm;
|
||||
}
|
||||
|
||||
public void setMainArm(HumanoidArm mainArm) {
|
||||
this.mainArm = mainArm;
|
||||
}
|
||||
|
||||
public NBTCompound getLeftShoulderNBT() {
|
||||
return leftShoulderNBT;
|
||||
}
|
||||
|
||||
public void setLeftShoulderNBT(NBTCompound leftShoulderNBT) {
|
||||
this.leftShoulderNBT = leftShoulderNBT;
|
||||
}
|
||||
|
||||
public NBTCompound getRightShoulderNBT() {
|
||||
return rightShoulderNBT;
|
||||
}
|
||||
|
||||
public void setRightShoulderNBT(NBTCompound rightShoulderNBT) {
|
||||
this.rightShoulderNBT = rightShoulderNBT;
|
||||
}
|
||||
|
||||
public static PlayerBuilder<PlayerBuilder> builderPlayer() {
|
||||
return new PlayerBuilder<>(new PlayerDataProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntityData> encode() {
|
||||
List<EntityData> metadata = super.encode();
|
||||
metadata.add(new EntityData(15, EntityDataTypes.FLOAT, additionalHealth));
|
||||
metadata.add(new EntityData(16, EntityDataTypes.INT, score));
|
||||
metadata.add(new EntityData(17, EntityDataTypes.BYTE, skinPartsMask));
|
||||
metadata.add(new EntityData(18, EntityDataTypes.BYTE, (byte) mainArm.ordinal()));
|
||||
metadata.add(new EntityData(19, EntityDataTypes.NBT, leftShoulderNBT));
|
||||
metadata.add(new EntityData(20, EntityDataTypes.NBT, rightShoulderNBT));
|
||||
return metadata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(List<EntityData> data) {
|
||||
super.decode(data);
|
||||
for (EntityData entityData : data) {
|
||||
switch (entityData.getIndex()) {
|
||||
case 15:
|
||||
additionalHealth = (float) entityData.getValue();
|
||||
break;
|
||||
case 16:
|
||||
score = (int) entityData.getValue();
|
||||
break;
|
||||
case 17:
|
||||
skinPartsMask = (byte) entityData.getValue();
|
||||
break;
|
||||
case 18:
|
||||
mainArm = HumanoidArm.values()[(byte) entityData.getValue()];
|
||||
break;
|
||||
case 19:
|
||||
leftShoulderNBT = (NBTCompound) entityData.getValue();
|
||||
break;
|
||||
case 20:
|
||||
rightShoulderNBT = (NBTCompound) entityData.getValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class PlayerBuilder<T extends PlayerBuilder> extends LivingEntityDataProvider.LivingEntityBuilder<T> {
|
||||
public PlayerBuilder(PlayerDataProvider entityDataProvider) {
|
||||
super(entityDataProvider);
|
||||
}
|
||||
|
||||
public T additionalHealth(float additionalHealth) {
|
||||
((PlayerDataProvider)provider).setAdditionalHealth(additionalHealth);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T score(int score) {
|
||||
((PlayerDataProvider)provider).setScore(score);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T skinPartsMask(byte skinPartsMask) {
|
||||
((PlayerDataProvider)provider).setSkinPartsMask(skinPartsMask);
|
||||
return (T)this;
|
||||
}
|
||||
|
||||
public T skinParts(Set<SkinSection> skinSections) {
|
||||
((PlayerDataProvider)provider).setSkinPartsMask(SkinSection.getMaskBySections(skinSections));
|
||||
return (T)this;
|
||||
}
|
||||
|
||||
public T mainArm(HumanoidArm mainArm) {
|
||||
((PlayerDataProvider)provider).setMainArm(mainArm);
|
||||
return (T)this;
|
||||
}
|
||||
|
||||
public T leftShoulderNBT(NBTCompound leftShoulderNBT) {
|
||||
((PlayerDataProvider)provider).setLeftShoulderNBT(leftShoulderNBT);
|
||||
return (T)this;
|
||||
}
|
||||
|
||||
public T rightShoulderNBT(NBTCompound rightShoulderNBT) {
|
||||
((PlayerDataProvider)provider).setRightShoulderNBT(rightShoulderNBT);
|
||||
return (T)this;
|
||||
}
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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;
|
||||
|
||||
public int getId(ClientVersion version) {
|
||||
if (this == DYING && version.isOlderThan(ClientVersion.V_1_17)) {
|
||||
return 6;
|
||||
}
|
||||
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;
|
||||
}
|
||||
return values()[id];
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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();
|
||||
}
|
||||
+289
@@ -0,0 +1,289 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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);
|
||||
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);
|
||||
|
||||
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 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 CAT = define("cat", ABSTRACT_TAMEABLE_ANIMAL);
|
||||
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 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);
|
||||
@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 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);
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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.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;
|
||||
|
||||
public class VillagerData {
|
||||
private VillagerType type;
|
||||
private VillagerProfession profession;
|
||||
private int level;
|
||||
|
||||
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 level;
|
||||
}
|
||||
|
||||
public void setLevel(int level) {
|
||||
this.level = level;
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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 {
|
||||
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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) 2021 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) 2021 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,335 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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 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");
|
||||
} else {
|
||||
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 ? new NBTCompound() : 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() {
|
||||
if (getType() == ItemTypes.BOOK) return getAmount() == 1;
|
||||
if (getType() == ItemTypes.ENCHANTED_BOOK) return false;
|
||||
return getMaxStackSize() == 1 && canBeDepleted() && !isEnchanted();
|
||||
}
|
||||
|
||||
public boolean isEnchanted() {
|
||||
if (!isEmpty() && this.nbt != null && this.nbt.getCompoundListTagOrNull("Enchantments") != null) {
|
||||
return !this.nbt.getCompoundListTagOrNull("Enchantments").isEmpty();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static List<Enchantment> getEnchantments(@Nullable NBTCompound nbt) {
|
||||
if (nbt == null || nbt.getCompoundListTagOrNull("Enchantments") == null)
|
||||
return new ArrayList<>(0);
|
||||
NBTList<NBTCompound> nbtList = nbt.getCompoundListTagOrNull("Enchantments");
|
||||
List<NBTCompound> compounds = nbtList.getTags();
|
||||
List<Enchantment> enchantments = new ArrayList<>(compounds.size());
|
||||
for (NBTCompound compound : compounds) {
|
||||
String id = compound.getStringTagValueOrNull("id");
|
||||
EnchantmentType type = EnchantmentTypes.getByName(id);
|
||||
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() {
|
||||
return getEnchantments(this.nbt);
|
||||
}
|
||||
|
||||
// TODO: Test on outdated versions
|
||||
public int getEnchantmentLevel(EnchantmentType enchantment) {
|
||||
if (isEnchanted()) {
|
||||
// isEnchanted() is true, so we can assume that nbt is not null
|
||||
assert nbt != null;
|
||||
for (NBTCompound base : nbt.getCompoundListTagOrNull("Enchantments").getTags()) {
|
||||
NBTString string = base.getTagOfTypeOrNull("id", NBTString.class);
|
||||
if (string != null && enchantment == EnchantmentTypes.getByName(string.getValue())) {
|
||||
return base.getTagOfTypeOrNull("lvl", NBTShort.class).getAsInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void setEnchantments(List<Enchantment> enchantments) {
|
||||
nbt = getOrCreateTag(); // Create tag if null
|
||||
if (enchantments.isEmpty()) {
|
||||
//Let us clear the enchantments
|
||||
if (nbt.getTagOrNull("Enchantments") != null) {
|
||||
nbt.removeTag("Enchantments");
|
||||
}
|
||||
}
|
||||
else {
|
||||
List<NBTCompound> list = new ArrayList<>();
|
||||
for (Enchantment enchantment : enchantments) {
|
||||
NBTCompound compound = new NBTCompound();
|
||||
compound.setTag("id", new NBTString(enchantment.getType().getName().toString()));
|
||||
compound.setTag("lvl", new NBTShort((short) enchantment.getLevel()));
|
||||
list.add(compound);
|
||||
}
|
||||
assert nbt != null; // NBT was created in getOrCreateTag()
|
||||
nbt.setTag("Enchantments", new NBTList<>(NBTType.COMPOUND, list));
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
return left.isEmpty() && right.isEmpty() || (!left.isEmpty() && !right.isEmpty() && ((left.nbt != null || right.nbt == null) && (left.nbt == null || left.nbt.equals(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;
|
||||
private List<Enchantment> enchantments = null;
|
||||
|
||||
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;
|
||||
|
||||
List<Enchantment> nbtEnchantments = getEnchantments(nbt);
|
||||
// This assumes logically, if already set enchants before NBT, then they would still want the enchants
|
||||
if (!nbtEnchantments.isEmpty()) {
|
||||
this.enchantments = nbtEnchantments;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder legacyData(int legacyData) {
|
||||
this.legacyData = legacyData;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Side effect: This will cause NBT to be created if it is null
|
||||
* This may affect some client sided inventory operations and may cause a desync
|
||||
*
|
||||
* @param enchantments The enchantments to set
|
||||
* @return This builder
|
||||
*/
|
||||
public Builder enchantments(List<Enchantment> enchantments) {
|
||||
this.enchantments = enchantments;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder addEnchantment(Enchantment enchantment) {
|
||||
if (enchantments == null) {
|
||||
enchantments = new ArrayList<>();
|
||||
}
|
||||
this.enchantments.add(enchantment);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemStack build() {
|
||||
ItemStack stack = new ItemStack(type, amount, nbt, legacyData);
|
||||
if (enchantments != null) {
|
||||
stack.setEnchantments(enchantments);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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.enchantment;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.item.enchantment.type.EnchantmentType;
|
||||
import com.github.retrooper.packetevents.protocol.item.enchantment.type.EnchantmentTypes;
|
||||
|
||||
public class Enchantment {
|
||||
private EnchantmentType type;
|
||||
private int level;
|
||||
|
||||
private Enchantment(EnchantmentType type, int level) {
|
||||
this.type = type;
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public EnchantmentType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(EnchantmentType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(int level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private EnchantmentType type;
|
||||
private int level;
|
||||
|
||||
public Builder type(EnchantmentType type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder level(int level) {
|
||||
this.level = level;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Enchantment build() {
|
||||
return new Enchantment(type, level);
|
||||
}
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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.enchantment.type;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.mapper.MappedEntity;
|
||||
|
||||
public interface EnchantmentType extends MappedEntity {
|
||||
}
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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.enchantment.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;
|
||||
|
||||
public class EnchantmentTypes {
|
||||
private static final Map<String, EnchantmentType> ENCHANTMENT_TYPE_MAPPINGS = new HashMap<>();
|
||||
private static final Map<Byte, Map<Integer, EnchantmentType>> ENCHANTMENT_TYPE_ID_MAPPINGS = new HashMap<>();
|
||||
private static final TypesBuilder TYPES_BUILDER = new TypesBuilder("enchantment/enchantment_type_mappings",
|
||||
ClientVersion.V_1_12,
|
||||
ClientVersion.V_1_13,
|
||||
ClientVersion.V_1_14,
|
||||
ClientVersion.V_1_16);
|
||||
|
||||
public static EnchantmentType define(String key) {
|
||||
TypesBuilderData data = TYPES_BUILDER.define(key);
|
||||
EnchantmentType enchantmentType = new EnchantmentType() {
|
||||
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];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof EnchantmentType) {
|
||||
return getName() == ((EnchantmentType) obj).getName();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
ENCHANTMENT_TYPE_MAPPINGS.put(enchantmentType.getName().toString(), enchantmentType);
|
||||
for (ClientVersion version : TYPES_BUILDER.getVersions()) {
|
||||
int index = TYPES_BUILDER.getDataIndex(version);
|
||||
Map<Integer, EnchantmentType> typeIdMap = ENCHANTMENT_TYPE_ID_MAPPINGS.computeIfAbsent((byte) index, k -> new HashMap<>());
|
||||
typeIdMap.put(enchantmentType.getId(version), enchantmentType);
|
||||
}
|
||||
return enchantmentType;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static EnchantmentType getByName(String name) {
|
||||
return ENCHANTMENT_TYPE_MAPPINGS.get(name);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static EnchantmentType getById(ClientVersion version, int id) {
|
||||
int index = TYPES_BUILDER.getDataIndex(version);
|
||||
Map<Integer, EnchantmentType> typeIdMap = ENCHANTMENT_TYPE_ID_MAPPINGS.get((byte) index);
|
||||
return typeIdMap.get(id);
|
||||
}
|
||||
|
||||
public static final EnchantmentType ALL_DAMAGE_PROTECTION = define("protection");
|
||||
public static final EnchantmentType FIRE_PROTECTION = define("fire_protection");
|
||||
public static final EnchantmentType FALL_PROTECTION = define("feather_falling");
|
||||
public static final EnchantmentType BLAST_PROTECTION = define("blast_protection");
|
||||
public static final EnchantmentType PROJECTILE_PROTECTION = define("projectile_protection");
|
||||
public static final EnchantmentType RESPIRATION = define("respiration");
|
||||
public static final EnchantmentType AQUA_AFFINITY = define("aqua_affinity");
|
||||
public static final EnchantmentType THORNS = define("thorns");
|
||||
public static final EnchantmentType DEPTH_STRIDER = define("depth_strider");
|
||||
public static final EnchantmentType FROST_WALKER = define("frost_walker");
|
||||
public static final EnchantmentType BINDING_CURSE = define("binding_curse");
|
||||
public static final EnchantmentType SOUL_SPEED = define("soul_speed");
|
||||
public static final EnchantmentType SHARPNESS = define("sharpness");
|
||||
public static final EnchantmentType SMITE = define("smite");
|
||||
public static final EnchantmentType BANE_OF_ARTHROPODS = define("bane_of_arthropods");
|
||||
public static final EnchantmentType KNOCKBACK = define("knockback");
|
||||
public static final EnchantmentType FIRE_ASPECT = define("fire_aspect");
|
||||
public static final EnchantmentType MOB_LOOTING = define("looting");
|
||||
public static final EnchantmentType SWEEPING_EDGE = define("sweeping");
|
||||
public static final EnchantmentType BLOCK_EFFICIENCY = define("efficiency");
|
||||
public static final EnchantmentType SILK_TOUCH = define("silk_touch");
|
||||
public static final EnchantmentType UNBREAKING = define("unbreaking");
|
||||
public static final EnchantmentType BLOCK_FORTUNE = define("fortune");
|
||||
public static final EnchantmentType POWER_ARROWS = define("power");
|
||||
public static final EnchantmentType PUNCH_ARROWS = define("punch");
|
||||
public static final EnchantmentType FLAMING_ARROWS = define("flame");
|
||||
public static final EnchantmentType INFINITY_ARROWS = define("infinity");
|
||||
public static final EnchantmentType FISHING_LUCK = define("luck_of_the_sea");
|
||||
public static final EnchantmentType FISHING_SPEED = define("lure");
|
||||
public static final EnchantmentType LOYALTY = define("loyalty");
|
||||
public static final EnchantmentType IMPALING = define("impaling");
|
||||
public static final EnchantmentType RIPTIDE = define("riptide");
|
||||
public static final EnchantmentType CHANNELING = define("channeling");
|
||||
public static final EnchantmentType MULTISHOT = define("multishot");
|
||||
public static final EnchantmentType QUICK_CHARGE = define("quick_charge");
|
||||
public static final EnchantmentType PIERCING = define("piercing");
|
||||
public static final EnchantmentType MENDING = define("mending");
|
||||
public static final EnchantmentType VANISHING_CURSE = define("vanishing_curse");
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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.type;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.mapper.MappedEntity;
|
||||
import com.github.retrooper.packetevents.protocol.world.states.type.StateType;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public interface ItemType extends MappedEntity {
|
||||
int getMaxAmount();
|
||||
|
||||
int getMaxDurability();
|
||||
|
||||
boolean isMusicDisc();
|
||||
|
||||
ItemType getCraftRemainder();
|
||||
|
||||
@Nullable
|
||||
StateType getPlacedType();
|
||||
|
||||
Set<ItemTypes.ItemAttribute> getAttributes();
|
||||
|
||||
boolean hasAttribute(ItemTypes.ItemAttribute attribute);
|
||||
}
|
||||
+1316
File diff suppressed because it is too large.
Load diff
+12
@@ -0,0 +1,12 @@
|
||||
package com.github.retrooper.packetevents.protocol.mapper;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
|
||||
import com.github.retrooper.packetevents.resources.ResourceLocation;
|
||||
|
||||
public interface LegacyMappedEntity {
|
||||
|
||||
ResourceLocation getName();
|
||||
|
||||
int getLegacyId(ClientVersion version);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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.mapper;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
|
||||
import com.github.retrooper.packetevents.resources.ResourceLocation;
|
||||
|
||||
public interface MappedEntity {
|
||||
ResourceLocation getName();
|
||||
|
||||
int getId(ClientVersion version);
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is part of packetevents - https://github.com/retrooper/packetevents
|
||||
* Copyright (C) 2021 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.mapper;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
|
||||
|
||||
public interface StaticMappedEntity extends MappedEntity{
|
||||
int getId();
|
||||
|
||||
default int getId(ClientVersion version) {
|
||||
return getId();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* This file is part of ProtocolSupport - https://github.com/ProtocolSupport/ProtocolSupport
|
||||
* Copyright (C) 2021 ProtocolSupport
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.nbt;
|
||||
|
||||
public abstract class NBT {
|
||||
|
||||
public abstract NBTType<?> getType();
|
||||
|
||||
@Override
|
||||
public abstract boolean equals(Object other);
|
||||
|
||||
@Override
|
||||
public abstract int hashCode();
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "nbt";
|
||||
}
|
||||
|
||||
public abstract NBT copy();
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* This file is part of ProtocolSupport - https://github.com/ProtocolSupport/ProtocolSupport
|
||||
* Copyright (C) 2021 ProtocolSupport
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.nbt;
|
||||
|
||||
public class NBTByte extends NBTNumber {
|
||||
|
||||
protected final byte value;
|
||||
|
||||
public NBTByte(byte value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public NBTByte(boolean value) {
|
||||
this((byte) (value ? 1 : 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTType<NBTByte> getType() {
|
||||
return NBTType.BYTE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getAsByte() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short getAsShort() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAsInt() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAsLong() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getAsFloat() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getAsDouble() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Byte.hashCode(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
NBTByte other = (NBTByte) obj;
|
||||
return value == other.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTByte copy() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* This file is part of ProtocolSupport - https://github.com/ProtocolSupport/ProtocolSupport
|
||||
* Copyright (C) 2021 ProtocolSupport
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.nbt;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class NBTByteArray extends NBT {
|
||||
|
||||
protected final byte[] array;
|
||||
|
||||
public NBTByteArray(byte[] array) {
|
||||
this.array = array;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTType<NBTByteArray> getType() {
|
||||
return NBTType.BYTE_ARRAY;
|
||||
}
|
||||
|
||||
public byte[] getValue() {
|
||||
return array;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
NBTByteArray other = (NBTByteArray) obj;
|
||||
return Arrays.equals(array, other.array);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Arrays.hashCode(array);
|
||||
}
|
||||
|
||||
public NBTByteArray copy() {
|
||||
byte[] abyte = new byte[this.array.length];
|
||||
System.arraycopy(this.array, 0, abyte, 0, this.array.length);
|
||||
return new NBTByteArray(abyte);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
/*
|
||||
* This file is part of ProtocolSupport - https://github.com/ProtocolSupport/ProtocolSupport
|
||||
* Copyright (C) 2021 ProtocolSupport
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.nbt;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class NBTCompound extends NBT {
|
||||
|
||||
protected final Map<String, NBT> tags = new LinkedHashMap<>();
|
||||
|
||||
@Override
|
||||
public NBTType<NBTCompound> getType() {
|
||||
return NBTType.COMPOUND;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return tags.isEmpty();
|
||||
}
|
||||
|
||||
public Set<String> getTagNames() {
|
||||
return Collections.unmodifiableSet(tags.keySet());
|
||||
}
|
||||
|
||||
public Map<String, NBT> getTags() {
|
||||
return Collections.unmodifiableMap(tags);
|
||||
}
|
||||
|
||||
public NBT getTagOrThrow(String key) {
|
||||
NBT tag = getTagOrNull(key);
|
||||
if (tag == null) {
|
||||
throw new IllegalStateException(MessageFormat.format("NBT {0} does not exist", key));
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
|
||||
public NBT getTagOrNull(String key) {
|
||||
return tags.get(key);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends NBT> T getTagOfTypeOrThrow(String key, Class<T> type) {
|
||||
NBT tag = getTagOrThrow(key);
|
||||
if (type.isInstance(tag)) {
|
||||
return (T) tag;
|
||||
} else {
|
||||
throw new IllegalStateException(MessageFormat.format("NBT {0} has unexpected type, expected {1}, but got {2}", key, type, tag.getClass()));
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends NBT> T getTagOfTypeOrNull(String key, Class<T> type) {
|
||||
NBT tag = getTagOrNull(key);
|
||||
if (type.isInstance(tag)) {
|
||||
return (T) tag;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends NBT> NBTList<T> getTagListOfTypeOrThrow(String key, Class<T> type) {
|
||||
NBTList<? extends NBT> list = getTagOfTypeOrThrow(key, NBTList.class);
|
||||
if (!type.isAssignableFrom(list.getTagsType().getNBTClass())) {
|
||||
throw new IllegalStateException(MessageFormat.format("NBTList {0} tags type has unexpected type, expected {1}, but got {2}", key, type, list.getTagsType().getNBTClass()));
|
||||
}
|
||||
return (NBTList<T>) list;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends NBT> NBTList<T> getTagListOfTypeOrNull(String key, Class<T> type) {
|
||||
NBTList<? extends NBT> list = getTagOfTypeOrNull(key, NBTList.class);
|
||||
if ((list != null) && type.isAssignableFrom(list.getTagsType().getNBTClass())) {
|
||||
return (NBTList<T>) list;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public NBTCompound getCompoundTagOrThrow(String key) {
|
||||
return getTagOfTypeOrThrow(key, NBTCompound.class);
|
||||
}
|
||||
|
||||
public NBTCompound getCompoundTagOrNull(String key) {
|
||||
return getTagOfTypeOrNull(key, NBTCompound.class);
|
||||
}
|
||||
|
||||
public NBTNumber getNumberTagOrThrow(String key) {
|
||||
return getTagOfTypeOrThrow(key, NBTNumber.class);
|
||||
}
|
||||
|
||||
public NBTNumber getNumberTagOrNull(String key) {
|
||||
return getTagOfTypeOrNull(key, NBTNumber.class);
|
||||
}
|
||||
|
||||
public NBTString getStringTagOrThrow(String key) {
|
||||
return getTagOfTypeOrThrow(key, NBTString.class);
|
||||
}
|
||||
|
||||
public NBTString getStringTagOrNull(String key) {
|
||||
return getTagOfTypeOrNull(key, NBTString.class);
|
||||
}
|
||||
|
||||
public NBTList<NBTCompound> getCompoundListTagOrThrow(String key) {
|
||||
return getTagListOfTypeOrThrow(key, NBTCompound.class);
|
||||
}
|
||||
|
||||
public NBTList<NBTCompound> getCompoundListTagOrNull(String key) {
|
||||
return getTagListOfTypeOrNull(key, NBTCompound.class);
|
||||
}
|
||||
|
||||
public NBTList<NBTNumber> getNumberTagListTagOrThrow(String key) {
|
||||
return getTagListOfTypeOrThrow(key, NBTNumber.class);
|
||||
}
|
||||
|
||||
public NBTList<NBTNumber> getNumberListTagOrNull(String key) {
|
||||
return getTagListOfTypeOrNull(key, NBTNumber.class);
|
||||
}
|
||||
|
||||
public NBTList<NBTString> getStringListTagOrThrow(String key) {
|
||||
return getTagListOfTypeOrThrow(key, NBTString.class);
|
||||
}
|
||||
|
||||
public NBTList<NBTString> getStringListTagOrNull(String key) {
|
||||
return getTagListOfTypeOrNull(key, NBTString.class);
|
||||
}
|
||||
|
||||
public String getStringTagValueOrThrow(String key) {
|
||||
return getStringTagOrThrow(key).getValue();
|
||||
}
|
||||
|
||||
public String getStringTagValueOrNull(String key) {
|
||||
NBT tag = getTagOrNull(key);
|
||||
if (tag instanceof NBTString) {
|
||||
return ((NBTString) tag).getValue();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getStringTagValueOrDefault(String key, String defaultValue) {
|
||||
NBT tag = getTagOrNull(key);
|
||||
if (tag instanceof NBTString) {
|
||||
return ((NBTString) tag).getValue();
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public NBT removeTag(String key) {
|
||||
return tags.remove(key);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends NBT> T removeTagAndReturnIfType(String key, Class<T> type) {
|
||||
NBT tag = removeTag(key);
|
||||
if (type.isInstance(tag)) {
|
||||
return (T) tag;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends NBT> NBTList<T> removeTagAndReturnIfListType(String key, Class<T> type) {
|
||||
NBTList<?> list = removeTagAndReturnIfType(key, NBTList.class);
|
||||
if ((list != null) && type.isAssignableFrom(list.getTagsType().getNBTClass())) {
|
||||
return (NBTList<T>) list;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setTag(String key, NBT tag) {
|
||||
if (tag != null) {
|
||||
tags.put(key, tag);
|
||||
} else {
|
||||
tags.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
public NBTCompound copy() {
|
||||
NBTCompound clone = new NBTCompound();
|
||||
for (Map.Entry<String, NBT> entry : tags.entrySet()) {
|
||||
clone.setTag(entry.getKey(), entry.getValue().copy());
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
|
||||
public boolean getBoolean(String string) {
|
||||
NBTByte nbtByte = this.getTagOfTypeOrNull(string, NBTByte.class);
|
||||
// Empty byte tags are considered 0
|
||||
byte byteValue = nbtByte == null ? 0 : nbtByte.getAsByte();
|
||||
return byteValue != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (other instanceof NBTCompound) {
|
||||
if (isEmpty() && ((NBTCompound) other).isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
return tags.equals(((NBTCompound) other).tags);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return tags.hashCode();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* This file is part of ProtocolSupport - https://github.com/ProtocolSupport/ProtocolSupport
|
||||
* Copyright (C) 2021 ProtocolSupport
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.nbt;
|
||||
|
||||
public class NBTDouble extends NBTNumber {
|
||||
|
||||
protected final double value;
|
||||
|
||||
public NBTDouble(double value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTType<NBTDouble> getType() {
|
||||
return NBTType.DOUBLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getAsByte() {
|
||||
return (byte) value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short getAsShort() {
|
||||
return (short) value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAsInt() {
|
||||
return (int) value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAsLong() {
|
||||
return (long) value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getAsFloat() {
|
||||
return (float) value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getAsDouble() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Double.hashCode(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
NBTDouble other = (NBTDouble) obj;
|
||||
return Double.doubleToLongBits(value) == Double.doubleToLongBits(other.value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTDouble copy() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* This file is part of ProtocolSupport - https://github.com/ProtocolSupport/ProtocolSupport
|
||||
* Copyright (C) 2021 ProtocolSupport
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.nbt;
|
||||
|
||||
public class NBTEnd extends NBT {
|
||||
|
||||
public static final NBTEnd INSTANCE = new NBTEnd();
|
||||
|
||||
@Override
|
||||
public NBTType<NBTEnd> getType() {
|
||||
return NBTType.END;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
return getClass() == obj.getClass();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTEnd copy() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* This file is part of ProtocolSupport - https://github.com/ProtocolSupport/ProtocolSupport
|
||||
* Copyright (C) 2021 ProtocolSupport
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.nbt;
|
||||
|
||||
public class NBTFloat extends NBTNumber {
|
||||
|
||||
protected final float value;
|
||||
|
||||
public NBTFloat(float value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTType<NBTFloat> getType() {
|
||||
return NBTType.FLOAT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getAsByte() {
|
||||
return (byte) value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short getAsShort() {
|
||||
return (short) value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAsInt() {
|
||||
return (int) value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAsLong() {
|
||||
return (long) value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getAsFloat() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getAsDouble() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
NBTFloat other = (NBTFloat) obj;
|
||||
return Float.floatToIntBits(value) == Float.floatToIntBits(other.value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Float.hashCode(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTFloat copy() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* This file is part of ProtocolSupport - https://github.com/ProtocolSupport/ProtocolSupport
|
||||
* Copyright (C) 2021 ProtocolSupport
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.nbt;
|
||||
|
||||
public class NBTInt extends NBTNumber {
|
||||
|
||||
protected final int value;
|
||||
|
||||
public NBTInt(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTType<NBTInt> getType() {
|
||||
return NBTType.INT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getAsByte() {
|
||||
return (byte) value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short getAsShort() {
|
||||
return (short) value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAsInt() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAsLong() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getAsFloat() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getAsDouble() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
NBTInt other = (NBTInt) obj;
|
||||
return value == other.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Integer.hashCode(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTInt copy() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* This file is part of ProtocolSupport - https://github.com/ProtocolSupport/ProtocolSupport
|
||||
* Copyright (C) 2021 ProtocolSupport
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.nbt;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class NBTIntArray extends NBT {
|
||||
|
||||
protected final int[] array;
|
||||
|
||||
public NBTIntArray(int[] array) {
|
||||
this.array = array;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTType<NBTIntArray> getType() {
|
||||
return NBTType.INT_ARRAY;
|
||||
}
|
||||
|
||||
public int[] getValue() {
|
||||
return array;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
NBTIntArray other = (NBTIntArray) obj;
|
||||
return Arrays.equals(array, other.array);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Arrays.hashCode(array);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTIntArray copy() {
|
||||
int[] aint = new int[this.array.length];
|
||||
System.arraycopy(this.array, 0, aint, 0, this.array.length);
|
||||
return new NBTIntArray(aint);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* This file is part of ProtocolSupport - https://github.com/ProtocolSupport/ProtocolSupport
|
||||
* Copyright (C) 2021 ProtocolSupport
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.nbt;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class NBTList<T extends NBT> extends NBT {
|
||||
|
||||
protected final NBTType<T> type;
|
||||
protected final List<T> tags = new ArrayList<>();
|
||||
|
||||
public NBTList(NBTType<T> type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public NBTList(NBTType<T> type, List<T> tags) {
|
||||
this.type = type;
|
||||
this.tags.addAll(tags);
|
||||
}
|
||||
|
||||
public static NBTList<NBTCompound> createCompoundList() {
|
||||
return new NBTList<>(NBTType.COMPOUND);
|
||||
}
|
||||
|
||||
public static NBTList<NBTString> createStringList() {
|
||||
return new NBTList<>(NBTType.STRING);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
public NBTType<NBTList> getType() {
|
||||
return NBTType.LIST;
|
||||
}
|
||||
|
||||
public NBTType<T> getTagsType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return tags.isEmpty();
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return tags.size();
|
||||
}
|
||||
|
||||
public List<T> getTags() {
|
||||
return Collections.unmodifiableList(tags);
|
||||
}
|
||||
|
||||
public T getTag(int index) {
|
||||
return tags.get(index);
|
||||
}
|
||||
|
||||
public void setTag(int index, T tag) {
|
||||
validateAddTag(tag);
|
||||
tags.set(index, tag);
|
||||
}
|
||||
|
||||
public void addTag(int index, T tag) {
|
||||
validateAddTag(tag);
|
||||
tags.add(index, tag);
|
||||
}
|
||||
|
||||
public void addTag(T tag) {
|
||||
validateAddTag(tag);
|
||||
tags.add(tag);
|
||||
}
|
||||
|
||||
protected void validateAddTag(T tag) {
|
||||
if (type != tag.getType()) {
|
||||
throw new IllegalArgumentException(MessageFormat.format("Invalid tag type. Expected {0}, got {1}.", type.getNBTClass(), tag.getClass()));
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
NBTList<T> other = (NBTList<T>) obj;
|
||||
return Objects.equals(type, other.type) && Objects.equals(tags, other.tags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(type, tags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTList<T> copy() {
|
||||
List<T> newTags = new ArrayList<>();
|
||||
for (T tag : this.tags) {
|
||||
newTags.add((T) tag.copy());
|
||||
}
|
||||
return new NBTList<>(type, newTags);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* This file is part of ProtocolSupport - https://github.com/ProtocolSupport/ProtocolSupport
|
||||
* Copyright (C) 2021 ProtocolSupport
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.nbt;
|
||||
|
||||
public class NBTLong extends NBTNumber {
|
||||
|
||||
protected final long value;
|
||||
|
||||
public NBTLong(long value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTType<NBTLong> getType() {
|
||||
return NBTType.LONG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getAsByte() {
|
||||
return (byte) value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short getAsShort() {
|
||||
return (short) value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAsInt() {
|
||||
return (int) value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAsLong() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getAsFloat() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getAsDouble() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
NBTLong other = (NBTLong) obj;
|
||||
return value == other.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Long.hashCode(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTLong copy() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* This file is part of ProtocolSupport - https://github.com/ProtocolSupport/ProtocolSupport
|
||||
* Copyright (C) 2021 ProtocolSupport
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.nbt;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class NBTLongArray extends NBT {
|
||||
|
||||
protected final long[] array;
|
||||
|
||||
public NBTLongArray(long[] array) {
|
||||
this.array = array;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTType<NBTLongArray> getType() {
|
||||
return NBTType.LONG_ARRAY;
|
||||
}
|
||||
|
||||
public long[] getValue() {
|
||||
return array;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
NBTLongArray other = (NBTLongArray) obj;
|
||||
return Arrays.equals(array, other.array);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Arrays.hashCode(array);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTLongArray copy() {
|
||||
long[] along = new long[this.array.length];
|
||||
System.arraycopy(this.array, 0, along, 0, this.array.length);
|
||||
return new NBTLongArray(along);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* This file is part of ProtocolSupport - https://github.com/ProtocolSupport/ProtocolSupport
|
||||
* Copyright (C) 2021 ProtocolSupport
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.nbt;
|
||||
|
||||
public abstract class NBTNumber extends NBT {
|
||||
|
||||
public abstract byte getAsByte();
|
||||
|
||||
public abstract short getAsShort();
|
||||
|
||||
public abstract int getAsInt();
|
||||
|
||||
public abstract long getAsLong();
|
||||
|
||||
public abstract float getAsFloat();
|
||||
|
||||
public abstract double getAsDouble();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* This file is part of ProtocolSupport - https://github.com/ProtocolSupport/ProtocolSupport
|
||||
* Copyright (C) 2021 ProtocolSupport
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.github.retrooper.packetevents.protocol.nbt;
|
||||
|
||||
public class NBTShort extends NBTNumber {
|
||||
|
||||
protected final short value;
|
||||
|
||||
public NBTShort(short value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTType<NBTShort> getType() {
|
||||
return NBTType.SHORT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getAsByte() {
|
||||
return (byte) value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public short getAsShort() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAsInt() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAsLong() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getAsFloat() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getAsDouble() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
NBTShort other = (NBTShort) obj;
|
||||
return value == other.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Short.hashCode(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTShort copy() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* This file is part of ProtocolSupport - https://github.com/ProtocolSupport/ProtocolSupport
|
||||
* Copyright (C) 2021 ProtocolSupport
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.nbt;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class NBTString extends NBT {
|
||||
|
||||
protected final String string;
|
||||
|
||||
public NBTString(String string) {
|
||||
this.string = string;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTType<NBTString> getType() {
|
||||
return NBTType.STRING;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return string;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
NBTString other = (NBTString) obj;
|
||||
return Objects.equals(string, other.string);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(string);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTString copy() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* This file is part of ProtocolSupport - https://github.com/ProtocolSupport/ProtocolSupport
|
||||
* Copyright (C) 2021 ProtocolSupport
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.nbt;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class NBTType<T extends NBT> {
|
||||
|
||||
public static final NBTType<NBTEnd> END = new NBTType<>(NBTEnd.class);
|
||||
public static final NBTType<NBTByte> BYTE = new NBTType<>(NBTByte.class);
|
||||
public static final NBTType<NBTShort> SHORT = new NBTType<>(NBTShort.class);
|
||||
public static final NBTType<NBTInt> INT = new NBTType<>(NBTInt.class);
|
||||
public static final NBTType<NBTLong> LONG = new NBTType<>(NBTLong.class);
|
||||
public static final NBTType<NBTFloat> FLOAT = new NBTType<>(NBTFloat.class);
|
||||
public static final NBTType<NBTDouble> DOUBLE = new NBTType<>(NBTDouble.class);
|
||||
public static final NBTType<NBTByteArray> BYTE_ARRAY = new NBTType<>(NBTByteArray.class);
|
||||
public static final NBTType<NBTString> STRING = new NBTType<>(NBTString.class);
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static final NBTType<NBTList> LIST = new NBTType<>(NBTList.class);
|
||||
public static final NBTType<NBTCompound> COMPOUND = new NBTType<>(NBTCompound.class);
|
||||
public static final NBTType<NBTIntArray> INT_ARRAY = new NBTType<>(NBTIntArray.class);
|
||||
public static final NBTType<NBTLongArray> LONG_ARRAY = new NBTType<>(NBTLongArray.class);
|
||||
|
||||
protected final Class<T> clazz;
|
||||
|
||||
protected NBTType(Class<T> clazz) {
|
||||
this.clazz = clazz;
|
||||
}
|
||||
|
||||
public Class<T> getNBTClass() {
|
||||
return clazz;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return clazz.getSimpleName();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
NBTType<T> other = (NBTType<T>) obj;
|
||||
return Objects.equals(clazz, other.clazz);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return clazz.hashCode();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* This file is part of ProtocolSupport - https://github.com/ProtocolSupport/ProtocolSupport
|
||||
* Copyright (C) 2021 ProtocolSupport
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.nbt.codec;
|
||||
|
||||
import com.github.retrooper.packetevents.manager.server.ServerVersion;
|
||||
import com.github.retrooper.packetevents.netty.buffer.ByteBufInputStream;
|
||||
import com.github.retrooper.packetevents.netty.buffer.ByteBufOutputStream;
|
||||
import com.github.retrooper.packetevents.netty.buffer.ByteBufHelper;
|
||||
import com.github.retrooper.packetevents.protocol.nbt.NBTCompound;
|
||||
import com.github.retrooper.packetevents.protocol.nbt.NBTEnd;
|
||||
import com.github.retrooper.packetevents.protocol.nbt.serializer.DefaultNBTSerializer;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
public class NBTCodec {
|
||||
public static NBTCompound readNBT(Object byteBuf, ServerVersion serverVersion) {
|
||||
if (serverVersion.isNewerThanOrEquals(ServerVersion.V_1_8)) {
|
||||
try {
|
||||
return (NBTCompound) DefaultNBTSerializer.INSTANCE.deserializeTag(
|
||||
new ByteBufInputStream(byteBuf));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
final short length = ByteBufHelper.readShort(byteBuf);
|
||||
if (length < 0) {
|
||||
return null;
|
||||
}
|
||||
Object slicedBuffer = ByteBufHelper.readSlice(byteBuf, length);
|
||||
try (DataInputStream stream = new DataInputStream(
|
||||
new GZIPInputStream(new ByteBufInputStream(slicedBuffer)))) {
|
||||
return (NBTCompound) DefaultNBTSerializer.INSTANCE.deserializeTag(stream);
|
||||
}
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new IllegalStateException(ex);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void writeNBT(Object byteBuf, ServerVersion serverVersion, NBTCompound tag) {
|
||||
if (serverVersion.isNewerThanOrEquals(ServerVersion.V_1_8)) {
|
||||
try (ByteBufOutputStream outputStream = new ByteBufOutputStream(byteBuf)) {
|
||||
if (tag != null) {
|
||||
DefaultNBTSerializer.INSTANCE.serializeTag(outputStream, tag);
|
||||
} else {
|
||||
DefaultNBTSerializer.INSTANCE.serializeTag(outputStream, NBTEnd.INSTANCE);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (tag == null) {
|
||||
ByteBufHelper.writeShort(byteBuf, -1);
|
||||
} else {
|
||||
int lengthWriterIndex = ByteBufHelper.writerIndex(byteBuf);
|
||||
ByteBufHelper.writeShort(byteBuf, 0);
|
||||
int writerIndexDataStart = ByteBufHelper.writerIndex(byteBuf);
|
||||
try (DataOutputStream outputstream = new DataOutputStream(new GZIPOutputStream(new ByteBufOutputStream(byteBuf)))) {
|
||||
DefaultNBTSerializer.INSTANCE.serializeTag(outputstream, tag);
|
||||
} catch (Exception e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
int writerIndexDataEnd = ByteBufHelper.writerIndex(byteBuf);
|
||||
ByteBufHelper.writerIndex(byteBuf, lengthWriterIndex);
|
||||
ByteBufHelper.writeShort(byteBuf, writerIndexDataEnd - writerIndexDataStart);
|
||||
ByteBufHelper.writerIndex(byteBuf, writerIndexDataEnd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* This file is part of ProtocolSupport - https://github.com/ProtocolSupport/ProtocolSupport
|
||||
* Copyright (C) 2021 ProtocolSupport
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.github.retrooper.packetevents.protocol.nbt.serializer;
|
||||
|
||||
import com.github.retrooper.packetevents.protocol.nbt.*;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class DefaultNBTSerializer extends NBTSerializer<DataInput, DataOutput> {
|
||||
|
||||
public static final DefaultNBTSerializer INSTANCE = new DefaultNBTSerializer();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public DefaultNBTSerializer() {
|
||||
super(DataInput::readByte, DataOutput::writeByte, DataInput::readUTF, DataOutput::writeUTF);
|
||||
registerType(NBTType.END, 0, stream -> NBTEnd.INSTANCE, (stream, tag) -> {
|
||||
});
|
||||
registerType(NBTType.BYTE, 1, stream -> new NBTByte(stream.readByte()), (stream, tag) -> stream.writeByte(tag.getAsByte()));
|
||||
registerType(NBTType.SHORT, 2, stream -> new NBTShort(stream.readShort()), (stream, tag) -> stream.writeShort(tag.getAsShort()));
|
||||
registerType(NBTType.INT, 3, stream -> new NBTInt(stream.readInt()), (stream, tag) -> stream.writeInt(tag.getAsInt()));
|
||||
registerType(NBTType.LONG, 4, stream -> new NBTLong(stream.readLong()), (stream, tag) -> stream.writeLong(tag.getAsLong()));
|
||||
registerType(NBTType.FLOAT, 5, stream -> new NBTFloat(stream.readFloat()), (stream, tag) -> stream.writeFloat(tag.getAsFloat()));
|
||||
registerType(NBTType.DOUBLE, 6, stream -> new NBTDouble(stream.readDouble()), (stream, tag) -> stream.writeDouble(tag.getAsDouble()));
|
||||
registerType(NBTType.STRING, 8, stream -> new NBTString(stream.readUTF()), (stream, tag) -> stream.writeUTF(tag.getValue()));
|
||||
registerType(
|
||||
NBTType.BYTE_ARRAY, 7,
|
||||
stream -> {
|
||||
byte[] array = new byte[stream.readInt()];
|
||||
stream.readFully(array);
|
||||
return new NBTByteArray(array);
|
||||
},
|
||||
(stream, tag) -> {
|
||||
byte[] array = tag.getValue();
|
||||
stream.writeInt(array.length);
|
||||
stream.write(array);
|
||||
}
|
||||
);
|
||||
registerType(
|
||||
NBTType.INT_ARRAY, 11,
|
||||
stream -> {
|
||||
int[] array = new int[stream.readInt()];
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
array[i] = stream.readInt();
|
||||
}
|
||||
return new NBTIntArray(array);
|
||||
},
|
||||
(stream, tag) -> {
|
||||
int[] array = tag.getValue();
|
||||
stream.writeInt(array.length);
|
||||
for (int i : array) {
|
||||
stream.writeInt(i);
|
||||
}
|
||||
}
|
||||
);
|
||||
registerType(
|
||||
NBTType.LONG_ARRAY, 12,
|
||||
stream -> {
|
||||
long[] array = new long[stream.readInt()];
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
array[i] = stream.readLong();
|
||||
}
|
||||
return new NBTLongArray(array);
|
||||
},
|
||||
(stream, tag) -> {
|
||||
long[] array = tag.getValue();
|
||||
stream.writeInt(array.length);
|
||||
for (long i : array) {
|
||||
stream.writeLong(i);
|
||||
}
|
||||
}
|
||||
);
|
||||
registerType(
|
||||
NBTType.COMPOUND, 10,
|
||||
stream -> {
|
||||
NBTCompound compound = new NBTCompound();
|
||||
NBTType<?> valueType = null;
|
||||
while ((valueType = readTagType(stream)) != NBTType.END) {
|
||||
compound.setTag(readTagName(stream), readTag(stream, valueType));
|
||||
}
|
||||
return compound;
|
||||
},
|
||||
(stream, tag) -> {
|
||||
for (Entry<String, NBT> entry : tag.getTags().entrySet()) {
|
||||
NBT value = entry.getValue();
|
||||
writeTagType(stream, value.getType());
|
||||
writeTagName(stream, entry.getKey());
|
||||
writeTag(stream, value);
|
||||
}
|
||||
writeTagType(stream, NBTType.END);
|
||||
}
|
||||
);
|
||||
registerType(
|
||||
NBTType.LIST, 9,
|
||||
stream -> {
|
||||
NBTType<? extends NBT> valueType = readTagType(stream);
|
||||
int size = stream.readInt();
|
||||
if ((valueType == NBTType.END) && (size > 0)) {
|
||||
throw new IllegalStateException("Missing nbt list values tag type");
|
||||
}
|
||||
NBTList<NBT> list = new NBTList<>((NBTType<NBT>) valueType);
|
||||
for (int i = 0; i < size; i++) {
|
||||
list.addTag(readTag(stream, valueType));
|
||||
}
|
||||
return list;
|
||||
},
|
||||
(stream, tag) -> {
|
||||
writeTagType(stream, tag.getTagsType());
|
||||
stream.writeInt(tag.size());
|
||||
for (NBT value : ((List<NBT>) tag.getTags())) {
|
||||
writeTag(stream, value);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
Loaded 100 of 558 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user