geforkt von Mirrors/Paper
Commits vergleichen
1548 Commits
Autor | SHA1 | Datum | |
---|---|---|---|
9505258ec4 | |||
abfde9e36e | |||
88fd8688a9 | |||
037a909005 | |||
ba810f1058 | |||
|
66f1534cfd | ||
|
203381a204 | ||
|
ba981a97c0 | ||
854824431b | |||
397b42d3af | |||
|
11b4ac7c65 | ||
|
9ab644ed29 | ||
ab00a73799 | |||
be922367c3 | |||
fa5a4a7c1f | |||
b3c5a9b5bb | |||
|
7c9240f4a6 | ||
|
1798e949e5 | ||
|
4a97ba3ea8 | ||
|
f97aff74b6 | ||
|
098bd39092 | ||
|
ab0d24aa6f | ||
|
dd941cc40a | ||
|
1187544fb0 | ||
|
1c3c47ab0b | ||
9b92b0b328 | |||
678af5b9fa | |||
191d74a113 | |||
|
7d7f123e98 | ||
|
1cecc24cad | ||
|
70dfa467e7 | ||
|
306d0dfdf0 | ||
|
83b6b26d39 | ||
|
b1b5d4c1e4 | ||
|
4d7cef3418 | ||
|
77a5779e24 | ||
|
4e6a2a13a3 | ||
|
042f15ffbd | ||
|
7e44684a1f | ||
|
5a5c3a4a24 | ||
|
df3b6544f7 | ||
|
0a1be9ae87 | ||
|
58c7ea3193 | ||
|
67d414a927 | ||
|
227544cfc7 | ||
|
100d75a11c | ||
|
438863c4c5 | ||
|
0246a9da86 | ||
|
3234b20ee4 | ||
|
50bdfc3e2c | ||
|
f774787a39 | ||
|
694b120d0b | ||
|
f82bea6940 | ||
|
dcbd99de4a | ||
|
66165f712a | ||
|
645a677122 | ||
|
e1462a9253 | ||
|
5a5035be96 | ||
|
5512af798f | ||
|
73a863b337 | ||
|
aa36ae6576 | ||
|
3a47518b4b | ||
|
7e91a2c3ab | ||
|
9aea24002a | ||
|
aa3b356834 | ||
|
5fee9c62da | ||
|
681c01336b | ||
|
f1f01a1622 | ||
|
968bdeb46f | ||
|
e71c1df54c | ||
|
7ea403902b | ||
|
75af62b298 | ||
|
2a39276794 | ||
|
d08e8d1afa | ||
|
a8db527449 | ||
|
3c8a7fe1a4 | ||
|
dd11ef8441 | ||
|
44c3dd0d4c | ||
|
2df5bba16a | ||
|
b653276565 | ||
|
4efd24b336 | ||
|
00b949f1bb | ||
|
967f98aa81 | ||
|
05ed6a6ff5 | ||
|
ceeb8c14ee | ||
|
506f1651e5 | ||
|
a6ceda12c5 | ||
|
ef96a69e84 | ||
|
2cd8c461af | ||
|
b57b24d549 | ||
|
9fd77108e3 | ||
|
77fcb29607 | ||
|
3b45454190 | ||
|
8b23018575 | ||
|
aa929d6666 | ||
|
05e5865da3 | ||
|
b4f04ff4b3 | ||
|
8b35adca88 | ||
|
9fd5b3cfbd | ||
|
99ae7bbc97 | ||
|
34a2917dcc | ||
|
1595e4afc0 | ||
|
2288e13816 | ||
|
5a503d7db4 | ||
|
ffe31a1cd0 | ||
|
70ff1ec079 | ||
|
2773dc4847 | ||
|
c6e9579688 | ||
|
0e02aa5b8e | ||
|
1d0fcb5aaf | ||
|
821081d646 | ||
|
90ae1dc573 | ||
|
7bd22b1835 | ||
|
f250ec0a2e | ||
|
a594d182e4 | ||
|
8b558d9e0b | ||
|
f7124df56b | ||
|
20889d04d8 | ||
|
b0ef3ca25a | ||
|
70b0e84476 | ||
|
62ed302bf4 | ||
|
2fa5e0e0df | ||
|
4d20922b79 | ||
|
8d91b859cb | ||
|
be8ac7acc3 | ||
|
b89e6a0195 | ||
|
8c8b227547 | ||
|
7eec21e80d | ||
|
b45d9b6c97 | ||
|
aa8d38d3db | ||
|
1f5db50424 | ||
|
dd49fba8c5 | ||
|
dd31654684 | ||
|
b99d071a36 | ||
|
1d3fc0ee68 | ||
|
897ece48d5 | ||
|
5ae4758c8b | ||
|
97afc9a00c | ||
|
b2e5587a2e | ||
|
95aa440473 | ||
|
19eefe9321 | ||
|
812701d901 | ||
|
76c2f16f57 | ||
|
77c763b5ef | ||
|
19105a9019 | ||
|
9cd0201535 | ||
|
0409a68f50 | ||
|
081146c56e | ||
|
d64be7e10a | ||
|
a0fad76fb6 | ||
|
0a1b133c28 | ||
|
8b1d26df0b | ||
|
2118196dd5 | ||
|
bab07e0ff9 | ||
|
666bc4dbb2 | ||
|
cf60574a2f | ||
|
2df432f6af | ||
|
e0d9d6028c | ||
|
f4ddd4ac24 | ||
|
38428c0d6c | ||
|
c0268ca86e | ||
|
250e78c42a | ||
|
4ea696ffe4 | ||
|
3b1c85b3a2 | ||
|
d23825aa56 | ||
|
126f6d7dc1 | ||
|
7bbe6820c2 | ||
|
090775eff4 | ||
|
4514f41ffa | ||
|
b4b820851f | ||
|
b9f7098723 | ||
|
21c9a7c79d | ||
|
b3e072a625 | ||
|
bf8552f0f0 | ||
|
13992b17c7 | ||
|
152f4feff3 | ||
|
a7f6633362 | ||
|
fb762cf368 | ||
|
8dfb85c173 | ||
|
de8220c3bc | ||
|
61b85e4cbf | ||
|
f8ee0a06c5 | ||
|
d9111ccec2 | ||
|
106dbae220 | ||
|
167961e744 | ||
|
fbc2a55cde | ||
|
e1c0033552 | ||
|
ec4c712efa | ||
|
d8c298007f | ||
|
c84a3b541c | ||
|
dc684c60d1 | ||
|
752f957e12 | ||
|
60f3bd8d0c | ||
|
1f8e7a7b09 | ||
|
f873bcee24 | ||
|
7240d9d81c | ||
|
5a5412ca70 | ||
|
5e7cd0784b | ||
|
b090c65fe0 | ||
|
e339ec27b4 | ||
|
3555a7776e | ||
|
7df472527f | ||
|
d41636f445 | ||
|
c1aefeecc6 | ||
|
56b5b7d452 | ||
|
0008fa17e9 | ||
|
04dad71064 | ||
|
a835ad1076 | ||
|
b420038799 | ||
|
fb511c698e | ||
|
5bd7f4e8ae | ||
|
0b6701da5a | ||
|
4bc15f13aa | ||
|
5d834b1b71 | ||
|
ee9b820fbe | ||
|
097284d06b | ||
|
512fd08eca | ||
|
730882fca9 | ||
|
ffe310a8e1 | ||
|
188cff20c7 | ||
|
5fca3ae47b | ||
|
f5693896c5 | ||
|
df633e5ffa | ||
|
38b3182a90 | ||
|
66f7b672ed | ||
|
038f8d915e | ||
|
5442bffab5 | ||
|
184a943ad4 | ||
|
547f09dfa0 | ||
|
69d1d0a4f4 | ||
|
a308c7c8d7 | ||
|
0d3ce2d704 | ||
|
3c04f9f668 | ||
|
6a34750160 | ||
|
6d4e235784 | ||
|
4140de28eb | ||
|
a399f23903 | ||
|
14c03366ed | ||
|
33b36cde31 | ||
|
52b49fbcc8 | ||
|
8731266275 | ||
|
ba163e10bb | ||
|
ed2ea4538e | ||
|
083bd9e75c | ||
|
27e29ccaf2 | ||
|
0bc9aeef26 | ||
|
ec05cb8b38 | ||
|
0b7552272a | ||
|
2055809b1e | ||
|
8a37f93925 | ||
|
7fbb8278e7 | ||
|
79e2cb620e | ||
|
906df69f05 | ||
|
bd5867a96f | ||
|
88d76d9fe5 | ||
|
79c1ce1844 | ||
|
4f13be937e | ||
|
b8f2101c36 | ||
|
54fbd0cf0c | ||
|
ac647513b2 | ||
|
5d8e53d78d | ||
|
0513374b1f | ||
|
3181470ad7 | ||
|
a47e11d464 | ||
|
06e69c8991 | ||
|
8e6554a80a | ||
|
0fcf3e347f | ||
|
27d2ed84f4 | ||
|
efd91e52a6 | ||
|
a31dc90741 | ||
|
ed85aac53c | ||
|
7e2b682e54 | ||
|
d9e659a618 | ||
|
716b868b08 | ||
|
672c07728f | ||
|
84f6e6e0b1 | ||
|
9d6f2cced7 | ||
|
9c917fef08 | ||
|
b0c9b9c4d8 | ||
|
23fe1166d4 | ||
|
347bbe3897 | ||
|
b0e3ca43b8 | ||
|
841ab4134d | ||
|
1b8cdc6d82 | ||
|
6649a171dc | ||
|
ac4ee06c01 | ||
|
9774a52d11 | ||
|
ca50b87947 | ||
|
a7ae966530 | ||
|
4e10fadfdc | ||
|
41bee55b53 | ||
|
f0bd0cca8f | ||
|
26e90b9ffb | ||
|
535dca56c2 | ||
|
4fd3ac00b4 | ||
|
dff591d292 | ||
|
377733d44c | ||
|
3004717b0e | ||
|
5e7b65a9a9 | ||
|
2a90732677 | ||
|
6de7a1f052 | ||
|
d408381c77 | ||
|
3de408ee3e | ||
|
a9201d4a7d | ||
|
b14958485d | ||
|
d3ffa62b7f | ||
|
980cff9f29 | ||
|
66cb880754 | ||
|
9bf4855524 | ||
|
7d2e5c33ea | ||
|
591521e697 | ||
|
b3b340617e | ||
|
0ad09de75b | ||
|
5a9afbee65 | ||
|
d8d59e0cde | ||
|
f17519338b | ||
|
3fc93581bb | ||
|
2faa3b2f44 | ||
|
bebcc9cc93 | ||
|
fa8a407072 | ||
|
218d33ccb1 | ||
|
0688f212f5 | ||
|
11c39637de | ||
|
f041f48458 | ||
|
7e48f66c05 | ||
|
711f82e01e | ||
|
ac554ad46d | ||
|
b98d20a8ac | ||
|
447f9a1e16 | ||
|
6c02dbcfa1 | ||
|
a61d58d467 | ||
|
cdb6ba8ef1 | ||
|
39532a1f8c | ||
|
4fd58a1b8f | ||
|
7f1a154d15 | ||
|
8748ae16ac | ||
|
2df1dace32 | ||
|
b56e92f3d4 | ||
|
cc29d2b7d5 | ||
|
1b67e02385 | ||
|
f2512b1238 | ||
|
ab2a85a35f | ||
|
5729b294ee | ||
|
eee55d019f | ||
|
89ad61fd00 | ||
|
9e51f94941 | ||
|
ac3a5471c8 | ||
|
2a6a5fef59 | ||
|
21d91ce634 | ||
|
716dfd8698 | ||
|
816ea9ecd5 | ||
|
54c5ecb4e4 | ||
|
0e43d3c103 | ||
|
9d8d38d137 | ||
|
b13c7dbe36 | ||
|
7ae2c671c6 | ||
|
7401313e16 | ||
|
6fcca46674 | ||
|
5632210f10 | ||
|
156675c773 | ||
|
0db72ac19e | ||
|
59fe7ccc3b | ||
|
544ce20e01 | ||
|
18c201b838 | ||
|
faa7aa266a | ||
|
310b47bb96 | ||
|
b8c454c2ba | ||
|
4cfd9e25fa | ||
|
3e0eb4a1ba | ||
|
fa6013d83b | ||
|
8c058f88a6 | ||
|
4ea67abd46 | ||
|
937a67a651 | ||
|
3fdd0948b7 | ||
|
25e44bc63b | ||
|
812ccb96a4 | ||
|
44ee092878 | ||
|
fbe3c00675 | ||
|
8f7ac62905 | ||
|
f9397e108e | ||
|
69a971a35c | ||
|
05308fc299 | ||
|
7f2d5315fd | ||
|
61c9c07e95 | ||
|
82a801201e | ||
|
0f3e324152 | ||
|
ba673a3b78 | ||
|
52ff3b7382 | ||
|
0f4d328fc1 | ||
|
aed7dcab98 | ||
|
4491ac05d1 | ||
|
9d6e7e3df0 | ||
|
c4a1cd137a | ||
|
37b3891032 | ||
|
6e31f385e3 | ||
|
1a03cc9b60 | ||
|
306b203c2d | ||
|
e16263c39f | ||
|
a3c4dc95e3 | ||
|
f187fd696a | ||
|
d93c6f91f7 | ||
|
3e90a19183 | ||
|
d964c15e15 | ||
|
7e3d5b569d | ||
|
8ce62b3492 | ||
|
4ad6022ee3 | ||
|
83767f9544 | ||
|
d99d84a8aa | ||
|
8454786c8d | ||
|
75c22d545f | ||
|
aeb3f376a2 | ||
|
d02bb811de | ||
|
dd571d89f2 | ||
|
06cae13223 | ||
|
a771940776 | ||
|
53d8edd756 | ||
|
b3ea907b77 | ||
|
20af7a753c | ||
|
a390119b04 | ||
|
b7e148a107 | ||
|
af97400701 | ||
|
711dbd74ea | ||
|
e2552eea24 | ||
|
0b1b1fe067 | ||
|
55b1a8740d | ||
|
f933c35700 | ||
|
c82766d436 | ||
|
f037f08035 | ||
|
5731f346e2 | ||
|
f85d423535 | ||
|
91b5de66bf | ||
|
81f4405e26 | ||
|
9bac3894e1 | ||
|
68e23db25d | ||
|
80bd01527f | ||
|
2f19f0fb7b | ||
|
548504381f | ||
|
f1fc1b30be | ||
|
ba8512a0d8 | ||
|
c38f96b0e5 | ||
|
6a4974b1b9 | ||
|
ff77f82539 | ||
|
464cc81633 | ||
|
4c53acedce | ||
|
882ea0a430 | ||
|
e856d17ec5 | ||
|
19ac9d43ce | ||
|
1bc278b125 | ||
|
44e68c301a | ||
|
cc81668863 | ||
|
f6fae41cdf | ||
|
00dac83d67 | ||
|
8b28f9f564 | ||
|
478a971a7b | ||
|
813cfbf2b0 | ||
|
7e9da43b33 | ||
|
2997fd6459 | ||
|
43d110e9a9 | ||
|
bcdf1f96b8 | ||
|
c5c2a5fe13 | ||
|
62b96c520f | ||
|
867eb9054b | ||
|
7c6411b930 | ||
|
d2ef0622c9 | ||
|
31ad90b018 | ||
|
a244281287 | ||
|
10e6143499 | ||
|
e85e1ec4a6 | ||
|
3062eb208d | ||
|
68aea43526 | ||
|
2641c02193 | ||
|
ed790385ed | ||
|
8d3759d4a5 | ||
|
d01f6b2fd2 | ||
|
ca9001a936 | ||
|
820f999ba4 | ||
|
04a25c2813 | ||
|
768befec89 | ||
|
b984f66d13 | ||
|
9c580566b9 | ||
|
f4c7639986 | ||
|
bab31b6f55 | ||
|
653f0432b5 | ||
|
ccf158a817 | ||
|
b8da9ac51a | ||
|
457e2c8a5a | ||
|
45900385cd | ||
|
345b5c1c4c | ||
|
6da0d8cc91 | ||
|
2debcaff9d | ||
|
c9907c650f | ||
|
ec4ada852e | ||
|
f6ea3736a7 | ||
|
e9eec78fc7 | ||
|
ec9f7e3850 | ||
|
6a87d141f3 | ||
|
b673721d77 | ||
|
690b1cd321 | ||
|
25f7c68e6b | ||
|
ce0e78c103 | ||
|
1444b3632e | ||
|
bb1351cb8d | ||
|
c95db4fcaa | ||
|
b7338094a5 | ||
|
1df7e21459 | ||
|
11044315fd | ||
|
e0a245d2ea | ||
|
051855997e | ||
|
961782982b | ||
|
4d9e824a44 | ||
|
22227ccf26 | ||
|
71ae391eb3 | ||
|
90095cd7c4 | ||
|
fc5c0dae7f | ||
|
e832328b7e | ||
|
4e654f2a3a | ||
|
1de0dc8828 | ||
|
21afc0a2e2 | ||
|
a403a8d085 | ||
|
2d9d0d8b1d | ||
|
5be858e9b7 | ||
|
cc4614854a | ||
|
9079c90d22 | ||
|
1d7d7e92f2 | ||
|
309ebc13fc | ||
|
8244815161 | ||
|
906f906089 | ||
|
0225537fd1 | ||
|
487555b627 | ||
|
d6a3c0c239 | ||
|
862d00478e | ||
|
5cfd92b240 | ||
|
f2350fe0d1 | ||
|
d07c487d4d | ||
|
2eeed9e6fa | ||
|
9cac5b6f4f | ||
|
eb41348d39 | ||
|
ffccfd5488 | ||
|
598a1cb947 | ||
|
dd6ce09922 | ||
|
7cdf804392 | ||
|
380c4d2313 | ||
|
ef057bba7d | ||
|
00c14f2e7b | ||
|
f2c45ed1d3 | ||
|
abc49bf069 | ||
|
f4c7d373e4 | ||
|
a6b6ecdd22 | ||
|
fc53ff5a71 | ||
|
c5f68ff9be | ||
|
a033033b7a | ||
|
3af1346520 | ||
|
908b8141c9 | ||
|
3b078f822a | ||
|
9e886c4310 | ||
|
862299b6a6 | ||
|
4445d23544 | ||
|
3263470312 | ||
|
f061e76e1f | ||
|
46d462b83e | ||
|
8fe90dede7 | ||
|
526795bacd | ||
|
37db2d7e4c | ||
|
a7f1dc6a07 | ||
|
5436d44bf2 | ||
|
1207162055 | ||
|
241d8e26fb | ||
|
8e75001cb8 | ||
|
3d31e45e7e | ||
|
acf838f535 | ||
|
182e79bce1 | ||
|
d8456ee65b | ||
|
bbee11fb0e | ||
|
06361fa662 | ||
|
a774fbaca8 | ||
|
bd38e0318a | ||
|
a2035440cf | ||
|
e709245b55 | ||
|
45d1486fec | ||
|
710dced8b7 | ||
|
00fd87a10f | ||
|
b6001403e9 | ||
|
9ec7dfcbc4 | ||
|
88419b2075 | ||
|
41ffa0cf8c | ||
|
de620b8480 | ||
|
05fe15e0fc | ||
|
55ffcb1111 | ||
|
09d6dfb0df | ||
|
99a641690a | ||
|
d361a7f609 | ||
|
e6034867ba | ||
|
cd110a8995 | ||
|
ab1afb0ed8 | ||
f7dafd4d0e | |||
32ff11c890 | |||
d2fab8f93b | |||
|
62b220a87f | ||
|
80e1a45959 | ||
|
a0931f4864 | ||
|
0052e2db39 | ||
|
6ad63fba30 | ||
|
89d51d5f29 | ||
|
b21eb4d9a4 | ||
|
60218cd207 | ||
|
880fef77ab | ||
|
ce5c8dd379 | ||
|
bbc03d8116 | ||
|
8870d22bc7 | ||
|
9c4bb0df0e | ||
|
54a23403da | ||
|
850b736e14 | ||
|
681bbff110 | ||
|
d0ebfbbd15 | ||
|
e3bc4c4107 | ||
|
71c84c8132 | ||
|
3ea95efdeb | ||
|
4939f87118 | ||
|
351923d17e | ||
|
d95341e44a | ||
|
1964b22439 | ||
|
9a66f2b2e1 | ||
|
a07d526698 | ||
|
7ccefdcd6c | ||
|
7f85940143 | ||
|
37df12143c | ||
|
31699ae9a8 | ||
|
cde5587e58 | ||
|
4b58a85158 | ||
|
e6a521514e | ||
|
2fa2d32ceb | ||
|
bf6e803c6c | ||
|
99bae594c8 | ||
|
581fb30a4c | ||
|
97c01206bc | ||
|
cbe62d91fb | ||
|
69b52b4d8e | ||
|
9c04729de1 | ||
|
534659e97e | ||
|
934cd77da8 | ||
|
9e171ef8ff | ||
|
c5d168cef9 | ||
|
8bc5be8ba7 | ||
|
7f856a1d1f | ||
|
87ce7c7209 | ||
|
294347bee2 | ||
|
b3c81089ae | ||
|
3841722fe1 | ||
|
0cc3a7ec6b | ||
|
b333831b70 | ||
|
4643b0d959 | ||
|
ed130f1170 | ||
|
7f7d05a21c | ||
|
1ed50dade8 | ||
|
fe53b0e76f | ||
|
bd2fd615ce | ||
|
b03f255532 | ||
|
1831240d1c | ||
|
b700460999 | ||
|
a4a08b7342 | ||
|
d405ff1255 | ||
|
ad2cf68a7f | ||
|
51bef80755 | ||
|
11645e3268 | ||
|
76da4bc683 | ||
|
24dc2bfc50 | ||
|
581b101180 | ||
|
c57d1aa245 | ||
|
e66037960b | ||
|
52619e7a21 | ||
|
484d6bfb4e | ||
|
25013d9970 | ||
|
9eb0b38157 | ||
|
684319f9c6 | ||
|
27cabc19a0 | ||
|
d9df6bc5e6 | ||
|
e9e0bc168d | ||
|
98e6d20ebd | ||
|
f7dd304b1f | ||
|
8d94596e30 | ||
|
b48d737759 | ||
|
4a98986e28 | ||
|
68c3297947 | ||
|
8e41ef4cc5 | ||
|
42e88a8b7b | ||
|
1c956abfbc | ||
|
eeb6afc435 | ||
|
cc693ce82b | ||
|
106c67a811 | ||
|
f61ebdce91 | ||
|
3e20d3a275 | ||
|
5e73c555bc | ||
|
94807a1d2e | ||
|
ebf97bdfdd | ||
|
848a3960f6 | ||
|
0ef59845bf | ||
|
f9fdedf2d7 | ||
|
93a848c4b9 | ||
|
c151c956e0 | ||
|
8657cd91d7 | ||
|
78fcb8e766 | ||
|
17275ffd68 | ||
|
c0e4697dbd | ||
|
e84621a9d8 | ||
|
8c8862f3a8 | ||
|
a0ffb57745 | ||
|
f28caff927 | ||
|
ec196207c2 | ||
|
a80d31b1bd | ||
|
07b956e3a3 | ||
|
f1c5f0198c | ||
|
e46276eb71 | ||
|
570cfb44d6 | ||
|
a58e29db99 | ||
|
25a99b12e8 | ||
|
a93acc4275 | ||
|
8379027ee0 | ||
|
19a620213f | ||
|
7eaff48d7c | ||
|
b2a6d575dd | ||
|
259bc76026 | ||
|
ae001ae6ee | ||
|
1fa48d140c | ||
|
509876d26f | ||
|
692db0c81d | ||
|
816bacc2c3 | ||
|
58e120b77c | ||
|
983377b55a | ||
|
1281f4f552 | ||
|
0ae58c09a1 | ||
|
3484ae987a | ||
|
e56e53f83a | ||
|
5e978d3a3d | ||
|
e4ab50de34 | ||
|
2951732742 | ||
|
b2ffb1b02d | ||
|
2c3ccb80f0 | ||
|
3c0d6aaed9 | ||
|
8221b085f9 | ||
|
c081104395 | ||
|
88d28d6bdd | ||
|
a401585cfa | ||
|
d1f507fc0e | ||
|
0d6a0c3b28 | ||
|
dc621507f5 | ||
|
f483b38596 | ||
|
4fdda9e583 | ||
|
c215ce1858 | ||
|
e035fd7034 | ||
|
61768e08e7 | ||
|
1cda66e395 | ||
|
ff7b9b0380 | ||
|
4adca3d7a3 | ||
|
49f9f6f2cd | ||
|
e7e1c8a832 | ||
|
1e7dd72f15 | ||
|
b4c9e7e5d4 | ||
|
d11a58802a | ||
|
45e01a2a78 | ||
|
086ca616d8 | ||
|
5385b21fd3 | ||
|
8c007d90a5 | ||
|
47b2c186d7 | ||
|
0b952981e6 | ||
|
e3140fb70e | ||
|
ff26d54ee0 | ||
|
de04cbced5 | ||
|
f1820dc80a | ||
|
7e15d977ec | ||
|
dc3ef2ae0f | ||
|
0fadaed078 | ||
|
7c2dc4b342 | ||
|
82f9280ae4 | ||
|
28abbaa7bd | ||
|
dd16335e40 | ||
|
3434a6fc66 | ||
|
166761f29f | ||
|
bcbe5dcd78 | ||
|
b42a1da873 | ||
|
abfb6b219b | ||
|
9051fc347c | ||
|
f17622cc3d | ||
|
7606e6da39 | ||
|
8d8eb3bdf6 | ||
|
2f92d4e00e | ||
|
f9edc4b1cd | ||
|
930a24f965 | ||
|
ff72782888 | ||
|
d0476837a5 | ||
|
9223f05a40 | ||
|
6577db6dd6 | ||
|
6c4c13df44 | ||
|
9227a9648c | ||
|
b277feb448 | ||
|
3b94cc3546 | ||
|
ada77b3a3b | ||
|
6bafacfb14 | ||
|
b1f94a84e8 | ||
|
772d430cd1 | ||
|
896e29bba7 | ||
|
d1dbe0020d | ||
|
0addaa1cf2 | ||
|
c833571526 | ||
|
a2b6275487 | ||
|
f10b36d7fc | ||
|
9bc67abccf | ||
|
ff2946e04b | ||
|
d3f1bc04b4 | ||
|
b32a34c71d | ||
|
03541446b2 | ||
|
c2b70338fc | ||
|
1d028f3853 | ||
|
05148728de | ||
|
deb02722b2 | ||
|
6b272a65e7 | ||
|
5999d669ac | ||
|
67f1688c30 | ||
|
b8f9558745 | ||
|
a364b7e88b | ||
|
0dee538a62 | ||
|
6c4efc92be | ||
|
13b92ad487 | ||
|
855a8196cf | ||
|
9546b9c587 | ||
|
cd61b5d98e | ||
|
6bf2ebf200 | ||
|
25dc4afafa | ||
|
46be245976 | ||
|
cc78c7f5f5 | ||
|
29e137669e | ||
|
2053d6ace7 | ||
|
fc12258f24 | ||
|
c7a463a736 | ||
|
723c05e7fe | ||
|
5513f8a795 | ||
|
bdbdca8a56 | ||
|
ad99d4568b | ||
|
6e9a238a8c | ||
|
7a59fd38d4 | ||
|
9d9fcf7e62 | ||
|
1a33343012 | ||
|
a30aad98f7 | ||
|
c3f3edea07 | ||
|
b89fff0490 | ||
|
dfac4f9df2 | ||
|
fad3fa9bde | ||
|
2a9a9c4cf0 | ||
|
2efd9bb99f | ||
|
d7fc0c5ab2 | ||
|
603b32976b | ||
|
9b56221762 | ||
|
8e8d6aeeb0 | ||
|
2a1ace0cf2 | ||
|
931781c220 | ||
|
9271ee7643 | ||
|
8e061ce9c8 | ||
|
5cbd5352b4 | ||
|
37bee09e3d | ||
|
ffa4115239 | ||
|
40872ece07 | ||
|
3766afadd5 | ||
|
977a729eb0 | ||
|
8bda1f72a5 | ||
|
2184fbca00 | ||
|
9993eb9d16 | ||
|
2182d47792 | ||
|
4d111a32bb | ||
|
b37bbcfd98 | ||
|
f9938d3949 | ||
|
0b20f94297 | ||
|
8eac3e1b93 | ||
|
8280211e52 | ||
|
faa2f475b0 | ||
|
334b2f20db | ||
|
ed753d34d2 | ||
|
96d5e6ca48 | ||
|
e1cd9e59e5 | ||
|
eda3d537d6 | ||
|
250388defe | ||
|
86117967db | ||
|
581c7434be | ||
|
39dee1ab52 | ||
|
e5274eeac9 | ||
|
0a8c873722 | ||
|
ce7f068095 | ||
|
f186318a91 | ||
|
a506b48daa | ||
|
aee3830763 | ||
|
9548629853 | ||
|
531ef27e89 | ||
|
9ee60eca7d | ||
|
dd47ec6fe2 | ||
|
d8847bc1f3 | ||
|
63e77b531d | ||
|
6675d13b31 | ||
|
c95bc5f86d | ||
|
4675152f49 | ||
|
274e54ba58 | ||
|
8cafc07297 | ||
|
e289accb03 | ||
|
2553f30153 | ||
|
75d04e9b04 | ||
|
23860da6c2 | ||
|
8a3980c60b | ||
|
0cdce89d59 | ||
|
15a0de2eef | ||
|
43c343228e | ||
|
bffb08c2f9 | ||
|
6592fed511 | ||
|
aa6c4c11e5 | ||
|
f78d7ce8ff | ||
|
44057da467 | ||
|
230682d51b | ||
|
487109fddc | ||
|
8493340be4 | ||
|
0b218903a8 | ||
|
1865625d95 | ||
|
5bb30ce95b | ||
|
3e4eaf2188 | ||
|
415d7081d2 | ||
|
a81a384303 | ||
|
5bdfb29ba1 | ||
|
c6fac381ed | ||
|
8b1ac39e89 | ||
|
52849f6da6 | ||
|
b1faa5d5f4 | ||
|
b3cac042c1 | ||
|
29350674b3 | ||
|
8cf2503804 | ||
|
996d529fb3 | ||
|
b974a6b6f3 | ||
|
acc6d012b0 | ||
|
c1ac98328c | ||
|
90fe0d58a5 | ||
|
489bff9bbd | ||
|
71a1787f6c | ||
|
3a5c6f8cee | ||
|
a3e4d1aa36 | ||
|
4b0bc74c90 | ||
|
00331d943e | ||
|
2f4281e2b4 | ||
|
e57af7d01e | ||
|
44ee1cd05e | ||
|
852c1c236d | ||
|
3e1c5e3eb0 | ||
|
e4d184f39d | ||
|
3e9d2ac5f2 | ||
|
f613437019 | ||
|
2f5bb7e306 | ||
|
1a4778d260 | ||
|
5509610db5 | ||
|
7e5dd92f9f | ||
|
69ce9276e4 | ||
|
72f7945e77 | ||
|
e87240b674 | ||
|
a2ba45239c | ||
|
99b735c1ac | ||
|
a702a083cd | ||
|
adb4fb4bd3 | ||
|
29a0209575 | ||
|
08c0b488b9 | ||
|
cfe311d7a5 | ||
|
431e6418ab | ||
|
02cfaa8ff8 | ||
|
5eec4ec3bf | ||
|
f36bb59739 | ||
|
6573d9555d | ||
|
9d21a88218 | ||
|
bb1c0dd6fa | ||
|
f6969b6374 | ||
|
38376f43a0 | ||
|
c4ba28a21a | ||
|
0f69290f07 | ||
|
4cdbb0c86c | ||
|
1765917a6f | ||
|
fe54a13b13 | ||
|
b3b961f9d5 | ||
|
c207429b21 | ||
|
298c47857b | ||
|
3cf03fc31a | ||
|
5cbce366b2 | ||
|
5923b7d085 | ||
|
e284bb1215 | ||
|
7a00758b1b | ||
|
11138a770e | ||
|
8b9e3dcd9e | ||
|
866d2d9f4a | ||
|
025c5d7a28 | ||
|
ea56138b30 | ||
|
5dca26ce54 | ||
|
84556f3cda | ||
|
38dc3b25d8 | ||
|
8d922746d9 | ||
|
2ec643a53c | ||
|
6be43952eb | ||
|
9624451ffd | ||
|
b561a12078 | ||
|
9c126fd2a9 | ||
|
38b7565d9e | ||
|
8b512e3466 | ||
|
9df2066642 | ||
|
4c17176c77 | ||
|
a353f4d207 | ||
|
a50d7c340b | ||
|
02807238c4 | ||
|
d23c4a50e6 | ||
|
b3ec8bd8ae | ||
|
81c5901c67 | ||
|
47aeab84ad | ||
|
915bb9220e | ||
|
6af97e11b6 | ||
|
d259503c92 | ||
|
ea01aa335a | ||
|
e88856dd75 | ||
|
896aa8b54a | ||
|
ead3ddba32 | ||
|
603c33df06 | ||
|
1ebaffacf5 | ||
|
f4d8a64094 | ||
|
63a1b0c137 | ||
|
a91e19f1df | ||
|
8baf510f92 | ||
|
ac7e4ad35e | ||
|
3aa8e7ef3f | ||
|
4875ee4814 | ||
|
32d9c6684b | ||
|
772fb3e385 | ||
|
2617c927a0 | ||
|
e5bd562d28 | ||
|
452009bbde | ||
|
574bc968d3 | ||
|
95a31de306 | ||
|
af1090259a | ||
|
74094edf08 | ||
|
662b6c5ca8 | ||
|
79fef73926 | ||
|
00d82983bd | ||
|
2cb3a1a3dc | ||
|
fc84aee124 | ||
|
2cee84193c | ||
|
a62835bbb1 | ||
|
24fd5aea0c | ||
|
2bc818efd4 | ||
|
78a003ee89 | ||
|
7b29d1f4c5 | ||
|
ef6a41195d | ||
|
a27262375c | ||
|
c60dd35989 | ||
|
7ebfdd5e6d | ||
|
91671751e7 | ||
|
20253f478f | ||
|
2b72b74a36 | ||
|
b6e46e90cd | ||
|
6267e26420 | ||
|
773dd72446 | ||
|
3fd1502717 | ||
|
1b1c23010a | ||
|
581b683931 | ||
|
a856073368 | ||
|
ba0e1f54b9 | ||
|
3cec9c985f | ||
|
d8af99a82c | ||
|
064fb50cc1 | ||
|
06a741d713 | ||
|
e312ebb1bd | ||
|
ede9c06814 | ||
|
0c8e84c20d | ||
|
deb92c2129 | ||
|
83cfeb1b37 | ||
|
99b311de54 | ||
|
eb60bffa98 | ||
|
29d1c7b602 | ||
|
7145f41b6e | ||
|
6378792a99 | ||
|
e68fd7162a | ||
|
eea0c649ca | ||
|
1c15111f08 | ||
|
517f8fbbac | ||
|
fb06829845 | ||
|
c9cd94f3c6 | ||
|
e2b197132d | ||
|
72e87abc2d | ||
|
33bec7f20a | ||
|
471f4de9c4 | ||
|
39953cf08d | ||
|
b4e3b3d1dd | ||
|
b8edb0e130 | ||
|
0c0a480d82 | ||
|
0e622c79fa | ||
|
7d13b7066c | ||
|
6813244fb0 | ||
7c36d82b47 | |||
|
6f30f08b20 | ||
|
e552bebca1 | ||
|
0c8882f7f9 | ||
|
b45ecc93c1 | ||
|
b8a0049207 | ||
|
7a1863ed78 | ||
|
a751001ed1 | ||
|
fcc5f232f9 | ||
|
9cbad8ebbf | ||
|
3716832282 | ||
|
a712766995 | ||
|
7386a13642 | ||
|
9395aa6079 | ||
|
0c7385b569 | ||
|
27d39cac4f | ||
|
fed9042390 | ||
|
e3f29f4345 | ||
|
b29ecd4c22 | ||
|
2be57c6943 | ||
|
97b9c4a2a4 | ||
|
35ef0537be | ||
|
281855c877 | ||
|
af6142eab3 | ||
|
00a68b1efe | ||
|
7232506c22 | ||
|
1b96c64620 | ||
|
5bf82aa136 | ||
|
88891c37b1 | ||
|
1259b93ba6 | ||
|
990765bd08 | ||
|
45ba65283f | ||
|
f43a19c275 | ||
|
d928dda91d | ||
|
bd67b83fd0 | ||
|
ed8401c748 | ||
|
5b34a09ed0 | ||
|
67a1a8caf8 | ||
|
d12916255a | ||
|
666a2147a7 | ||
|
2bd6ba2c63 | ||
|
fd4f0c7741 | ||
c903985792 | |||
b1fab7dde9 | |||
|
eb8f2bb2a1 | ||
|
307d05bba8 | ||
|
ea1f33cf9a | ||
|
73af2d4cea | ||
|
47b805fdf1 | ||
|
6520ca1c47 | ||
|
a73ed9572e | ||
|
93829bba5a | ||
|
23c44c2b8d | ||
|
02338e5069 | ||
|
1dfdbef42b | ||
|
2df309bd49 | ||
|
29aaf7bc24 | ||
|
20a71c58d3 | ||
|
3b4839ee32 | ||
|
3c41f8f0b3 | ||
|
9bc70e6888 | ||
|
4179b8f3fa | ||
|
98c567fe6f | ||
|
a2002a76b8 | ||
|
93cf3eb832 | ||
|
9ffccd6430 | ||
|
408a9050ba | ||
|
ef2b574c6a | ||
|
5274ad672b | ||
|
d6d2b6f4e5 | ||
|
8fe8ca6658 | ||
|
31358d5e48 | ||
|
508a295b44 | ||
|
2fa8efce9b | ||
|
69a801305d | ||
|
2c55dd86ff | ||
|
13c9d3c423 | ||
|
81619a652e | ||
|
f402f89a67 | ||
|
6c7e3c5193 | ||
|
7d1cc6d409 | ||
|
a40e48f3fd | ||
|
1837f6c677 | ||
|
b14979e352 | ||
|
aa93dcfdce | ||
|
42830546f3 | ||
|
e19177a2c3 | ||
|
2c54b3949f | ||
|
d8b8f61961 | ||
|
383f0ed924 | ||
|
24d690fe7e | ||
|
46a36d3b28 | ||
|
2f8d9db58c | ||
|
b1334b5105 | ||
|
c016e039a5 | ||
|
40adc2345b | ||
|
c793bd93be | ||
|
b533905cc3 | ||
|
fe780d041e | ||
|
de3f149185 | ||
|
22ed60c101 | ||
|
aefb73c234 | ||
|
ece4fd3597 | ||
|
836586d59b | ||
|
92bc19b049 | ||
|
1f8ca77bb6 | ||
|
a60eeb85f5 | ||
|
a3c760e6af | ||
|
f9473d9928 | ||
|
b3dc7a3b4b | ||
|
805fdd83b3 | ||
|
6b325cd6a9 | ||
|
5de0f8ac48 | ||
|
e105354330 | ||
|
d7d3f6371e | ||
|
48ea66e97f | ||
|
dadd8b5a7c | ||
|
12c970097d | ||
|
c0936a71bd | ||
|
4356758b64 | ||
|
171ba7ccf3 | ||
|
e16fefb443 | ||
|
f2c1e1366a | ||
|
fead63e2ea | ||
|
225c95025b | ||
|
437e8da700 | ||
|
2c9c5e4662 | ||
|
82cd69fcf4 | ||
|
e4b40ddc22 | ||
|
8582999344 | ||
|
cf0f013f53 | ||
|
7103f813bc | ||
|
3f6c4b07ac | ||
|
990be1691b | ||
|
e8bec64217 | ||
|
b34d4ecd2e | ||
|
aea9cdd37d | ||
50d1701a1c | |||
abee30417b | |||
a6457334ec | |||
|
206dd3af05 | ||
|
b1696788d6 | ||
|
c613877e54 | ||
|
3756f5bbf5 | ||
|
1f5bec71f3 | ||
|
b1fe756b73 | ||
|
d6d4c78e7d | ||
|
976b95c74c | ||
|
275173e538 | ||
|
873533b129 | ||
|
faf9a65b62 | ||
|
072b78a713 | ||
|
3a0373901e | ||
|
c1ea5502d4 | ||
|
38856661c0 | ||
|
a226f44b45 | ||
|
f5551380b3 | ||
|
3f237e869a | ||
|
02e3b5a91a | ||
|
17966ddb8e | ||
|
f6139de06c | ||
|
81834ac54a | ||
|
fa674f3d35 | ||
|
b134eb406a | ||
|
41e6f20420 | ||
|
f7b386ddc7 | ||
|
8bc0574fb8 | ||
|
bae6096aa2 | ||
|
837cc25c51 | ||
|
62262d73d2 | ||
|
2e363c73ba | ||
|
c287e921a9 | ||
|
b48e2e352e | ||
|
2d09115b3a | ||
|
87dfff4cfa | ||
|
de19eb8c4a | ||
|
f8cfdd4ba9 | ||
|
eb0693fff7 | ||
|
f4dfdcbb5b | ||
|
3722877c3c | ||
|
e2e874f549 | ||
|
bc3496ea58 | ||
|
3d06377b24 | ||
|
2ffb704efa | ||
|
dc30ee591d | ||
|
0284b272d3 | ||
|
648c000fb2 | ||
|
4b5f84712b | ||
|
4e3febbfe0 | ||
|
f9fc44ff9f | ||
|
9ebf75d894 | ||
|
c9e125f62a | ||
|
9ada4bd7af | ||
|
ea9fdc393c | ||
|
0d969f0a1b | ||
|
82c64790f4 | ||
|
e829a9d8f3 | ||
|
6d74ad155f | ||
|
03c3587e2e | ||
|
ccb194bbbb | ||
|
3621d76d8f | ||
|
21f2d158c4 | ||
|
c9eb393d18 | ||
|
04509f0234 | ||
|
8ce5219e07 | ||
|
e325e37268 | ||
|
59060aaec3 | ||
|
9d428792c4 | ||
|
aed9ef0788 | ||
|
318a08c1db | ||
|
a0a2e7287c | ||
|
c1def9d852 | ||
|
57a592466d | ||
|
efb4197a1b | ||
|
902691b636 | ||
|
619d7c93d8 | ||
|
cc491a396e | ||
|
3fe0e32495 | ||
|
f0aea8123e | ||
|
0a9e232f48 | ||
|
7002799587 | ||
|
37e689f367 | ||
|
034edecc37 | ||
|
b4ae928db9 | ||
|
870dafe358 | ||
|
1a0280ccc0 | ||
|
f80338725e | ||
|
a6628220d3 | ||
|
ad4eb2ec7d | ||
|
4af62f6d1d | ||
|
0cc83ea9b6 | ||
|
2873869bb1 | ||
|
1c12701691 | ||
|
d5682d77c3 | ||
|
aa1c25c88d | ||
|
bab0b3a7c3 | ||
|
b05cd80334 | ||
|
605e66c5de | ||
|
91b45c49ce | ||
|
6d118492b6 | ||
|
74ad522fc5 | ||
|
819facd7c4 | ||
|
0c4a1c4496 | ||
|
de18bb96e8 | ||
|
20aaebbd47 | ||
|
13ab8b77d3 | ||
|
47c5d82017 | ||
|
1eba407610 | ||
|
236eabd751 | ||
|
c13b259ff2 | ||
|
ac1a626493 | ||
|
0ca9f14d58 | ||
|
b1a2378144 | ||
|
f0889559f3 | ||
|
c31a22c563 | ||
|
44e22b45a5 | ||
|
0b8147f68e | ||
|
8f7a7ec440 | ||
|
e09a44e169 | ||
|
3c8e176265 | ||
|
838d8afd76 | ||
|
c1f313b273 | ||
|
7f384988cd | ||
|
3fed7289ed | ||
|
94aa4b518a | ||
|
0ed49782c5 | ||
|
474a02835d | ||
|
01f5831171 | ||
|
197786ead0 | ||
|
c1bbde4bc6 | ||
|
3fbb00319f | ||
|
965cf53cd5 | ||
|
bc4a6647c9 | ||
|
175a774247 | ||
|
14cfd64d2d | ||
|
d8e07590e3 | ||
|
956062a5d5 | ||
|
d8d3bd70b0 | ||
|
8a18fc55ab | ||
|
bacbf86ed2 | ||
|
2eda177116 | ||
|
ea0b63992c | ||
|
fa8fa1ce08 | ||
|
0f91091ccc | ||
|
f9f90791e4 | ||
|
90a0835f43 | ||
|
bcd8dc2c11 | ||
|
b6817605ce | ||
|
a61b4845f2 | ||
|
4ba5aacc37 | ||
|
5b66d33a77 | ||
|
f8603a46a8 | ||
|
57fdc668fa | ||
|
ab7bc3fb34 | ||
|
9daa019d6c | ||
|
1edfefdef8 | ||
|
efd47e3a68 | ||
|
688409279f | ||
|
1d4c7806ff | ||
|
813d0399f9 | ||
|
9846d0d89e | ||
|
83da4b6101 | ||
|
4f9575eed8 | ||
|
bcec5b11e6 | ||
|
f4ce997a42 | ||
|
2cccbbe1f4 | ||
|
936205beae | ||
|
5c4671a9bf | ||
|
8e3009e0db | ||
|
f7717c3712 | ||
|
beed22d336 | ||
|
dd216c1f09 | ||
|
6d2121efde | ||
|
23a443eeaa | ||
|
8d040fad9b | ||
|
bd35d605e8 | ||
|
e338793603 | ||
|
5ffdff8822 | ||
|
e811927394 | ||
|
8be7a60b76 | ||
|
ab72b123ec | ||
|
058d7c1aa3 | ||
|
b626528da0 | ||
|
f8d2f823db | ||
|
6a7fef0e4a | ||
|
f8c01122e6 | ||
|
9cda28480e | ||
|
b5ce6e3dc5 | ||
|
29b17a892d | ||
|
ad6c14c62e | ||
|
e9f6e7ae8a | ||
|
f5677aa472 | ||
|
3c8c22323f | ||
|
dab4864a11 | ||
|
9b77660f07 | ||
|
9367e6e6b3 | ||
|
e6ef1bae88 | ||
|
497b91939c | ||
|
641dafd0a8 | ||
|
08491449ae | ||
|
9893e2b734 | ||
|
1d2fe64da8 | ||
|
50e683de14 | ||
|
dc08c74cb3 | ||
|
5fb3ab0109 | ||
|
1704bf782e | ||
|
7a96bf2095 | ||
|
11ab383e4f | ||
|
06fdc02537 | ||
|
bf92f3e4db | ||
|
cbcdfd03e7 | ||
|
ef5fa90932 | ||
|
a13759afcc | ||
|
32875b429a | ||
|
5c78e77da5 | ||
|
9940019ff8 | ||
|
ce2a36dbd6 | ||
|
bd62f2c2dd | ||
|
fbf74ba0ac | ||
|
a622ebacd4 | ||
|
d5abb94e69 | ||
|
38be4f873b | ||
|
a0f548f5ec | ||
|
23b0ef524a | ||
|
9087a644a3 | ||
|
92f872c146 | ||
|
e8b82590d0 | ||
|
7af4cd3647 | ||
|
c7520ec49d | ||
|
ff603cb76d | ||
|
7929540ba3 | ||
|
83948f6f59 | ||
|
eb0950290d | ||
|
662b85e00e | ||
|
510082222b | ||
|
055f7228f0 | ||
|
2a024870de | ||
|
11f5158eaa | ||
|
5730a94208 | ||
|
79db3a2a4b | ||
|
02bc2eca34 | ||
|
85a67dadf2 | ||
|
646f590779 | ||
|
5a1e1584aa | ||
|
fe881073af | ||
|
4f933b2405 | ||
|
a2918a5fea | ||
|
9b0e97b75b | ||
|
eb0232ef09 | ||
|
73cf1257ca | ||
|
647cf31e61 | ||
|
3bc992d8f2 | ||
|
72a9f8a9b8 | ||
|
92a019385d | ||
|
28d49a1b58 | ||
|
2c485d1485 | ||
|
ffab9f2bc1 | ||
|
482dfc2db0 | ||
|
b93379bd7f | ||
|
3e54639d9c | ||
|
c225146bc9 | ||
|
94604b6474 | ||
|
dbeef458b2 | ||
|
0f17027652 | ||
|
72923817d6 | ||
|
7954d96905 | ||
|
7d24f2ef06 | ||
|
18d51375b8 | ||
|
1295869b43 | ||
|
bacf389fc3 | ||
|
9dccea73fb | ||
|
0f5c422d24 | ||
|
f4c92b410c | ||
|
0e2d6d6550 | ||
|
bdeb519d1b | ||
|
562e74263b | ||
|
8149f115ef | ||
|
9a731dc325 | ||
|
cf4eac0a17 | ||
|
2b6be6f1b3 | ||
|
2cd29ddbb5 | ||
|
2ed604cf72 | ||
|
155aa36d89 | ||
|
18470db17f | ||
|
4e994669d3 | ||
|
4d7269e07c | ||
|
bf2053a156 | ||
|
27c05030e5 | ||
|
5cc78f2b6f | ||
|
6f57163e4a | ||
|
75280ef51c | ||
|
541753be25 | ||
|
e5e75dd008 | ||
|
f2075c4d3c | ||
|
3dcf4e4198 | ||
|
d30cda1273 | ||
|
8a815a0eae | ||
|
4151f752f1 | ||
|
a172880e7d | ||
|
e57441254d | ||
|
f408c253ec | ||
|
dead691e8c | ||
|
5170d6f159 | ||
|
b670798876 | ||
|
4ae202eb82 | ||
|
08e6622b81 | ||
|
83a1304b37 | ||
|
ad3e1bc121 | ||
|
9256248567 | ||
|
16fc1a175e | ||
|
fc072c0954 | ||
|
2f953a8843 | ||
|
e2b8e6b548 | ||
|
ed44f69c9b | ||
|
81d7ff6e31 | ||
|
88367398d9 | ||
|
c7a82c1a50 |
@ -4,6 +4,10 @@ end_of_line=lf
|
||||
insert_final_newline=true
|
||||
indent_style=space
|
||||
indent_size=4
|
||||
ij_any_block_comment_add_space = false
|
||||
ij_any_block_comment_at_first_column = false
|
||||
ij_any_line_comment_at_first_column = false
|
||||
ij_any_line_comment_add_space = true
|
||||
|
||||
[*.tiny]
|
||||
indent_style=tab
|
||||
@ -16,3 +20,23 @@ indent_size=2
|
||||
|
||||
[*.patch]
|
||||
trim_trailing_whitespace=false
|
||||
|
||||
[*.java]
|
||||
ij_continuation_indent_size = 4
|
||||
ij_java_class_count_to_use_import_on_demand = 999999
|
||||
ij_java_insert_inner_class_imports = false
|
||||
ij_java_names_count_to_use_import_on_demand = 999999
|
||||
ij_java_imports_layout = *,|,$*
|
||||
ij_java_generate_final_locals = true
|
||||
ij_java_generate_final_parameters = true
|
||||
ij_java_method_parameters_new_line_after_left_paren = true
|
||||
ij_java_method_parameters_right_paren_on_new_line = true
|
||||
|
||||
[test-plugin/**/*.java]
|
||||
ij_java_use_fq_class_names = false
|
||||
|
||||
[Paper-Server/src/main/resources/data/**/*.json]
|
||||
indent_size = 2
|
||||
|
||||
[paper-api-generator/generated/**/*.java]
|
||||
ij_java_imports_layout = $*,|,*
|
||||
|
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -1,4 +1,4 @@
|
||||
* text=auto
|
||||
* text=auto eol=lf
|
||||
|
||||
*.sh text eol=lf
|
||||
gradlew text eol=lf
|
||||
|
42
.github/DISCUSSION_TEMPLATE/ideas.yml
vendored
Normale Datei
42
.github/DISCUSSION_TEMPLATE/ideas.yml
vendored
Normale Datei
@ -0,0 +1,42 @@
|
||||
labels: ["status: needs triage"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thank you for filling out a feature request for Paper! Please be as detailed as possible so that we may consider and review the request easier.
|
||||
We ask that you search all the issues to avoid a duplicate feature request. If one exists, please reply if you have anything to add.
|
||||
Before requesting a new feature, please make sure you are using the latest version and that the feature you are requesting is not already in Paper.
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Is your feature request related to a problem?
|
||||
description: Please give some context for this request. Why do you want it added?
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Describe the solution you'd like.
|
||||
description: A clear and concise description of what you want.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Describe alternatives you've considered.
|
||||
description: List any alternatives you might have tried to get the feature you want.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Other
|
||||
description: Add any other context or screenshots about the feature request below.
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Before submitting this feature request, please search our issue tracker to ensure your feature has not
|
||||
already been requested.
|
@ -44,10 +44,10 @@ body:
|
||||
|
||||
```
|
||||
> version
|
||||
[20:34:42 INFO]: This server is running Paper version git-Paper-540 (MC: 1.16.5) (Implementing API version 1.16.5-R0.1-SNAPSHOT)
|
||||
[20:34:42 INFO]: Checking version, please wait...
|
||||
[20:34:42 INFO]: Previous version: git-Paper-538 (MC: 1.16.5)
|
||||
[20:34:42 INFO]: This server is running Paper version 1.21-105-master@7e91a2c (2024-07-20T21:04:31Z) (Implementing API version 1.21-R0.1-SNAPSHOT)
|
||||
[20:34:42 INFO]: You are running the latest version
|
||||
[20:34:42 INFO]: Previous version: 1.21-103-aa3b356 (MC: 1.21)
|
||||
```
|
||||
|
||||
</details>
|
||||
@ -68,7 +68,7 @@ body:
|
||||
value: |
|
||||
Before submitting this issue, please ensure the following:
|
||||
|
||||
1. You are running the latest version of Paper from [our downloads page](https://papermc.io/downloads).
|
||||
1. You are running the latest version of Paper from [our downloads page](https://papermc.io/downloads/paper).
|
||||
2. You searched for and ensured there isn't already an open issue regarding this.
|
||||
3. Your version of Minecraft is supported by Paper.
|
||||
|
||||
|
5
.github/ISSUE_TEMPLATE/config.yml
vendored
5
.github/ISSUE_TEMPLATE/config.yml
vendored
@ -1,8 +1,11 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Feature Request
|
||||
url: https://github.com/PaperMC/Paper/discussions/new?category=ideas
|
||||
about: Suggest an idea for Paper
|
||||
- name: PaperMC Discord
|
||||
url: https://discord.gg/papermc
|
||||
about: If you are having issues with timings or have other minor issues, come ask us on our Discord server!
|
||||
about: If you are having issues with spark or have other minor issues, come ask us on our Discord server!
|
||||
- name: Exploit Report
|
||||
url: https://discord.gg/papermc
|
||||
about: |
|
||||
|
44
.github/ISSUE_TEMPLATE/feature-request.yml
vendored
44
.github/ISSUE_TEMPLATE/feature-request.yml
vendored
@ -1,44 +0,0 @@
|
||||
name: Feature Request
|
||||
description: Suggest an idea for Paper
|
||||
labels: [ "status: needs triage", "type: feature" ]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thank you for filling out a feature request for Paper! Please be as detailed as possible so that we may consider and review the request easier.
|
||||
We ask that you search all the issues to avoid a duplicate feature request. If one exists, please reply if you have anything to add.
|
||||
Before requesting a new feature, please make sure you are using the latest version and that the feature you are requesting is not already in Paper.
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Is your feature request related to a problem?
|
||||
description: Please give some context for this request. Why do you want it added?
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Describe the solution you'd like.
|
||||
description: A clear and concise description of what you want.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Describe alternatives you've considered.
|
||||
description: List any alternatives you might have tried to get the feature you want.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Other
|
||||
description: Add any other context or screenshots about the feature request below.
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Before submitting this feature request, please search our issue tracker to ensure your feature has not
|
||||
already been requested.
|
12
.github/ISSUE_TEMPLATE/performance-problem.yml
vendored
12
.github/ISSUE_TEMPLATE/performance-problem.yml
vendored
@ -10,9 +10,9 @@ body:
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Timings or Profile link
|
||||
description: We ask that all timings/profiles are a link, not a screenshot. Screenshots inhibit our ability to figure out the real cause of the issue.
|
||||
placeholder: "Example: https://timings.aikar.co/?id=6b48586fbbdd48e585ca0ebb07c59dd0"
|
||||
label: Profile link
|
||||
description: We ask that all profiles are a link, not a screenshot. Screenshots inhibit our ability to figure out the real cause of the issue.
|
||||
placeholder: "Example: https://spark.lucko.me/XsN0hxGfsi"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
@ -56,10 +56,10 @@ body:
|
||||
|
||||
```
|
||||
> version
|
||||
[20:34:42 INFO]: This server is running Paper version git-Paper-540 (MC: 1.16.5) (Implementing API version 1.16.5-R0.1-SNAPSHOT)
|
||||
[20:34:42 INFO]: Checking version, please wait...
|
||||
[20:34:42 INFO]: Previous version: git-Paper-538 (MC: 1.16.5)
|
||||
[20:34:42 INFO]: This server is running Paper version 1.21-105-master@7e91a2c (2024-07-20T21:04:31Z) (Implementing API version 1.21-R0.1-SNAPSHOT)
|
||||
[20:34:42 INFO]: You are running the latest version
|
||||
[20:34:42 INFO]: Previous version: 1.21-103-aa3b356 (MC: 1.21)
|
||||
```
|
||||
|
||||
</details>
|
||||
@ -79,6 +79,6 @@ body:
|
||||
value: |
|
||||
Before submitting this issue, please ensure the following:
|
||||
|
||||
1. You are running the latest version of Paper from [our downloads page](https://papermc.io/downloads).
|
||||
1. You are running the latest version of Paper from [our downloads page](https://papermc.io/downloads/paper).
|
||||
2. You searched for and ensured there isn't already an open issue regarding this.
|
||||
3. Your version of Minecraft is supported by Paper.
|
||||
|
@ -44,10 +44,10 @@ body:
|
||||
|
||||
```
|
||||
> version
|
||||
[20:34:42 INFO]: This server is running Paper version git-Paper-540 (MC: 1.16.5) (Implementing API version 1.16.5-R0.1-SNAPSHOT)
|
||||
[20:34:42 INFO]: Checking version, please wait...
|
||||
[20:34:42 INFO]: Previous version: git-Paper-538 (MC: 1.16.5)
|
||||
[20:34:42 INFO]: This server is running Paper version 1.21-105-master@7e91a2c (2024-07-20T21:04:31Z) (Implementing API version 1.21-R0.1-SNAPSHOT)
|
||||
[20:34:42 INFO]: You are running the latest version
|
||||
[20:34:42 INFO]: Previous version: 1.21-103-aa3b356 (MC: 1.21)
|
||||
```
|
||||
|
||||
</details>
|
||||
@ -68,7 +68,7 @@ body:
|
||||
value: |
|
||||
Before submitting this issue, please ensure the following:
|
||||
|
||||
1. You are running the latest version of Paper from [our downloads page](https://papermc.io/downloads).
|
||||
1. You are running the latest version of Paper from [our downloads page](https://papermc.io/downloads/paper).
|
||||
2. Your version of Minecraft is supported by Paper.
|
||||
|
||||
If your server crash log contains `DO NOT REPORT THIS TO PAPER`, please ask in our
|
||||
|
60
.github/workflows/build.yml
vendored
60
.github/workflows/build.yml
vendored
@ -21,28 +21,41 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
java: [17]
|
||||
java: [21]
|
||||
fail-fast: true
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- if: ${{ github.event_name == 'push' }}
|
||||
uses: actions/checkout@v4
|
||||
- if: ${{ github.event_name == 'pull_request' }}
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: JDK ${{ matrix.java }}
|
||||
uses: actions/setup-java@v3.6.0
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
distribution: 'temurin'
|
||||
distribution: 'zulu'
|
||||
|
||||
- name: Validate Gradle wrapper
|
||||
uses: gradle/wrapper-validation-action@v2
|
||||
- name: Setup Gradle
|
||||
uses: gradle/gradle-build-action@v2
|
||||
uses: gradle/actions/setup-gradle@v3
|
||||
|
||||
- name: Configure Build
|
||||
uses: actions/github-script@v6
|
||||
uses: actions/github-script@v7
|
||||
id: determine
|
||||
env:
|
||||
REF_NAME: "${{ github.ref_name }}"
|
||||
REF_TYPE: "${{ github.ref_type }}"
|
||||
EVENT: "${{ toJSON(github.event) }}"
|
||||
EVENT_TYPE: "${{ github.event_name }}"
|
||||
with:
|
||||
script: |
|
||||
const {owner, repo} = context.repo;
|
||||
const event_name = "${{ github.event_name }}";
|
||||
const event = ${{ toJSON(github.event) }};
|
||||
const ref_type = "${{ github.ref_type }}";
|
||||
const ref_name = "${{ github.ref_name }}";
|
||||
const event_name = `${process.env.EVENT_TYPE}`;
|
||||
const event = JSON.parse(`${process.env.EVENT}`);
|
||||
const ref_type = `${process.env.REF_TYPE}`;
|
||||
const ref_name = `${process.env.REF_NAME}`;
|
||||
const result = {
|
||||
action: "build"
|
||||
};
|
||||
@ -68,19 +81,38 @@ jobs:
|
||||
- name: Apply Patches
|
||||
run: |
|
||||
git config --global user.email "no-reply@github.com"
|
||||
git config --global user.name "Github Actions"
|
||||
git config --global user.name "GitHub Actions"
|
||||
./gradlew applyPatches --stacktrace
|
||||
|
||||
- name: Build
|
||||
run: ./gradlew build --stacktrace
|
||||
|
||||
- name: Upload Test Results
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Test Results (${{ matrix.java }})
|
||||
path: |
|
||||
**/build/test-results/test/TEST-*.xml
|
||||
|
||||
- name: Create Paperclip Jar
|
||||
if: fromJSON(steps.determine.outputs.result).action == 'paperclip'
|
||||
run: ./gradlew createReobfPaperclipJar --stacktrace
|
||||
run: ./gradlew createMojmapPaperclipJar --stacktrace
|
||||
|
||||
- name: Upload Paperclip Jar
|
||||
if: fromJSON(steps.determine.outputs.result).action == 'paperclip'
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: paper-${{ fromJSON(steps.determine.outputs.result).pr }}
|
||||
path: build/libs/paper-paperclip-*-reobf.jar
|
||||
path: build/libs/paper-paperclip-*-mojmap.jar
|
||||
event_file:
|
||||
name: "Event File"
|
||||
# Only run on PRs if the source branch is on someone else's repo
|
||||
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Event File
|
||||
path: ${{ github.event_path }}
|
||||
|
15
.github/workflows/close_invalid_prs.yml
vendored
15
.github/workflows/close_invalid_prs.yml
vendored
@ -6,9 +6,22 @@ on:
|
||||
|
||||
jobs:
|
||||
run:
|
||||
if: ${{ github.repository != github.event.pull_request.head.repo.full_name && github.head_ref == 'master' }}
|
||||
if: |
|
||||
github.repository != github.event.pull_request.head.repo.full_name &&
|
||||
(
|
||||
github.head_ref == 'master' ||
|
||||
github.event.pull_request.head.repo.owner.type != 'User'
|
||||
)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: superbrothers/close-pull-request@v3
|
||||
id: "master_branch"
|
||||
if: github.head_ref == 'master'
|
||||
with:
|
||||
comment: "Please do not open pull requests from the `master` branch, create a new branch instead."
|
||||
|
||||
- uses: superbrothers/close-pull-request@v3
|
||||
id: "org_account"
|
||||
if: github.event.pull_request.head.repo.owner.type != 'User' && steps.master_branch.outcome == 'skipped'
|
||||
with:
|
||||
comment: "Please do not open pull requests from non-user accounts like organizations. Create a fork on a user account instead."
|
||||
|
24
.github/workflows/pr_comment.yml
vendored
24
.github/workflows/pr_comment.yml
vendored
@ -17,7 +17,15 @@ jobs:
|
||||
if: github.event.workflow_run.conclusion == 'success'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/github-script@v6
|
||||
- uses: actions/github-script@v7
|
||||
env:
|
||||
BRANCH_NAME: "${{ github.event.workflow_run.head_branch }}"
|
||||
PR_OWNER: "${{ github.event.workflow_run.head_repository.owner.login }}"
|
||||
PR_SHA: "${{ github.event.workflow_run.head_sha }}"
|
||||
RUN_ID: "${{ github.event.workflow_run.id }}"
|
||||
REPO_ID: "${{ github.event.repository.id }}"
|
||||
EVENT_TYPE: "${{ github.event.workflow_run.event}}"
|
||||
PULL_REQUESTS: "${{ toJSON(github.event.workflow_run.pull_requests) }}"
|
||||
with:
|
||||
# This snippet is public-domain, taken from
|
||||
# https://github.com/oprypin/nightly.link/blob/master/.github/workflows/pr-comment.yml
|
||||
@ -37,17 +45,17 @@ jobs:
|
||||
}
|
||||
|
||||
const { owner, repo } = context.repo;
|
||||
const run_id = ${{ github.event.workflow_run.id }};
|
||||
const repo_id = ${{ github.event.repository.id }};
|
||||
const run_id = `${process.env.RUN_ID}`;
|
||||
const repo_id = `${process.env.REPO_ID}`;
|
||||
|
||||
let pulls = [];
|
||||
const event_type = "${{ github.event.workflow_run.event}}";
|
||||
const event_type = `${process.env.EVENT_TYPE}`;
|
||||
if (event_type === "push") { // if push, it's from the same repo which means `pull_requests` is populated
|
||||
pulls = ${{ toJSON(github.event.workflow_run.pull_requests) }};
|
||||
pulls = JSON.parse(`${process.env.PULL_REQUESTS}`);
|
||||
} else {
|
||||
const pr_branch = "${{ github.event.workflow_run.head_branch }}";
|
||||
const pr_sha = "${{ github.event.workflow_run.head_sha }}";
|
||||
const pr_owner = "${{ github.event.workflow_run.head_repository.owner.login }}";
|
||||
const pr_branch = `${process.env.BRANCH_NAME}`;
|
||||
const pr_sha = `${process.env.PR_SHA}`;
|
||||
const pr_owner = `${process.env.PR_OWNER}`;
|
||||
const { data } = await github.rest.pulls.list({ owner, repo, head: `${pr_owner}:${pr_branch}`, state: "open" });
|
||||
core.debug(JSON.stringify(data, null, 2));
|
||||
pulls = data.filter((pr) => pr.head.sha === pr_sha && pr.labels.find((l) => l.name === "build-pr-jar"));
|
||||
|
76
.github/workflows/projects.yml
vendored
Normale Datei
76
.github/workflows/projects.yml
vendored
Normale Datei
@ -0,0 +1,76 @@
|
||||
name: Update Projects
|
||||
|
||||
on:
|
||||
issues:
|
||||
types:
|
||||
- labeled
|
||||
- unlabeled
|
||||
- closed
|
||||
- reopened
|
||||
|
||||
jobs:
|
||||
bugs:
|
||||
if: "github.event_name == 'issues' && contains(github.event.*.labels.*.name, 'type: bug')"
|
||||
concurrency:
|
||||
group: update-bugs-project-${{ github.event.issue.number }}
|
||||
cancel-in-progress: true
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: "authenticate"
|
||||
id: "authenticate"
|
||||
uses: "tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92" # v1
|
||||
with:
|
||||
app_id: "${{ secrets.PROJECTS_APP_ID }}"
|
||||
installation_id: "36153445"
|
||||
private_key: "${{ secrets.PROJECTS_PRIVATE_KEY }}"
|
||||
|
||||
- uses: PaperMC/update-projects-action@v0.2.0
|
||||
name: Update open issue
|
||||
if: github.event.issue.state == 'open'
|
||||
with:
|
||||
github-token: "${{ steps.authenticate.outputs.token }}"
|
||||
project-url: https://github.com/orgs/PaperMC/projects/5/views/2
|
||||
column-field: Status
|
||||
label-to-column-map: |
|
||||
{
|
||||
"resolution: awaiting response": "⌛ Awaiting Response",
|
||||
"resolution: cannot reproduce": "Invalid",
|
||||
"resolution: duplicate": "Invalid",
|
||||
"resolution: incomplete": "Invalid",
|
||||
"resolution: invalid": "Invalid",
|
||||
"resolution: superseded": "Invalid",
|
||||
"resolution: unsupported": "Invalid",
|
||||
"resolution: won't fix": "Invalid",
|
||||
"resolution: works as intended": "Invalid",
|
||||
"status: accepted": "✅ Accepted",
|
||||
"status: blocked": "Needs Work",
|
||||
"status: defer upstream": "Needs Work",
|
||||
"status: in progress": "Needs Work",
|
||||
"status: input wanted": "Needs Work",
|
||||
"status: needs triage": "🕑 Needs Triage",
|
||||
"status: rebase required": "Needs Work",
|
||||
"status: unlikely": "✅ Accepted"
|
||||
}
|
||||
|
||||
- uses: PaperMC/update-projects-action@v0.2.0
|
||||
name: Update closed issue
|
||||
if: github.event.issue.state == 'closed'
|
||||
with:
|
||||
github-token: "${{ steps.authenticate.outputs.token }}"
|
||||
project-url: https://github.com/orgs/PaperMC/projects/5/views/2
|
||||
column-field: Status
|
||||
clear-on-no-match: false
|
||||
# include "status: needs triage" below to catch any closed issues without setting a resolution
|
||||
label-to-column-map: |
|
||||
{
|
||||
"resolution: cannot reproduce": "Invalid",
|
||||
"resolution: duplicate": "Invalid",
|
||||
"resolution: incomplete": "Invalid",
|
||||
"resolution: invalid": "Invalid",
|
||||
"resolution: superseded": "Invalid",
|
||||
"resolution: unsupported": "Invalid",
|
||||
"resolution: won't fix": "Invalid",
|
||||
"resolution: works as intended": "Invalid",
|
||||
"status: accepted": "Done",
|
||||
"status: needs triage": "Invalid"
|
||||
}
|
32
.github/workflows/test_results.yml
vendored
Normale Datei
32
.github/workflows/test_results.yml
vendored
Normale Datei
@ -0,0 +1,32 @@
|
||||
name: Test Results
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: [ "Build Paper" ]
|
||||
types:
|
||||
- completed
|
||||
permissions: { }
|
||||
|
||||
jobs:
|
||||
test-results:
|
||||
name: Test Results
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event.workflow_run.conclusion != 'skipped'
|
||||
permissions:
|
||||
checks: write
|
||||
# for downloading test result artifacts
|
||||
actions: read
|
||||
steps:
|
||||
- name: Download and Extract Artifacts
|
||||
uses: dawidd6/action-download-artifact@v3
|
||||
with:
|
||||
run_id: ${{ github.event.workflow_run.id }}
|
||||
path: artifacts
|
||||
- name: Publish Test Results
|
||||
uses: EnricoMi/publish-unit-test-result-action@v2
|
||||
with:
|
||||
commit: ${{ github.event.workflow_run.head_sha }}
|
||||
event_file: artifacts/Event File/event.json
|
||||
event_name: ${{ github.event.workflow_run.event }}
|
||||
files: "artifacts/**/*.xml"
|
||||
comment_mode: off
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -61,6 +61,7 @@ out/
|
||||
|
||||
# other stuff
|
||||
run/
|
||||
logs/
|
||||
|
||||
Paper-Server
|
||||
Paper-API
|
||||
@ -72,3 +73,4 @@ paperclip.properties
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
test-plugin.settings.gradle.kts
|
||||
paper-api-generator.settings.gradle.kts
|
||||
|
@ -4,11 +4,11 @@ PaperMC is happy you're willing to contribute to our projects. We are usually
|
||||
very lenient with all submitted PRs, but there are still some guidelines you
|
||||
can follow to make the approval process go more smoothly.
|
||||
|
||||
## Use a Personal Fork and not Organization
|
||||
## Use a Personal Fork and not an Organization
|
||||
|
||||
Paper will routinely modify your PR, whether it's a quick rebase or to take care
|
||||
of any minor nitpicks we might have. Often, it's better for us to solve these
|
||||
problems for you than make you go back and forth trying to fix it yourself.
|
||||
problems for you than make you go back and forth trying to fix them yourself.
|
||||
|
||||
Unfortunately, if you use an organization for your PR, it prevents Paper from
|
||||
modifying it. This requires us to manually merge your PR, resulting in us
|
||||
@ -27,12 +27,12 @@ which can be obtained in (most) package managers such as `apt` (Debian / Ubuntu;
|
||||
you will most likely use this for WSL), `homebrew` (macOS / Linux), and more:
|
||||
|
||||
- `git` (package `git` everywhere);
|
||||
- A Java 17 or later JDK (packages vary, use Google/DuckDuckGo/etc.).
|
||||
- A Java 21 or later JDK (packages vary, use Google/DuckDuckGo/etc.).
|
||||
- [Adoptium](https://adoptium.net/) has builds for most operating systems.
|
||||
- Paper requires JDK 17 to build, however makes use of Gradle's
|
||||
- Paper requires JDK 21 to build, however, makes use of Gradle's
|
||||
[Toolchains](https://docs.gradle.org/current/userguide/toolchains.html)
|
||||
feature to allow building with only JRE 8 or later installed. (Gradle will
|
||||
automatically provision JDK 17 for compilation if it cannot find an existing
|
||||
feature to allow building with only JRE 11 or later installed. (Gradle will
|
||||
automatically provision JDK 21 for compilation if it cannot find an existing
|
||||
install).
|
||||
|
||||
If you're on Windows, check
|
||||
@ -42,11 +42,11 @@ If you're compiling with Docker, you can use Adoptium's
|
||||
[`eclipse-temurin`](https://hub.docker.com/_/eclipse-temurin/) images like so:
|
||||
|
||||
```console
|
||||
# docker run -it -v "$(pwd)":/data --rm eclipse-temurin:17.0.1_12-jdk bash
|
||||
# docker run -it -v "$(pwd)":/data --rm eclipse-temurin:21.0.3_9-jdk bash
|
||||
Pulling image...
|
||||
|
||||
root@abcdefg1234:/# javac -version
|
||||
javac 17.0.1
|
||||
javac 21.0.3
|
||||
```
|
||||
|
||||
## Understanding Patches
|
||||
@ -67,7 +67,7 @@ Assuming you have already forked the repository:
|
||||
|
||||
1. Clone your fork to your local machine;
|
||||
2. Type `./gradlew applyPatches` in a terminal to apply the changes from upstream.
|
||||
On Windows, leave out the `./` at the beginning for all `gradlew` commands;
|
||||
On Windows, replace the `./` with `.\` at the beginning for all `gradlew` commands;
|
||||
3. cd into `Paper-Server` for server changes, and `Paper-API` for API changes.
|
||||
<!--You can also run `./paper server` or `./paper api` for these same directories
|
||||
respectively.
|
||||
@ -184,7 +184,7 @@ These steps assume the `origin` remote is your fork of this repository and `upst
|
||||
1. Checkout feature/fix branch and rebase on master: `git checkout patch-branch && git rebase master`.
|
||||
1. Apply updated patches: `./gradlew applyPatches`.
|
||||
1. If there are conflicts, fix them.
|
||||
1. If your PR creates new patches instead of modifying exist ones, in both the `Paper-Server` and `Paper-API` directories, ensure your newly-created patch is the last commit by either:
|
||||
1. If your PR creates new patches instead of modifying existing ones, in both the `Paper-Server` and `Paper-API` directories, ensure your newly-created patch is the last commit by either:
|
||||
* Renaming the patch file with a large 4-digit number in front (e.g. 9999-Patch-to-add-some-new-stuff.patch), and re-applying patches.
|
||||
* Running `git rebase --interactive base` and moving the commits to the end.
|
||||
1. Rebuild patches: `./gradlew rebuildPatches`.
|
||||
@ -204,37 +204,58 @@ when making and submitting changes.
|
||||
|
||||
## Formatting
|
||||
|
||||
All modifications to non-Paper files should be marked.
|
||||
All modifications to non-Paper files should be marked. The one exception to this is
|
||||
when modifying javadoc comments, which should not have these markers.
|
||||
|
||||
- Multi-line changes start with `// Paper start` and end with `// Paper end`;
|
||||
- You can put a comment with an explanation if it isn't obvious, like this:
|
||||
`// Paper start - reason`.
|
||||
- The comments should generally be about the reason the change was made, what
|
||||
it was before, or what the change is.
|
||||
- Multi-line messages should start with `// Paper start` and use `/* Multi
|
||||
line message here */` for the message itself.
|
||||
- One-line changes should have `// Paper` or `// Paper - reason`.
|
||||
- You need to add a comment with a short and identifiable description of the patch:
|
||||
`// Paper start - <COMMIT DESCRIPTION>`
|
||||
- The comments should generally be about the reason the change was made, what
|
||||
it was before, or what the change is.
|
||||
- After the general commit description, you can add additional information either
|
||||
after a `;` or in the next line.
|
||||
- Multi-line changes start with `// Paper start - <COMMIT DESCRIPTION>` and end
|
||||
with `// Paper end - <COMMIT DESCRIPTION>`.
|
||||
- One-line changes should have `// Paper - <COMMIT DESCRIPTION>` at the end of the line.
|
||||
|
||||
Here's an example of how to mark changes by Paper:
|
||||
|
||||
```java
|
||||
entity.getWorld().dontbeStupid(); // Paper - was beStupid() which is bad
|
||||
entity.getWorld().dontBeStupid(); // Paper - Was beStupid(), which is bad
|
||||
entity.getFriends().forEach(Entity::explode);
|
||||
entity.a();
|
||||
entity.b();
|
||||
// Paper start - use plugin-set spawn
|
||||
entity.updateFriends();
|
||||
|
||||
// Paper start - Use plugin-set spawn
|
||||
// entity.getWorld().explode(entity.getWorld().getSpawn());
|
||||
Location spawnLocation = ((CraftWorld)entity.getWorld()).getSpawnLocation();
|
||||
entity.getWorld().explode(new BlockPosition(spawnLocation.getX(), spawnLocation.getY(), spawnLocation.getZ()));
|
||||
// Paper end
|
||||
// Paper end - Use plugin-set spawn
|
||||
```
|
||||
|
||||
We generally follow usual Java style (aka. Oracle style), or what is programmed
|
||||
We generally follow the usual Java style (aka. Oracle style), or what is programmed
|
||||
into most IDEs and formatters by default. There are a few notes, however:
|
||||
- It is fine to go over 80 lines as long as it doesn't hurt readability.
|
||||
There are exceptions, especially in Spigot-related files
|
||||
- When in doubt or the code around your change is in a clearly different style,
|
||||
use the same style as the surrounding code.
|
||||
- Usage of the `var` keyword is heavily discouraged, as it makes reading patch files
|
||||
a lot harder and can lead to confusion during updates due to changed return types.
|
||||
The only exception to this is if a line would otherwise be way too long/filled with
|
||||
hard to parse generics in a case where the base type itself is already obvious
|
||||
|
||||
### Imports
|
||||
When adding new imports to a class in a file not created by the current patch, use the fully qualified class name
|
||||
instead of adding a new import to the top of the file. If you are using a type a significant number of times, you
|
||||
can add an import with a comment. However, if its only used a couple of times, the FQN is preferred to prevent future
|
||||
patch conflicts in the import section of the file.
|
||||
|
||||
```java
|
||||
import org.bukkit.event.Event;
|
||||
// don't add import here, use FQN like below
|
||||
|
||||
public class SomeEvent extends Event {
|
||||
public final org.bukkit.Location newLocation; // Paper - add location
|
||||
}
|
||||
```
|
||||
|
||||
## Access Transformers
|
||||
Sometimes, vanilla or CraftBukkit code already contains a field, method, or type you want to access
|
||||
@ -302,7 +323,7 @@ Subject: [PATCH] revert serverside behavior of keepalives
|
||||
This patch intends to bump up the time that a client has to reply to the
|
||||
server back to 30 seconds as per pre 1.12.2, which allowed clients
|
||||
more than enough time to reply potentially allowing them to be less
|
||||
tempermental due to lag spikes on the network thread, e.g. that caused
|
||||
temperamental due to lag spikes on the network thread, e.g. that caused
|
||||
by plugins that are interacting with netty.
|
||||
|
||||
We also add a system property to allow people to tweak how long the server
|
||||
@ -478,4 +499,4 @@ everything like usual.
|
||||
> in Windows like described here:
|
||||
> <https://docs.microsoft.com/en-us/windows/wsl/filesystems#view-your-current-directory-in-windows-file-explorer>
|
||||
|
||||
[MappingViewer]: https://nms.screamingsandals.org/
|
||||
[MappingViewer]: https://mappings.cephx.dev/
|
||||
|
@ -55,4 +55,13 @@ TheFruxz <cedricspitzer@outlook.de>
|
||||
Kieran Wallbanks <kieran.wallbanks@gmail.com>
|
||||
Denery <dorofeevij@gmail.com>
|
||||
Jakubk15 <jakubk15@protonmail.com>
|
||||
Redned <redned235@gmail.com>
|
||||
Luke Chambers <consolelogluke@gmail.com>
|
||||
Emily <emilia.lopezf.1999@gmail.com>
|
||||
dawon <dawon@dawon.eu>
|
||||
Ollie <69084614+olijeffers0n@users.noreply.github.com>
|
||||
Oliwier Miodun <naczs@blueflow.pl>
|
||||
aerulion <aerulion@gmail.com>
|
||||
Lukas Planz <lukas.planz@web.de>
|
||||
granny <contact@granny.dev>
|
||||
```
|
||||
|
@ -1,36 +0,0 @@
|
||||
plugins {
|
||||
`java-library`
|
||||
`maven-publish`
|
||||
}
|
||||
|
||||
java {
|
||||
withSourcesJar()
|
||||
withJavadocJar()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":paper-api"))
|
||||
api("com.mojang:brigadier:1.0.18")
|
||||
|
||||
compileOnly("it.unimi.dsi:fastutil:8.5.6")
|
||||
compileOnly("org.jetbrains:annotations:23.0.0")
|
||||
|
||||
testImplementation("junit:junit:4.13.2")
|
||||
testImplementation("org.hamcrest:hamcrest-library:1.3")
|
||||
testImplementation("org.ow2.asm:asm-tree:9.2")
|
||||
}
|
||||
|
||||
configure<PublishingExtension> {
|
||||
publications.create<MavenPublication>("maven") {
|
||||
from(components["java"])
|
||||
}
|
||||
}
|
||||
|
||||
val scanJar = tasks.register("scanJarForBadCalls", io.papermc.paperweight.tasks.ScanJarForBadCalls::class) {
|
||||
badAnnotations.add("Lio/papermc/paper/annotation/DoNotUse;")
|
||||
jarToScan.set(tasks.jar.flatMap { it.archiveFile })
|
||||
classpath.from(configurations.compileClasspath)
|
||||
}
|
||||
tasks.check {
|
||||
dependsOn(scanJar)
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package com.destroystokyo.paper.brigadier;
|
||||
|
||||
import com.mojang.brigadier.Command;
|
||||
import com.mojang.brigadier.suggestion.SuggestionProvider;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
* Brigadier {@link Command}, {@link SuggestionProvider}, and permission checker for Bukkit {@link Command}s.
|
||||
*
|
||||
* @param <S> command source type
|
||||
*/
|
||||
public interface BukkitBrigadierCommand <S extends BukkitBrigadierCommandSource> extends Command<S>, Predicate<S>, SuggestionProvider<S> {
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
package com.destroystokyo.paper.brigadier;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface BukkitBrigadierCommandSource {
|
||||
|
||||
@Nullable
|
||||
Entity getBukkitEntity();
|
||||
|
||||
@Nullable
|
||||
World getBukkitWorld();
|
||||
|
||||
@Nullable
|
||||
Location getBukkitLocation();
|
||||
|
||||
CommandSender getBukkitSender();
|
||||
}
|
@ -1,72 +0,0 @@
|
||||
package com.destroystokyo.paper.event.brigadier;
|
||||
|
||||
import com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource;
|
||||
import com.mojang.brigadier.tree.RootCommandNode;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Fired any time a Brigadier RootCommandNode is generated for a player to inform the client of commands.
|
||||
* You may manipulate this CommandNode to change what the client sees.
|
||||
*
|
||||
* <p>This event may fire on login, world change, and permission rebuilds, by plugin request, and potentially future means.</p>
|
||||
*
|
||||
* <p>This event will fire before {@link org.bukkit.event.player.PlayerCommandSendEvent}, so no filtering has been done by
|
||||
* other plugins yet.</p>
|
||||
*
|
||||
* <p>WARNING: This event will potentially (and most likely) fire twice! Once for Async, and once again for Sync.
|
||||
* It is important that you check event.isAsynchronous() and event.hasFiredAsync() to ensure you only act once.
|
||||
* If for some reason we are unable to send this asynchronously in the future, only the sync method will fire.</p>
|
||||
*
|
||||
* <p>Your logic should look like this:
|
||||
* {@code if (event.isAsynchronous() || !event.hasFiredAsync()) { // do stuff }}</p>
|
||||
*
|
||||
* <p>If your logic is not safe to run asynchronously, only react to the synchronous version.</p>
|
||||
*
|
||||
* <p>This is a draft/experimental API and is subject to change.</p>
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public class AsyncPlayerSendCommandsEvent <S extends BukkitBrigadierCommandSource> extends PlayerEvent {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final RootCommandNode<S> node;
|
||||
private final boolean hasFiredAsync;
|
||||
|
||||
public AsyncPlayerSendCommandsEvent(Player player, RootCommandNode<S> node, boolean hasFiredAsync) {
|
||||
super(player, !Bukkit.isPrimaryThread());
|
||||
this.node = node;
|
||||
this.hasFiredAsync = hasFiredAsync;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the full Root Command Node being sent to the client, which is mutable.
|
||||
*
|
||||
* @return the root command node
|
||||
*/
|
||||
public RootCommandNode<S> getCommandNode() {
|
||||
return node;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets if this event has already fired asynchronously.
|
||||
*
|
||||
* @return whether this event has already fired asynchronously
|
||||
*/
|
||||
public boolean hasFiredAsync() {
|
||||
return hasFiredAsync;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
package com.destroystokyo.paper.event.brigadier;
|
||||
|
||||
import com.mojang.brigadier.suggestion.Suggestions;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Called when sending {@link Suggestions} to the client. Will be called asynchronously if a plugin
|
||||
* marks the {@link com.destroystokyo.paper.event.server.AsyncTabCompleteEvent} event handled asynchronously,
|
||||
* otherwise called synchronously.
|
||||
*/
|
||||
public class AsyncPlayerSendSuggestionsEvent extends PlayerEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled = false;
|
||||
|
||||
private Suggestions suggestions;
|
||||
private final String buffer;
|
||||
|
||||
public AsyncPlayerSendSuggestionsEvent(Player player, Suggestions suggestions, String buffer) {
|
||||
super(player, !Bukkit.isPrimaryThread());
|
||||
this.suggestions = suggestions;
|
||||
this.buffer = buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the input buffer sent to request these suggestions.
|
||||
*
|
||||
* @return the input buffer
|
||||
*/
|
||||
public String getBuffer() {
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the suggestions to be sent to client.
|
||||
*
|
||||
* @return the suggestions
|
||||
*/
|
||||
public Suggestions getSuggestions() {
|
||||
return suggestions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the suggestions to be sent to client.
|
||||
*
|
||||
* @param suggestions suggestions
|
||||
*/
|
||||
public void setSuggestions(Suggestions suggestions) {
|
||||
this.suggestions = suggestions;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancels sending suggestions to the client.
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -1,168 +0,0 @@
|
||||
package com.destroystokyo.paper.event.brigadier;
|
||||
|
||||
import com.destroystokyo.paper.brigadier.BukkitBrigadierCommand;
|
||||
import com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource;
|
||||
import com.mojang.brigadier.tree.ArgumentCommandNode;
|
||||
import com.mojang.brigadier.tree.LiteralCommandNode;
|
||||
import com.mojang.brigadier.tree.RootCommandNode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.server.ServerEvent;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Fired anytime the server synchronizes Bukkit commands to Brigadier.
|
||||
*
|
||||
* <p>Allows a plugin to control the command node structure for its commands.
|
||||
* This is done at Plugin Enable time after commands have been registered, but may also
|
||||
* run at a later point in the server lifetime due to plugins, a server reload, etc.</p>
|
||||
*
|
||||
* <p>This is a draft/experimental API and is subject to change.</p>
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public class CommandRegisteredEvent<S extends BukkitBrigadierCommandSource> extends ServerEvent implements Cancellable {
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final String commandLabel;
|
||||
private final Command command;
|
||||
private final BukkitBrigadierCommand<S> brigadierCommand;
|
||||
private final RootCommandNode<S> root;
|
||||
private final ArgumentCommandNode<S, String> defaultArgs;
|
||||
private LiteralCommandNode<S> literal;
|
||||
private boolean rawCommand = false;
|
||||
private boolean cancelled = false;
|
||||
|
||||
public CommandRegisteredEvent(String commandLabel, BukkitBrigadierCommand<S> brigadierCommand, Command command, RootCommandNode<S> root, LiteralCommandNode<S> literal, ArgumentCommandNode<S, String> defaultArgs) {
|
||||
this.commandLabel = commandLabel;
|
||||
this.brigadierCommand = brigadierCommand;
|
||||
this.command = command;
|
||||
this.root = root;
|
||||
this.literal = literal;
|
||||
this.defaultArgs = defaultArgs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the command label of the {@link Command} being registered.
|
||||
*
|
||||
* @return the command label
|
||||
*/
|
||||
public String getCommandLabel() {
|
||||
return this.commandLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the {@link BukkitBrigadierCommand} for the {@link Command} being registered. This can be used
|
||||
* as the {@link com.mojang.brigadier.Command command executor} or
|
||||
* {@link com.mojang.brigadier.suggestion.SuggestionProvider} of a {@link com.mojang.brigadier.tree.CommandNode}
|
||||
* to delegate to the {@link Command} being registered.
|
||||
*
|
||||
* @return the {@link BukkitBrigadierCommand}
|
||||
*/
|
||||
public BukkitBrigadierCommand<S> getBrigadierCommand() {
|
||||
return this.brigadierCommand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the {@link Command} being registered.
|
||||
*
|
||||
* @return the {@link Command}
|
||||
*/
|
||||
public Command getCommand() {
|
||||
return this.command;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the {@link RootCommandNode} which is being registered to.
|
||||
*
|
||||
* @return the {@link RootCommandNode}
|
||||
*/
|
||||
public RootCommandNode<S> getRoot() {
|
||||
return this.root;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Bukkit APIs default arguments node (greedy string), for if
|
||||
* you wish to reuse it.
|
||||
*
|
||||
* @return default arguments node
|
||||
*/
|
||||
public ArgumentCommandNode<S, String> getDefaultArgs() {
|
||||
return this.defaultArgs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the {@link LiteralCommandNode} to be registered for the {@link Command}.
|
||||
*
|
||||
* @return the {@link LiteralCommandNode}
|
||||
*/
|
||||
public LiteralCommandNode<S> getLiteral() {
|
||||
return this.literal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the {@link LiteralCommandNode} used to register this command. The default literal is mutable, so
|
||||
* this is primarily if you want to completely replace the object.
|
||||
*
|
||||
* @param literal new node
|
||||
*/
|
||||
public void setLiteral(LiteralCommandNode<S> literal) {
|
||||
this.literal = literal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether this command should is treated as "raw".
|
||||
*
|
||||
* @see #setRawCommand(boolean)
|
||||
* @return whether this command is treated as "raw"
|
||||
*/
|
||||
public boolean isRawCommand() {
|
||||
return this.rawCommand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether this command should be treated as "raw".
|
||||
*
|
||||
* <p>A "raw" command will only use the node provided by this event for
|
||||
* sending the command tree to the client. For execution purposes, the default
|
||||
* greedy string execution of a standard Bukkit {@link Command} is used.</p>
|
||||
*
|
||||
* <p>On older versions of Paper, this was the default and only behavior of this
|
||||
* event.</p>
|
||||
*
|
||||
* @param rawCommand whether this command should be treated as "raw"
|
||||
*/
|
||||
public void setRawCommand(final boolean rawCommand) {
|
||||
this.rawCommand = rawCommand;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancels registering this command to Brigadier, but will remain in Bukkit Command Map. Can be used to hide a
|
||||
* command from all players.
|
||||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
package io.papermc.paper.brigadier;
|
||||
|
||||
import com.mojang.brigadier.Message;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.ComponentLike;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Helper methods to bridge the gaps between Brigadier and Paper-MojangAPI.
|
||||
*/
|
||||
public final class PaperBrigadier {
|
||||
private PaperBrigadier() {
|
||||
throw new RuntimeException("PaperBrigadier is not to be instantiated!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new Brigadier {@link Message} from a {@link ComponentLike}.
|
||||
*
|
||||
* <p>Mostly useful for creating rich suggestion tooltips in combination with other Paper-MojangAPI APIs.</p>
|
||||
*
|
||||
* @param componentLike The {@link ComponentLike} to use for the {@link Message} contents
|
||||
* @return A new Brigadier {@link Message}
|
||||
*/
|
||||
public static @NonNull Message message(final @NonNull ComponentLike componentLike) {
|
||||
return PaperBrigadierProvider.instance().message(componentLike);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new {@link Component} from a Brigadier {@link Message}.
|
||||
*
|
||||
* <p>If the {@link Message} was created from a {@link Component}, it will simply be
|
||||
* converted back, otherwise a new {@link TextComponent} will be created with the
|
||||
* content of {@link Message#getString()}</p>
|
||||
*
|
||||
* @param message The {@link Message} to create a {@link Component} from
|
||||
* @return The created {@link Component}
|
||||
*/
|
||||
public static @NonNull Component componentFromMessage(final @NonNull Message message) {
|
||||
return PaperBrigadierProvider.instance().componentFromMessage(message);
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
package io.papermc.paper.brigadier;
|
||||
|
||||
import com.mojang.brigadier.Message;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.ComponentLike;
|
||||
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
interface PaperBrigadierProvider {
|
||||
final class Holder {
|
||||
private static @MonotonicNonNull PaperBrigadierProvider INSTANCE;
|
||||
}
|
||||
|
||||
static @NonNull PaperBrigadierProvider instance() {
|
||||
return requireNonNull(Holder.INSTANCE, "PaperBrigadierProvider has not yet been initialized!");
|
||||
}
|
||||
|
||||
static void initialize(final @NonNull PaperBrigadierProvider instance) {
|
||||
if (Holder.INSTANCE != null) {
|
||||
throw new IllegalStateException("PaperBrigadierProvider has already been initialized!");
|
||||
}
|
||||
Holder.INSTANCE = instance;
|
||||
}
|
||||
|
||||
@NonNull Message message(@NonNull ComponentLike componentLike);
|
||||
|
||||
@NonNull Component componentFromMessage(@NonNull Message message);
|
||||
}
|
43
README.md
43
README.md
@ -4,48 +4,47 @@ Paper [![Paper Build Status](https://img.shields.io/github/actions/workflow/stat
|
||||
[![Open Collective](https://img.shields.io/opencollective/all/papermc?label=OpenCollective%20Sponsors)](https://opencollective.com/papermc)
|
||||
===========
|
||||
|
||||
High performance Spigot fork that aims to fix gameplay and mechanics inconsistencies.
|
||||
The most widely used, high-performance Minecraft server that aims to fix gameplay and mechanics inconsistencies.
|
||||
|
||||
|
||||
**Support and Project Discussion:**
|
||||
- [Our forums](https://forums.papermc.io/), [Discord](https://discord.gg/papermc), or [IRC](https://webchat.esper.net/?channels=paper)
|
||||
- [Our forums](https://forums.papermc.io/) or [Discord](https://discord.gg/papermc)
|
||||
|
||||
How To (Server Admins)
|
||||
------
|
||||
Paperclip is a jar file that you can download and run just like a normal jar file.
|
||||
|
||||
Download Paper from our [downloads page](https://papermc.io/downloads).
|
||||
Download Paper from our [downloads page](https://papermc.io/downloads/paper).
|
||||
|
||||
Run the Paperclip jar directly from your server. Just like old times
|
||||
|
||||
* Documentation on using Paper: [docs.papermc.io](https://docs.papermc.io)
|
||||
* For a sneak peek at upcoming features, [see here](https://github.com/PaperMC/Paper/projects)
|
||||
* Documentation on using Paper: [docs.papermc.io](https://docs.papermc.io)
|
||||
* For a sneak peek at upcoming features, [see here](https://github.com/PaperMC/Paper/projects)
|
||||
|
||||
How To (Plugin Developers)
|
||||
------
|
||||
* See our API patches [here](patches/api)
|
||||
* See upcoming, pending, and recently added API [here](https://github.com/PaperMC/Paper/projects/6)
|
||||
* Paper API javadocs here: [papermc.io/javadocs](https://papermc.io/javadocs/)
|
||||
* Maven Repo (for paper-api):
|
||||
* See our API patches [here](patches/api)
|
||||
* See upcoming, pending, and recently added API [here](https://github.com/orgs/PaperMC/projects/2/views/4)
|
||||
* Paper API javadocs here: [papermc.io/javadocs](https://papermc.io/javadocs/)
|
||||
#### Repository (for paper-api)
|
||||
##### Maven
|
||||
|
||||
```xml
|
||||
<repository>
|
||||
<id>papermc</id>
|
||||
<url>https://repo.papermc.io/repository/maven-public/</url>
|
||||
</repository>
|
||||
```
|
||||
* Artifact Information:
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>io.papermc.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>1.19.3-R0.1-SNAPSHOT</version>
|
||||
<version>1.21.1-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
**Or alternatively, with Gradle:**
|
||||
|
||||
* Repository:
|
||||
```
|
||||
##### Gradle
|
||||
```kotlin
|
||||
repositories {
|
||||
maven {
|
||||
@ -54,19 +53,19 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("io.papermc.paper:paper-api:1.19.3-R0.1-SNAPSHOT")
|
||||
compileOnly("io.papermc.paper:paper-api:1.21.1-R0.1-SNAPSHOT")
|
||||
}
|
||||
|
||||
java {
|
||||
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
|
||||
toolchain.languageVersion.set(JavaLanguageVersion.of(21))
|
||||
}
|
||||
```
|
||||
|
||||
How To (Compiling Jar From Source)
|
||||
------
|
||||
To compile Paper, you need JDK 17 and an internet connection.
|
||||
To compile Paper, you need JDK 21 and an internet connection.
|
||||
|
||||
Clone this repo, run `./gradlew applyPatches`, then `./gradlew createReobfBundlerJar` from your terminal. You can find the compiled jar in the project root's `build/libs` directory.
|
||||
Clone this repo, run `./gradlew applyPatches`, then `./gradlew createMojmapBundlerJar` from your terminal. You can find the compiled jar in the project root's `build/libs` directory.
|
||||
|
||||
To get a full list of tasks, run `./gradlew tasks`.
|
||||
|
||||
@ -76,9 +75,9 @@ See [Contributing](CONTRIBUTING.md)
|
||||
|
||||
Support Us
|
||||
------
|
||||
First of all, thank you for considering helping out, we really appreciate that!
|
||||
First of all, thank you for considering helping out, we really appreciate that!
|
||||
|
||||
PaperMC has various recurring expenses, mostly related to infrastructure. Paper uses [Open Collective](https://opencollective.com/) via the [Open Source Collective fiscal host](https://opencollective.com/opensource) to manage expenses. Open Collective allows us to be extremely transparent, so you can always see how your donations are used. You can read more about financially supporting PaperMC [on our website](https://papermc.io/sponsors).
|
||||
PaperMC has various recurring expenses, mostly related to infrastructure. Paper uses [Open Collective](https://opencollective.com/) via the [Open Source Collective fiscal host](https://opencollective.com/opensource) to manage expenses. Open Collective allows us to be extremely transparent, so you can always see how your donations are used. You can read more about financially supporting PaperMC [on our website](https://papermc.io/sponsors).
|
||||
|
||||
You can find our collective [here](https://opencollective.com/papermc), or you can donate via GitHub Sponsors [here](https://github.com/sponsors/PaperMC), which will also go towards the collective.
|
||||
|
||||
|
@ -8,3 +8,8 @@
|
||||
# To import classes from the vanilla Minecraft jar use `minecraft` as the artifactId:
|
||||
# minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter
|
||||
# minecraft net/minecraft/world/level/entity/LevelEntityGetter.java
|
||||
# To import minecraft data files, like the default chat type, use `mc_data` as the prefix:
|
||||
# mc_data chat_type/chat.json
|
||||
# mc_data dimension_type/overworld.json
|
||||
#
|
||||
|
||||
|
@ -12,3 +12,7 @@ public net.minecraft.server.MinecraftServer doRunTask(Lnet/minecraft/server/Tick
|
||||
# AT remap issue? todo 1.18
|
||||
public net.minecraft.world.level.dimension.end.EndDragonFight findExitPortal()Lnet/minecraft/world/level/block/state/pattern/BlockPattern$BlockPatternMatch;
|
||||
public net.minecraft.nbt.TagParser readArrayTag()Lnet/minecraft/nbt/Tag;
|
||||
|
||||
# TODO 1.20 remapSpigotAt.at doesn't remap the return type for this method for some reason
|
||||
public net/minecraft/world/entity/Display$TextDisplay getText()Lnet/minecraft/network/chat/Component;
|
||||
public net/minecraft/world/entity/Display$BlockDisplay getBlockState()Lnet/minecraft/world/level/block/state/BlockState;
|
||||
|
@ -14,15 +14,15 @@ tiny 2 0 mojang+yarn spigot
|
||||
|
||||
# CraftBukkit changes type
|
||||
c net/minecraft/server/level/ServerLevel net/minecraft/server/level/WorldServer
|
||||
f Lnet/minecraft/world/level/storage/PrimaryLevelData; serverLevelData N
|
||||
f Lnet/minecraft/world/level/storage/PrimaryLevelData; serverLevelData K
|
||||
|
||||
c net/minecraft/world/level/chunk/LevelChunk net/minecraft/world/level/chunk/Chunk
|
||||
f Lnet/minecraft/server/level/ServerLevel; level q
|
||||
f Lnet/minecraft/server/level/ServerLevel; level r
|
||||
|
||||
# See mappings-patch.tiny
|
||||
c net/minecraft/server/level/ChunkMap net/minecraft/server/level/PlayerChunkMap
|
||||
f Lnet/minecraft/server/level/ChunkMap$ChunkDistanceManager; distanceManager G
|
||||
|
||||
# Paper changes type
|
||||
c net/minecraft/core/MappedRegistry net/minecraft/core/RegistryMaterials
|
||||
f Lit/unimi/dsi/fastutil/objects/Reference2IntOpenHashMap; toId e
|
||||
# The method is made public by Spigot, which then causes accidental overrides
|
||||
c net/minecraft/world/entity/Entity net/minecraft/world/entity/Entity
|
||||
m ()Z isInRain isInRain0
|
||||
|
198
build.gradle.kts
198
build.gradle.kts
@ -1,11 +1,17 @@
|
||||
import io.papermc.paperweight.PaperweightException
|
||||
import io.papermc.paperweight.tasks.BaseTask
|
||||
import io.papermc.paperweight.util.*
|
||||
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
|
||||
import org.gradle.api.tasks.testing.logging.TestLogEvent
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.nio.file.Path
|
||||
import java.util.regex.Pattern
|
||||
import kotlin.io.path.*
|
||||
|
||||
plugins {
|
||||
java
|
||||
`maven-publish`
|
||||
id("com.github.johnrengelman.shadow") version "7.1.2" apply false
|
||||
id("io.papermc.paperweight.core") version "1.5.1"
|
||||
id("io.papermc.paperweight.core") version "1.7.1"
|
||||
}
|
||||
|
||||
allprojects {
|
||||
@ -14,7 +20,7 @@ allprojects {
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(17))
|
||||
languageVersion = JavaLanguageVersion.of(21)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -24,7 +30,7 @@ val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
|
||||
subprojects {
|
||||
tasks.withType<JavaCompile> {
|
||||
options.encoding = Charsets.UTF_8.name()
|
||||
options.release.set(17)
|
||||
options.release = 21
|
||||
}
|
||||
tasks.withType<Javadoc> {
|
||||
options.encoding = Charsets.UTF_8.name()
|
||||
@ -61,31 +67,31 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
paramMappings("net.fabricmc:yarn:1.19.3+build.1:mergedv2")
|
||||
remapper("net.fabricmc:tiny-remapper:0.8.6:fat")
|
||||
decompiler("net.minecraftforge:forgeflower:2.0.605.1")
|
||||
spigotDecompiler("io.papermc:patched-spigot-fernflower:0.1+build.6")
|
||||
paperclip("io.papermc:paperclip:3.0.2")
|
||||
paramMappings("net.fabricmc:yarn:1.21.1+build.3:mergedv2")
|
||||
remapper("net.fabricmc:tiny-remapper:0.10.3:fat")
|
||||
decompiler("org.vineflower:vineflower:1.10.1")
|
||||
spigotDecompiler("io.papermc:patched-spigot-fernflower:0.1+build.13")
|
||||
paperclip("io.papermc:paperclip:3.0.3")
|
||||
}
|
||||
|
||||
paperweight {
|
||||
minecraftVersion.set(providers.gradleProperty("mcVersion"))
|
||||
serverProject.set(project(":paper-server"))
|
||||
minecraftVersion = providers.gradleProperty("mcVersion")
|
||||
serverProject = project(":paper-server")
|
||||
|
||||
paramMappingsRepo.set(paperMavenPublicUrl)
|
||||
remapRepo.set(paperMavenPublicUrl)
|
||||
decompileRepo.set(paperMavenPublicUrl)
|
||||
paramMappingsRepo = paperMavenPublicUrl
|
||||
remapRepo = paperMavenPublicUrl
|
||||
decompileRepo = paperMavenPublicUrl
|
||||
|
||||
craftBukkit {
|
||||
fernFlowerJar.set(layout.file(spigotDecompiler.elements.map { it.single().asFile }))
|
||||
fernFlowerJar = layout.file(spigotDecompiler.elements.map { it.single().asFile })
|
||||
}
|
||||
|
||||
paper {
|
||||
spigotApiPatchDir.set(layout.projectDirectory.dir("patches/api"))
|
||||
spigotServerPatchDir.set(layout.projectDirectory.dir("patches/server"))
|
||||
spigotApiPatchDir = layout.projectDirectory.dir("patches/api")
|
||||
spigotServerPatchDir = layout.projectDirectory.dir("patches/server")
|
||||
|
||||
mappingsPatch.set(layout.projectDirectory.file("build-data/mappings-patch.tiny"))
|
||||
reobfMappingsPatch.set(layout.projectDirectory.file("build-data/reobf-mappings-patch.tiny"))
|
||||
mappingsPatch = layout.projectDirectory.file("build-data/mappings-patch.tiny")
|
||||
reobfMappingsPatch = layout.projectDirectory.file("build-data/reobf-mappings-patch.tiny")
|
||||
|
||||
reobfPackagesToFix.addAll(
|
||||
"co.aikar.timings",
|
||||
@ -102,8 +108,7 @@ paperweight {
|
||||
}
|
||||
|
||||
tasks.generateDevelopmentBundle {
|
||||
apiCoordinates.set("io.papermc.paper:paper-api")
|
||||
mojangApiCoordinates.set("io.papermc.paper:paper-mojangapi")
|
||||
apiCoordinates = "io.papermc.paper:paper-api"
|
||||
libraryRepositories.addAll(
|
||||
"https://repo.maven.apache.org/maven2/",
|
||||
paperMavenPublicUrl,
|
||||
@ -131,11 +136,6 @@ allprojects {
|
||||
}
|
||||
}
|
||||
|
||||
tasks.collectAtsFromPatches {
|
||||
// Uncomment while updating for a new Minecraft version
|
||||
//extraPatchDir.set(layout.projectDirectory.dir("patches/unapplied/server"))
|
||||
}
|
||||
|
||||
tasks.register("printMinecraftVersion") {
|
||||
doLast {
|
||||
println(providers.gradleProperty("mcVersion").get().trim())
|
||||
@ -147,3 +147,149 @@ tasks.register("printPaperVersion") {
|
||||
println(project.version)
|
||||
}
|
||||
}
|
||||
|
||||
// see gradle.properties
|
||||
if (providers.gradleProperty("updatingMinecraft").getOrElse("false").toBoolean()) {
|
||||
tasks.collectAtsFromPatches {
|
||||
val dir = layout.projectDirectory.dir("patches/unapplied/server")
|
||||
if (dir.path.isDirectory()) {
|
||||
extraPatchDir = dir
|
||||
}
|
||||
}
|
||||
tasks.withType<io.papermc.paperweight.tasks.RebuildGitPatches>().configureEach {
|
||||
filterPatches = false
|
||||
}
|
||||
tasks.register("continueServerUpdate", RebasePatches::class) {
|
||||
description = "Moves the next X patches from unapplied to applied, and applies them. X being the number of patches that apply cleanly, plus the terminal failure if any."
|
||||
projectDir = project.projectDir
|
||||
appliedPatches = file("patches/server")
|
||||
unappliedPatches = file("patches/unapplied/server")
|
||||
applyTaskName = "applyServerPatches"
|
||||
patchedDir = "Paper-Server"
|
||||
}
|
||||
}
|
||||
|
||||
@UntrackedTask(because = "Does not make sense to track state")
|
||||
abstract class RebasePatches : BaseTask() {
|
||||
@get:Internal
|
||||
abstract val projectDir: DirectoryProperty
|
||||
|
||||
@get:InputFiles
|
||||
abstract val appliedPatches: DirectoryProperty
|
||||
|
||||
@get:InputFiles
|
||||
abstract val unappliedPatches: DirectoryProperty
|
||||
|
||||
@get:Input
|
||||
abstract val applyTaskName: Property<String>
|
||||
|
||||
@get:Input
|
||||
abstract val patchedDir: Property<String>
|
||||
|
||||
private fun unapplied(): List<Path> =
|
||||
unappliedPatches.path.listDirectoryEntries("*.patch").sortedBy { it.name }
|
||||
|
||||
private fun appliedLoc(patch: Path): Path = appliedPatches.path.resolve(unappliedPatches.path.relativize(patch))
|
||||
|
||||
companion object {
|
||||
val regex = Pattern.compile("Patch failed at ([0-9]{4}) (.*)")
|
||||
val continuationRegex = Pattern.compile("^\\s{1}.+\$")
|
||||
const val subjectPrefix = "Subject: [PATCH] "
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
fun run() {
|
||||
val patchedDirPath = projectDir.path.resolve(patchedDir.get())
|
||||
if (patchedDirPath.isDirectory()) {
|
||||
val status = Git(patchedDirPath)("status").getText()
|
||||
if (status.contains("You are in the middle of an am session.")) {
|
||||
throw PaperweightException("Cannot continue update when $patchedDirPath is in the middle of an am session.")
|
||||
}
|
||||
}
|
||||
|
||||
val unapplied = unapplied()
|
||||
for (patch in unapplied) {
|
||||
patch.copyTo(appliedLoc(patch))
|
||||
}
|
||||
|
||||
val out = ByteArrayOutputStream()
|
||||
val proc = ProcessBuilder()
|
||||
.directory(projectDir.path)
|
||||
.command("./gradlew", applyTaskName.get())
|
||||
.redirectErrorStream(true)
|
||||
.start()
|
||||
|
||||
val f = redirect(proc.inputStream, out)
|
||||
|
||||
val exit = proc.waitFor()
|
||||
f.get()
|
||||
|
||||
if (exit != 0) {
|
||||
val outStr = String(out.toByteArray())
|
||||
val matcher = regex.matcher(outStr)
|
||||
if (!matcher.find()) error("Could not determine failure point")
|
||||
val failedSubjectFragment = matcher.group(2)
|
||||
val failed = unapplied.single { p ->
|
||||
p.useLines { lines ->
|
||||
val collect = mutableListOf<String>()
|
||||
for (line in lines) {
|
||||
if (line.startsWith(subjectPrefix)) {
|
||||
collect += line
|
||||
} else if (collect.size == 1) {
|
||||
if (continuationRegex.matcher(line).matches()) {
|
||||
collect += line
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
val subjectLine = collect.joinToString("").substringAfter(subjectPrefix)
|
||||
subjectLine.startsWith(failedSubjectFragment)
|
||||
}
|
||||
}
|
||||
|
||||
// delete successful & failure point from unapplied patches dir
|
||||
for (path in unapplied) {
|
||||
path.deleteIfExists()
|
||||
if (path == failed) {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// delete failed from patches dir
|
||||
var started = false
|
||||
for (path in unapplied) {
|
||||
if (path == failed) {
|
||||
started = true
|
||||
continue
|
||||
}
|
||||
if (started) {
|
||||
appliedLoc(path).deleteIfExists()
|
||||
}
|
||||
}
|
||||
|
||||
// Delete the build file before resetting the AM session in case it has compilation errors
|
||||
patchedDirPath.resolve("build.gradle.kts").deleteIfExists()
|
||||
// Apply again to reset the am session (so it ends on the failed patch, to allow us to rebuild after fixing it)
|
||||
val apply2 = ProcessBuilder()
|
||||
.directory(projectDir.path)
|
||||
.command("./gradlew", applyTaskName.get())
|
||||
.redirectErrorStream(true)
|
||||
.start()
|
||||
|
||||
val f1 = redirect(apply2.inputStream, System.out)
|
||||
apply2.waitFor()
|
||||
f1.get()
|
||||
|
||||
logger.lifecycle(outStr)
|
||||
logger.lifecycle("Patch failed at $failed; See Git output above.")
|
||||
} else {
|
||||
unapplied.forEach { it.deleteIfExists() }
|
||||
logger.lifecycle("All patches applied!")
|
||||
}
|
||||
|
||||
val git = Git(projectDir.path)
|
||||
git("add", appliedPatches.path.toString() + "/*").runSilently()
|
||||
git("add", unappliedPatches.path.toString() + "/*").runSilently()
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
group=io.papermc.paper
|
||||
version=1.19.3-R0.1-SNAPSHOT
|
||||
mcVersion=1.19.3
|
||||
version=1.21.1-R0.1-SNAPSHOT
|
||||
mcVersion=1.21.1
|
||||
|
||||
# Set to true while updating Minecraft version
|
||||
updatingMinecraft=false
|
||||
|
||||
org.gradle.caching=true
|
||||
org.gradle.parallel=true
|
||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binäre Datei nicht angezeigt.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
31
gradlew
vendored
31
gradlew
vendored
@ -55,7 +55,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@ -83,10 +83,8 @@ done
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@ -133,10 +131,13 @@ location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
|
20
gradlew.bat
vendored
20
gradlew.bat
vendored
@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
|
35
paper-api-generator/build.gradle.kts
Normale Datei
35
paper-api-generator/build.gradle.kts
Normale Datei
@ -0,0 +1,35 @@
|
||||
import io.papermc.paperweight.PaperweightSourceGeneratorHelper
|
||||
import io.papermc.paperweight.extension.PaperweightSourceGeneratorExt
|
||||
|
||||
plugins {
|
||||
java
|
||||
}
|
||||
|
||||
plugins.apply(PaperweightSourceGeneratorHelper::class)
|
||||
|
||||
extensions.configure(PaperweightSourceGeneratorExt::class) {
|
||||
atFile.set(projectDir.toPath().resolve("wideners.at").toFile())
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("com.squareup:javapoet:1.13.0")
|
||||
implementation(project(":paper-api"))
|
||||
implementation("io.github.classgraph:classgraph:4.8.47")
|
||||
implementation("org.jetbrains:annotations:24.0.1")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
|
||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
||||
}
|
||||
|
||||
tasks.register<JavaExec>("generate") {
|
||||
dependsOn(tasks.check)
|
||||
mainClass.set("io.papermc.generator.Main")
|
||||
classpath(sourceSets.main.map { it.runtimeClasspath })
|
||||
args(projectDir.toPath().resolve("generated").toString())
|
||||
}
|
||||
|
||||
tasks.test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
group = "io.papermc.paper"
|
||||
version = "1.0-SNAPSHOT"
|
@ -0,0 +1,443 @@
|
||||
package com.destroystokyo.paper.entity.ai;
|
||||
|
||||
import com.destroystokyo.paper.entity.RangedEntity;
|
||||
import io.papermc.paper.entity.SchoolableFish;
|
||||
import io.papermc.paper.generated.GeneratedFrom;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.entity.AbstractHorse;
|
||||
import org.bukkit.entity.AbstractSkeleton;
|
||||
import org.bukkit.entity.AbstractVillager;
|
||||
import org.bukkit.entity.Animals;
|
||||
import org.bukkit.entity.Bee;
|
||||
import org.bukkit.entity.Blaze;
|
||||
import org.bukkit.entity.Cat;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.Creeper;
|
||||
import org.bukkit.entity.Dolphin;
|
||||
import org.bukkit.entity.Drowned;
|
||||
import org.bukkit.entity.Enderman;
|
||||
import org.bukkit.entity.Evoker;
|
||||
import org.bukkit.entity.Fish;
|
||||
import org.bukkit.entity.Fox;
|
||||
import org.bukkit.entity.Ghast;
|
||||
import org.bukkit.entity.Guardian;
|
||||
import org.bukkit.entity.Illager;
|
||||
import org.bukkit.entity.Illusioner;
|
||||
import org.bukkit.entity.IronGolem;
|
||||
import org.bukkit.entity.Llama;
|
||||
import org.bukkit.entity.Mob;
|
||||
import org.bukkit.entity.Monster;
|
||||
import org.bukkit.entity.Ocelot;
|
||||
import org.bukkit.entity.Panda;
|
||||
import org.bukkit.entity.Parrot;
|
||||
import org.bukkit.entity.Phantom;
|
||||
import org.bukkit.entity.PolarBear;
|
||||
import org.bukkit.entity.PufferFish;
|
||||
import org.bukkit.entity.Rabbit;
|
||||
import org.bukkit.entity.Raider;
|
||||
import org.bukkit.entity.Shulker;
|
||||
import org.bukkit.entity.Silverfish;
|
||||
import org.bukkit.entity.SkeletonHorse;
|
||||
import org.bukkit.entity.Slime;
|
||||
import org.bukkit.entity.Spellcaster;
|
||||
import org.bukkit.entity.Spider;
|
||||
import org.bukkit.entity.Squid;
|
||||
import org.bukkit.entity.Strider;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.entity.Turtle;
|
||||
import org.bukkit.entity.Vex;
|
||||
import org.bukkit.entity.Vindicator;
|
||||
import org.bukkit.entity.WanderingTrader;
|
||||
import org.bukkit.entity.Wither;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.bukkit.entity.Zombie;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* Vanilla keys for Mob Goals.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
* changed (including removals) on any Minecraft version
|
||||
* bump, so cross-version compatibility is not provided on the
|
||||
* same level as it is on most of the other API.
|
||||
*/
|
||||
@SuppressWarnings({
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
public interface VanillaGoal<T extends Mob> extends Goal<T> {
|
||||
GoalKey<AbstractHorse> RANDOM_STAND = create("random_stand", AbstractHorse.class);
|
||||
|
||||
GoalKey<AbstractHorse> RUN_AROUND_LIKE_CRAZY = create("run_around_like_crazy", AbstractHorse.class);
|
||||
|
||||
GoalKey<AbstractSkeleton> ABSTRACT_SKELETON_MELEE = create("abstract_skeleton_melee", AbstractSkeleton.class);
|
||||
|
||||
GoalKey<AbstractVillager> LOOK_AT_TRADING_PLAYER = create("look_at_trading_player", AbstractVillager.class);
|
||||
|
||||
GoalKey<AbstractVillager> TRADE_WITH_PLAYER = create("trade_with_player", AbstractVillager.class);
|
||||
|
||||
GoalKey<Animals> BREED = create("breed", Animals.class);
|
||||
|
||||
GoalKey<Animals> FOLLOW_PARENT = create("follow_parent", Animals.class);
|
||||
|
||||
GoalKey<Bee> BEE_ATTACK = create("bee_attack", Bee.class);
|
||||
|
||||
GoalKey<Bee> BEE_BECOME_ANGRY = create("bee_become_angry", Bee.class);
|
||||
|
||||
GoalKey<Bee> BEE_ENTER_HIVE = create("bee_enter_hive", Bee.class);
|
||||
|
||||
GoalKey<Bee> BEE_GO_TO_HIVE = create("bee_go_to_hive", Bee.class);
|
||||
|
||||
GoalKey<Bee> BEE_GO_TO_KNOWN_FLOWER = create("bee_go_to_known_flower", Bee.class);
|
||||
|
||||
GoalKey<Bee> BEE_GROW_CROP = create("bee_grow_crop", Bee.class);
|
||||
|
||||
GoalKey<Bee> BEE_HURT_BY_OTHER = create("bee_hurt_by_other", Bee.class);
|
||||
|
||||
GoalKey<Bee> BEE_LOCATE_HIVE = create("bee_locate_hive", Bee.class);
|
||||
|
||||
GoalKey<Bee> BEE_POLLINATE = create("bee_pollinate", Bee.class);
|
||||
|
||||
GoalKey<Bee> BEE_WANDER = create("bee_wander", Bee.class);
|
||||
|
||||
GoalKey<Blaze> BLAZE_ATTACK = create("blaze_attack", Blaze.class);
|
||||
|
||||
GoalKey<Cat> CAT_AVOID_ENTITY = create("cat_avoid_entity", Cat.class);
|
||||
|
||||
GoalKey<Cat> CAT_LIE_ON_BED = create("cat_lie_on_bed", Cat.class);
|
||||
|
||||
GoalKey<Cat> CAT_RELAX_ON_OWNER = create("cat_relax_on_owner", Cat.class);
|
||||
|
||||
GoalKey<Cat> CAT_SIT_ON_BLOCK = create("cat_sit_on_block", Cat.class);
|
||||
|
||||
GoalKey<Cat> CAT_TEMPT = create("cat_tempt", Cat.class);
|
||||
|
||||
GoalKey<Creature> AVOID_ENTITY = create("avoid_entity", Creature.class);
|
||||
|
||||
GoalKey<Creature> BREATH_AIR = create("breath_air", Creature.class);
|
||||
|
||||
GoalKey<Creature> DROWNED_GO_TO_WATER = create("drowned_go_to_water", Creature.class);
|
||||
|
||||
GoalKey<Creature> FLEE_SUN = create("flee_sun", Creature.class);
|
||||
|
||||
GoalKey<Creature> FOLLOW_BOAT = create("follow_boat", Creature.class);
|
||||
|
||||
GoalKey<Creature> GOLEM_RANDOM_STROLL_IN_VILLAGE = create("golem_random_stroll_in_village", Creature.class);
|
||||
|
||||
GoalKey<Creature> HURT_BY = create("hurt_by", Creature.class);
|
||||
|
||||
GoalKey<Creature> MELEE_ATTACK = create("melee_attack", Creature.class);
|
||||
|
||||
GoalKey<Creature> MOVE_BACK_TO_VILLAGE = create("move_back_to_village", Creature.class);
|
||||
|
||||
GoalKey<Creature> MOVE_THROUGH_VILLAGE = create("move_through_village", Creature.class);
|
||||
|
||||
GoalKey<Creature> MOVE_TOWARDS = create("move_towards", Creature.class);
|
||||
|
||||
GoalKey<Creature> MOVE_TOWARDS_RESTRICTION = create("move_towards_restriction", Creature.class);
|
||||
|
||||
GoalKey<Creature> PANIC = create("panic", Creature.class);
|
||||
|
||||
GoalKey<Creature> PARROT_WANDER = create("parrot_wander", Creature.class);
|
||||
|
||||
GoalKey<Creature> RANDOM_STROLL = create("random_stroll", Creature.class);
|
||||
|
||||
GoalKey<Creature> RANDOM_SWIMMING = create("random_swimming", Creature.class);
|
||||
|
||||
GoalKey<Creature> REMOVE_BLOCK = create("remove_block", Creature.class);
|
||||
|
||||
GoalKey<Creature> RESTRICT_SUN = create("restrict_sun", Creature.class);
|
||||
|
||||
GoalKey<Creature> STROLL_THROUGH_VILLAGE = create("stroll_through_village", Creature.class);
|
||||
|
||||
GoalKey<Creature> TEMPT = create("tempt", Creature.class);
|
||||
|
||||
GoalKey<Creature> TRY_FIND_WATER = create("try_find_water", Creature.class);
|
||||
|
||||
GoalKey<Creature> WATER_AVOIDING_RANDOM_FLYING = create("water_avoiding_random_flying", Creature.class);
|
||||
|
||||
GoalKey<Creature> WATER_AVOIDING_RANDOM_STROLL = create("water_avoiding_random_stroll", Creature.class);
|
||||
|
||||
GoalKey<Creeper> SWELL = create("swell", Creeper.class);
|
||||
|
||||
GoalKey<Dolphin> DOLPHIN_JUMP = create("dolphin_jump", Dolphin.class);
|
||||
|
||||
GoalKey<Dolphin> DOLPHIN_SWIM_TO_TREASURE = create("dolphin_swim_to_treasure", Dolphin.class);
|
||||
|
||||
GoalKey<Dolphin> DOLPHIN_SWIM_WITH_PLAYER = create("dolphin_swim_with_player", Dolphin.class);
|
||||
|
||||
GoalKey<Dolphin> PLAY_WITH_ITEMS = create("play_with_items", Dolphin.class);
|
||||
|
||||
GoalKey<Drowned> DROWNED_ATTACK = create("drowned_attack", Drowned.class);
|
||||
|
||||
GoalKey<Drowned> DROWNED_GO_TO_BEACH = create("drowned_go_to_beach", Drowned.class);
|
||||
|
||||
GoalKey<Drowned> DROWNED_SWIM_UP = create("drowned_swim_up", Drowned.class);
|
||||
|
||||
GoalKey<Enderman> ENDERMAN_FREEZE_WHEN_LOOKED_AT = create("enderman_freeze_when_looked_at", Enderman.class);
|
||||
|
||||
GoalKey<Enderman> ENDERMAN_LEAVE_BLOCK = create("enderman_leave_block", Enderman.class);
|
||||
|
||||
GoalKey<Enderman> ENDERMAN_LOOK_FOR_PLAYER = create("enderman_look_for_player", Enderman.class);
|
||||
|
||||
GoalKey<Enderman> ENDERMAN_TAKE_BLOCK = create("enderman_take_block", Enderman.class);
|
||||
|
||||
GoalKey<Evoker> EVOKER_ATTACK_SPELL = create("evoker_attack_spell", Evoker.class);
|
||||
|
||||
GoalKey<Evoker> EVOKER_CASTING_SPELL = create("evoker_casting_spell", Evoker.class);
|
||||
|
||||
GoalKey<Evoker> EVOKER_SUMMON_SPELL = create("evoker_summon_spell", Evoker.class);
|
||||
|
||||
GoalKey<Evoker> EVOKER_WOLOLO_SPELL = create("evoker_wololo_spell", Evoker.class);
|
||||
|
||||
GoalKey<Fish> FISH_SWIM = create("fish_swim", Fish.class);
|
||||
|
||||
GoalKey<Fox> DEFEND_TRUSTED = create("defend_trusted", Fox.class);
|
||||
|
||||
GoalKey<Fox> FACEPLANT = create("faceplant", Fox.class);
|
||||
|
||||
GoalKey<Fox> FOX_BREED = create("fox_breed", Fox.class);
|
||||
|
||||
GoalKey<Fox> FOX_EAT_BERRIES = create("fox_eat_berries", Fox.class);
|
||||
|
||||
GoalKey<Fox> FOX_FLOAT = create("fox_float", Fox.class);
|
||||
|
||||
GoalKey<Fox> FOX_FOLLOW_PARENT = create("fox_follow_parent", Fox.class);
|
||||
|
||||
GoalKey<Fox> FOX_LOOK_AT_PLAYER = create("fox_look_at_player", Fox.class);
|
||||
|
||||
GoalKey<Fox> FOX_MELEE_ATTACK = create("fox_melee_attack", Fox.class);
|
||||
|
||||
GoalKey<Fox> FOX_PANIC = create("fox_panic", Fox.class);
|
||||
|
||||
GoalKey<Fox> FOX_POUNCE = create("fox_pounce", Fox.class);
|
||||
|
||||
GoalKey<Fox> FOX_SEARCH_FOR_ITEMS = create("fox_search_for_items", Fox.class);
|
||||
|
||||
GoalKey<Fox> FOX_STROLL_THROUGH_VILLAGE = create("fox_stroll_through_village", Fox.class);
|
||||
|
||||
GoalKey<Fox> PERCH_AND_SEARCH = create("perch_and_search", Fox.class);
|
||||
|
||||
GoalKey<Fox> SEEK_SHELTER = create("seek_shelter", Fox.class);
|
||||
|
||||
GoalKey<Fox> SLEEP = create("sleep", Fox.class);
|
||||
|
||||
GoalKey<Fox> STALK_PREY = create("stalk_prey", Fox.class);
|
||||
|
||||
GoalKey<Ghast> GHAST_LOOK = create("ghast_look", Ghast.class);
|
||||
|
||||
GoalKey<Ghast> GHAST_SHOOT_FIREBALL = create("ghast_shoot_fireball", Ghast.class);
|
||||
|
||||
GoalKey<Ghast> RANDOM_FLOAT_AROUND = create("random_float_around", Ghast.class);
|
||||
|
||||
GoalKey<Guardian> GUARDIAN_ATTACK = create("guardian_attack", Guardian.class);
|
||||
|
||||
GoalKey<Illager> RAIDER_OPEN_DOOR = create("raider_open_door", Illager.class);
|
||||
|
||||
GoalKey<Illusioner> ILLUSIONER_BLINDNESS_SPELL = create("illusioner_blindness_spell", Illusioner.class);
|
||||
|
||||
GoalKey<Illusioner> ILLUSIONER_MIRROR_SPELL = create("illusioner_mirror_spell", Illusioner.class);
|
||||
|
||||
GoalKey<IronGolem> DEFEND_VILLAGE = create("defend_village", IronGolem.class);
|
||||
|
||||
GoalKey<IronGolem> OFFER_FLOWER = create("offer_flower", IronGolem.class);
|
||||
|
||||
GoalKey<Llama> LLAMA_ATTACK_WOLF = create("llama_attack_wolf", Llama.class);
|
||||
|
||||
GoalKey<Llama> LLAMA_FOLLOW_CARAVAN = create("llama_follow_caravan", Llama.class);
|
||||
|
||||
GoalKey<Llama> LLAMA_HURT_BY = create("llama_hurt_by", Llama.class);
|
||||
|
||||
GoalKey<Llama> TRADER_LLAMA_DEFEND_WANDERING_TRADER = create("trader_llama_defend_wandering_trader", Llama.class);
|
||||
|
||||
GoalKey<Mob> BREAK_DOOR = create("break_door", Mob.class);
|
||||
|
||||
GoalKey<Mob> CLIMB_ON_TOP_OF_POWDER_SNOW = create("climb_on_top_of_powder_snow", Mob.class);
|
||||
|
||||
GoalKey<Mob> EAT_BLOCK = create("eat_block", Mob.class);
|
||||
|
||||
GoalKey<Mob> FLOAT = create("float", Mob.class);
|
||||
|
||||
GoalKey<Mob> FOLLOW_MOB = create("follow_mob", Mob.class);
|
||||
|
||||
GoalKey<Mob> INTERACT = create("interact", Mob.class);
|
||||
|
||||
GoalKey<Mob> LEAP_AT = create("leap_at", Mob.class);
|
||||
|
||||
GoalKey<Mob> LOOK_AT_PLAYER = create("look_at_player", Mob.class);
|
||||
|
||||
GoalKey<Mob> NEAREST_ATTACKABLE = create("nearest_attackable", Mob.class);
|
||||
|
||||
GoalKey<Mob> OCELOT_ATTACK = create("ocelot_attack", Mob.class);
|
||||
|
||||
GoalKey<Mob> OPEN_DOOR = create("open_door", Mob.class);
|
||||
|
||||
GoalKey<Mob> RANDOM_LOOK_AROUND = create("random_look_around", Mob.class);
|
||||
|
||||
GoalKey<Mob> RESET_UNIVERSAL_ANGER = create("reset_universal_anger", Mob.class);
|
||||
|
||||
GoalKey<Mob> USE_ITEM = create("use_item", Mob.class);
|
||||
|
||||
GoalKey<Mob> VINDICATOR_BREAK_DOOR = create("vindicator_break_door", Mob.class);
|
||||
|
||||
GoalKey<Monster> RANGED_BOW_ATTACK = create("ranged_bow_attack", Monster.class);
|
||||
|
||||
GoalKey<Monster> RANGED_CROSSBOW_ATTACK = create("ranged_crossbow_attack", Monster.class);
|
||||
|
||||
GoalKey<Ocelot> OCELOT_AVOID_ENTITY = create("ocelot_avoid_entity", Ocelot.class);
|
||||
|
||||
GoalKey<Ocelot> OCELOT_TEMPT = create("ocelot_tempt", Ocelot.class);
|
||||
|
||||
GoalKey<Panda> PANDA_ATTACK = create("panda_attack", Panda.class);
|
||||
|
||||
GoalKey<Panda> PANDA_AVOID = create("panda_avoid", Panda.class);
|
||||
|
||||
GoalKey<Panda> PANDA_BREED = create("panda_breed", Panda.class);
|
||||
|
||||
GoalKey<Panda> PANDA_HURT_BY = create("panda_hurt_by", Panda.class);
|
||||
|
||||
GoalKey<Panda> PANDA_LIE_ON_BACK = create("panda_lie_on_back", Panda.class);
|
||||
|
||||
GoalKey<Panda> PANDA_LOOK_AT_PLAYER = create("panda_look_at_player", Panda.class);
|
||||
|
||||
GoalKey<Panda> PANDA_PANIC = create("panda_panic", Panda.class);
|
||||
|
||||
GoalKey<Panda> PANDA_ROLL = create("panda_roll", Panda.class);
|
||||
|
||||
GoalKey<Panda> PANDA_SIT = create("panda_sit", Panda.class);
|
||||
|
||||
GoalKey<Panda> PANDA_SNEEZE = create("panda_sneeze", Panda.class);
|
||||
|
||||
GoalKey<Parrot> LAND_ON_OWNERS_SHOULDER = create("land_on_owners_shoulder", Parrot.class);
|
||||
|
||||
GoalKey<Phantom> PHANTOM_ATTACK_PLAYER = create("phantom_attack_player", Phantom.class);
|
||||
|
||||
GoalKey<Phantom> PHANTOM_ATTACK_STRATEGY = create("phantom_attack_strategy", Phantom.class);
|
||||
|
||||
GoalKey<Phantom> PHANTOM_CIRCLE_AROUND_ANCHOR = create("phantom_circle_around_anchor", Phantom.class);
|
||||
|
||||
GoalKey<Phantom> PHANTOM_SWEEP_ATTACK = create("phantom_sweep_attack", Phantom.class);
|
||||
|
||||
GoalKey<PolarBear> POLAR_BEAR_ATTACK_PLAYERS = create("polar_bear_attack_players", PolarBear.class);
|
||||
|
||||
GoalKey<PolarBear> POLAR_BEAR_HURT_BY = create("polar_bear_hurt_by", PolarBear.class);
|
||||
|
||||
GoalKey<PolarBear> POLAR_BEAR_MELEE_ATTACK = create("polar_bear_melee_attack", PolarBear.class);
|
||||
|
||||
GoalKey<PufferFish> PUFFERFISH_PUFF = create("pufferfish_puff", PufferFish.class);
|
||||
|
||||
GoalKey<Rabbit> RABBIT_AVOID_ENTITY = create("rabbit_avoid_entity", Rabbit.class);
|
||||
|
||||
GoalKey<Rabbit> RABBIT_PANIC = create("rabbit_panic", Rabbit.class);
|
||||
|
||||
GoalKey<Rabbit> RAID_GARDEN = create("raid_garden", Rabbit.class);
|
||||
|
||||
GoalKey<Raider> HOLD_GROUND_ATTACK = create("hold_ground_attack", Raider.class);
|
||||
|
||||
GoalKey<Raider> LONG_DISTANCE_PATROL = create("long_distance_patrol", Raider.class);
|
||||
|
||||
GoalKey<Raider> NEAREST_ATTACKABLE_WITCH = create("nearest_attackable_witch", Raider.class);
|
||||
|
||||
GoalKey<Raider> NEAREST_HEALABLE_RAIDER = create("nearest_healable_raider", Raider.class);
|
||||
|
||||
GoalKey<Raider> OBTAIN_RAID_LEADER_BANNER = create("obtain_raid_leader_banner", Raider.class);
|
||||
|
||||
GoalKey<Raider> PATHFIND_TO_RAID = create("pathfind_to_raid", Raider.class);
|
||||
|
||||
GoalKey<Raider> RAIDER_CELEBRATION = create("raider_celebration", Raider.class);
|
||||
|
||||
GoalKey<Raider> RAIDER_MOVE_THROUGH_VILLAGE = create("raider_move_through_village", Raider.class);
|
||||
|
||||
GoalKey<RangedEntity> DROWNED_TRIDENT_ATTACK = create("drowned_trident_attack", RangedEntity.class);
|
||||
|
||||
GoalKey<RangedEntity> RANGED_ATTACK = create("ranged_attack", RangedEntity.class);
|
||||
|
||||
GoalKey<SchoolableFish> FOLLOW_FLOCK_LEADER = create("follow_flock_leader", SchoolableFish.class);
|
||||
|
||||
GoalKey<Shulker> SHULKER_ATTACK = create("shulker_attack", Shulker.class);
|
||||
|
||||
GoalKey<Shulker> SHULKER_DEFENSE_ATTACK = create("shulker_defense_attack", Shulker.class);
|
||||
|
||||
GoalKey<Shulker> SHULKER_NEAREST_ATTACK = create("shulker_nearest_attack", Shulker.class);
|
||||
|
||||
GoalKey<Shulker> SHULKER_PEEK = create("shulker_peek", Shulker.class);
|
||||
|
||||
GoalKey<Silverfish> SILVERFISH_MERGE_WITH_STONE = create("silverfish_merge_with_stone", Silverfish.class);
|
||||
|
||||
GoalKey<Silverfish> SILVERFISH_WAKE_UP_FRIENDS = create("silverfish_wake_up_friends", Silverfish.class);
|
||||
|
||||
GoalKey<SkeletonHorse> SKELETON_TRAP = create("skeleton_trap", SkeletonHorse.class);
|
||||
|
||||
GoalKey<Slime> SLIME_ATTACK = create("slime_attack", Slime.class);
|
||||
|
||||
GoalKey<Slime> SLIME_FLOAT = create("slime_float", Slime.class);
|
||||
|
||||
GoalKey<Slime> SLIME_KEEP_ON_JUMPING = create("slime_keep_on_jumping", Slime.class);
|
||||
|
||||
GoalKey<Slime> SLIME_RANDOM_DIRECTION = create("slime_random_direction", Slime.class);
|
||||
|
||||
GoalKey<Spellcaster> SPELLCASTER_CASTING_SPELL = create("spellcaster_casting_spell", Spellcaster.class);
|
||||
|
||||
GoalKey<Spider> SPIDER = create("spider", Spider.class);
|
||||
|
||||
GoalKey<Spider> SPIDER_ATTACK = create("spider_attack", Spider.class);
|
||||
|
||||
GoalKey<Squid> SQUID_FLEE = create("squid_flee", Squid.class);
|
||||
|
||||
GoalKey<Squid> SQUID_RANDOM_MOVEMENT = create("squid_random_movement", Squid.class);
|
||||
|
||||
GoalKey<Strider> STRIDER_GO_TO_LAVA = create("strider_go_to_lava", Strider.class);
|
||||
|
||||
GoalKey<Tameable> FOLLOW_OWNER = create("follow_owner", Tameable.class);
|
||||
|
||||
GoalKey<Tameable> NON_TAME_RANDOM = create("non_tame_random", Tameable.class);
|
||||
|
||||
GoalKey<Tameable> OWNER_HURT = create("owner_hurt", Tameable.class);
|
||||
|
||||
GoalKey<Tameable> OWNER_HURT_BY = create("owner_hurt_by", Tameable.class);
|
||||
|
||||
GoalKey<Tameable> SIT_WHEN_ORDERED_TO = create("sit_when_ordered_to", Tameable.class);
|
||||
|
||||
GoalKey<Tameable> TAMABLE_ANIMAL_PANIC = create("tamable_animal_panic", Tameable.class);
|
||||
|
||||
GoalKey<Turtle> TURTLE_BREED = create("turtle_breed", Turtle.class);
|
||||
|
||||
GoalKey<Turtle> TURTLE_GO_HOME = create("turtle_go_home", Turtle.class);
|
||||
|
||||
GoalKey<Turtle> TURTLE_GO_TO_WATER = create("turtle_go_to_water", Turtle.class);
|
||||
|
||||
GoalKey<Turtle> TURTLE_LAY_EGG = create("turtle_lay_egg", Turtle.class);
|
||||
|
||||
GoalKey<Turtle> TURTLE_PANIC = create("turtle_panic", Turtle.class);
|
||||
|
||||
GoalKey<Turtle> TURTLE_RANDOM_STROLL = create("turtle_random_stroll", Turtle.class);
|
||||
|
||||
GoalKey<Turtle> TURTLE_TRAVEL = create("turtle_travel", Turtle.class);
|
||||
|
||||
GoalKey<Vex> VEX_CHARGE_ATTACK = create("vex_charge_attack", Vex.class);
|
||||
|
||||
GoalKey<Vex> VEX_COPY_OWNER = create("vex_copy_owner", Vex.class);
|
||||
|
||||
GoalKey<Vex> VEX_RANDOM_MOVE = create("vex_random_move", Vex.class);
|
||||
|
||||
GoalKey<Vindicator> VINDICATOR_JOHNNY_ATTACK = create("vindicator_johnny_attack", Vindicator.class);
|
||||
|
||||
GoalKey<WanderingTrader> WANDER_TO_POSITION = create("wander_to_position", WanderingTrader.class);
|
||||
|
||||
GoalKey<Wither> WITHER_DO_NOTHING = create("wither_do_nothing", Wither.class);
|
||||
|
||||
GoalKey<Wolf> BEG = create("beg", Wolf.class);
|
||||
|
||||
GoalKey<Wolf> WOLF_AVOID_ENTITY = create("wolf_avoid_entity", Wolf.class);
|
||||
|
||||
GoalKey<Zombie> ZOMBIE_ATTACK = create("zombie_attack", Zombie.class);
|
||||
|
||||
GoalKey<Zombie> ZOMBIE_ATTACK_TURTLE_EGG = create("zombie_attack_turtle_egg", Zombie.class);
|
||||
|
||||
private static <T extends Mob> @NonNull GoalKey<T> create(final @NonNull String key,
|
||||
final @NonNull Class<T> type) {
|
||||
return GoalKey.of(type, NamespacedKey.minecraft(key));
|
||||
}
|
||||
}
|
@ -0,0 +1,490 @@
|
||||
package io.papermc.paper.registry.keys;
|
||||
|
||||
import static net.kyori.adventure.key.Key.key;
|
||||
|
||||
import io.papermc.paper.generated.GeneratedFrom;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#BIOME}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
* changed (including removals) on any Minecraft version
|
||||
* bump, so cross-version compatibility is not provided on the
|
||||
* same level as it is on most of the other API.
|
||||
*/
|
||||
@SuppressWarnings({
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@ApiStatus.Experimental
|
||||
public final class BiomeKeys {
|
||||
/**
|
||||
* {@code minecraft:badlands}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> BADLANDS = create(key("badlands"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:bamboo_jungle}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> BAMBOO_JUNGLE = create(key("bamboo_jungle"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:basalt_deltas}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> BASALT_DELTAS = create(key("basalt_deltas"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:beach}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> BEACH = create(key("beach"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:birch_forest}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> BIRCH_FOREST = create(key("birch_forest"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:cherry_grove}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> CHERRY_GROVE = create(key("cherry_grove"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:cold_ocean}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> COLD_OCEAN = create(key("cold_ocean"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:crimson_forest}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> CRIMSON_FOREST = create(key("crimson_forest"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:dark_forest}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> DARK_FOREST = create(key("dark_forest"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:deep_cold_ocean}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> DEEP_COLD_OCEAN = create(key("deep_cold_ocean"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:deep_dark}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> DEEP_DARK = create(key("deep_dark"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:deep_frozen_ocean}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> DEEP_FROZEN_OCEAN = create(key("deep_frozen_ocean"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:deep_lukewarm_ocean}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> DEEP_LUKEWARM_OCEAN = create(key("deep_lukewarm_ocean"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:deep_ocean}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> DEEP_OCEAN = create(key("deep_ocean"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:desert}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> DESERT = create(key("desert"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:dripstone_caves}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> DRIPSTONE_CAVES = create(key("dripstone_caves"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:end_barrens}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> END_BARRENS = create(key("end_barrens"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:end_highlands}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> END_HIGHLANDS = create(key("end_highlands"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:end_midlands}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> END_MIDLANDS = create(key("end_midlands"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:eroded_badlands}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> ERODED_BADLANDS = create(key("eroded_badlands"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:flower_forest}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> FLOWER_FOREST = create(key("flower_forest"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:forest}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> FOREST = create(key("forest"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:frozen_ocean}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> FROZEN_OCEAN = create(key("frozen_ocean"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:frozen_peaks}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> FROZEN_PEAKS = create(key("frozen_peaks"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:frozen_river}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> FROZEN_RIVER = create(key("frozen_river"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:grove}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> GROVE = create(key("grove"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:ice_spikes}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> ICE_SPIKES = create(key("ice_spikes"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:jagged_peaks}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> JAGGED_PEAKS = create(key("jagged_peaks"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:jungle}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> JUNGLE = create(key("jungle"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:lukewarm_ocean}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> LUKEWARM_OCEAN = create(key("lukewarm_ocean"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:lush_caves}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> LUSH_CAVES = create(key("lush_caves"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:mangrove_swamp}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> MANGROVE_SWAMP = create(key("mangrove_swamp"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:meadow}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> MEADOW = create(key("meadow"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:mushroom_fields}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> MUSHROOM_FIELDS = create(key("mushroom_fields"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:nether_wastes}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> NETHER_WASTES = create(key("nether_wastes"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:ocean}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> OCEAN = create(key("ocean"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:old_growth_birch_forest}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> OLD_GROWTH_BIRCH_FOREST = create(key("old_growth_birch_forest"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:old_growth_pine_taiga}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> OLD_GROWTH_PINE_TAIGA = create(key("old_growth_pine_taiga"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:old_growth_spruce_taiga}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> OLD_GROWTH_SPRUCE_TAIGA = create(key("old_growth_spruce_taiga"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:plains}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> PLAINS = create(key("plains"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:river}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> RIVER = create(key("river"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:savanna}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> SAVANNA = create(key("savanna"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:savanna_plateau}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> SAVANNA_PLATEAU = create(key("savanna_plateau"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:small_end_islands}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> SMALL_END_ISLANDS = create(key("small_end_islands"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:snowy_beach}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> SNOWY_BEACH = create(key("snowy_beach"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:snowy_plains}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> SNOWY_PLAINS = create(key("snowy_plains"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:snowy_slopes}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> SNOWY_SLOPES = create(key("snowy_slopes"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:snowy_taiga}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> SNOWY_TAIGA = create(key("snowy_taiga"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:soul_sand_valley}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> SOUL_SAND_VALLEY = create(key("soul_sand_valley"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:sparse_jungle}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> SPARSE_JUNGLE = create(key("sparse_jungle"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:stony_peaks}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> STONY_PEAKS = create(key("stony_peaks"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:stony_shore}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> STONY_SHORE = create(key("stony_shore"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:sunflower_plains}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> SUNFLOWER_PLAINS = create(key("sunflower_plains"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:swamp}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> SWAMP = create(key("swamp"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:taiga}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> TAIGA = create(key("taiga"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:the_end}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> THE_END = create(key("the_end"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:the_void}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> THE_VOID = create(key("the_void"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:warm_ocean}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> WARM_OCEAN = create(key("warm_ocean"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:warped_forest}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> WARPED_FOREST = create(key("warped_forest"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:windswept_forest}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> WINDSWEPT_FOREST = create(key("windswept_forest"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:windswept_gravelly_hills}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> WINDSWEPT_GRAVELLY_HILLS = create(key("windswept_gravelly_hills"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:windswept_hills}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> WINDSWEPT_HILLS = create(key("windswept_hills"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:windswept_savanna}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> WINDSWEPT_SAVANNA = create(key("windswept_savanna"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:wooded_badlands}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Biome> WOODED_BADLANDS = create(key("wooded_badlands"));
|
||||
|
||||
private BiomeKeys() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a key for {@link Biome} in the registry {@code minecraft:worldgen/biome}.
|
||||
*
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static @NonNull TypedKey<Biome> create(final @NonNull Key key) {
|
||||
return TypedKey.create(RegistryKey.BIOME, key);
|
||||
}
|
||||
}
|
@ -0,0 +1,371 @@
|
||||
package io.papermc.paper.registry.keys;
|
||||
|
||||
import static net.kyori.adventure.key.Key.key;
|
||||
|
||||
import io.papermc.paper.generated.GeneratedFrom;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.damage.DamageType;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#DAMAGE_TYPE}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
* changed (including removals) on any Minecraft version
|
||||
* bump, so cross-version compatibility is not provided on the
|
||||
* same level as it is on most of the other API.
|
||||
*/
|
||||
@SuppressWarnings({
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@ApiStatus.Experimental
|
||||
public final class DamageTypeKeys {
|
||||
/**
|
||||
* {@code minecraft:arrow}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> ARROW = create(key("arrow"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:bad_respawn_point}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> BAD_RESPAWN_POINT = create(key("bad_respawn_point"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:cactus}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> CACTUS = create(key("cactus"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:campfire}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> CAMPFIRE = create(key("campfire"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:cramming}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> CRAMMING = create(key("cramming"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:dragon_breath}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> DRAGON_BREATH = create(key("dragon_breath"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:drown}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> DROWN = create(key("drown"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:dry_out}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> DRY_OUT = create(key("dry_out"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:explosion}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> EXPLOSION = create(key("explosion"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:fall}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> FALL = create(key("fall"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:falling_anvil}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> FALLING_ANVIL = create(key("falling_anvil"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:falling_block}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> FALLING_BLOCK = create(key("falling_block"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:falling_stalactite}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> FALLING_STALACTITE = create(key("falling_stalactite"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:fireball}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> FIREBALL = create(key("fireball"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:fireworks}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> FIREWORKS = create(key("fireworks"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:fly_into_wall}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> FLY_INTO_WALL = create(key("fly_into_wall"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:freeze}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> FREEZE = create(key("freeze"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:generic}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> GENERIC = create(key("generic"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:generic_kill}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> GENERIC_KILL = create(key("generic_kill"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:hot_floor}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> HOT_FLOOR = create(key("hot_floor"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:in_fire}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> IN_FIRE = create(key("in_fire"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:in_wall}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> IN_WALL = create(key("in_wall"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:indirect_magic}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> INDIRECT_MAGIC = create(key("indirect_magic"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:lava}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> LAVA = create(key("lava"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:lightning_bolt}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> LIGHTNING_BOLT = create(key("lightning_bolt"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:magic}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> MAGIC = create(key("magic"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:mob_attack}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> MOB_ATTACK = create(key("mob_attack"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:mob_attack_no_aggro}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> MOB_ATTACK_NO_AGGRO = create(key("mob_attack_no_aggro"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:mob_projectile}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> MOB_PROJECTILE = create(key("mob_projectile"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:on_fire}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> ON_FIRE = create(key("on_fire"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:out_of_world}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> OUT_OF_WORLD = create(key("out_of_world"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:outside_border}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> OUTSIDE_BORDER = create(key("outside_border"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:player_attack}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> PLAYER_ATTACK = create(key("player_attack"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:player_explosion}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> PLAYER_EXPLOSION = create(key("player_explosion"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:sonic_boom}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> SONIC_BOOM = create(key("sonic_boom"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:spit}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> SPIT = create(key("spit"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:stalagmite}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> STALAGMITE = create(key("stalagmite"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:starve}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> STARVE = create(key("starve"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:sting}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> STING = create(key("sting"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:sweet_berry_bush}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> SWEET_BERRY_BUSH = create(key("sweet_berry_bush"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:thorns}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> THORNS = create(key("thorns"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:thrown}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> THROWN = create(key("thrown"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:trident}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> TRIDENT = create(key("trident"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:unattributed_fireball}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> UNATTRIBUTED_FIREBALL = create(key("unattributed_fireball"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:wind_charge}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> WIND_CHARGE = create(key("wind_charge"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:wither}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> WITHER = create(key("wither"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:wither_skull}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<DamageType> WITHER_SKULL = create(key("wither_skull"));
|
||||
|
||||
private DamageTypeKeys() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a key for {@link DamageType} in the registry {@code minecraft:damage_type}.
|
||||
*
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static @NonNull TypedKey<DamageType> create(final @NonNull Key key) {
|
||||
return TypedKey.create(RegistryKey.DAMAGE_TYPE, key);
|
||||
}
|
||||
}
|
@ -0,0 +1,329 @@
|
||||
package io.papermc.paper.registry.keys;
|
||||
|
||||
import static net.kyori.adventure.key.Key.key;
|
||||
|
||||
import io.papermc.paper.generated.GeneratedFrom;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#ENCHANTMENT}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
* changed (including removals) on any Minecraft version
|
||||
* bump, so cross-version compatibility is not provided on the
|
||||
* same level as it is on most of the other API.
|
||||
*/
|
||||
@SuppressWarnings({
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@ApiStatus.Experimental
|
||||
public final class EnchantmentKeys {
|
||||
/**
|
||||
* {@code minecraft:aqua_affinity}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> AQUA_AFFINITY = create(key("aqua_affinity"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:bane_of_arthropods}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> BANE_OF_ARTHROPODS = create(key("bane_of_arthropods"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:binding_curse}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> BINDING_CURSE = create(key("binding_curse"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:blast_protection}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> BLAST_PROTECTION = create(key("blast_protection"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:breach}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> BREACH = create(key("breach"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:channeling}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> CHANNELING = create(key("channeling"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:density}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> DENSITY = create(key("density"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:depth_strider}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> DEPTH_STRIDER = create(key("depth_strider"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:efficiency}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> EFFICIENCY = create(key("efficiency"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:feather_falling}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> FEATHER_FALLING = create(key("feather_falling"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:fire_aspect}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> FIRE_ASPECT = create(key("fire_aspect"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:fire_protection}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> FIRE_PROTECTION = create(key("fire_protection"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:flame}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> FLAME = create(key("flame"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:fortune}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> FORTUNE = create(key("fortune"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:frost_walker}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> FROST_WALKER = create(key("frost_walker"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:impaling}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> IMPALING = create(key("impaling"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:infinity}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> INFINITY = create(key("infinity"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:knockback}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> KNOCKBACK = create(key("knockback"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:looting}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> LOOTING = create(key("looting"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:loyalty}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> LOYALTY = create(key("loyalty"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:luck_of_the_sea}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> LUCK_OF_THE_SEA = create(key("luck_of_the_sea"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:lure}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> LURE = create(key("lure"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:mending}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> MENDING = create(key("mending"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:multishot}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> MULTISHOT = create(key("multishot"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:piercing}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> PIERCING = create(key("piercing"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:power}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> POWER = create(key("power"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:projectile_protection}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> PROJECTILE_PROTECTION = create(key("projectile_protection"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:protection}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> PROTECTION = create(key("protection"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:punch}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> PUNCH = create(key("punch"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:quick_charge}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> QUICK_CHARGE = create(key("quick_charge"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:respiration}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> RESPIRATION = create(key("respiration"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:riptide}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> RIPTIDE = create(key("riptide"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:sharpness}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> SHARPNESS = create(key("sharpness"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:silk_touch}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> SILK_TOUCH = create(key("silk_touch"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:smite}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> SMITE = create(key("smite"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:soul_speed}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> SOUL_SPEED = create(key("soul_speed"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:sweeping_edge}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> SWEEPING_EDGE = create(key("sweeping_edge"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:swift_sneak}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> SWIFT_SNEAK = create(key("swift_sneak"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:thorns}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> THORNS = create(key("thorns"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:unbreaking}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> UNBREAKING = create(key("unbreaking"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:vanishing_curse}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> VANISHING_CURSE = create(key("vanishing_curse"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:wind_burst}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Enchantment> WIND_BURST = create(key("wind_burst"));
|
||||
|
||||
private EnchantmentKeys() {
|
||||
}
|
||||
|
||||
private static @NonNull TypedKey<Enchantment> create(final @NonNull Key key) {
|
||||
return TypedKey.create(RegistryKey.ENCHANTMENT, key);
|
||||
}
|
||||
}
|
@ -0,0 +1,455 @@
|
||||
package io.papermc.paper.registry.keys;
|
||||
|
||||
import static net.kyori.adventure.key.Key.key;
|
||||
|
||||
import io.papermc.paper.generated.GeneratedFrom;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.GameEvent;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#GAME_EVENT}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
* changed (including removals) on any Minecraft version
|
||||
* bump, so cross-version compatibility is not provided on the
|
||||
* same level as it is on most of the other API.
|
||||
*/
|
||||
@SuppressWarnings({
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@ApiStatus.Experimental
|
||||
public final class GameEventKeys {
|
||||
/**
|
||||
* {@code minecraft:block_activate}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> BLOCK_ACTIVATE = create(key("block_activate"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:block_attach}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> BLOCK_ATTACH = create(key("block_attach"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:block_change}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> BLOCK_CHANGE = create(key("block_change"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:block_close}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> BLOCK_CLOSE = create(key("block_close"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:block_deactivate}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> BLOCK_DEACTIVATE = create(key("block_deactivate"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:block_destroy}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> BLOCK_DESTROY = create(key("block_destroy"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:block_detach}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> BLOCK_DETACH = create(key("block_detach"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:block_open}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> BLOCK_OPEN = create(key("block_open"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:block_place}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> BLOCK_PLACE = create(key("block_place"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:container_close}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> CONTAINER_CLOSE = create(key("container_close"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:container_open}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> CONTAINER_OPEN = create(key("container_open"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:drink}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> DRINK = create(key("drink"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:eat}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> EAT = create(key("eat"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:elytra_glide}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> ELYTRA_GLIDE = create(key("elytra_glide"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:entity_action}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> ENTITY_ACTION = create(key("entity_action"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:entity_damage}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> ENTITY_DAMAGE = create(key("entity_damage"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:entity_die}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> ENTITY_DIE = create(key("entity_die"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:entity_dismount}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> ENTITY_DISMOUNT = create(key("entity_dismount"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:entity_interact}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> ENTITY_INTERACT = create(key("entity_interact"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:entity_mount}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> ENTITY_MOUNT = create(key("entity_mount"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:entity_place}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> ENTITY_PLACE = create(key("entity_place"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:equip}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> EQUIP = create(key("equip"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:explode}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> EXPLODE = create(key("explode"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:flap}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> FLAP = create(key("flap"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:fluid_pickup}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> FLUID_PICKUP = create(key("fluid_pickup"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:fluid_place}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> FLUID_PLACE = create(key("fluid_place"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:hit_ground}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> HIT_GROUND = create(key("hit_ground"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:instrument_play}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> INSTRUMENT_PLAY = create(key("instrument_play"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:item_interact_finish}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> ITEM_INTERACT_FINISH = create(key("item_interact_finish"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:item_interact_start}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> ITEM_INTERACT_START = create(key("item_interact_start"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:jukebox_play}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> JUKEBOX_PLAY = create(key("jukebox_play"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:jukebox_stop_play}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> JUKEBOX_STOP_PLAY = create(key("jukebox_stop_play"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:lightning_strike}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> LIGHTNING_STRIKE = create(key("lightning_strike"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:note_block_play}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> NOTE_BLOCK_PLAY = create(key("note_block_play"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:prime_fuse}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> PRIME_FUSE = create(key("prime_fuse"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:projectile_land}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> PROJECTILE_LAND = create(key("projectile_land"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:projectile_shoot}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> PROJECTILE_SHOOT = create(key("projectile_shoot"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:resonate_1}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> RESONATE_1 = create(key("resonate_1"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:resonate_2}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> RESONATE_2 = create(key("resonate_2"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:resonate_3}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> RESONATE_3 = create(key("resonate_3"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:resonate_4}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> RESONATE_4 = create(key("resonate_4"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:resonate_5}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> RESONATE_5 = create(key("resonate_5"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:resonate_6}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> RESONATE_6 = create(key("resonate_6"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:resonate_7}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> RESONATE_7 = create(key("resonate_7"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:resonate_8}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> RESONATE_8 = create(key("resonate_8"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:resonate_9}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> RESONATE_9 = create(key("resonate_9"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:resonate_10}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> RESONATE_10 = create(key("resonate_10"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:resonate_11}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> RESONATE_11 = create(key("resonate_11"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:resonate_12}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> RESONATE_12 = create(key("resonate_12"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:resonate_13}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> RESONATE_13 = create(key("resonate_13"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:resonate_14}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> RESONATE_14 = create(key("resonate_14"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:resonate_15}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> RESONATE_15 = create(key("resonate_15"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:sculk_sensor_tendrils_clicking}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> SCULK_SENSOR_TENDRILS_CLICKING = create(key("sculk_sensor_tendrils_clicking"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:shear}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> SHEAR = create(key("shear"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:shriek}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> SHRIEK = create(key("shriek"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:splash}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> SPLASH = create(key("splash"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:step}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> STEP = create(key("step"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:swim}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> SWIM = create(key("swim"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:teleport}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> TELEPORT = create(key("teleport"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:unequip}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<GameEvent> UNEQUIP = create(key("unequip"));
|
||||
|
||||
private GameEventKeys() {
|
||||
}
|
||||
|
||||
private static @NonNull TypedKey<GameEvent> create(final @NonNull Key key) {
|
||||
return TypedKey.create(RegistryKey.GAME_EVENT, key);
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
package io.papermc.paper.registry.keys;
|
||||
|
||||
import static net.kyori.adventure.key.Key.key;
|
||||
|
||||
import io.papermc.paper.generated.GeneratedFrom;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.MusicInstrument;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#INSTRUMENT}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
* changed (including removals) on any Minecraft version
|
||||
* bump, so cross-version compatibility is not provided on the
|
||||
* same level as it is on most of the other API.
|
||||
*/
|
||||
@SuppressWarnings({
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@ApiStatus.Experimental
|
||||
public final class InstrumentKeys {
|
||||
/**
|
||||
* {@code minecraft:admire_goat_horn}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MusicInstrument> ADMIRE_GOAT_HORN = create(key("admire_goat_horn"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:call_goat_horn}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MusicInstrument> CALL_GOAT_HORN = create(key("call_goat_horn"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:dream_goat_horn}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MusicInstrument> DREAM_GOAT_HORN = create(key("dream_goat_horn"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:feel_goat_horn}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MusicInstrument> FEEL_GOAT_HORN = create(key("feel_goat_horn"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:ponder_goat_horn}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MusicInstrument> PONDER_GOAT_HORN = create(key("ponder_goat_horn"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:seek_goat_horn}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MusicInstrument> SEEK_GOAT_HORN = create(key("seek_goat_horn"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:sing_goat_horn}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MusicInstrument> SING_GOAT_HORN = create(key("sing_goat_horn"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:yearn_goat_horn}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<MusicInstrument> YEARN_GOAT_HORN = create(key("yearn_goat_horn"));
|
||||
|
||||
private InstrumentKeys() {
|
||||
}
|
||||
|
||||
private static @NonNull TypedKey<MusicInstrument> create(final @NonNull Key key) {
|
||||
return TypedKey.create(RegistryKey.INSTRUMENT, key);
|
||||
}
|
||||
}
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@ -0,0 +1,308 @@
|
||||
package io.papermc.paper.registry.keys;
|
||||
|
||||
import static net.kyori.adventure.key.Key.key;
|
||||
|
||||
import io.papermc.paper.generated.GeneratedFrom;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#MOB_EFFECT}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
* changed (including removals) on any Minecraft version
|
||||
* bump, so cross-version compatibility is not provided on the
|
||||
* same level as it is on most of the other API.
|
||||
*/
|
||||
@SuppressWarnings({
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@ApiStatus.Experimental
|
||||
public final class MobEffectKeys {
|
||||
/**
|
||||
* {@code minecraft:absorption}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> ABSORPTION = create(key("absorption"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:bad_omen}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> BAD_OMEN = create(key("bad_omen"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:blindness}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> BLINDNESS = create(key("blindness"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:conduit_power}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> CONDUIT_POWER = create(key("conduit_power"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:darkness}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> DARKNESS = create(key("darkness"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:dolphins_grace}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> DOLPHINS_GRACE = create(key("dolphins_grace"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:fire_resistance}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> FIRE_RESISTANCE = create(key("fire_resistance"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:glowing}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> GLOWING = create(key("glowing"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:haste}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> HASTE = create(key("haste"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:health_boost}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> HEALTH_BOOST = create(key("health_boost"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:hero_of_the_village}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> HERO_OF_THE_VILLAGE = create(key("hero_of_the_village"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:hunger}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> HUNGER = create(key("hunger"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:infested}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> INFESTED = create(key("infested"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:instant_damage}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> INSTANT_DAMAGE = create(key("instant_damage"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:instant_health}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> INSTANT_HEALTH = create(key("instant_health"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:invisibility}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> INVISIBILITY = create(key("invisibility"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:jump_boost}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> JUMP_BOOST = create(key("jump_boost"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:levitation}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> LEVITATION = create(key("levitation"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:luck}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> LUCK = create(key("luck"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:mining_fatigue}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> MINING_FATIGUE = create(key("mining_fatigue"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:nausea}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> NAUSEA = create(key("nausea"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:night_vision}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> NIGHT_VISION = create(key("night_vision"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:oozing}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> OOZING = create(key("oozing"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:poison}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> POISON = create(key("poison"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:raid_omen}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> RAID_OMEN = create(key("raid_omen"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:regeneration}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> REGENERATION = create(key("regeneration"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:resistance}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> RESISTANCE = create(key("resistance"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:saturation}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> SATURATION = create(key("saturation"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:slow_falling}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> SLOW_FALLING = create(key("slow_falling"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:slowness}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> SLOWNESS = create(key("slowness"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:speed}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> SPEED = create(key("speed"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:strength}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> STRENGTH = create(key("strength"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:trial_omen}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> TRIAL_OMEN = create(key("trial_omen"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:unluck}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> UNLUCK = create(key("unluck"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:water_breathing}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> WATER_BREATHING = create(key("water_breathing"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:weakness}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> WEAKNESS = create(key("weakness"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:weaving}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> WEAVING = create(key("weaving"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:wind_charged}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> WIND_CHARGED = create(key("wind_charged"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:wither}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<PotionEffectType> WITHER = create(key("wither"));
|
||||
|
||||
private MobEffectKeys() {
|
||||
}
|
||||
|
||||
private static @NonNull TypedKey<PotionEffectType> create(final @NonNull Key key) {
|
||||
return TypedKey.create(RegistryKey.MOB_EFFECT, key);
|
||||
}
|
||||
}
|
@ -0,0 +1,280 @@
|
||||
package io.papermc.paper.registry.keys;
|
||||
|
||||
import static net.kyori.adventure.key.Key.key;
|
||||
|
||||
import io.papermc.paper.generated.GeneratedFrom;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.generator.structure.Structure;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#STRUCTURE}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
* changed (including removals) on any Minecraft version
|
||||
* bump, so cross-version compatibility is not provided on the
|
||||
* same level as it is on most of the other API.
|
||||
*/
|
||||
@SuppressWarnings({
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@ApiStatus.Experimental
|
||||
public final class StructureKeys {
|
||||
/**
|
||||
* {@code minecraft:ancient_city}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> ANCIENT_CITY = create(key("ancient_city"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:bastion_remnant}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> BASTION_REMNANT = create(key("bastion_remnant"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:buried_treasure}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> BURIED_TREASURE = create(key("buried_treasure"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:desert_pyramid}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> DESERT_PYRAMID = create(key("desert_pyramid"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:end_city}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> END_CITY = create(key("end_city"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:fortress}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> FORTRESS = create(key("fortress"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:igloo}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> IGLOO = create(key("igloo"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:jungle_pyramid}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> JUNGLE_PYRAMID = create(key("jungle_pyramid"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:mansion}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> MANSION = create(key("mansion"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:mineshaft}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> MINESHAFT = create(key("mineshaft"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:mineshaft_mesa}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> MINESHAFT_MESA = create(key("mineshaft_mesa"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:monument}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> MONUMENT = create(key("monument"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:nether_fossil}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> NETHER_FOSSIL = create(key("nether_fossil"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:ocean_ruin_cold}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> OCEAN_RUIN_COLD = create(key("ocean_ruin_cold"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:ocean_ruin_warm}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> OCEAN_RUIN_WARM = create(key("ocean_ruin_warm"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:pillager_outpost}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> PILLAGER_OUTPOST = create(key("pillager_outpost"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:ruined_portal}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> RUINED_PORTAL = create(key("ruined_portal"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:ruined_portal_desert}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> RUINED_PORTAL_DESERT = create(key("ruined_portal_desert"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:ruined_portal_jungle}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> RUINED_PORTAL_JUNGLE = create(key("ruined_portal_jungle"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:ruined_portal_mountain}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> RUINED_PORTAL_MOUNTAIN = create(key("ruined_portal_mountain"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:ruined_portal_nether}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> RUINED_PORTAL_NETHER = create(key("ruined_portal_nether"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:ruined_portal_ocean}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> RUINED_PORTAL_OCEAN = create(key("ruined_portal_ocean"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:ruined_portal_swamp}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> RUINED_PORTAL_SWAMP = create(key("ruined_portal_swamp"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:shipwreck}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> SHIPWRECK = create(key("shipwreck"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:shipwreck_beached}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> SHIPWRECK_BEACHED = create(key("shipwreck_beached"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:stronghold}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> STRONGHOLD = create(key("stronghold"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:swamp_hut}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> SWAMP_HUT = create(key("swamp_hut"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:trail_ruins}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> TRAIL_RUINS = create(key("trail_ruins"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:trial_chambers}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> TRIAL_CHAMBERS = create(key("trial_chambers"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:village_desert}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> VILLAGE_DESERT = create(key("village_desert"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:village_plains}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> VILLAGE_PLAINS = create(key("village_plains"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:village_savanna}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> VILLAGE_SAVANNA = create(key("village_savanna"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:village_snowy}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> VILLAGE_SNOWY = create(key("village_snowy"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:village_taiga}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Structure> VILLAGE_TAIGA = create(key("village_taiga"));
|
||||
|
||||
private StructureKeys() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a key for {@link Structure} in the registry {@code minecraft:worldgen/structure}.
|
||||
*
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static @NonNull TypedKey<Structure> create(final @NonNull Key key) {
|
||||
return TypedKey.create(RegistryKey.STRUCTURE, key);
|
||||
}
|
||||
}
|
@ -0,0 +1,147 @@
|
||||
package io.papermc.paper.registry.keys;
|
||||
|
||||
import static net.kyori.adventure.key.Key.key;
|
||||
|
||||
import io.papermc.paper.generated.GeneratedFrom;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.generator.structure.StructureType;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#STRUCTURE_TYPE}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
* changed (including removals) on any Minecraft version
|
||||
* bump, so cross-version compatibility is not provided on the
|
||||
* same level as it is on most of the other API.
|
||||
*/
|
||||
@SuppressWarnings({
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@ApiStatus.Experimental
|
||||
public final class StructureTypeKeys {
|
||||
/**
|
||||
* {@code minecraft:buried_treasure}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<StructureType> BURIED_TREASURE = create(key("buried_treasure"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:desert_pyramid}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<StructureType> DESERT_PYRAMID = create(key("desert_pyramid"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:end_city}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<StructureType> END_CITY = create(key("end_city"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:fortress}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<StructureType> FORTRESS = create(key("fortress"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:igloo}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<StructureType> IGLOO = create(key("igloo"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:jigsaw}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<StructureType> JIGSAW = create(key("jigsaw"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:jungle_temple}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<StructureType> JUNGLE_TEMPLE = create(key("jungle_temple"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:mineshaft}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<StructureType> MINESHAFT = create(key("mineshaft"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:nether_fossil}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<StructureType> NETHER_FOSSIL = create(key("nether_fossil"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:ocean_monument}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<StructureType> OCEAN_MONUMENT = create(key("ocean_monument"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:ocean_ruin}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<StructureType> OCEAN_RUIN = create(key("ocean_ruin"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:ruined_portal}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<StructureType> RUINED_PORTAL = create(key("ruined_portal"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:shipwreck}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<StructureType> SHIPWRECK = create(key("shipwreck"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:stronghold}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<StructureType> STRONGHOLD = create(key("stronghold"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:swamp_hut}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<StructureType> SWAMP_HUT = create(key("swamp_hut"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:woodland_mansion}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<StructureType> WOODLAND_MANSION = create(key("woodland_mansion"));
|
||||
|
||||
private StructureTypeKeys() {
|
||||
}
|
||||
|
||||
private static @NonNull TypedKey<StructureType> create(final @NonNull Key key) {
|
||||
return TypedKey.create(RegistryKey.STRUCTURE_TYPE, key);
|
||||
}
|
||||
}
|
@ -0,0 +1,112 @@
|
||||
package io.papermc.paper.registry.keys;
|
||||
|
||||
import static net.kyori.adventure.key.Key.key;
|
||||
|
||||
import io.papermc.paper.generated.GeneratedFrom;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.inventory.meta.trim.TrimMaterial;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#TRIM_MATERIAL}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
* changed (including removals) on any Minecraft version
|
||||
* bump, so cross-version compatibility is not provided on the
|
||||
* same level as it is on most of the other API.
|
||||
*/
|
||||
@SuppressWarnings({
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@ApiStatus.Experimental
|
||||
public final class TrimMaterialKeys {
|
||||
/**
|
||||
* {@code minecraft:amethyst}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<TrimMaterial> AMETHYST = create(key("amethyst"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:copper}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<TrimMaterial> COPPER = create(key("copper"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:diamond}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<TrimMaterial> DIAMOND = create(key("diamond"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:emerald}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<TrimMaterial> EMERALD = create(key("emerald"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:gold}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<TrimMaterial> GOLD = create(key("gold"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:iron}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<TrimMaterial> IRON = create(key("iron"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:lapis}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<TrimMaterial> LAPIS = create(key("lapis"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:netherite}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<TrimMaterial> NETHERITE = create(key("netherite"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:quartz}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<TrimMaterial> QUARTZ = create(key("quartz"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:redstone}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<TrimMaterial> REDSTONE = create(key("redstone"));
|
||||
|
||||
private TrimMaterialKeys() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a key for {@link TrimMaterial} in the registry {@code minecraft:trim_material}.
|
||||
*
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static @NonNull TypedKey<TrimMaterial> create(final @NonNull Key key) {
|
||||
return TypedKey.create(RegistryKey.TRIM_MATERIAL, key);
|
||||
}
|
||||
}
|
@ -0,0 +1,168 @@
|
||||
package io.papermc.paper.registry.keys;
|
||||
|
||||
import static net.kyori.adventure.key.Key.key;
|
||||
|
||||
import io.papermc.paper.generated.GeneratedFrom;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.inventory.meta.trim.TrimPattern;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#TRIM_PATTERN}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
* changed (including removals) on any Minecraft version
|
||||
* bump, so cross-version compatibility is not provided on the
|
||||
* same level as it is on most of the other API.
|
||||
*/
|
||||
@SuppressWarnings({
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@ApiStatus.Experimental
|
||||
public final class TrimPatternKeys {
|
||||
/**
|
||||
* {@code minecraft:bolt}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<TrimPattern> BOLT = create(key("bolt"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:coast}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<TrimPattern> COAST = create(key("coast"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:dune}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<TrimPattern> DUNE = create(key("dune"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:eye}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<TrimPattern> EYE = create(key("eye"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:flow}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<TrimPattern> FLOW = create(key("flow"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:host}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<TrimPattern> HOST = create(key("host"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:raiser}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<TrimPattern> RAISER = create(key("raiser"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:rib}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<TrimPattern> RIB = create(key("rib"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:sentry}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<TrimPattern> SENTRY = create(key("sentry"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:shaper}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<TrimPattern> SHAPER = create(key("shaper"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:silence}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<TrimPattern> SILENCE = create(key("silence"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:snout}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<TrimPattern> SNOUT = create(key("snout"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:spire}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<TrimPattern> SPIRE = create(key("spire"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:tide}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<TrimPattern> TIDE = create(key("tide"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:vex}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<TrimPattern> VEX = create(key("vex"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:ward}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<TrimPattern> WARD = create(key("ward"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:wayfinder}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<TrimPattern> WAYFINDER = create(key("wayfinder"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:wild}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<TrimPattern> WILD = create(key("wild"));
|
||||
|
||||
private TrimPatternKeys() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a key for {@link TrimPattern} in the registry {@code minecraft:trim_pattern}.
|
||||
*
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static @NonNull TypedKey<TrimPattern> create(final @NonNull Key key) {
|
||||
return TypedKey.create(RegistryKey.TRIM_PATTERN, key);
|
||||
}
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
package io.papermc.paper.registry.keys;
|
||||
|
||||
import static net.kyori.adventure.key.Key.key;
|
||||
|
||||
import io.papermc.paper.generated.GeneratedFrom;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#WOLF_VARIANT}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
* changed (including removals) on any Minecraft version
|
||||
* bump, so cross-version compatibility is not provided on the
|
||||
* same level as it is on most of the other API.
|
||||
*/
|
||||
@SuppressWarnings({
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@ApiStatus.Experimental
|
||||
public final class WolfVariantKeys {
|
||||
/**
|
||||
* {@code minecraft:ashen}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Wolf.Variant> ASHEN = create(key("ashen"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:black}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Wolf.Variant> BLACK = create(key("black"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:chestnut}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Wolf.Variant> CHESTNUT = create(key("chestnut"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:pale}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Wolf.Variant> PALE = create(key("pale"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:rusty}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Wolf.Variant> RUSTY = create(key("rusty"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:snowy}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Wolf.Variant> SNOWY = create(key("snowy"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:spotted}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Wolf.Variant> SPOTTED = create(key("spotted"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:striped}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Wolf.Variant> STRIPED = create(key("striped"));
|
||||
|
||||
/**
|
||||
* {@code minecraft:woods}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TypedKey<Wolf.Variant> WOODS = create(key("woods"));
|
||||
|
||||
private WolfVariantKeys() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a key for {@link Wolf.Variant} in the registry {@code minecraft:wolf_variant}.
|
||||
*
|
||||
* @param key the value's key in the registry
|
||||
* @return a new typed key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static @NonNull TypedKey<Wolf.Variant> create(final @NonNull Key key) {
|
||||
return TypedKey.create(RegistryKey.WOLF_VARIANT, key);
|
||||
}
|
||||
}
|
@ -0,0 +1,323 @@
|
||||
package io.papermc.paper.registry.keys.tags;
|
||||
|
||||
import static net.kyori.adventure.key.Key.key;
|
||||
|
||||
import io.papermc.paper.generated.GeneratedFrom;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.tag.TagKey;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.bukkit.MinecraftExperimental;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
* Vanilla keys for {@link RegistryKey#ENCHANTMENT}.
|
||||
*
|
||||
* @apiNote The fields provided here are a direct representation of
|
||||
* what is available from the vanilla game source. They may be
|
||||
* changed (including removals) on any Minecraft version
|
||||
* bump, so cross-version compatibility is not provided on the
|
||||
* same level as it is on most of the other API.
|
||||
*/
|
||||
@SuppressWarnings({
|
||||
"unused",
|
||||
"SpellCheckingInspection"
|
||||
})
|
||||
@GeneratedFrom("1.21.1")
|
||||
@ApiStatus.Experimental
|
||||
public final class EnchantmentTagKeys {
|
||||
/**
|
||||
* {@code #minecraft:curse}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> CURSE = create(key("curse"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:double_trade_price}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> DOUBLE_TRADE_PRICE = create(key("double_trade_price"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:exclusive_set/armor}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> EXCLUSIVE_SET_ARMOR = create(key("exclusive_set/armor"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:exclusive_set/boots}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> EXCLUSIVE_SET_BOOTS = create(key("exclusive_set/boots"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:exclusive_set/bow}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> EXCLUSIVE_SET_BOW = create(key("exclusive_set/bow"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:exclusive_set/crossbow}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> EXCLUSIVE_SET_CROSSBOW = create(key("exclusive_set/crossbow"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:exclusive_set/damage}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> EXCLUSIVE_SET_DAMAGE = create(key("exclusive_set/damage"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:exclusive_set/mining}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> EXCLUSIVE_SET_MINING = create(key("exclusive_set/mining"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:exclusive_set/riptide}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> EXCLUSIVE_SET_RIPTIDE = create(key("exclusive_set/riptide"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:in_enchanting_table}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> IN_ENCHANTING_TABLE = create(key("in_enchanting_table"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:non_treasure}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> NON_TREASURE = create(key("non_treasure"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:on_mob_spawn_equipment}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> ON_MOB_SPAWN_EQUIPMENT = create(key("on_mob_spawn_equipment"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:on_random_loot}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> ON_RANDOM_LOOT = create(key("on_random_loot"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:on_traded_equipment}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> ON_TRADED_EQUIPMENT = create(key("on_traded_equipment"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:prevents_bee_spawns_when_mining}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> PREVENTS_BEE_SPAWNS_WHEN_MINING = create(key("prevents_bee_spawns_when_mining"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:prevents_decorated_pot_shattering}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> PREVENTS_DECORATED_POT_SHATTERING = create(key("prevents_decorated_pot_shattering"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:prevents_ice_melting}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> PREVENTS_ICE_MELTING = create(key("prevents_ice_melting"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:prevents_infested_spawns}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> PREVENTS_INFESTED_SPAWNS = create(key("prevents_infested_spawns"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:smelts_loot}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> SMELTS_LOOT = create(key("smelts_loot"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:tooltip_order}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> TOOLTIP_ORDER = create(key("tooltip_order"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:tradeable}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> TRADEABLE = create(key("tradeable"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:trades/desert_common}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
|
||||
public static final TagKey<Enchantment> TRADES_DESERT_COMMON = create(key("trades/desert_common"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:trades/desert_special}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
|
||||
public static final TagKey<Enchantment> TRADES_DESERT_SPECIAL = create(key("trades/desert_special"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:trades/jungle_common}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
|
||||
public static final TagKey<Enchantment> TRADES_JUNGLE_COMMON = create(key("trades/jungle_common"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:trades/jungle_special}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
|
||||
public static final TagKey<Enchantment> TRADES_JUNGLE_SPECIAL = create(key("trades/jungle_special"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:trades/plains_common}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
|
||||
public static final TagKey<Enchantment> TRADES_PLAINS_COMMON = create(key("trades/plains_common"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:trades/plains_special}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
|
||||
public static final TagKey<Enchantment> TRADES_PLAINS_SPECIAL = create(key("trades/plains_special"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:trades/savanna_common}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
|
||||
public static final TagKey<Enchantment> TRADES_SAVANNA_COMMON = create(key("trades/savanna_common"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:trades/savanna_special}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
|
||||
public static final TagKey<Enchantment> TRADES_SAVANNA_SPECIAL = create(key("trades/savanna_special"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:trades/snow_common}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
|
||||
public static final TagKey<Enchantment> TRADES_SNOW_COMMON = create(key("trades/snow_common"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:trades/snow_special}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
|
||||
public static final TagKey<Enchantment> TRADES_SNOW_SPECIAL = create(key("trades/snow_special"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:trades/swamp_common}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
|
||||
public static final TagKey<Enchantment> TRADES_SWAMP_COMMON = create(key("trades/swamp_common"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:trades/swamp_special}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
|
||||
public static final TagKey<Enchantment> TRADES_SWAMP_SPECIAL = create(key("trades/swamp_special"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:trades/taiga_common}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
|
||||
public static final TagKey<Enchantment> TRADES_TAIGA_COMMON = create(key("trades/taiga_common"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:trades/taiga_special}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
@MinecraftExperimental(MinecraftExperimental.Requires.TRADE_REBALANCE)
|
||||
public static final TagKey<Enchantment> TRADES_TAIGA_SPECIAL = create(key("trades/taiga_special"));
|
||||
|
||||
/**
|
||||
* {@code #minecraft:treasure}
|
||||
*
|
||||
* @apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
*/
|
||||
public static final TagKey<Enchantment> TREASURE = create(key("treasure"));
|
||||
|
||||
private EnchantmentTagKeys() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a tag key for {@link Enchantment} in the registry {@code minecraft:enchantment}.
|
||||
*
|
||||
* @param key the tag key's key
|
||||
* @return a new tag key
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public static @NonNull TagKey<Enchantment> create(final @NonNull Key key) {
|
||||
return TagKey.create(RegistryKey.ENCHANTMENT, key);
|
||||
}
|
||||
}
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@ -0,0 +1,52 @@
|
||||
package io.papermc.generator;
|
||||
|
||||
import io.papermc.generator.types.GeneratedKeyType;
|
||||
import io.papermc.generator.types.GeneratedTagKeyType;
|
||||
import io.papermc.generator.types.SourceGenerator;
|
||||
import io.papermc.generator.types.goal.MobGoalGenerator;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import org.bukkit.GameEvent;
|
||||
import org.bukkit.MusicInstrument;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.damage.DamageType;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.bukkit.generator.structure.Structure;
|
||||
import org.bukkit.generator.structure.StructureType;
|
||||
import org.bukkit.inventory.ItemType;
|
||||
import org.bukkit.inventory.meta.trim.TrimMaterial;
|
||||
import org.bukkit.inventory.meta.trim.TrimPattern;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public interface Generators {
|
||||
|
||||
SourceGenerator[] API = {
|
||||
simpleKey("GameEventKeys", GameEvent.class, Registries.GAME_EVENT, RegistryKey.GAME_EVENT, false),
|
||||
simpleKey("BiomeKeys", Biome.class, Registries.BIOME, RegistryKey.BIOME, true),
|
||||
simpleKey("TrimMaterialKeys", TrimMaterial.class, Registries.TRIM_MATERIAL, RegistryKey.TRIM_MATERIAL, true),
|
||||
simpleKey("TrimPatternKeys", TrimPattern.class, Registries.TRIM_PATTERN, RegistryKey.TRIM_PATTERN, true),
|
||||
simpleKey("StructureKeys", Structure.class, Registries.STRUCTURE, RegistryKey.STRUCTURE, true),
|
||||
simpleKey("StructureTypeKeys", StructureType.class, Registries.STRUCTURE_TYPE, RegistryKey.STRUCTURE_TYPE, false),
|
||||
simpleKey("InstrumentKeys", MusicInstrument.class, Registries.INSTRUMENT, RegistryKey.INSTRUMENT, false),
|
||||
simpleKey("EnchantmentKeys", Enchantment.class, Registries.ENCHANTMENT, RegistryKey.ENCHANTMENT, false),
|
||||
simpleKey("MobEffectKeys", PotionEffectType.class, Registries.MOB_EFFECT, RegistryKey.MOB_EFFECT, false),
|
||||
simpleKey("DamageTypeKeys", DamageType.class, Registries.DAMAGE_TYPE, RegistryKey.DAMAGE_TYPE, true),
|
||||
simpleKey("WolfVariantKeys", Wolf.Variant.class, Registries.WOLF_VARIANT, RegistryKey.WOLF_VARIANT, true),
|
||||
simpleKey("ItemTypeKeys", ItemType.class, Registries.ITEM, RegistryKey.ITEM, false),
|
||||
|
||||
simpleTagKey("EnchantmentTagKeys", Enchantment.class, Registries.ENCHANTMENT, RegistryKey.ENCHANTMENT),
|
||||
simpleTagKey("ItemTypeTagKeys", ItemType.class, Registries.ITEM, RegistryKey.ITEM),
|
||||
new MobGoalGenerator("VanillaGoal", "com.destroystokyo.paper.entity.ai")
|
||||
};
|
||||
|
||||
private static <T, A> SourceGenerator simpleKey(final String className, final Class<A> apiType, final ResourceKey<? extends Registry<T>> registryKey, final RegistryKey<A> apiRegistryKey, final boolean publicCreateKeyMethod) {
|
||||
return new GeneratedKeyType<>(className, apiType, "io.papermc.paper.registry.keys", registryKey, apiRegistryKey, publicCreateKeyMethod);
|
||||
}
|
||||
|
||||
private static <T, A> SourceGenerator simpleTagKey(final String className, final Class<A> apiType, final ResourceKey<? extends Registry<T>> registryKey, final RegistryKey<A> apiRegistryKey) {
|
||||
return new GeneratedTagKeyType<>(className, apiType, "io.papermc.paper.registry.keys.tags", registryKey, apiRegistryKey, true);
|
||||
}
|
||||
}
|
79
paper-api-generator/src/main/java/io/papermc/generator/Main.java
Normale Datei
79
paper-api-generator/src/main/java/io/papermc/generator/Main.java
Normale Datei
@ -0,0 +1,79 @@
|
||||
package io.papermc.generator;
|
||||
|
||||
import com.google.common.util.concurrent.MoreExecutors;
|
||||
import com.mojang.logging.LogUtils;
|
||||
import io.papermc.generator.types.SourceGenerator;
|
||||
import io.papermc.generator.utils.TagCollector;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Map;
|
||||
import net.minecraft.SharedConstants;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.core.LayeredRegistryAccess;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.resources.RegistryDataLoader;
|
||||
import net.minecraft.server.Bootstrap;
|
||||
import net.minecraft.server.RegistryLayer;
|
||||
import net.minecraft.server.ReloadableServerResources;
|
||||
import net.minecraft.server.WorldLoader;
|
||||
import net.minecraft.server.packs.PackType;
|
||||
import net.minecraft.server.packs.repository.Pack;
|
||||
import net.minecraft.server.packs.repository.PackRepository;
|
||||
import net.minecraft.server.packs.repository.ServerPacksSource;
|
||||
import net.minecraft.server.packs.resources.MultiPackResourceManager;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.flag.FeatureFlags;
|
||||
import org.apache.commons.io.file.PathUtils;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
public final class Main {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
public static final RegistryAccess.Frozen REGISTRY_ACCESS;
|
||||
public static final Map<TagKey<?>, String> EXPERIMENTAL_TAGS;
|
||||
|
||||
static {
|
||||
SharedConstants.tryDetectVersion();
|
||||
Bootstrap.bootStrap();
|
||||
Bootstrap.validate();
|
||||
|
||||
final PackRepository resourceRepository = ServerPacksSource.createVanillaTrustedRepository();
|
||||
resourceRepository.reload();
|
||||
final MultiPackResourceManager resourceManager = new MultiPackResourceManager(PackType.SERVER_DATA, resourceRepository.getAvailablePacks().stream().map(Pack::open).toList());
|
||||
LayeredRegistryAccess<RegistryLayer> layers = RegistryLayer.createRegistryAccess();
|
||||
layers = WorldLoader.loadAndReplaceLayer(resourceManager, layers, RegistryLayer.WORLDGEN, RegistryDataLoader.WORLDGEN_REGISTRIES);
|
||||
REGISTRY_ACCESS = layers.compositeAccess().freeze();
|
||||
final ReloadableServerResources datapack = ReloadableServerResources.loadResources(resourceManager, layers, FeatureFlags.REGISTRY.allFlags(), Commands.CommandSelection.DEDICATED, 0, MoreExecutors.directExecutor(), MoreExecutors.directExecutor()).join();
|
||||
datapack.updateRegistryTags();
|
||||
|
||||
EXPERIMENTAL_TAGS = TagCollector.grabExperimental(resourceManager);
|
||||
}
|
||||
|
||||
private Main() {
|
||||
}
|
||||
|
||||
public static void main(final String[] args) {
|
||||
LOGGER.info("Running API generators...");
|
||||
generate(Paths.get(args[0]), Generators.API);
|
||||
// LOGGER.info("Running Server generators...");
|
||||
// generate(Paths.get(args[1]), Generators.SERVER);
|
||||
}
|
||||
|
||||
private static void generate(Path output, SourceGenerator[] generators) {
|
||||
try {
|
||||
if (Files.exists(output)) {
|
||||
PathUtils.deleteDirectory(output);
|
||||
}
|
||||
Files.createDirectories(output);
|
||||
|
||||
for (final SourceGenerator generator : generators) {
|
||||
generator.writeToFile(output);
|
||||
}
|
||||
|
||||
LOGGER.info("Files written to {}", output.toAbsolutePath());
|
||||
} catch (final Exception ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,193 @@
|
||||
package io.papermc.generator.types;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.squareup.javapoet.FieldSpec;
|
||||
import com.squareup.javapoet.JavaFile;
|
||||
import com.squareup.javapoet.MethodSpec;
|
||||
import com.squareup.javapoet.ParameterSpec;
|
||||
import com.squareup.javapoet.ParameterizedTypeName;
|
||||
import com.squareup.javapoet.TypeName;
|
||||
import com.squareup.javapoet.TypeSpec;
|
||||
import io.papermc.generator.Main;
|
||||
import io.papermc.generator.utils.Annotations;
|
||||
import io.papermc.generator.utils.CollectingContext;
|
||||
import io.papermc.generator.utils.Formatting;
|
||||
import io.papermc.generator.utils.Javadocs;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.TypedKey;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.RegistrySetBuilder;
|
||||
import net.minecraft.data.registries.VanillaRegistries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.world.flag.FeatureElement;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
|
||||
import static com.squareup.javapoet.TypeSpec.classBuilder;
|
||||
import static io.papermc.generator.utils.Annotations.EXPERIMENTAL_API_ANNOTATION;
|
||||
import static io.papermc.generator.utils.Annotations.NOT_NULL;
|
||||
import static io.papermc.generator.utils.Annotations.experimentalAnnotations;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
import static javax.lang.model.element.Modifier.FINAL;
|
||||
import static javax.lang.model.element.Modifier.PRIVATE;
|
||||
import static javax.lang.model.element.Modifier.PUBLIC;
|
||||
import static javax.lang.model.element.Modifier.STATIC;
|
||||
|
||||
@DefaultQualifier(NonNull.class)
|
||||
public class GeneratedKeyType<T, A> extends SimpleGenerator {
|
||||
|
||||
private static final Map<ResourceKey<? extends Registry<?>>, RegistrySetBuilder.RegistryBootstrap<?>> VANILLA_REGISTRY_ENTRIES = VanillaRegistries.BUILDER.entries.stream()
|
||||
.collect(Collectors.toMap(RegistrySetBuilder.RegistryStub::key, RegistrySetBuilder.RegistryStub::bootstrap));
|
||||
|
||||
private static final Map<ResourceKey<? extends Registry<?>>, RegistrySetBuilder.RegistryBootstrap<?>> EXPERIMENTAL_REGISTRY_ENTRIES = Collections.emptyMap(); // Update for Experimental API
|
||||
|
||||
private static final Map<RegistryKey<?>, String> REGISTRY_KEY_FIELD_NAMES;
|
||||
static {
|
||||
final Map<RegistryKey<?>, String> map = new HashMap<>();
|
||||
try {
|
||||
for (final Field field : RegistryKey.class.getFields()) {
|
||||
if (!Modifier.isStatic(field.getModifiers()) || !Modifier.isFinal(field.getModifiers()) || field.getType() != RegistryKey.class) {
|
||||
continue;
|
||||
}
|
||||
map.put((RegistryKey<?>) field.get(null), field.getName());
|
||||
}
|
||||
REGISTRY_KEY_FIELD_NAMES = Map.copyOf(map);
|
||||
} catch (final ReflectiveOperationException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static final String CREATE_JAVADOC = """
|
||||
Creates a key for {@link $T} in the registry {@code $L}.
|
||||
|
||||
@param key the value's key in the registry
|
||||
@return a new typed key
|
||||
""";
|
||||
|
||||
private final Class<A> apiType;
|
||||
private final ResourceKey<? extends Registry<T>> registryKey;
|
||||
private final RegistryKey<A> apiRegistryKey;
|
||||
private final boolean publicCreateKeyMethod;
|
||||
|
||||
public GeneratedKeyType(final String keysClassName, final Class<A> apiType, final String pkg, final ResourceKey<? extends Registry<T>> registryKey, final RegistryKey<A> apiRegistryKey, final boolean publicCreateKeyMethod) {
|
||||
super(keysClassName, pkg);
|
||||
this.apiType = apiType;
|
||||
this.registryKey = registryKey;
|
||||
this.apiRegistryKey = apiRegistryKey;
|
||||
this.publicCreateKeyMethod = publicCreateKeyMethod;
|
||||
}
|
||||
|
||||
private MethodSpec.Builder createMethod(final TypeName returnType) {
|
||||
final TypeName keyType = TypeName.get(Key.class).annotated(NOT_NULL);
|
||||
|
||||
final ParameterSpec keyParam = ParameterSpec.builder(keyType, "key", FINAL).build();
|
||||
final MethodSpec.Builder create = MethodSpec.methodBuilder("create")
|
||||
.addModifiers(this.publicCreateKeyMethod ? PUBLIC : PRIVATE, STATIC)
|
||||
.addParameter(keyParam)
|
||||
.addCode("return $T.create($T.$L, $N);", TypedKey.class, RegistryKey.class, requireNonNull(REGISTRY_KEY_FIELD_NAMES.get(this.apiRegistryKey), "Missing field for " + this.apiRegistryKey), keyParam)
|
||||
.returns(returnType.annotated(NOT_NULL));
|
||||
if (this.publicCreateKeyMethod) {
|
||||
create.addAnnotation(EXPERIMENTAL_API_ANNOTATION); // TODO remove once not experimental
|
||||
create.addJavadoc(CREATE_JAVADOC, this.apiType, this.registryKey.location().toString());
|
||||
}
|
||||
return create;
|
||||
}
|
||||
|
||||
private TypeSpec.Builder keyHolderType() {
|
||||
return classBuilder(this.className)
|
||||
.addModifiers(PUBLIC, FINAL)
|
||||
.addJavadoc(Javadocs.getVersionDependentClassHeader("{@link $T#$L}"), RegistryKey.class, REGISTRY_KEY_FIELD_NAMES.get(this.apiRegistryKey))
|
||||
.addAnnotations(Annotations.CLASS_HEADER)
|
||||
.addMethod(MethodSpec.constructorBuilder()
|
||||
.addModifiers(PRIVATE)
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TypeSpec getTypeSpec() {
|
||||
final TypeName typedKey = ParameterizedTypeName.get(TypedKey.class, this.apiType);
|
||||
|
||||
final TypeSpec.Builder typeBuilder = this.keyHolderType();
|
||||
final MethodSpec.Builder createMethod = this.createMethod(typedKey);
|
||||
|
||||
final Registry<T> registry = Main.REGISTRY_ACCESS.registryOrThrow(this.registryKey);
|
||||
final Set<ResourceKey<T>> experimental = this.collectExperimentalKeys(registry);
|
||||
|
||||
boolean allExperimental = true;
|
||||
for (final Holder.Reference<T> reference : registry.holders().sorted(Formatting.alphabeticKeyOrder(reference -> reference.key().location().getPath())).toList()) {
|
||||
final ResourceKey<T> key = reference.key();
|
||||
final String keyPath = key.location().getPath();
|
||||
final String fieldName = Formatting.formatKeyAsField(keyPath);
|
||||
final FieldSpec.Builder fieldBuilder = FieldSpec.builder(typedKey, fieldName, PUBLIC, STATIC, FINAL)
|
||||
.initializer("$N(key($S))", createMethod.build(), keyPath)
|
||||
.addJavadoc(Javadocs.getVersionDependentField("{@code $L}"), key.location().toString());
|
||||
if (experimental.contains(key)) {
|
||||
fieldBuilder.addAnnotations(experimentalAnnotations(null)); // Update for Experimental API
|
||||
} else {
|
||||
allExperimental = false;
|
||||
}
|
||||
typeBuilder.addField(fieldBuilder.build());
|
||||
}
|
||||
if (allExperimental) {
|
||||
typeBuilder.addAnnotations(experimentalAnnotations(null)); // Update for Experimental API
|
||||
createMethod.addAnnotations(experimentalAnnotations(null)); // Update for Experimental API
|
||||
} else {
|
||||
typeBuilder.addAnnotation(EXPERIMENTAL_API_ANNOTATION); // TODO experimental API
|
||||
}
|
||||
return typeBuilder.addMethod(createMethod.build()).build();
|
||||
}
|
||||
|
||||
private Set<ResourceKey<T>> collectExperimentalKeys(final Registry<T> registry) {
|
||||
if (FeatureElement.FILTERED_REGISTRIES.contains(registry.key())) {
|
||||
return this.collectExperimentalKeysBuiltIn(registry);
|
||||
} else {
|
||||
return this.collectExperimentalKeysDataDriven(registry);
|
||||
}
|
||||
}
|
||||
|
||||
private Set<ResourceKey<T>> collectExperimentalKeysBuiltIn(final Registry<T> registry) {
|
||||
final HolderLookup.RegistryLookup<T> filteredLookup = registry.asLookup().filterElements(v -> {
|
||||
return false; // Update for Experimental API
|
||||
});
|
||||
return filteredLookup.listElementIds().collect(Collectors.toUnmodifiableSet());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Set<ResourceKey<T>> collectExperimentalKeysDataDriven(final Registry<T> registry) {
|
||||
final RegistrySetBuilder.@Nullable RegistryBootstrap<T> experimentalBootstrap = (RegistrySetBuilder.RegistryBootstrap<T>) EXPERIMENTAL_REGISTRY_ENTRIES.get(this.registryKey);
|
||||
if (experimentalBootstrap == null) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
final Set<ResourceKey<T>> experimental = Collections.newSetFromMap(new IdentityHashMap<>());
|
||||
final CollectingContext<T> experimentalCollector = new CollectingContext<>(experimental, registry);
|
||||
experimentalBootstrap.run(experimentalCollector);
|
||||
|
||||
final RegistrySetBuilder.@Nullable RegistryBootstrap<T> vanillaBootstrap = (RegistrySetBuilder.RegistryBootstrap<T>) VANILLA_REGISTRY_ENTRIES.get(this.registryKey);
|
||||
if (vanillaBootstrap != null) {
|
||||
final Set<ResourceKey<T>> vanilla = Collections.newSetFromMap(new IdentityHashMap<>());
|
||||
final CollectingContext<T> vanillaCollector = new CollectingContext<>(vanilla, registry);
|
||||
vanillaBootstrap.run(vanillaCollector);
|
||||
return Sets.difference(experimental, vanilla);
|
||||
}
|
||||
return experimental;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JavaFile.Builder file(final JavaFile.Builder builder) {
|
||||
return builder
|
||||
.addStaticImport(Key.class, "key");
|
||||
}
|
||||
}
|
@ -0,0 +1,137 @@
|
||||
package io.papermc.generator.types;
|
||||
|
||||
import com.squareup.javapoet.FieldSpec;
|
||||
import com.squareup.javapoet.JavaFile;
|
||||
import com.squareup.javapoet.MethodSpec;
|
||||
import com.squareup.javapoet.ParameterSpec;
|
||||
import com.squareup.javapoet.ParameterizedTypeName;
|
||||
import com.squareup.javapoet.TypeName;
|
||||
import com.squareup.javapoet.TypeSpec;
|
||||
import io.papermc.generator.Main;
|
||||
import io.papermc.generator.utils.Annotations;
|
||||
import io.papermc.generator.utils.Formatting;
|
||||
import io.papermc.generator.utils.Javadocs;
|
||||
import io.papermc.paper.registry.RegistryKey;
|
||||
import io.papermc.paper.registry.tag.TagKey;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import net.kyori.adventure.key.Key;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import org.bukkit.MinecraftExperimental;
|
||||
|
||||
import static com.squareup.javapoet.TypeSpec.classBuilder;
|
||||
import static io.papermc.generator.utils.Annotations.EXPERIMENTAL_API_ANNOTATION;
|
||||
import static io.papermc.generator.utils.Annotations.NOT_NULL;
|
||||
import static io.papermc.generator.utils.Annotations.experimentalAnnotations;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
import static javax.lang.model.element.Modifier.FINAL;
|
||||
import static javax.lang.model.element.Modifier.PRIVATE;
|
||||
import static javax.lang.model.element.Modifier.PUBLIC;
|
||||
import static javax.lang.model.element.Modifier.STATIC;
|
||||
|
||||
public class GeneratedTagKeyType<T, A> extends SimpleGenerator {
|
||||
|
||||
private static final Map<RegistryKey<?>, String> REGISTRY_KEY_FIELD_NAMES;
|
||||
static {
|
||||
final Map<RegistryKey<?>, String> map = new HashMap<>();
|
||||
try {
|
||||
for (final Field field : RegistryKey.class.getFields()) {
|
||||
if (!Modifier.isStatic(field.getModifiers()) || !Modifier.isFinal(field.getModifiers()) || field.getType() != RegistryKey.class) {
|
||||
continue;
|
||||
}
|
||||
map.put((RegistryKey<?>) field.get(null), field.getName());
|
||||
}
|
||||
REGISTRY_KEY_FIELD_NAMES = Map.copyOf(map);
|
||||
} catch (final ReflectiveOperationException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static final String CREATE_JAVADOC = """
|
||||
Creates a tag key for {@link $T} in the registry {@code $L}.
|
||||
|
||||
@param key the tag key's key
|
||||
@return a new tag key
|
||||
""";
|
||||
|
||||
private final Class<A> apiType;
|
||||
private final ResourceKey<? extends Registry<T>> registryKey;
|
||||
private final RegistryKey<A> apiRegistryKey;
|
||||
private final boolean publicCreateKeyMethod;
|
||||
|
||||
public GeneratedTagKeyType(final String keysClassName, final Class<A> apiType, final String pkg, final ResourceKey<? extends Registry<T>> registryKey, final RegistryKey<A> apiRegistryKey, final boolean publicCreateKeyMethod) {
|
||||
super(keysClassName, pkg);
|
||||
this.apiType = apiType;
|
||||
this.registryKey = registryKey;
|
||||
this.apiRegistryKey = apiRegistryKey;
|
||||
this.publicCreateKeyMethod = publicCreateKeyMethod;
|
||||
}
|
||||
|
||||
private MethodSpec.Builder createMethod(final TypeName returnType) {
|
||||
final TypeName keyType = TypeName.get(Key.class).annotated(NOT_NULL);
|
||||
|
||||
final ParameterSpec keyParam = ParameterSpec.builder(keyType, "key", FINAL).build();
|
||||
final MethodSpec.Builder create = MethodSpec.methodBuilder("create")
|
||||
.addModifiers(this.publicCreateKeyMethod ? PUBLIC : PRIVATE, STATIC)
|
||||
.addParameter(keyParam)
|
||||
.addCode("return $T.create($T.$L, $N);", TagKey.class, RegistryKey.class, requireNonNull(REGISTRY_KEY_FIELD_NAMES.get(this.apiRegistryKey), "Missing field for " + this.apiRegistryKey), keyParam)
|
||||
.returns(returnType.annotated(NOT_NULL));
|
||||
if (this.publicCreateKeyMethod) {
|
||||
create.addAnnotation(EXPERIMENTAL_API_ANNOTATION); // TODO remove once not experimental
|
||||
create.addJavadoc(CREATE_JAVADOC, this.apiType, this.registryKey.location().toString());
|
||||
}
|
||||
return create;
|
||||
}
|
||||
|
||||
private TypeSpec.Builder keyHolderType() {
|
||||
return classBuilder(this.className)
|
||||
.addModifiers(PUBLIC, FINAL)
|
||||
.addJavadoc(Javadocs.getVersionDependentClassHeader("{@link $T#$L}"), RegistryKey.class, REGISTRY_KEY_FIELD_NAMES.get(this.apiRegistryKey))
|
||||
.addAnnotations(Annotations.CLASS_HEADER)
|
||||
.addMethod(MethodSpec.constructorBuilder()
|
||||
.addModifiers(PRIVATE)
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TypeSpec getTypeSpec() {
|
||||
final TypeName tagKey = ParameterizedTypeName.get(TagKey.class, this.apiType);
|
||||
|
||||
final TypeSpec.Builder typeBuilder = this.keyHolderType();
|
||||
final MethodSpec.Builder createMethod = this.createMethod(tagKey);
|
||||
|
||||
final Registry<T> registry = Main.REGISTRY_ACCESS.registryOrThrow(this.registryKey);
|
||||
|
||||
final AtomicBoolean allExperimental = new AtomicBoolean(true);
|
||||
registry.getTagNames().sorted(Formatting.alphabeticKeyOrder(nmsTagKey -> nmsTagKey.location().getPath())).forEach(nmsTagKey -> {
|
||||
final String fieldName = Formatting.formatKeyAsField(nmsTagKey.location().getPath());
|
||||
final FieldSpec.Builder fieldBuilder = FieldSpec.builder(tagKey, fieldName, PUBLIC, STATIC, FINAL)
|
||||
.initializer("$N(key($S))", createMethod.build(), nmsTagKey.location().getPath())
|
||||
.addJavadoc(Javadocs.getVersionDependentField("{@code $L}"), "#" + nmsTagKey.location());
|
||||
if (Main.EXPERIMENTAL_TAGS.containsKey(nmsTagKey)) {
|
||||
fieldBuilder.addAnnotations(experimentalAnnotations(MinecraftExperimental.Requires.TRADE_REBALANCE)); // Update for Experimental API
|
||||
} else {
|
||||
allExperimental.set(false);
|
||||
}
|
||||
typeBuilder.addField(fieldBuilder.build());
|
||||
});
|
||||
if (allExperimental.get()) {
|
||||
typeBuilder.addAnnotations(experimentalAnnotations(null)); // Update for Experimental API
|
||||
createMethod.addAnnotations(experimentalAnnotations(null)); // Update for Experimental API
|
||||
} else {
|
||||
typeBuilder.addAnnotation(EXPERIMENTAL_API_ANNOTATION); // TODO experimental API
|
||||
}
|
||||
return typeBuilder.addMethod(createMethod.build()).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JavaFile.Builder file(final JavaFile.Builder builder) {
|
||||
return builder
|
||||
.addStaticImport(Key.class, "key");
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package io.papermc.generator.types;
|
||||
|
||||
import com.squareup.javapoet.JavaFile;
|
||||
import com.squareup.javapoet.TypeSpec;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Path;
|
||||
|
||||
public abstract class SimpleGenerator implements SourceGenerator {
|
||||
|
||||
protected final String className;
|
||||
protected final String packageName;
|
||||
|
||||
protected SimpleGenerator(String className, String packageName) {
|
||||
this.className = className;
|
||||
this.packageName = packageName;
|
||||
}
|
||||
|
||||
protected abstract TypeSpec getTypeSpec();
|
||||
|
||||
protected abstract JavaFile.Builder file(JavaFile.Builder builder);
|
||||
|
||||
@Override
|
||||
public void writeToFile(Path parent) throws IOException {
|
||||
|
||||
JavaFile.Builder builder = JavaFile.builder(this.packageName, this.getTypeSpec());
|
||||
this.file(builder)
|
||||
.indent(" ")
|
||||
.skipJavaLangImports(true);
|
||||
|
||||
builder.build().writeTo(parent, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package io.papermc.generator.types;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
|
||||
public interface SourceGenerator {
|
||||
|
||||
void writeToFile(Path parent) throws IOException;
|
||||
}
|
@ -0,0 +1,143 @@
|
||||
package io.papermc.generator.types.goal;
|
||||
|
||||
import com.destroystokyo.paper.entity.RangedEntity;
|
||||
import com.destroystokyo.paper.entity.ai.GoalKey;
|
||||
import com.squareup.javapoet.ClassName;
|
||||
import com.squareup.javapoet.FieldSpec;
|
||||
import com.squareup.javapoet.JavaFile;
|
||||
import com.squareup.javapoet.MethodSpec;
|
||||
import com.squareup.javapoet.ParameterSpec;
|
||||
import com.squareup.javapoet.ParameterizedTypeName;
|
||||
import com.squareup.javapoet.TypeName;
|
||||
import com.squareup.javapoet.TypeSpec;
|
||||
import com.squareup.javapoet.TypeVariableName;
|
||||
import io.github.classgraph.ClassGraph;
|
||||
import io.github.classgraph.ScanResult;
|
||||
import io.papermc.generator.types.SimpleGenerator;
|
||||
import io.papermc.generator.utils.Annotations;
|
||||
import io.papermc.generator.utils.Formatting;
|
||||
import io.papermc.generator.utils.Javadocs;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import javax.lang.model.element.Modifier;
|
||||
import net.minecraft.world.entity.ai.goal.Goal;
|
||||
import net.minecraft.world.entity.ai.goal.WrappedGoal;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.entity.AbstractHorse;
|
||||
import org.bukkit.entity.Blaze;
|
||||
import org.bukkit.entity.Cat;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.Dolphin;
|
||||
import org.bukkit.entity.Drowned;
|
||||
import org.bukkit.entity.Enderman;
|
||||
import org.bukkit.entity.Evoker;
|
||||
import org.bukkit.entity.Fish;
|
||||
import org.bukkit.entity.Fox;
|
||||
import org.bukkit.entity.Ghast;
|
||||
import org.bukkit.entity.Llama;
|
||||
import org.bukkit.entity.Mob;
|
||||
import org.bukkit.entity.Monster;
|
||||
import org.bukkit.entity.Panda;
|
||||
import org.bukkit.entity.Parrot;
|
||||
import org.bukkit.entity.PigZombie;
|
||||
import org.bukkit.entity.PolarBear;
|
||||
import org.bukkit.entity.Rabbit;
|
||||
import org.bukkit.entity.Raider;
|
||||
import org.bukkit.entity.Ravager;
|
||||
import org.bukkit.entity.Shulker;
|
||||
import org.bukkit.entity.Silverfish;
|
||||
import org.bukkit.entity.SkeletonHorse;
|
||||
import org.bukkit.entity.Slime;
|
||||
import org.bukkit.entity.Spellcaster;
|
||||
import org.bukkit.entity.Spider;
|
||||
import org.bukkit.entity.Squid;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.entity.TraderLlama;
|
||||
import org.bukkit.entity.Turtle;
|
||||
import org.bukkit.entity.Vex;
|
||||
import org.bukkit.entity.Vindicator;
|
||||
import org.bukkit.entity.WanderingTrader;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import static javax.lang.model.element.Modifier.FINAL;
|
||||
import static javax.lang.model.element.Modifier.PRIVATE;
|
||||
import static javax.lang.model.element.Modifier.PUBLIC;
|
||||
import static javax.lang.model.element.Modifier.STATIC;
|
||||
|
||||
@DefaultQualifier(NonNull.class)
|
||||
public class MobGoalGenerator extends SimpleGenerator {
|
||||
|
||||
private static final String CLASS_HEADER = Javadocs.getVersionDependentClassHeader("Mob Goals");
|
||||
|
||||
public MobGoalGenerator(final String keysClassName, final String pkg) {
|
||||
super(keysClassName, pkg);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TypeSpec getTypeSpec() {
|
||||
TypeVariableName type = TypeVariableName.get("T", Mob.class);
|
||||
TypeSpec.Builder typeBuilder = TypeSpec.interfaceBuilder(this.className)
|
||||
.addSuperinterface(ParameterizedTypeName.get(ClassName.get(com.destroystokyo.paper.entity.ai.Goal.class), type))
|
||||
.addModifiers(PUBLIC)
|
||||
.addTypeVariable(type)
|
||||
.addAnnotations(Annotations.CLASS_HEADER)
|
||||
.addJavadoc(CLASS_HEADER);
|
||||
|
||||
TypeName mobType = ParameterizedTypeName.get(ClassName.get(Class.class), type)
|
||||
.annotated(Annotations.NOT_NULL);
|
||||
TypeName keyType = TypeName.get(String.class)
|
||||
.annotated(Annotations.NOT_NULL);
|
||||
|
||||
ParameterSpec keyParam = ParameterSpec.builder(keyType, "key", FINAL).build();
|
||||
ParameterSpec typeParam = ParameterSpec.builder(mobType, "type", FINAL).build();
|
||||
MethodSpec.Builder createMethod = MethodSpec.methodBuilder("create")
|
||||
.addModifiers(PRIVATE, STATIC)
|
||||
.addParameter(keyParam)
|
||||
.addParameter(typeParam)
|
||||
.addCode("return $T.of($N, $T.minecraft($N));", GoalKey.class, typeParam, NamespacedKey.class, keyParam)
|
||||
.addTypeVariable(type)
|
||||
.returns(ParameterizedTypeName.get(ClassName.get(GoalKey.class), type).annotated(Annotations.NOT_NULL));
|
||||
|
||||
List<Class<Goal>> classes;
|
||||
try (ScanResult scanResult = new ClassGraph().enableAllInfo().whitelistPackages("net.minecraft").scan()) {
|
||||
classes = scanResult.getSubclasses(Goal.class.getName()).loadClasses(Goal.class);
|
||||
}
|
||||
|
||||
List<GoalKey<Mob>> vanillaNames = classes.stream()
|
||||
.filter(clazz -> !java.lang.reflect.Modifier.isAbstract(clazz.getModifiers()))
|
||||
.filter(clazz -> !WrappedGoal.class.equals(clazz)) // TODO - properly fix
|
||||
.map(goalClass -> MobGoalNames.getKey(goalClass.getName(), goalClass))
|
||||
.filter((key) -> !MobGoalNames.isIgnored(key.getNamespacedKey().getKey()))
|
||||
.sorted(Comparator.<GoalKey<?>, String>comparing(o -> o.getEntityClass().getSimpleName())
|
||||
.thenComparing(vanillaGoalKey -> vanillaGoalKey.getNamespacedKey().getKey())
|
||||
)
|
||||
.toList();
|
||||
|
||||
|
||||
for (final GoalKey<?> goalKey : vanillaNames) {
|
||||
TypeName typedKey = ParameterizedTypeName.get(GoalKey.class, goalKey.getEntityClass());
|
||||
NamespacedKey key = goalKey.getNamespacedKey();
|
||||
|
||||
String keyPath = key.getKey();
|
||||
String fieldName = Formatting.formatKeyAsField(keyPath);
|
||||
FieldSpec.Builder fieldBuilder = FieldSpec.builder(typedKey, fieldName, PUBLIC, STATIC, FINAL)
|
||||
.initializer("$N($S, $T.class)", createMethod.build(), keyPath, goalKey.getEntityClass());
|
||||
typeBuilder.addField(fieldBuilder.build());
|
||||
}
|
||||
|
||||
return typeBuilder.addMethod(createMethod.build()).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JavaFile.Builder file(JavaFile.Builder builder) {
|
||||
return builder;
|
||||
}
|
||||
|
||||
record DeprecatedEntry(Class<?> entity, String entryName, @Nullable String removalVersion,
|
||||
@Nullable String removedVersion) {
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,333 @@
|
||||
package io.papermc.generator.types.goal;
|
||||
|
||||
import com.destroystokyo.paper.entity.RangedEntity;
|
||||
import com.destroystokyo.paper.entity.ai.GoalKey;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import net.minecraft.world.entity.FlyingMob;
|
||||
import net.minecraft.world.entity.PathfinderMob;
|
||||
import net.minecraft.world.entity.TamableAnimal;
|
||||
import net.minecraft.world.entity.ai.goal.Goal;
|
||||
import net.minecraft.world.entity.ambient.AmbientCreature;
|
||||
import net.minecraft.world.entity.animal.AbstractFish;
|
||||
import net.minecraft.world.entity.animal.AbstractGolem;
|
||||
import net.minecraft.world.entity.animal.AbstractSchoolingFish;
|
||||
import net.minecraft.world.entity.animal.Animal;
|
||||
import net.minecraft.world.entity.animal.Pufferfish;
|
||||
import net.minecraft.world.entity.animal.ShoulderRidingEntity;
|
||||
import net.minecraft.world.entity.animal.SnowGolem;
|
||||
import net.minecraft.world.entity.animal.WaterAnimal;
|
||||
import net.minecraft.world.entity.animal.horse.AbstractChestedHorse;
|
||||
import net.minecraft.world.entity.boss.wither.WitherBoss;
|
||||
import net.minecraft.world.entity.monster.AbstractIllager;
|
||||
import net.minecraft.world.entity.monster.EnderMan;
|
||||
import net.minecraft.world.entity.monster.PatrollingMonster;
|
||||
import net.minecraft.world.entity.monster.RangedAttackMob;
|
||||
import net.minecraft.world.entity.monster.SpellcasterIllager;
|
||||
import net.minecraft.world.entity.monster.ZombifiedPiglin;
|
||||
import net.minecraft.world.entity.monster.piglin.AbstractPiglin;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.entity.AbstractHorse;
|
||||
import org.bukkit.entity.AbstractSkeleton;
|
||||
import org.bukkit.entity.AbstractVillager;
|
||||
import org.bukkit.entity.Ageable;
|
||||
import org.bukkit.entity.Ambient;
|
||||
import org.bukkit.entity.Animals;
|
||||
import org.bukkit.entity.Bat;
|
||||
import org.bukkit.entity.Bee;
|
||||
import org.bukkit.entity.Blaze;
|
||||
import org.bukkit.entity.Cat;
|
||||
import org.bukkit.entity.CaveSpider;
|
||||
import org.bukkit.entity.ChestedHorse;
|
||||
import org.bukkit.entity.Chicken;
|
||||
import org.bukkit.entity.Cod;
|
||||
import org.bukkit.entity.Cow;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.Creeper;
|
||||
import org.bukkit.entity.Dolphin;
|
||||
import org.bukkit.entity.Donkey;
|
||||
import org.bukkit.entity.Drowned;
|
||||
import org.bukkit.entity.ElderGuardian;
|
||||
import org.bukkit.entity.EnderDragon;
|
||||
import org.bukkit.entity.Enderman;
|
||||
import org.bukkit.entity.Endermite;
|
||||
import org.bukkit.entity.Evoker;
|
||||
import org.bukkit.entity.Fish;
|
||||
import org.bukkit.entity.Flying;
|
||||
import org.bukkit.entity.Fox;
|
||||
import org.bukkit.entity.Ghast;
|
||||
import org.bukkit.entity.Giant;
|
||||
import org.bukkit.entity.Golem;
|
||||
import org.bukkit.entity.Guardian;
|
||||
import org.bukkit.entity.Hoglin;
|
||||
import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.Husk;
|
||||
import org.bukkit.entity.Illager;
|
||||
import org.bukkit.entity.Illusioner;
|
||||
import org.bukkit.entity.IronGolem;
|
||||
import org.bukkit.entity.Llama;
|
||||
import org.bukkit.entity.MagmaCube;
|
||||
import org.bukkit.entity.Mob;
|
||||
import org.bukkit.entity.Monster;
|
||||
import org.bukkit.entity.Mule;
|
||||
import org.bukkit.entity.MushroomCow;
|
||||
import org.bukkit.entity.Ocelot;
|
||||
import org.bukkit.entity.Panda;
|
||||
import org.bukkit.entity.Parrot;
|
||||
import org.bukkit.entity.Phantom;
|
||||
import org.bukkit.entity.Pig;
|
||||
import org.bukkit.entity.PigZombie;
|
||||
import org.bukkit.entity.Piglin;
|
||||
import org.bukkit.entity.PiglinAbstract;
|
||||
import org.bukkit.entity.PiglinBrute;
|
||||
import org.bukkit.entity.Pillager;
|
||||
import org.bukkit.entity.PolarBear;
|
||||
import org.bukkit.entity.PufferFish;
|
||||
import org.bukkit.entity.Rabbit;
|
||||
import org.bukkit.entity.Raider;
|
||||
import org.bukkit.entity.Ravager;
|
||||
import org.bukkit.entity.Salmon;
|
||||
import org.bukkit.entity.Sheep;
|
||||
import org.bukkit.entity.Shulker;
|
||||
import org.bukkit.entity.Silverfish;
|
||||
import org.bukkit.entity.Skeleton;
|
||||
import org.bukkit.entity.SkeletonHorse;
|
||||
import org.bukkit.entity.Slime;
|
||||
import org.bukkit.entity.Snowman;
|
||||
import org.bukkit.entity.Spellcaster;
|
||||
import org.bukkit.entity.Spider;
|
||||
import org.bukkit.entity.Squid;
|
||||
import org.bukkit.entity.Stray;
|
||||
import org.bukkit.entity.Strider;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.entity.TraderLlama;
|
||||
import org.bukkit.entity.TropicalFish;
|
||||
import org.bukkit.entity.Turtle;
|
||||
import org.bukkit.entity.Vex;
|
||||
import org.bukkit.entity.Villager;
|
||||
import org.bukkit.entity.Vindicator;
|
||||
import org.bukkit.entity.WanderingTrader;
|
||||
import org.bukkit.entity.WaterMob;
|
||||
import org.bukkit.entity.Witch;
|
||||
import org.bukkit.entity.Wither;
|
||||
import org.bukkit.entity.WitherSkeleton;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.bukkit.entity.Zoglin;
|
||||
import org.bukkit.entity.Zombie;
|
||||
import org.bukkit.entity.ZombieHorse;
|
||||
import org.bukkit.entity.ZombieVillager;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class MobGoalNames {
|
||||
|
||||
private static final Map<Class<? extends Goal>, Class<? extends Mob>> entityClassCache = new HashMap<>();
|
||||
public static final Map<Class<? extends net.minecraft.world.entity.Mob>, Class<? extends Mob>> bukkitMap = new HashMap<>();
|
||||
|
||||
|
||||
static {
|
||||
//<editor-fold defaultstate="collapsed" desc="bukkitMap Entities">
|
||||
bukkitMap.put(net.minecraft.world.entity.Mob.class, Mob.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.AgeableMob.class, Ageable.class);
|
||||
bukkitMap.put(AmbientCreature.class, Ambient.class);
|
||||
bukkitMap.put(Animal.class, Animals.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.ambient.Bat.class, Bat.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.Bee.class, Bee.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.Blaze.class, Blaze.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.Cat.class, Cat.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.CaveSpider.class, CaveSpider.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.Chicken.class, Chicken.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.Cod.class, Cod.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.Cow.class, Cow.class);
|
||||
bukkitMap.put(PathfinderMob.class, Creature.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.Creeper.class, Creeper.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.Dolphin.class, Dolphin.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.Drowned.class, Drowned.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.boss.enderdragon.EnderDragon.class, EnderDragon.class);
|
||||
bukkitMap.put(EnderMan.class, Enderman.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.Endermite.class, Endermite.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.Evoker.class, Evoker.class);
|
||||
bukkitMap.put(AbstractFish.class, Fish.class);
|
||||
bukkitMap.put(AbstractSchoolingFish.class, io.papermc.paper.entity.SchoolableFish.class);
|
||||
bukkitMap.put(FlyingMob.class, Flying.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.Fox.class, Fox.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.Ghast.class, Ghast.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.Giant.class, Giant.class);
|
||||
bukkitMap.put(AbstractGolem.class, Golem.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.Guardian.class, Guardian.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.ElderGuardian.class, ElderGuardian.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.horse.Horse.class, Horse.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.horse.AbstractHorse.class, AbstractHorse.class);
|
||||
bukkitMap.put(AbstractChestedHorse.class, ChestedHorse.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.horse.Donkey.class, Donkey.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.horse.Mule.class, Mule.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.horse.SkeletonHorse.class, SkeletonHorse.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.horse.ZombieHorse.class, ZombieHorse.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.camel.Camel.class, org.bukkit.entity.Camel.class);
|
||||
bukkitMap.put(AbstractIllager.class, Illager.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.Illusioner.class, Illusioner.class);
|
||||
bukkitMap.put(SpellcasterIllager.class, Spellcaster.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.IronGolem.class, IronGolem.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.horse.Llama.class, Llama.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.horse.TraderLlama.class, TraderLlama.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.MagmaCube.class, MagmaCube.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.Monster.class, Monster.class);
|
||||
bukkitMap.put(PatrollingMonster.class, Raider.class); // close enough
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.MushroomCow.class, MushroomCow.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.Ocelot.class, Ocelot.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.Panda.class, Panda.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.Parrot.class, Parrot.class);
|
||||
bukkitMap.put(ShoulderRidingEntity.class, Parrot.class); // close enough
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.Phantom.class, Phantom.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.Pig.class, Pig.class);
|
||||
bukkitMap.put(ZombifiedPiglin.class, PigZombie.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.Pillager.class, Pillager.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.PolarBear.class, PolarBear.class);
|
||||
bukkitMap.put(Pufferfish.class, PufferFish.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.Rabbit.class, Rabbit.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.raid.Raider.class, Raider.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.Ravager.class, Ravager.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.Salmon.class, Salmon.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.Sheep.class, Sheep.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.Shulker.class, Shulker.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.Silverfish.class, Silverfish.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.Skeleton.class, Skeleton.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.AbstractSkeleton.class, AbstractSkeleton.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.Stray.class, Stray.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.WitherSkeleton.class, WitherSkeleton.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.Slime.class, Slime.class);
|
||||
bukkitMap.put(SnowGolem.class, Snowman.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.Spider.class, Spider.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.Squid.class, Squid.class);
|
||||
bukkitMap.put(TamableAnimal.class, Tameable.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.TropicalFish.class, TropicalFish.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.Turtle.class, Turtle.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.Vex.class, Vex.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.npc.Villager.class, Villager.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.npc.AbstractVillager.class, AbstractVillager.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.npc.WanderingTrader.class, WanderingTrader.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.Vindicator.class, Vindicator.class);
|
||||
bukkitMap.put(WaterAnimal.class, WaterMob.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.Witch.class, Witch.class);
|
||||
bukkitMap.put(WitherBoss.class, Wither.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.Wolf.class, Wolf.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.Zombie.class, Zombie.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.Husk.class, Husk.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.ZombieVillager.class, ZombieVillager.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.hoglin.Hoglin.class, Hoglin.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.piglin.Piglin.class, Piglin.class);
|
||||
bukkitMap.put(AbstractPiglin.class, PiglinAbstract.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.piglin.PiglinBrute.class, PiglinBrute.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.Strider.class, Strider.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.Zoglin.class, Zoglin.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.GlowSquid.class, org.bukkit.entity.GlowSquid.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.axolotl.Axolotl.class, org.bukkit.entity.Axolotl.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.goat.Goat.class, org.bukkit.entity.Goat.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.frog.Frog.class, org.bukkit.entity.Frog.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.frog.Tadpole.class, org.bukkit.entity.Tadpole.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.warden.Warden.class, org.bukkit.entity.Warden.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.allay.Allay.class, org.bukkit.entity.Allay.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.sniffer.Sniffer.class, org.bukkit.entity.Sniffer.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.breeze.Breeze.class, org.bukkit.entity.Breeze.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.animal.armadillo.Armadillo.class, org.bukkit.entity.Armadillo.class);
|
||||
bukkitMap.put(net.minecraft.world.entity.monster.Bogged.class, org.bukkit.entity.Bogged.class);
|
||||
//</editor-fold>
|
||||
}
|
||||
|
||||
private static final BiMap<String, String> deobfuscationMap = HashBiMap.create();
|
||||
static final Set<String> ignored = new HashSet<>();
|
||||
|
||||
static {
|
||||
deobfuscationMap.put("abstract_skeleton_1", "abstract_skeleton_melee");
|
||||
|
||||
ignored.add("goal_selector_1");
|
||||
ignored.add("goal_selector_2");
|
||||
ignored.add("selector_1");
|
||||
ignored.add("selector_2");
|
||||
ignored.add("wrapped");
|
||||
}
|
||||
|
||||
public static String getUsableName(String name) {
|
||||
final String original = name;
|
||||
name = name.substring(name.lastIndexOf(".") + 1);
|
||||
boolean flag = false;
|
||||
// inner classes
|
||||
if (name.contains("$")) {
|
||||
String cut = name.substring(name.indexOf("$") + 1);
|
||||
if (cut.length() <= 2) {
|
||||
name = name.replace("Entity", "");
|
||||
name = name.replace("$", "_");
|
||||
flag = true;
|
||||
} else {
|
||||
// mapped, wooo
|
||||
name = cut;
|
||||
}
|
||||
}
|
||||
name = name.replace("PathfinderGoal", "");
|
||||
name = name.replace("TargetGoal", "");
|
||||
name = name.replace("Goal", "");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (char c : name.toCharArray()) {
|
||||
if (c >= 'A' && c <= 'Z') {
|
||||
sb.append("_");
|
||||
sb.append(Character.toLowerCase(c));
|
||||
} else {
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
name = sb.toString();
|
||||
name = name.replaceFirst("_", "");
|
||||
|
||||
if (flag && !deobfuscationMap.containsKey(name.toLowerCase(Locale.ROOT)) && !ignored.contains(name)) {
|
||||
System.out.println("need to map " + original + " (" + name.toLowerCase(Locale.ROOT) + ")");
|
||||
}
|
||||
|
||||
// did we rename this key?
|
||||
return deobfuscationMap.getOrDefault(name, name);
|
||||
}
|
||||
|
||||
public static boolean isIgnored(String name) {
|
||||
return ignored.contains(name);
|
||||
}
|
||||
|
||||
|
||||
public static <T extends Mob> GoalKey<T> getKey(String clazzName, Class<? extends Goal> goalClass) {
|
||||
String name = getUsableName(clazzName);
|
||||
if (MobGoalNames.isIgnored(name)) {
|
||||
//noinspection unchecked
|
||||
return (GoalKey<T>) GoalKey.of(Mob.class, NamespacedKey.minecraft(name));
|
||||
}
|
||||
return GoalKey.of(getEntity(goalClass), NamespacedKey.minecraft(name));
|
||||
}
|
||||
|
||||
public static <T extends Mob> Class<T> getEntity(Class<? extends Goal> goalClass) {
|
||||
//noinspection unchecked
|
||||
return (Class<T>) entityClassCache.computeIfAbsent(goalClass, key -> {
|
||||
for (Constructor<?> ctor : key.getDeclaredConstructors()) {
|
||||
for (int i = 0; i < ctor.getParameterCount(); i++) {
|
||||
Class<?> param = ctor.getParameterTypes()[i];
|
||||
if (net.minecraft.world.entity.Mob.class.isAssignableFrom(param)) {
|
||||
//noinspection unchecked
|
||||
return toBukkitClass((Class<? extends net.minecraft.world.entity.Mob>) param);
|
||||
} else if (RangedAttackMob.class.isAssignableFrom(param)) {
|
||||
return RangedEntity.class;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("Can't figure out applicable entity for mob goal " + goalClass); // maybe just return EntityInsentient?
|
||||
});
|
||||
}
|
||||
|
||||
public static Class<? extends Mob> toBukkitClass(Class<? extends net.minecraft.world.entity.Mob> nmsClass) {
|
||||
Class<? extends Mob> bukkitClass = bukkitMap.get(nmsClass);
|
||||
if (bukkitClass == null) {
|
||||
throw new RuntimeException("Can't figure out applicable bukkit entity for nms entity " + nmsClass); // maybe just return Mob?
|
||||
}
|
||||
return bukkitClass;
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package io.papermc.generator.utils;
|
||||
|
||||
import com.squareup.javapoet.AnnotationSpec;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.papermc.paper.generated.GeneratedFrom;
|
||||
import net.minecraft.SharedConstants;
|
||||
import org.bukkit.MinecraftExperimental;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public final class Annotations {
|
||||
|
||||
public static List<AnnotationSpec> experimentalAnnotations(final MinecraftExperimental.@Nullable Requires requiredFeatureFlag) {
|
||||
final List<AnnotationSpec> annotationSpecs = new ArrayList<>();
|
||||
annotationSpecs.add(AnnotationSpec.builder(ApiStatus.Experimental.class).build());
|
||||
if (requiredFeatureFlag != null) {
|
||||
annotationSpecs.add(AnnotationSpec.builder(MinecraftExperimental.class)
|
||||
.addMember("value", "$T.$L", MinecraftExperimental.Requires.class, requiredFeatureFlag.name())
|
||||
.build());
|
||||
} else {
|
||||
annotationSpecs.add(AnnotationSpec.builder(MinecraftExperimental.class).build());
|
||||
}
|
||||
return annotationSpecs;
|
||||
}
|
||||
|
||||
public static AnnotationSpec deprecatedVersioned(final @Nullable String version, final boolean forRemoval) {
|
||||
final AnnotationSpec.Builder annotationSpec = AnnotationSpec.builder(Deprecated.class);
|
||||
if (forRemoval) {
|
||||
annotationSpec.addMember("forRemoval", "$L", true);
|
||||
}
|
||||
if (version != null) {
|
||||
annotationSpec.addMember("since", "$S", version);
|
||||
}
|
||||
|
||||
return annotationSpec.build();
|
||||
}
|
||||
|
||||
public static AnnotationSpec scheduledRemoval(final @Nullable String version) {
|
||||
return AnnotationSpec.builder(ApiStatus.ScheduledForRemoval.class)
|
||||
.addMember("inVersion", "$S", version)
|
||||
.build();
|
||||
}
|
||||
|
||||
@ApiStatus.Experimental
|
||||
public static final AnnotationSpec EXPERIMENTAL_API_ANNOTATION = AnnotationSpec.builder(ApiStatus.Experimental.class).build();
|
||||
public static final AnnotationSpec NOT_NULL = AnnotationSpec.builder(NonNull.class).build();
|
||||
private static final AnnotationSpec SUPPRESS_WARNINGS = AnnotationSpec.builder(SuppressWarnings.class)
|
||||
.addMember("value", "$S", "unused")
|
||||
.addMember("value", "$S", "SpellCheckingInspection")
|
||||
.build();
|
||||
private static final AnnotationSpec GENERATED_FROM = AnnotationSpec.builder(GeneratedFrom.class)
|
||||
.addMember("value", "$S", SharedConstants.getCurrentVersion().getName())
|
||||
.build();
|
||||
public static final Iterable<AnnotationSpec> CLASS_HEADER = List.of(
|
||||
SUPPRESS_WARNINGS,
|
||||
GENERATED_FROM
|
||||
);
|
||||
|
||||
private Annotations() {
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package io.papermc.generator.utils;
|
||||
|
||||
import com.mojang.serialization.Lifecycle;
|
||||
import io.papermc.generator.Main;
|
||||
import java.util.Set;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.HolderGetter;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.data.worldgen.BootstrapContext;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
|
||||
@DefaultQualifier(NonNull.class)
|
||||
public record CollectingContext<T>(Set<ResourceKey<T>> registered,
|
||||
Registry<T> registry) implements BootstrapContext<T> {
|
||||
|
||||
@Override
|
||||
public Holder.Reference<T> register(final ResourceKey<T> resourceKey, final @NonNull T t, final Lifecycle lifecycle) {
|
||||
this.registered.add(resourceKey);
|
||||
return Holder.Reference.createStandAlone(this.registry.holderOwner(), resourceKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <S> HolderGetter<S> lookup(final ResourceKey<? extends Registry<? extends S>> resourceKey) {
|
||||
return Main.REGISTRY_ACCESS.registryOrThrow(resourceKey).asLookup();
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package io.papermc.generator.utils;
|
||||
|
||||
import java.util.Optional;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import java.util.Comparator;
|
||||
import java.util.Locale;
|
||||
import java.util.OptionalInt;
|
||||
import java.util.function.Function;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public final class Formatting {
|
||||
|
||||
private static final Pattern ILLEGAL_FIELD_CHARACTERS = Pattern.compile("[.-/]");
|
||||
|
||||
public static String formatKeyAsField(String path) {
|
||||
return ILLEGAL_FIELD_CHARACTERS.matcher(path.toUpperCase(Locale.ROOT)).replaceAll("_");
|
||||
}
|
||||
|
||||
public static Optional<String> formatTagKey(String tagDir, String resourcePath) {
|
||||
int tagsIndex = resourcePath.indexOf(tagDir);
|
||||
int dotIndex = resourcePath.lastIndexOf('.');
|
||||
if (tagsIndex == -1 || dotIndex == -1) {
|
||||
return Optional.empty();
|
||||
}
|
||||
return Optional.of(resourcePath.substring(tagsIndex + tagDir.length() + 1, dotIndex)); // namespace/tags/registry_key/[tag_key].json
|
||||
}
|
||||
|
||||
public static Comparator<String> ALPHABETIC_KEY_ORDER = alphabeticKeyOrder(path -> path);
|
||||
|
||||
public static <T> Comparator<T> alphabeticKeyOrder(Function<T, String> mapper) {
|
||||
return (o1, o2) -> {
|
||||
String path1 = mapper.apply(o1);
|
||||
String path2 = mapper.apply(o2);
|
||||
|
||||
OptionalInt trailingInt1 = tryParseTrailingInt(path1);
|
||||
OptionalInt trailingInt2 = tryParseTrailingInt(path2);
|
||||
|
||||
if (trailingInt1.isPresent() && trailingInt2.isPresent()) {
|
||||
return Integer.compare(trailingInt1.getAsInt(), trailingInt2.getAsInt());
|
||||
}
|
||||
|
||||
return path1.compareTo(path2);
|
||||
};
|
||||
}
|
||||
|
||||
private static OptionalInt tryParseTrailingInt(String path) {
|
||||
int delimiterIndex = path.lastIndexOf('_');
|
||||
if (delimiterIndex != -1) {
|
||||
String score = path.substring(delimiterIndex + 1);
|
||||
if (NumberUtils.isDigits(score)) {
|
||||
return OptionalInt.of(Integer.parseInt(score));
|
||||
}
|
||||
}
|
||||
return OptionalInt.empty();
|
||||
}
|
||||
|
||||
private Formatting() {
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package io.papermc.generator.utils;
|
||||
|
||||
public final class Javadocs {
|
||||
|
||||
public static String getVersionDependentClassHeader(String headerIdentifier) {
|
||||
return """
|
||||
Vanilla keys for %s.
|
||||
|
||||
@apiNote The fields provided here are a direct representation of
|
||||
what is available from the vanilla game source. They may be
|
||||
changed (including removals) on any Minecraft version
|
||||
bump, so cross-version compatibility is not provided on the
|
||||
same level as it is on most of the other API.
|
||||
""".formatted(headerIdentifier);
|
||||
}
|
||||
|
||||
public static String getVersionDependentField(String headerIdentifier) {
|
||||
return """
|
||||
%s
|
||||
|
||||
@apiNote This field is version-dependant and may be removed in future Minecraft versions
|
||||
""".formatted(headerIdentifier);
|
||||
}
|
||||
|
||||
private Javadocs() {
|
||||
}
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package io.papermc.generator.utils;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.mojang.logging.LogUtils;
|
||||
import io.papermc.generator.Main;
|
||||
import java.util.Collections;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.BiConsumer;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.server.packs.PackResources;
|
||||
import net.minecraft.server.packs.PackType;
|
||||
import net.minecraft.server.packs.repository.BuiltInPackSource;
|
||||
import net.minecraft.server.packs.resources.MultiPackResourceManager;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
// collect all the tags by grabbing the json from the data-packs
|
||||
// another (probably) way is to hook into the data generator like the typed keys generator
|
||||
public final class TagCollector {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
|
||||
public static Map<TagKey<?>, String> grabExperimental(final MultiPackResourceManager resourceManager) {
|
||||
Map<TagKey<?>, String> result = new IdentityHashMap<>();
|
||||
|
||||
// collect all vanilla tags
|
||||
Multimap<ResourceKey<? extends Registry<?>>, String> vanillaTags = HashMultimap.create();
|
||||
PackResources vanillaPack = resourceManager.listPacks()
|
||||
.filter(packResources -> packResources.packId().equals(BuiltInPackSource.VANILLA_ID))
|
||||
.findFirst()
|
||||
.orElseThrow();
|
||||
collectFromPack(vanillaPack, (entry, path) -> vanillaTags.put(entry.key(), path));
|
||||
|
||||
// then distinct with other data-pack tags to know for sure newly created tags and so experimental one
|
||||
resourceManager.listPacks().forEach(pack -> {
|
||||
String packId = pack.packId();
|
||||
if (packId.equals(BuiltInPackSource.VANILLA_ID)) return;
|
||||
|
||||
collectFromPack(pack, (entry, path) -> {
|
||||
if (vanillaTags.get(entry.key()).contains(path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
result.put(entry.value().getTagNames()
|
||||
.filter(tagKey -> tagKey.location().getPath().equals(path))
|
||||
.findFirst()
|
||||
.orElseThrow(), packId);
|
||||
});
|
||||
});
|
||||
return Collections.unmodifiableMap(result);
|
||||
}
|
||||
|
||||
private static void collectFromPack(PackResources pack, BiConsumer<RegistryAccess.RegistryEntry<?>, String> output) {
|
||||
Set<String> namespaces = pack.getNamespaces(PackType.SERVER_DATA);
|
||||
|
||||
for (String namespace : namespaces) {
|
||||
Main.REGISTRY_ACCESS.registries().forEach(entry -> {
|
||||
// this is probably expensive but can't find another way around and data-pack loader has similar logic
|
||||
// the issue is that registry key can have parent/key (and custom folder too) but tag key can also have parent/key so parsing become a mess
|
||||
// without having at least one of the two values
|
||||
String tagDir = Registries.tagsDirPath(entry.key());
|
||||
pack.listResources(PackType.SERVER_DATA, namespace, tagDir, (id, supplier) -> {
|
||||
Formatting.formatTagKey(tagDir, id.getPath()).ifPresentOrElse(path -> output.accept(entry, path), () -> {
|
||||
LOGGER.warn("Unable to parse the path: {}/{}/{}.json in the data-pack {} into a tag key", namespace, tagDir, id.getPath(), pack.packId());
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private TagCollector() {
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package io.papermc.generator;
|
||||
|
||||
import io.github.classgraph.ClassGraph;
|
||||
import io.github.classgraph.ScanResult;
|
||||
import io.papermc.generator.types.goal.MobGoalNames;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
public class MobGoalConverterTest {
|
||||
|
||||
@Test
|
||||
public void testBukkitMap() {
|
||||
final List<Class<Mob>> classes;
|
||||
try (ScanResult scanResult = new ClassGraph().enableAllInfo().whitelistPackages(Entity.class.getPackageName()).scan()) {
|
||||
classes = scanResult.getSubclasses(Mob.class.getName()).loadClasses(Mob.class);
|
||||
}
|
||||
|
||||
assertFalse(classes.isEmpty(), "There are supposed to be more than 0 mob classes!");
|
||||
|
||||
List<String> missingClasses = new ArrayList<>();
|
||||
for (Class<Mob> nmsClass : classes) {
|
||||
if (!MobGoalNames.bukkitMap.containsKey(nmsClass)) {
|
||||
missingClasses.add(nmsClass.getCanonicalName());
|
||||
}
|
||||
}
|
||||
|
||||
if (!missingClasses.isEmpty()) {
|
||||
fail("Missing some entity classes in the bukkit map: " + String.join(", ", missingClasses));
|
||||
}
|
||||
}
|
||||
}
|
7
paper-api-generator/wideners.at
Normale Datei
7
paper-api-generator/wideners.at
Normale Datei
@ -0,0 +1,7 @@
|
||||
public net/minecraft/server/WorldLoader loadAndReplaceLayer(Lnet/minecraft/server/packs/resources/ResourceManager;Lnet/minecraft/core/LayeredRegistryAccess;Lnet/minecraft/server/RegistryLayer;Ljava/util/List;)Lnet/minecraft/core/LayeredRegistryAccess;
|
||||
|
||||
# for auto-marking experimental stuff
|
||||
public net/minecraft/core/RegistrySetBuilder entries
|
||||
public net/minecraft/core/RegistrySetBuilder$RegistryStub
|
||||
public net/minecraft/data/registries/UpdateOneTwentyOneRegistries BUILDER
|
||||
public net/minecraft/data/registries/VanillaRegistries BUILDER
|
@ -8,7 +8,7 @@ apply if there are changes made to it from upstream - thus notifying us
|
||||
that changes were made.
|
||||
|
||||
diff --git a/.gitignore b/.gitignore
|
||||
index 11038da2e071699d6561a331565db0c8d7850d0e..317acfec5894101294a55abff61819431e6a5e65 100644
|
||||
index 5dd700a956e915c00b25d91dea8d6f285ddab72b..97e78e27ee0eea2c8b24886eeb19164d552323fe 100644
|
||||
--- a/.gitignore
|
||||
+++ b/.gitignore
|
||||
@@ -1,3 +1,5 @@
|
||||
@ -17,7 +17,7 @@ index 11038da2e071699d6561a331565db0c8d7850d0e..317acfec5894101294a55abff6181943
|
||||
# Eclipse stuff
|
||||
/.classpath
|
||||
/.project
|
||||
@@ -31,3 +33,7 @@
|
||||
@@ -32,3 +34,7 @@
|
||||
*.ipr
|
||||
*.iws
|
||||
.idea/
|
||||
@ -27,10 +27,10 @@ index 11038da2e071699d6561a331565db0c8d7850d0e..317acfec5894101294a55abff6181943
|
||||
+/.factorypath
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9686f621c7b837a7a38ffb2fea10ae492b18556d
|
||||
index 0000000000000000000000000000000000000000..6271e2bad0ed937c2c46a8c8fdf186c46b0b620e
|
||||
--- /dev/null
|
||||
+++ b/build.gradle.kts
|
||||
@@ -0,0 +1,81 @@
|
||||
@@ -0,0 +1,91 @@
|
||||
+plugins {
|
||||
+ `java-library`
|
||||
+ `maven-publish`
|
||||
@ -41,25 +41,30 @@ index 0000000000000000000000000000000000000000..9686f621c7b837a7a38ffb2fea10ae49
|
||||
+ withJavadocJar()
|
||||
+}
|
||||
+
|
||||
+val annotationsVersion = "24.1.0"
|
||||
+val bungeeCordChatVersion = "1.20-R0.2"
|
||||
+
|
||||
+dependencies {
|
||||
+ // api dependencies are listed transitively to API consumers
|
||||
+ api("com.google.guava:guava:31.1-jre")
|
||||
+ api("com.google.code.gson:gson:2.10")
|
||||
+ api("net.md-5:bungeecord-chat:1.16-R0.4")
|
||||
+ api("org.yaml:snakeyaml:1.33")
|
||||
+ api("com.google.guava:guava:32.1.2-jre")
|
||||
+ api("com.google.code.gson:gson:2.10.1")
|
||||
+ api("net.md-5:bungeecord-chat:$bungeeCordChatVersion")
|
||||
+ api("org.yaml:snakeyaml:2.2")
|
||||
+ api("org.joml:joml:1.10.5")
|
||||
+
|
||||
+ compileOnly("org.apache.maven:maven-resolver-provider:3.8.5")
|
||||
+ compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.3")
|
||||
+ compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3")
|
||||
+ compileOnly("org.apache.maven:maven-resolver-provider:3.9.6")
|
||||
+ compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18")
|
||||
+ compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18")
|
||||
+
|
||||
+ val annotations = "org.jetbrains:annotations-java5:23.0.0"
|
||||
+ val annotations = "org.jetbrains:annotations-java5:$annotationsVersion"
|
||||
+ compileOnly(annotations)
|
||||
+ testCompileOnly(annotations)
|
||||
+
|
||||
+ testImplementation("org.apache.commons:commons-lang3:3.12.0")
|
||||
+ testImplementation("junit:junit:4.13.2")
|
||||
+ testImplementation("org.hamcrest:hamcrest-library:1.3")
|
||||
+ testImplementation("org.ow2.asm:asm-tree:9.3")
|
||||
+ testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
|
||||
+ testImplementation("org.hamcrest:hamcrest:2.2")
|
||||
+ testImplementation("org.mockito:mockito-core:5.11.0")
|
||||
+ testImplementation("org.ow2.asm:asm-tree:9.7")
|
||||
+}
|
||||
+
|
||||
+configure<PublishingExtension> {
|
||||
@ -95,11 +100,12 @@ index 0000000000000000000000000000000000000000..9686f621c7b837a7a38ffb2fea10ae49
|
||||
+ options.use()
|
||||
+ options.isDocFilesSubDirs = true
|
||||
+ options.links(
|
||||
+ "https://guava.dev/releases/31.0.1-jre/api/docs/",
|
||||
+ "https://javadoc.io/doc/org.yaml/snakeyaml/1.33/",
|
||||
+ "https://javadoc.io/doc/org.jetbrains/annotations-java5/23.0.0/",
|
||||
+ "https://javadoc.io/doc/net.md-5/bungeecord-chat/1.16-R0.4/",
|
||||
+ "https://guava.dev/releases/32.1.2-jre/api/docs/",
|
||||
+ "https://javadoc.io/doc/org.yaml/snakeyaml/2.2/",
|
||||
+ "https://javadoc.io/doc/org.jetbrains/annotations-java5/$annotationsVersion/",
|
||||
+ "https://javadoc.io/doc/net.md-5/bungeecord-chat/$bungeeCordChatVersion/",
|
||||
+ )
|
||||
+ options.tags("apiNote:a:API Note:")
|
||||
+
|
||||
+ // workaround for https://github.com/gradle/gradle/issues/4046
|
||||
+ inputs.dir("src/main/javadoc").withPropertyName("javadoc-sourceset")
|
||||
@ -112,12 +118,16 @@ index 0000000000000000000000000000000000000000..9686f621c7b837a7a38ffb2fea10ae49
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+tasks.test {
|
||||
+ useJUnitPlatform()
|
||||
+}
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
deleted file mode 100644
|
||||
index 389f3761876d2a667309d317d1a99b545f36771a..0000000000000000000000000000000000000000
|
||||
index 2c5ac393cffbe61330c5aa95115e7e906c0775d3..0000000000000000000000000000000000000000
|
||||
--- a/pom.xml
|
||||
+++ /dev/null
|
||||
@@ -1,252 +0,0 @@
|
||||
@@ -1,267 +0,0 @@
|
||||
-
|
||||
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
@ -125,7 +135,7 @@ index 389f3761876d2a667309d317d1a99b545f36771a..00000000000000000000000000000000
|
||||
-
|
||||
- <groupId>org.spigotmc</groupId>
|
||||
- <artifactId>spigot-api</artifactId>
|
||||
- <version>1.19.3-R0.1-SNAPSHOT</version>
|
||||
- <version>1.21.1-R0.1-SNAPSHOT</version>
|
||||
- <packaging>jar</packaging>
|
||||
-
|
||||
- <name>Spigot-API</name>
|
||||
@ -134,8 +144,7 @@ index 389f3761876d2a667309d317d1a99b545f36771a..00000000000000000000000000000000
|
||||
-
|
||||
- <properties>
|
||||
- <skipTests>true</skipTests>
|
||||
- <maven.compiler.source>1.8</maven.compiler.source>
|
||||
- <maven.compiler.target>1.8</maven.compiler.target>
|
||||
- <maven.compiler.release>17</maven.compiler.release>
|
||||
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
- </properties>
|
||||
-
|
||||
@ -155,72 +164,85 @@ index 389f3761876d2a667309d317d1a99b545f36771a..00000000000000000000000000000000
|
||||
- <dependency>
|
||||
- <groupId>com.google.guava</groupId>
|
||||
- <artifactId>guava</artifactId>
|
||||
- <version>31.1-jre</version>
|
||||
- <version>32.1.2-jre</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <!-- bundled with Minecraft, should be kept in sync -->
|
||||
- <dependency>
|
||||
- <groupId>com.google.code.gson</groupId>
|
||||
- <artifactId>gson</artifactId>
|
||||
- <version>2.10</version>
|
||||
- <version>2.10.1</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <!-- bundled with Minecraft, should be kept in sync -->
|
||||
- <dependency>
|
||||
- <groupId>org.joml</groupId>
|
||||
- <artifactId>joml</artifactId>
|
||||
- <version>1.10.5</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>net.md-5</groupId>
|
||||
- <artifactId>bungeecord-chat</artifactId>
|
||||
- <version>1.16-R0.4</version>
|
||||
- <version>1.20-R0.2</version>
|
||||
- <type>jar</type>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>org.yaml</groupId>
|
||||
- <artifactId>snakeyaml</artifactId>
|
||||
- <version>1.33</version>
|
||||
- <version>2.2</version>
|
||||
- <scope>compile</scope>
|
||||
- </dependency>
|
||||
- <!-- not part of the API proper -->
|
||||
- <dependency>
|
||||
- <groupId>org.apache.maven</groupId>
|
||||
- <artifactId>maven-resolver-provider</artifactId>
|
||||
- <version>3.8.5</version>
|
||||
- <version>3.9.6</version>
|
||||
- <scope>provided</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>org.apache.maven.resolver</groupId>
|
||||
- <artifactId>maven-resolver-connector-basic</artifactId>
|
||||
- <version>1.7.3</version>
|
||||
- <version>1.9.18</version>
|
||||
- <scope>provided</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>org.apache.maven.resolver</groupId>
|
||||
- <artifactId>maven-resolver-transport-http</artifactId>
|
||||
- <version>1.7.3</version>
|
||||
- <version>1.9.18</version>
|
||||
- <scope>provided</scope>
|
||||
- </dependency>
|
||||
- <!-- annotations -->
|
||||
- <dependency>
|
||||
- <groupId>org.jetbrains</groupId>
|
||||
- <artifactId>annotations-java5</artifactId>
|
||||
- <version>23.0.0</version>
|
||||
- <version>24.1.0</version>
|
||||
- <scope>provided</scope>
|
||||
- </dependency>
|
||||
- <!-- testing -->
|
||||
- <dependency>
|
||||
- <groupId>junit</groupId>
|
||||
- <artifactId>junit</artifactId>
|
||||
- <version>4.13.2</version>
|
||||
- <groupId>org.junit.jupiter</groupId>
|
||||
- <artifactId>junit-jupiter</artifactId>
|
||||
- <version>5.10.2</version>
|
||||
- <scope>test</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>org.hamcrest</groupId>
|
||||
- <artifactId>hamcrest-library</artifactId>
|
||||
- <version>1.3</version>
|
||||
- <artifactId>hamcrest</artifactId>
|
||||
- <version>2.2</version>
|
||||
- <scope>test</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>org.mockito</groupId>
|
||||
- <artifactId>mockito-core</artifactId>
|
||||
- <version>5.11.0</version>
|
||||
- <scope>test</scope>
|
||||
- </dependency>
|
||||
- <dependency>
|
||||
- <groupId>org.ow2.asm</groupId>
|
||||
- <artifactId>asm-tree</artifactId>
|
||||
- <version>9.3</version>
|
||||
- <version>9.7</version>
|
||||
- <scope>test</scope>
|
||||
- </dependency>
|
||||
- </dependencies>
|
||||
@ -230,7 +252,7 @@ index 389f3761876d2a667309d317d1a99b545f36771a..00000000000000000000000000000000
|
||||
- <plugin>
|
||||
- <groupId>net.md-5</groupId>
|
||||
- <artifactId>scriptus</artifactId>
|
||||
- <version>0.4.1</version>
|
||||
- <version>0.5.0</version>
|
||||
- <executions>
|
||||
- <execution>
|
||||
- <phase>initialize</phase>
|
||||
@ -243,23 +265,16 @@ index 389f3761876d2a667309d317d1a99b545f36771a..00000000000000000000000000000000
|
||||
- <plugin>
|
||||
- <groupId>org.apache.maven.plugins</groupId>
|
||||
- <artifactId>maven-compiler-plugin</artifactId>
|
||||
- <version>3.10.1</version>
|
||||
- <version>3.13.0</version>
|
||||
- <configuration>
|
||||
- <!-- we use the Eclipse compiler as it doesn't need a JDK -->
|
||||
- <compilerId>eclipse</compilerId>
|
||||
- <!-- default changed with version 3.11.0 -->
|
||||
- <showWarnings>false</showWarnings>
|
||||
- </configuration>
|
||||
- <dependencies>
|
||||
- <dependency>
|
||||
- <groupId>org.codehaus.plexus</groupId>
|
||||
- <artifactId>plexus-compiler-eclipse</artifactId>
|
||||
- <version>2.12.0</version>
|
||||
- </dependency>
|
||||
- </dependencies>
|
||||
- </plugin>
|
||||
- <plugin>
|
||||
- <groupId>org.apache.maven.plugins</groupId>
|
||||
- <artifactId>maven-jar-plugin</artifactId>
|
||||
- <version>3.2.2</version>
|
||||
- <version>3.4.1</version>
|
||||
- <configuration>
|
||||
- <archive>
|
||||
- <manifest>
|
||||
@ -274,7 +289,7 @@ index 389f3761876d2a667309d317d1a99b545f36771a..00000000000000000000000000000000
|
||||
- <plugin>
|
||||
- <groupId>org.apache.maven.plugins</groupId>
|
||||
- <artifactId>maven-shade-plugin</artifactId>
|
||||
- <version>3.2.4</version>
|
||||
- <version>3.5.3</version>
|
||||
- <executions>
|
||||
- <execution>
|
||||
- <phase>package</phase>
|
||||
@ -294,21 +309,32 @@ index 389f3761876d2a667309d317d1a99b545f36771a..00000000000000000000000000000000
|
||||
- </filters>
|
||||
- <!-- when downloading via Maven we can pull depends individually -->
|
||||
- <shadedArtifactAttached>true</shadedArtifactAttached>
|
||||
- <!-- In 3.3.0 and later, shadedArtifactAttached causes dependant projects to use dependency reduced pom (bug?) -->
|
||||
- <createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
- </configuration>
|
||||
- </plugin>
|
||||
- <plugin>
|
||||
- <groupId>org.apache.maven.plugins</groupId>
|
||||
- <artifactId>maven-javadoc-plugin</artifactId>
|
||||
- <version>3.4.0</version>
|
||||
- <version>3.6.3</version>
|
||||
- <configuration>
|
||||
- <links>
|
||||
- <link>https://guava.dev/releases/31.0.1-jre/api/docs/</link>
|
||||
- <link>https://javadoc.io/doc/org.yaml/snakeyaml/1.30/</link>
|
||||
- <link>https://javadoc.io/doc/org.jetbrains/annotations-java5/23.0.0/</link>
|
||||
- <link>https://javadoc.io/doc/net.md-5/bungeecord-chat/1.16-R0.4/</link>
|
||||
- <link>https://guava.dev/releases/32.1.2-jre/api/docs/</link>
|
||||
- </links>
|
||||
- <tags>
|
||||
- <tag>
|
||||
- <name>apiNote</name>
|
||||
- <placement>a</placement>
|
||||
- <head>API Note:</head>
|
||||
- </tag>
|
||||
- </tags>
|
||||
- </configuration>
|
||||
- </plugin>
|
||||
- <plugin>
|
||||
- <groupId>org.apache.maven.plugins</groupId>
|
||||
- <artifactId>maven-surefire-plugin</artifactId>
|
||||
- <version>3.2.5</version>
|
||||
- </plugin>
|
||||
- </plugins>
|
||||
- </build>
|
||||
-
|
||||
@ -323,7 +349,7 @@ index 389f3761876d2a667309d317d1a99b545f36771a..00000000000000000000000000000000
|
||||
- <plugin>
|
||||
- <groupId>org.apache.maven.plugins</groupId>
|
||||
- <artifactId>maven-checkstyle-plugin</artifactId>
|
||||
- <version>3.1.2</version>
|
||||
- <version>3.3.1</version>
|
||||
- <executions>
|
||||
- <execution>
|
||||
- <phase>process-classes</phase>
|
||||
@ -334,7 +360,6 @@ index 389f3761876d2a667309d317d1a99b545f36771a..00000000000000000000000000000000
|
||||
- </executions>
|
||||
- <configuration>
|
||||
- <configLocation>checkstyle.xml</configLocation>
|
||||
- <suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
|
||||
- <includeTestSourceDirectory>true</includeTestSourceDirectory>
|
||||
- </configuration>
|
||||
- <dependencies>
|
||||
@ -348,7 +373,7 @@ index 389f3761876d2a667309d317d1a99b545f36771a..00000000000000000000000000000000
|
||||
- <plugin>
|
||||
- <groupId>org.codehaus.mojo</groupId>
|
||||
- <artifactId>animal-sniffer-maven-plugin</artifactId>
|
||||
- <version>1.21</version>
|
||||
- <version>1.23</version>
|
||||
- <executions>
|
||||
- <execution>
|
||||
- <phase>process-classes</phase>
|
||||
|
@ -5,50 +5,54 @@ Subject: [PATCH] Build system changes
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 9686f621c7b837a7a38ffb2fea10ae492b18556d..2b3288057d67e5add4e22e6b7072527057bcd808 100644
|
||||
index 6271e2bad0ed937c2c46a8c8fdf186c46b0b620e..a918fd14c95e714e935758d60bccd72755e00b11 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -14,15 +14,27 @@ dependencies {
|
||||
api("com.google.code.gson:gson:2.10")
|
||||
api("net.md-5:bungeecord-chat:1.16-R0.4")
|
||||
api("org.yaml:snakeyaml:1.33")
|
||||
@@ -18,15 +18,26 @@ dependencies {
|
||||
api("net.md-5:bungeecord-chat:$bungeeCordChatVersion")
|
||||
api("org.yaml:snakeyaml:2.2")
|
||||
api("org.joml:joml:1.10.5")
|
||||
+ // Paper start
|
||||
+ api("com.googlecode.json-simple:json-simple:1.1.1") {
|
||||
+ isTransitive = false // includes junit
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
compileOnly("org.apache.maven:maven-resolver-provider:3.8.5")
|
||||
compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.7.3")
|
||||
compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.7.3")
|
||||
+ compileOnly("com.google.code.findbugs:jsr305:1.3.9") // Paper
|
||||
compileOnly("org.apache.maven:maven-resolver-provider:3.9.6")
|
||||
compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18")
|
||||
compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18")
|
||||
|
||||
- val annotations = "org.jetbrains:annotations-java5:23.0.0"
|
||||
+ val annotations = "org.jetbrains:annotations:23.0.0" // Paper - we don't want Java 5 annotations...
|
||||
- val annotations = "org.jetbrains:annotations-java5:$annotationsVersion"
|
||||
+ val annotations = "org.jetbrains:annotations:$annotationsVersion" // Paper - we don't want Java 5 annotations...
|
||||
compileOnly(annotations)
|
||||
testCompileOnly(annotations)
|
||||
|
||||
+ // Paper start - add checker
|
||||
+ val checkerQual = "org.checkerframework:checker-qual:3.21.0"
|
||||
+ val checkerQual = "org.checkerframework:checker-qual:3.33.0"
|
||||
+ compileOnlyApi(checkerQual)
|
||||
+ testCompileOnly(checkerQual)
|
||||
+ // Paper end
|
||||
+
|
||||
testImplementation("org.apache.commons:commons-lang3:3.12.0")
|
||||
testImplementation("junit:junit:4.13.2")
|
||||
testImplementation("org.hamcrest:hamcrest-library:1.3")
|
||||
@@ -64,7 +76,7 @@ tasks.withType<Javadoc> {
|
||||
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
|
||||
testImplementation("org.hamcrest:hamcrest:2.2")
|
||||
@@ -69,8 +80,12 @@ tasks.withType<Javadoc> {
|
||||
options.links(
|
||||
"https://guava.dev/releases/31.0.1-jre/api/docs/",
|
||||
"https://javadoc.io/doc/org.yaml/snakeyaml/1.33/",
|
||||
- "https://javadoc.io/doc/org.jetbrains/annotations-java5/23.0.0/",
|
||||
+ "https://javadoc.io/doc/org.jetbrains/annotations/23.0.0/", // Paper - we don't want Java 5 annotations
|
||||
"https://javadoc.io/doc/net.md-5/bungeecord-chat/1.16-R0.4/",
|
||||
"https://guava.dev/releases/32.1.2-jre/api/docs/",
|
||||
"https://javadoc.io/doc/org.yaml/snakeyaml/2.2/",
|
||||
- "https://javadoc.io/doc/org.jetbrains/annotations-java5/$annotationsVersion/",
|
||||
+ "https://javadoc.io/doc/org.jetbrains/annotations/$annotationsVersion/", // Paper - we don't want Java 5 annotations
|
||||
"https://javadoc.io/doc/net.md-5/bungeecord-chat/$bungeeCordChatVersion/",
|
||||
+ // Paper start - add missing javadoc links
|
||||
+ "https://javadoc.io/doc/org.joml/joml/1.10.5/index.html",
|
||||
+ "https://www.javadoc.io/doc/com.google.code.gson/gson/2.10.1",
|
||||
+ // Paper end
|
||||
)
|
||||
options.tags("apiNote:a:API Note:")
|
||||
|
||||
@@ -79,3 +91,14 @@ tasks.withType<Javadoc> {
|
||||
}
|
||||
}
|
||||
@@ -89,3 +104,14 @@ tasks.withType<Javadoc> {
|
||||
tasks.test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
+
|
||||
+// Paper start
|
||||
|
@ -3,54 +3,31 @@ From: Shane Freeder <theboyetronic@gmail.com>
|
||||
Date: Sun, 17 Mar 2019 23:04:30 +0000
|
||||
Subject: [PATCH] Test changes
|
||||
|
||||
- convert to mockito for mocking of types
|
||||
- Allow use of TYPE_USE annotations
|
||||
- Ignore package-private methods for nullability annotations
|
||||
- Add excludes for classes which don't pass
|
||||
- Disable stupid BukkitMirrorTest
|
||||
|
||||
Co-authored-by: Riley Park <rileysebastianpark@gmail.com>
|
||||
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 2b3288057d67e5add4e22e6b7072527057bcd808..4b3453f8dab6008b6fad6245fb7205da33b4bfb8 100644
|
||||
index a918fd14c95e714e935758d60bccd72755e00b11..768024b2b4584fd7dd86f068c0e79c89ffc5faa1 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -34,6 +34,7 @@ dependencies {
|
||||
compileOnlyApi(checkerQual)
|
||||
testCompileOnly(checkerQual)
|
||||
// Paper end
|
||||
+ testImplementation("org.mockito:mockito-core:4.9.0") // Paper - add mockito
|
||||
@@ -105,6 +105,12 @@ tasks.test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
testImplementation("org.apache.commons:commons-lang3:3.12.0")
|
||||
testImplementation("junit:junit:4.13.2")
|
||||
diff --git a/src/test/java/io/papermc/paper/testing/EmptyRegistry.java b/src/test/java/io/papermc/paper/testing/EmptyRegistry.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ba9ddce87a9f385e729a5c2cf7c5eec120e388a7
|
||||
--- /dev/null
|
||||
+++ b/src/test/java/io/papermc/paper/testing/EmptyRegistry.java
|
||||
@@ -0,0 +1,23 @@
|
||||
+package io.papermc.paper.testing;
|
||||
+
|
||||
+import java.util.Collections;
|
||||
+import java.util.Iterator;
|
||||
+import org.bukkit.Keyed;
|
||||
+import org.bukkit.NamespacedKey;
|
||||
+import org.bukkit.Registry;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+public record EmptyRegistry() implements Registry<Keyed> {
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public Iterator<Keyed> iterator() {
|
||||
+ return Collections.emptyIterator();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @Nullable Keyed get(@NotNull final NamespacedKey key) {
|
||||
+ return null;
|
||||
+ }
|
||||
+// Paper start - compile tests with -parameters for better junit parameterized test names
|
||||
+tasks.compileTestJava {
|
||||
+ options.compilerArgs.add("-parameters")
|
||||
+}
|
||||
+// Paper end
|
||||
+
|
||||
// Paper start
|
||||
val scanJar = tasks.register("scanJarForBadCalls", io.papermc.paperweight.tasks.ScanJarForBadCalls::class) {
|
||||
badAnnotations.add("Lio/papermc/paper/annotation/DoNotUse;")
|
||||
diff --git a/src/test/java/io/papermc/paper/testing/EmptyTag.java b/src/test/java/io/papermc/paper/testing/EmptyTag.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..77154095cfb8b259bdb318e8ff40cb6f559ebc18
|
||||
@ -88,65 +65,26 @@ index 0000000000000000000000000000000000000000..77154095cfb8b259bdb318e8ff40cb6f
|
||||
+ return Collections.emptySet();
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/test/java/io/papermc/paper/testing/TestServer.java b/src/test/java/io/papermc/paper/testing/TestServer.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..756acf231b1b076b08046d86992ba7ce7f62a94f
|
||||
--- /dev/null
|
||||
+++ b/src/test/java/io/papermc/paper/testing/TestServer.java
|
||||
@@ -0,0 +1,48 @@
|
||||
+package io.papermc.paper.testing;
|
||||
+
|
||||
+import java.util.logging.Logger;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.NamespacedKey;
|
||||
+import org.bukkit.Server;
|
||||
+import org.bukkit.command.SimpleCommandMap;
|
||||
+import org.bukkit.plugin.PluginManager;
|
||||
+import org.bukkit.plugin.SimplePluginManager;
|
||||
+
|
||||
+import static org.mockito.ArgumentMatchers.anyString;
|
||||
+import static org.mockito.Mockito.any;
|
||||
+import static org.mockito.Mockito.mock;
|
||||
+import static org.mockito.Mockito.when;
|
||||
+
|
||||
+public final class TestServer {
|
||||
+
|
||||
+ @SuppressWarnings("removal")
|
||||
+ public static void setup() {
|
||||
+ //noinspection ConstantValue
|
||||
+ if (Bukkit.getServer() != null) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ final Server dummyServer = mock(Server.class);
|
||||
+
|
||||
+ final Logger logger = Logger.getLogger(TestServer.class.getCanonicalName());
|
||||
+ when(dummyServer.getLogger()).thenReturn(logger);
|
||||
+ when(dummyServer.getName()).thenReturn(TestServer.class.getSimpleName());
|
||||
+ when(dummyServer.getVersion()).thenReturn("Version_" + TestServer.class.getPackage().getImplementationVersion());
|
||||
+ when(dummyServer.getBukkitVersion()).thenReturn("BukkitVersion_" + TestServer.class.getPackage().getImplementationVersion());
|
||||
+
|
||||
+
|
||||
+ final Thread currentThread = Thread.currentThread();
|
||||
+ when(dummyServer.isPrimaryThread()).thenAnswer(ignored -> Thread.currentThread().equals(currentThread));
|
||||
+
|
||||
+ when(dummyServer.getTag(anyString(), any(NamespacedKey.class), any())).thenAnswer(ignored -> new EmptyTag());
|
||||
+
|
||||
+ final PluginManager pluginManager = new SimplePluginManager(dummyServer, new SimpleCommandMap(dummyServer));
|
||||
+ when(dummyServer.getPluginManager()).thenReturn(pluginManager);
|
||||
+
|
||||
+ when(dummyServer.getRegistry(any())).thenAnswer(ignored -> new EmptyRegistry());
|
||||
+ when(dummyServer.getScoreboardCriteria(anyString())).thenReturn(null);
|
||||
+
|
||||
+ Bukkit.setServer(dummyServer);
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java
|
||||
index 4ac3dd977e75cd8464163351d306e037ee32cb48..8f35cda0d67ec66646c6096a5bf1c84891b8b0fd 100644
|
||||
index 64e7aef6220097edefdff3b98a771b988365930d..d9091ba1e5a55e03adca98305233cce9d6888609 100644
|
||||
--- a/src/test/java/org/bukkit/AnnotationTest.java
|
||||
+++ b/src/test/java/org/bukkit/AnnotationTest.java
|
||||
@@ -40,7 +40,17 @@ public class AnnotationTest {
|
||||
@@ -29,7 +29,13 @@ public class AnnotationTest {
|
||||
"Lorg/jetbrains/annotations/Nullable;",
|
||||
"Lorg/jetbrains/annotations/NotNull;",
|
||||
"Lorg/jetbrains/annotations/Contract;",
|
||||
- "Lorg/bukkit/UndefinedNullability;"
|
||||
+ "Lorg/bukkit/UndefinedNullability;",
|
||||
+ // Paper start
|
||||
+ "Lorg/checkerframework/checker/nullness/qual/MonotonicNonNull;",
|
||||
+ "Lorg/checkerframework/checker/nullness/qual/NonNull;",
|
||||
+ "Lorg/checkerframework/checker/nullness/qual/Nullable;",
|
||||
+ "Lorg/checkerframework/checker/nullness/qual/PolyNull;",
|
||||
+ // Paper end
|
||||
};
|
||||
|
||||
private static final String[] EXCLUDED_CLASSES = {
|
||||
@@ -40,7 +46,17 @@ public class AnnotationTest {
|
||||
"org/bukkit/util/io/Wrapper",
|
||||
"org/bukkit/plugin/java/PluginClassLoader",
|
||||
// Generic functional interface
|
||||
@ -165,7 +103,7 @@ index 4ac3dd977e75cd8464163351d306e037ee32cb48..8f35cda0d67ec66646c6096a5bf1c848
|
||||
};
|
||||
|
||||
@Test
|
||||
@@ -67,14 +77,40 @@ public class AnnotationTest {
|
||||
@@ -67,14 +83,48 @@ public class AnnotationTest {
|
||||
}
|
||||
|
||||
if (mustBeAnnotated(Type.getReturnType(method.desc)) && !isWellAnnotated(method.invisibleAnnotations)) {
|
||||
@ -176,7 +114,7 @@ index 4ac3dd977e75cd8464163351d306e037ee32cb48..8f35cda0d67ec66646c6096a5bf1c848
|
||||
+ } else if (method.invisibleTypeAnnotations != null) {
|
||||
+ dance: for (final org.objectweb.asm.tree.TypeAnnotationNode invisibleTypeAnnotation : method.invisibleTypeAnnotations) {
|
||||
+ final org.objectweb.asm.TypeReference ref = new org.objectweb.asm.TypeReference(invisibleTypeAnnotation.typeRef);
|
||||
+ if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_RETURN && java.util.Arrays.binarySearch(ACCEPTED_ANNOTATIONS, invisibleTypeAnnotation.desc) >= 0) {
|
||||
+ if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_RETURN && java.util.Arrays.asList(ACCEPTED_ANNOTATIONS).contains(invisibleTypeAnnotation.desc)) {
|
||||
+ warn = false;
|
||||
+ break dance; // cha cha real smooth
|
||||
+ }
|
||||
@ -197,7 +135,15 @@ index 4ac3dd977e75cd8464163351d306e037ee32cb48..8f35cda0d67ec66646c6096a5bf1c848
|
||||
+ if (method.invisibleTypeAnnotations != null) {
|
||||
+ for (final org.objectweb.asm.tree.TypeAnnotationNode invisibleTypeAnnotation : method.invisibleTypeAnnotations) {
|
||||
+ final org.objectweb.asm.TypeReference ref = new org.objectweb.asm.TypeReference(invisibleTypeAnnotation.typeRef);
|
||||
+ if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_FORMAL_PARAMETER && ref.getTypeParameterIndex() == i && java.util.Arrays.binarySearch(ACCEPTED_ANNOTATIONS, invisibleTypeAnnotation.desc) >= 0) {
|
||||
+ if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_FORMAL_PARAMETER && ref.getTypeParameterIndex() == i && java.util.Arrays.asList(ACCEPTED_ANNOTATIONS).contains(invisibleTypeAnnotation.desc)) {
|
||||
+ continue dancing;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ if (method.visibleTypeAnnotations != null) {
|
||||
+ for (final org.objectweb.asm.tree.TypeAnnotationNode invisibleTypeAnnotation : method.visibleTypeAnnotations) {
|
||||
+ final org.objectweb.asm.TypeReference ref = new org.objectweb.asm.TypeReference(invisibleTypeAnnotation.typeRef);
|
||||
+ if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_FORMAL_PARAMETER && ref.getTypeParameterIndex() == i && java.util.Arrays.asList(ACCEPTED_ANNOTATIONS).contains(invisibleTypeAnnotation.desc)) {
|
||||
+ continue dancing;
|
||||
+ }
|
||||
+ }
|
||||
@ -206,7 +152,7 @@ index 4ac3dd977e75cd8464163351d306e037ee32cb48..8f35cda0d67ec66646c6096a5bf1c848
|
||||
ParameterNode paramNode = parameters == null ? null : parameters.get(i);
|
||||
String paramName = paramNode == null ? null : paramNode.name;
|
||||
|
||||
@@ -91,13 +127,18 @@ public class AnnotationTest {
|
||||
@@ -91,13 +141,18 @@ public class AnnotationTest {
|
||||
|
||||
Collections.sort(errors);
|
||||
|
||||
@ -224,12 +170,12 @@ index 4ac3dd977e75cd8464163351d306e037ee32cb48..8f35cda0d67ec66646c6096a5bf1c848
|
||||
+ builder.append("\t").append(message).append("\n");
|
||||
}
|
||||
|
||||
- Assert.fail("There " + errors.size() + " are missing annotation(s)");
|
||||
+ Assert.fail(builder.toString());
|
||||
- fail("There " + errors.size() + " are missing annotation(s)");
|
||||
+ fail(builder.toString());
|
||||
}
|
||||
|
||||
private static void collectClasses(@NotNull File from, @NotNull Map<String, ClassNode> to) throws IOException {
|
||||
@@ -140,6 +181,11 @@ public class AnnotationTest {
|
||||
@@ -140,6 +195,11 @@ public class AnnotationTest {
|
||||
// Exceptions are excluded
|
||||
return false;
|
||||
}
|
||||
@ -241,7 +187,7 @@ index 4ac3dd977e75cd8464163351d306e037ee32cb48..8f35cda0d67ec66646c6096a5bf1c848
|
||||
|
||||
for (String excludedClass : EXCLUDED_CLASSES) {
|
||||
if (excludedClass.equals(clazz.name)) {
|
||||
@@ -152,7 +198,7 @@ public class AnnotationTest {
|
||||
@@ -152,7 +212,7 @@ public class AnnotationTest {
|
||||
|
||||
private static boolean isMethodIncluded(@NotNull ClassNode clazz, @NotNull MethodNode method, @NotNull Map<String, ClassNode> allClasses) {
|
||||
// Exclude private, synthetic and deprecated methods
|
||||
@ -250,7 +196,7 @@ index 4ac3dd977e75cd8464163351d306e037ee32cb48..8f35cda0d67ec66646c6096a5bf1c848
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -170,11 +216,30 @@ public class AnnotationTest {
|
||||
@@ -170,11 +230,30 @@ public class AnnotationTest {
|
||||
if ("<init>".equals(method.name) && isAnonymous(clazz)) {
|
||||
return false;
|
||||
}
|
||||
@ -282,232 +228,31 @@ index 4ac3dd977e75cd8464163351d306e037ee32cb48..8f35cda0d67ec66646c6096a5bf1c848
|
||||
if (annotations == null) {
|
||||
return false;
|
||||
}
|
||||
diff --git a/src/test/java/org/bukkit/TestServer.java b/src/test/java/org/bukkit/TestServer.java
|
||||
deleted file mode 100644
|
||||
index 701a17c10f31cd345238a3c568264178ce372faa..0000000000000000000000000000000000000000
|
||||
--- a/src/test/java/org/bukkit/TestServer.java
|
||||
+++ /dev/null
|
||||
@@ -1,139 +0,0 @@
|
||||
-package org.bukkit;
|
||||
-
|
||||
-import com.google.common.collect.ImmutableMap;
|
||||
-import java.lang.reflect.InvocationHandler;
|
||||
-import java.lang.reflect.Method;
|
||||
-import java.lang.reflect.Proxy;
|
||||
-import java.util.Iterator;
|
||||
-import java.util.Map;
|
||||
-import java.util.logging.Logger;
|
||||
-import org.bukkit.command.SimpleCommandMap;
|
||||
-import org.bukkit.plugin.PluginManager;
|
||||
-import org.bukkit.plugin.SimplePluginManager;
|
||||
-import org.jetbrains.annotations.NotNull;
|
||||
-import org.jetbrains.annotations.Nullable;
|
||||
-
|
||||
-public final class TestServer implements InvocationHandler {
|
||||
- private static interface MethodHandler {
|
||||
- Object handle(TestServer server, Object[] args);
|
||||
- }
|
||||
-
|
||||
- private static final Map<Method, MethodHandler> methods;
|
||||
-
|
||||
- static {
|
||||
- try {
|
||||
- ImmutableMap.Builder<Method, MethodHandler> methodMap = ImmutableMap.builder();
|
||||
- methodMap.put(
|
||||
- Server.class.getMethod("isPrimaryThread"),
|
||||
- new MethodHandler() {
|
||||
- @Override
|
||||
- public Object handle(TestServer server, Object[] args) {
|
||||
- return Thread.currentThread().equals(server.creatingThread);
|
||||
- }
|
||||
- }
|
||||
- );
|
||||
- methodMap.put(
|
||||
- Server.class.getMethod("getPluginManager"),
|
||||
- new MethodHandler() {
|
||||
- @Override
|
||||
- public Object handle(TestServer server, Object[] args) {
|
||||
- return server.pluginManager;
|
||||
- }
|
||||
- }
|
||||
- );
|
||||
- methodMap.put(
|
||||
- Server.class.getMethod("getLogger"),
|
||||
- new MethodHandler() {
|
||||
- final Logger logger = Logger.getLogger(TestServer.class.getCanonicalName());
|
||||
- @Override
|
||||
- public Object handle(TestServer server, Object[] args) {
|
||||
- return logger;
|
||||
- }
|
||||
- }
|
||||
- );
|
||||
- methodMap.put(
|
||||
- Server.class.getMethod("getName"),
|
||||
- new MethodHandler() {
|
||||
- @Override
|
||||
- public Object handle(TestServer server, Object[] args) {
|
||||
- return TestServer.class.getSimpleName();
|
||||
- }
|
||||
- }
|
||||
- );
|
||||
- methodMap.put(
|
||||
- Server.class.getMethod("getVersion"),
|
||||
- new MethodHandler() {
|
||||
- @Override
|
||||
- public Object handle(TestServer server, Object[] args) {
|
||||
- return "Version_" + TestServer.class.getPackage().getImplementationVersion();
|
||||
- }
|
||||
- }
|
||||
- );
|
||||
- methodMap.put(
|
||||
- Server.class.getMethod("getBukkitVersion"),
|
||||
- new MethodHandler() {
|
||||
- @Override
|
||||
- public Object handle(TestServer server, Object[] args) {
|
||||
- return "BukkitVersion_" + TestServer.class.getPackage().getImplementationVersion();
|
||||
- }
|
||||
- }
|
||||
- );
|
||||
- methodMap.put(
|
||||
- Server.class.getMethod("getRegistry", Class.class),
|
||||
- new MethodHandler() {
|
||||
- @Override
|
||||
- public Object handle(TestServer server, Object[] args) {
|
||||
- return new Registry() {
|
||||
- @NotNull
|
||||
- @Override
|
||||
- public Iterator iterator() {
|
||||
- return null;
|
||||
- }
|
||||
-
|
||||
- @Nullable
|
||||
- @Override
|
||||
- public Keyed get(@NotNull NamespacedKey key) {
|
||||
- return null;
|
||||
- }
|
||||
- };
|
||||
- }
|
||||
- }
|
||||
- );
|
||||
- methodMap.put(
|
||||
- Server.class.getMethod("getScoreboardCriteria", String.class),
|
||||
- new MethodHandler() {
|
||||
- @Override
|
||||
- public Object handle(TestServer server, Object[] args) {
|
||||
- // Does not need to return anything. Exists solely to test CriteriaTest which has static init fields
|
||||
- return null;
|
||||
- }
|
||||
- }
|
||||
- );
|
||||
- methods = methodMap.build();
|
||||
-
|
||||
- TestServer server = new TestServer();
|
||||
- Server instance = Proxy.getProxyClass(Server.class.getClassLoader(), Server.class).asSubclass(Server.class).getConstructor(InvocationHandler.class).newInstance(server);
|
||||
- Bukkit.setServer(instance);
|
||||
- server.pluginManager = new SimplePluginManager(instance, new SimpleCommandMap(instance));
|
||||
- } catch (Throwable t) {
|
||||
- throw new Error(t);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- private Thread creatingThread = Thread.currentThread();
|
||||
- private PluginManager pluginManager;
|
||||
- private TestServer() {};
|
||||
-
|
||||
- public static Server getInstance() {
|
||||
- return Bukkit.getServer();
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public Object invoke(Object proxy, Method method, Object[] args) {
|
||||
- MethodHandler handler = methods.get(method);
|
||||
- if (handler != null) {
|
||||
- return handler.handle(this, args);
|
||||
- }
|
||||
- throw new UnsupportedOperationException(String.valueOf(method));
|
||||
- }
|
||||
-}
|
||||
diff --git a/src/test/java/org/bukkit/TestWorld.java b/src/test/java/org/bukkit/TestWorld.java
|
||||
index ab34f1199921d415fa2ca6e281a8125c9e6d7173..f64d024f5bbf9482aaddb56597b23b04c66f21bf 100644
|
||||
--- a/src/test/java/org/bukkit/TestWorld.java
|
||||
+++ b/src/test/java/org/bukkit/TestWorld.java
|
||||
@@ -18,7 +18,7 @@ public final class TestWorld implements InvocationHandler {
|
||||
diff --git a/src/test/java/org/bukkit/BukkitMirrorTest.java b/src/test/java/org/bukkit/BukkitMirrorTest.java
|
||||
index 89ca06ebecdaadd5dfc7bc74473ca15ad36f6eff..5974ceea58940e1799f3589eac0e39b925a42c3b 100644
|
||||
--- a/src/test/java/org/bukkit/BukkitMirrorTest.java
|
||||
+++ b/src/test/java/org/bukkit/BukkitMirrorTest.java
|
||||
@@ -9,6 +9,7 @@ import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
||||
static {
|
||||
try {
|
||||
- TestServer.getInstance();
|
||||
+ io.papermc.paper.testing.TestServer.setup(); // Paper
|
||||
+@org.junit.jupiter.api.Disabled // Paper
|
||||
public class BukkitMirrorTest {
|
||||
|
||||
ImmutableMap.Builder<Method, MethodHandler> methodMap = ImmutableMap.builder();
|
||||
methodMap.put(
|
||||
diff --git a/src/test/java/org/bukkit/event/SyntheticEventTest.java b/src/test/java/org/bukkit/event/SyntheticEventTest.java
|
||||
index d402cb59f508205ebe9ee450594826b04cecb90b..09886568ae6167141b463b6262565fa212af3385 100644
|
||||
--- a/src/test/java/org/bukkit/event/SyntheticEventTest.java
|
||||
+++ b/src/test/java/org/bukkit/event/SyntheticEventTest.java
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.bukkit.event;
|
||||
public static Stream<Arguments> data() {
|
||||
diff --git a/src/test/java/org/bukkit/support/TestServer.java b/src/test/java/org/bukkit/support/TestServer.java
|
||||
index 5709d52ed4ac4ce8dd8b0569281279f7305c5fb9..a47ee3ce660ec4467b5ed6a4b41fb2d19179a189 100644
|
||||
--- a/src/test/java/org/bukkit/support/TestServer.java
|
||||
+++ b/src/test/java/org/bukkit/support/TestServer.java
|
||||
@@ -72,6 +72,11 @@ public final class TestServer {
|
||||
UnsafeValues unsafeValues = mock(withSettings().stubOnly());
|
||||
when(instance.getUnsafe()).thenReturn(unsafeValues);
|
||||
|
||||
-import org.bukkit.TestServer;
|
||||
import org.bukkit.plugin.PluginLoader;
|
||||
import org.bukkit.plugin.SimplePluginManager;
|
||||
import org.bukkit.plugin.TestPlugin;
|
||||
@@ -12,14 +11,15 @@ public class SyntheticEventTest {
|
||||
@SuppressWarnings("deprecation")
|
||||
@Test
|
||||
public void test() {
|
||||
- final JavaPluginLoader loader = new JavaPluginLoader(TestServer.getInstance());
|
||||
+ io.papermc.paper.testing.TestServer.setup(); // Paper
|
||||
+ final JavaPluginLoader loader = new JavaPluginLoader(org.bukkit.Bukkit.getServer()); // Paper
|
||||
TestPlugin plugin = new TestPlugin(getClass().getName()) {
|
||||
@Override
|
||||
public PluginLoader getPluginLoader() {
|
||||
return loader;
|
||||
}
|
||||
};
|
||||
- SimplePluginManager pluginManager = new SimplePluginManager(TestServer.getInstance(), null);
|
||||
+ SimplePluginManager pluginManager = new SimplePluginManager(org.bukkit.Bukkit.getServer(), null); // Paper
|
||||
|
||||
TestEvent event = new TestEvent(false);
|
||||
Impl impl = new Impl();
|
||||
diff --git a/src/test/java/org/bukkit/plugin/PluginManagerTest.java b/src/test/java/org/bukkit/plugin/PluginManagerTest.java
|
||||
index f188cd4f3b07027c30d41f1162db77a506b7b6bb..c46ed2acb82db814d660459b705dd49e6d44240f 100644
|
||||
--- a/src/test/java/org/bukkit/plugin/PluginManagerTest.java
|
||||
+++ b/src/test/java/org/bukkit/plugin/PluginManagerTest.java
|
||||
@@ -2,7 +2,6 @@ package org.bukkit.plugin;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
-import org.bukkit.TestServer;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.TestEvent;
|
||||
import org.bukkit.permissions.Permission;
|
||||
@@ -14,7 +13,7 @@ public class PluginManagerTest {
|
||||
volatile Object value = null;
|
||||
+ // Paper start - testing changes
|
||||
+ when(instance.getTag(anyString(), any(NamespacedKey.class), any())).thenAnswer(ignored -> new io.papermc.paper.testing.EmptyTag());
|
||||
+ when(instance.getScoreboardCriteria(anyString())).thenReturn(null);
|
||||
+ // Paper end - testing changes
|
||||
+
|
||||
Bukkit.setServer(instance);
|
||||
}
|
||||
|
||||
- private static final PluginManager pm = TestServer.getInstance().getPluginManager();
|
||||
+ private static final PluginManager pm = org.bukkit.Bukkit.getServer().getPluginManager(); // Paper
|
||||
|
||||
private final MutableObject store = new MutableObject();
|
||||
|
||||
diff --git a/src/test/java/org/bukkit/scoreboard/CriteriaTest.java b/src/test/java/org/bukkit/scoreboard/CriteriaTest.java
|
||||
index eb94b6f4d58cd9f66b07791c57af7e359992e28c..a93f28e2f987a36e2c7e4f7d31506b750bdb222b 100644
|
||||
--- a/src/test/java/org/bukkit/scoreboard/CriteriaTest.java
|
||||
+++ b/src/test/java/org/bukkit/scoreboard/CriteriaTest.java
|
||||
@@ -2,7 +2,6 @@ package org.bukkit.scoreboard;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Statistic;
|
||||
-import org.bukkit.TestServer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
@@ -11,7 +10,7 @@ public class CriteriaTest {
|
||||
|
||||
@Test
|
||||
public void testStatistic() {
|
||||
- TestServer.getInstance();
|
||||
+ io.papermc.paper.testing.TestServer.setup(); // Paper
|
||||
|
||||
Assert.assertThrows(IllegalArgumentException.class, () -> Criteria.statistic(Statistic.AVIATE_ONE_CM, Material.STONE)); // Generic statistic with block
|
||||
Assert.assertThrows(IllegalArgumentException.class, () -> Criteria.statistic(Statistic.AVIATE_ONE_CM, EntityType.CREEPER)); // Generic statistic with entity type
|
||||
|
@ -1,19 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Fri, 1 Apr 2016 00:02:47 -0400
|
||||
Subject: [PATCH] Add FastUtil to Bukkit
|
||||
|
||||
Doesn't expose to plugins, just allows Paper-API to use it for optimization
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 044b7c49b569e1170108c912e9307f7fec278762..f0423df165bf7d0f3fad21d26b64f31ba3e6aeee 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -18,6 +18,7 @@ dependencies {
|
||||
api("com.googlecode.json-simple:json-simple:1.1.1") {
|
||||
isTransitive = false // includes junit
|
||||
}
|
||||
+ api("it.unimi.dsi:fastutil:8.5.6")
|
||||
// Paper end
|
||||
|
||||
compileOnly("org.apache.maven:maven-resolver-provider:3.8.5")
|
343
patches/api/0004-Code-Generation.patch
Normale Datei
343
patches/api/0004-Code-Generation.patch
Normale Datei
@ -0,0 +1,343 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Fri, 26 May 2023 18:14:44 -0700
|
||||
Subject: [PATCH] Code Generation
|
||||
|
||||
Currently includes generated key holder classes for types
|
||||
used in the Registry Modification API
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 768024b2b4584fd7dd86f068c0e79c89ffc5faa1..f11a22ab01e97e51619c96f2d8a78a99297efc59 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -1,6 +1,7 @@
|
||||
plugins {
|
||||
`java-library`
|
||||
`maven-publish`
|
||||
+ idea // Paper
|
||||
}
|
||||
|
||||
java {
|
||||
@@ -45,6 +46,22 @@ dependencies {
|
||||
testImplementation("org.ow2.asm:asm-tree:9.7")
|
||||
}
|
||||
|
||||
+// Paper start
|
||||
+val generatedApiPath: java.nio.file.Path = rootProject.projectDir.toPath().resolve("paper-api-generator/generated")
|
||||
+idea {
|
||||
+ module {
|
||||
+ generatedSourceDirs.add(generatedApiPath.toFile())
|
||||
+ }
|
||||
+}
|
||||
+sourceSets {
|
||||
+ main {
|
||||
+ java {
|
||||
+ srcDir(generatedApiPath)
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+// Paper end
|
||||
+
|
||||
configure<PublishingExtension> {
|
||||
publications.create<MavenPublication>("maven") {
|
||||
from(components["java"])
|
||||
@@ -121,3 +138,14 @@ tasks.check {
|
||||
dependsOn(scanJar)
|
||||
}
|
||||
// Paper end
|
||||
+// Paper start
|
||||
+val scanJarForOldGeneratedCode = tasks.register("scanJarForOldGeneratedCode", io.papermc.paperweight.tasks.ScanJarForOldGeneratedCode::class) {
|
||||
+ mcVersion.set(providers.gradleProperty("mcVersion"))
|
||||
+ annotation.set("Lio/papermc/paper/generated/GeneratedFrom;")
|
||||
+ jarToScan.set(tasks.jar.flatMap { it.archiveFile })
|
||||
+ classpath.from(configurations.compileClasspath)
|
||||
+}
|
||||
+tasks.check {
|
||||
+ dependsOn(scanJarForOldGeneratedCode)
|
||||
+}
|
||||
+// Paper end
|
||||
diff --git a/src/main/java/io/papermc/paper/generated/GeneratedFrom.java b/src/main/java/io/papermc/paper/generated/GeneratedFrom.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..2512dba27edfdccbc4430815b6cba048e3d93484
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/generated/GeneratedFrom.java
|
||||
@@ -0,0 +1,21 @@
|
||||
+package io.papermc.paper.generated;
|
||||
+
|
||||
+import java.lang.annotation.Documented;
|
||||
+import java.lang.annotation.ElementType;
|
||||
+import java.lang.annotation.Retention;
|
||||
+import java.lang.annotation.RetentionPolicy;
|
||||
+import java.lang.annotation.Target;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+
|
||||
+/**
|
||||
+ * Used to mark classes which are generated from
|
||||
+ * a specific version of minecraft.
|
||||
+ */
|
||||
+@ApiStatus.Internal
|
||||
+@Documented
|
||||
+@Retention(RetentionPolicy.RUNTIME)
|
||||
+@Target(ElementType.TYPE)
|
||||
+public @interface GeneratedFrom {
|
||||
+
|
||||
+ String value();
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/registry/RegistryKey.java b/src/main/java/io/papermc/paper/registry/RegistryKey.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..76daccf4ea502e1747a6f9176dc16fd20c561286
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/registry/RegistryKey.java
|
||||
@@ -0,0 +1,147 @@
|
||||
+package io.papermc.paper.registry;
|
||||
+
|
||||
+import net.kyori.adventure.key.Keyed;
|
||||
+import org.bukkit.Art;
|
||||
+import org.bukkit.Fluid;
|
||||
+import org.bukkit.GameEvent;
|
||||
+import org.bukkit.JukeboxSong;
|
||||
+import org.bukkit.MusicInstrument;
|
||||
+import org.bukkit.Particle;
|
||||
+import org.bukkit.Sound;
|
||||
+import org.bukkit.attribute.Attribute;
|
||||
+import org.bukkit.block.Biome;
|
||||
+import org.bukkit.block.BlockType;
|
||||
+import org.bukkit.block.banner.PatternType;
|
||||
+import org.bukkit.damage.DamageType;
|
||||
+import org.bukkit.enchantments.Enchantment;
|
||||
+import org.bukkit.entity.Cat;
|
||||
+import org.bukkit.entity.EntityType;
|
||||
+import org.bukkit.entity.Frog;
|
||||
+import org.bukkit.entity.Villager;
|
||||
+import org.bukkit.entity.Wolf;
|
||||
+import org.bukkit.entity.memory.MemoryKey;
|
||||
+import org.bukkit.generator.structure.Structure;
|
||||
+import org.bukkit.generator.structure.StructureType;
|
||||
+import org.bukkit.inventory.ItemType;
|
||||
+import org.bukkit.inventory.meta.trim.TrimMaterial;
|
||||
+import org.bukkit.inventory.meta.trim.TrimPattern;
|
||||
+import org.bukkit.map.MapCursor;
|
||||
+import org.bukkit.potion.PotionEffectType;
|
||||
+import org.bukkit.potion.PotionType;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+
|
||||
+import static io.papermc.paper.registry.RegistryKeyImpl.create;
|
||||
+
|
||||
+/**
|
||||
+ * Identifier for a specific registry. For use with
|
||||
+ * {@link TypedKey} and the registry modification API.
|
||||
+ * <p>
|
||||
+ * There are 2 types of registries, identified as "built-in"
|
||||
+ * or "data-driven". The former are not changeable by datapacks (which
|
||||
+ * doesn't necessarily mean they aren't changeable in the API) and
|
||||
+ * are loaded first. "Data-driven" registries are all created by
|
||||
+ * reading in data from the vanilla and other datapacks.
|
||||
+ *
|
||||
+ * @param <T> the value type
|
||||
+ */
|
||||
+@SuppressWarnings("unused")
|
||||
+public sealed interface RegistryKey<T> extends Keyed permits RegistryKeyImpl {
|
||||
+
|
||||
+ /* ******************* *
|
||||
+ * Built-in Registries *
|
||||
+ * ******************* */
|
||||
+ /**
|
||||
+ * Built-in registry for game events
|
||||
+ * @see io.papermc.paper.registry.keys.GameEventKeys
|
||||
+ */
|
||||
+ RegistryKey<GameEvent> GAME_EVENT = create("game_event");
|
||||
+ /**
|
||||
+ * Built-in registry for structure types.
|
||||
+ * @see io.papermc.paper.registry.keys.StructureTypeKeys
|
||||
+ */
|
||||
+ RegistryKey<StructureType> STRUCTURE_TYPE = create("worldgen/structure_type");
|
||||
+ /**
|
||||
+ * Built-in registry for instruments.
|
||||
+ * @see io.papermc.paper.registry.keys.InstrumentKeys
|
||||
+ */
|
||||
+ RegistryKey<MusicInstrument> INSTRUMENT = create("instrument");
|
||||
+ /**
|
||||
+ * Built-in registry for potion effect types (mob effects).
|
||||
+ * @see io.papermc.paper.registry.keys.MobEffectKeys
|
||||
+ */
|
||||
+ RegistryKey<PotionEffectType> MOB_EFFECT = create("mob_effect");
|
||||
+ /**
|
||||
+ * @apiNote DO NOT USE
|
||||
+ */
|
||||
+ @ApiStatus.Internal
|
||||
+ RegistryKey<BlockType> BLOCK = create("block");
|
||||
+ /**
|
||||
+ * @apiNote DO NOT USE
|
||||
+ */
|
||||
+ @ApiStatus.Internal
|
||||
+ RegistryKey<ItemType> ITEM = create("item");
|
||||
+
|
||||
+
|
||||
+ /* ********************** *
|
||||
+ * Data-driven Registries *
|
||||
+ * ********************** */
|
||||
+ /**
|
||||
+ * Data-driven registry for biomes.
|
||||
+ * @see io.papermc.paper.registry.keys.BiomeKeys
|
||||
+ */
|
||||
+ RegistryKey<Biome> BIOME = create("worldgen/biome");
|
||||
+ /**
|
||||
+ * Data-driven registry for structures.
|
||||
+ * @see io.papermc.paper.registry.keys.StructureKeys
|
||||
+ */
|
||||
+ RegistryKey<Structure> STRUCTURE = create("worldgen/structure");
|
||||
+ /**
|
||||
+ * Data-driven registry for trim materials.
|
||||
+ * @see io.papermc.paper.registry.keys.TrimMaterialKeys
|
||||
+ */
|
||||
+ RegistryKey<TrimMaterial> TRIM_MATERIAL = create("trim_material");
|
||||
+ /**
|
||||
+ * Data-driven registry for trim patterns.
|
||||
+ * @see io.papermc.paper.registry.keys.TrimPatternKeys
|
||||
+ */
|
||||
+ RegistryKey<TrimPattern> TRIM_PATTERN = create("trim_pattern");
|
||||
+ /**
|
||||
+ * Data-driven registry for damage types.
|
||||
+ * @see io.papermc.paper.registry.keys.DamageTypeKeys
|
||||
+ */
|
||||
+ RegistryKey<DamageType> DAMAGE_TYPE = create("damage_type");
|
||||
+ /**
|
||||
+ * Data-driven registry for wolf variants.
|
||||
+ * @see io.papermc.paper.registry.keys.WolfVariantKeys
|
||||
+ */
|
||||
+ RegistryKey<Wolf.Variant> WOLF_VARIANT = create("wolf_variant");
|
||||
+ /**
|
||||
+ * Data-driven registry for enchantments.
|
||||
+ * @see io.papermc.paper.registry.keys.EnchantmentKeys
|
||||
+ */
|
||||
+ RegistryKey<Enchantment> ENCHANTMENT = create("enchantment");
|
||||
+ /**
|
||||
+ * Data-driven registry for jukebox songs.
|
||||
+ */
|
||||
+ @ApiStatus.Experimental
|
||||
+ RegistryKey<JukeboxSong> JUKEBOX_SONG = create("jukebox_song");
|
||||
+
|
||||
+
|
||||
+ /* ******************* *
|
||||
+ * API-only Registries *
|
||||
+ * ******************* */
|
||||
+ RegistryKey<Art> PAINTING_VARIANT = create("painting_variant");
|
||||
+ RegistryKey<Attribute> ATTRIBUTE = create("attribute");
|
||||
+ RegistryKey<PatternType> BANNER_PATTERN = create("banner_pattern");
|
||||
+ RegistryKey<Cat.Type> CAT_VARIANT = create("cat_variant");
|
||||
+ RegistryKey<EntityType> ENTITY_TYPE = create("entity_type");
|
||||
+ RegistryKey<Particle> PARTICLE_TYPE = create("particle_type");
|
||||
+ RegistryKey<PotionType> POTION = create("potion");
|
||||
+ RegistryKey<Sound> SOUND_EVENT = create("sound_event");
|
||||
+ RegistryKey<Villager.Profession> VILLAGER_PROFESSION = create("villager_profession");
|
||||
+ RegistryKey<Villager.Type> VILLAGER_TYPE = create("villager_type");
|
||||
+ RegistryKey<MemoryKey<?>> MEMORY_MODULE_TYPE = create("memory_module_type");
|
||||
+ RegistryKey<Fluid> FLUID = create("fluid");
|
||||
+ RegistryKey<Frog.Variant> FROG_VARIANT = create("frog_variant");
|
||||
+ RegistryKey<MapCursor.Type> MAP_DECORATION_TYPE = create("map_decoration_type");
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java b/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..791813220b2504214b1adecc69093cd600fb0f8c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java
|
||||
@@ -0,0 +1,24 @@
|
||||
+package io.papermc.paper.registry;
|
||||
+
|
||||
+import com.google.common.collect.Sets;
|
||||
+import java.util.Set;
|
||||
+import net.kyori.adventure.key.Key;
|
||||
+import org.intellij.lang.annotations.Subst;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+record RegistryKeyImpl<T>(@NotNull Key key) implements RegistryKey<T> {
|
||||
+
|
||||
+ static final Set<RegistryKey<?>> REGISTRY_KEYS = Sets.newIdentityHashSet();
|
||||
+
|
||||
+ static <T> RegistryKey<T> create(@Subst("some_key") final String key) {
|
||||
+ final RegistryKey<T> registryKey = createInternal(key);
|
||||
+ REGISTRY_KEYS.add(registryKey);
|
||||
+ return registryKey;
|
||||
+ }
|
||||
+
|
||||
+ // creates the key without adding to the internal set of keys
|
||||
+ static <T> RegistryKey<T> createInternal(@Subst("some_key") final String key) {
|
||||
+ return new RegistryKeyImpl<>(Key.key(Key.MINECRAFT_NAMESPACE, key));
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/registry/TypedKey.java b/src/main/java/io/papermc/paper/registry/TypedKey.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..6f5a062ba7ee7173468ecea3c1855a233bf3855e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/registry/TypedKey.java
|
||||
@@ -0,0 +1,44 @@
|
||||
+package io.papermc.paper.registry;
|
||||
+
|
||||
+import net.kyori.adventure.key.Key;
|
||||
+import net.kyori.adventure.key.Keyed;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Represents a key for a value in a specific registry.
|
||||
+ *
|
||||
+ * @param <T> the value type for the registry
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+public sealed interface TypedKey<T> extends Keyed permits TypedKeyImpl {
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the key for the value in the registry.
|
||||
+ *
|
||||
+ * @return the value's key
|
||||
+ */
|
||||
+ @Override
|
||||
+ @NotNull Key key();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the registry key for the value this key
|
||||
+ * represents.
|
||||
+ *
|
||||
+ * @return the registry key
|
||||
+ */
|
||||
+ @NotNull RegistryKey<T> registryKey();
|
||||
+
|
||||
+ /**
|
||||
+ * Create a typed key from a key and a registry key.
|
||||
+ *
|
||||
+ * @param registryKey the registry this key is for
|
||||
+ * @param key the key for the value in the registry
|
||||
+ * @param <T> value type
|
||||
+ * @return a new key for the value key and registry key
|
||||
+ */
|
||||
+ @ApiStatus.Experimental
|
||||
+ static <T> @NotNull TypedKey<T> create(final @NotNull RegistryKey<T> registryKey, final @NotNull Key key) {
|
||||
+ return new TypedKeyImpl<>(key, registryKey);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/registry/TypedKeyImpl.java b/src/main/java/io/papermc/paper/registry/TypedKeyImpl.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..1a97b3359c4ece5c29131da7c3f208aaa8fab66e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/registry/TypedKeyImpl.java
|
||||
@@ -0,0 +1,8 @@
|
||||
+package io.papermc.paper.registry;
|
||||
+
|
||||
+import net.kyori.adventure.key.Key;
|
||||
+import net.kyori.adventure.key.Keyed;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+record TypedKeyImpl<T>(@NotNull Key key, @NotNull RegistryKey<T> registryKey) implements TypedKey<T> {
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/MinecraftExperimental.java b/src/main/java/org/bukkit/MinecraftExperimental.java
|
||||
index a86b87e4c3332202e40e484c3f9c6562b419c70f..305532968f9f7dd497c77259ed147ea2f081bc74 100644
|
||||
--- a/src/main/java/org/bukkit/MinecraftExperimental.java
|
||||
+++ b/src/main/java/org/bukkit/MinecraftExperimental.java
|
||||
@@ -47,5 +47,6 @@ public @interface MinecraftExperimental {
|
||||
@ApiStatus.Internal
|
||||
public enum Requires {
|
||||
|
||||
+ BUNDLE, TRADE_REBALANCE // Paper
|
||||
}
|
||||
}
|
19
patches/api/0005-Add-FastUtil-to-Bukkit.patch
Normale Datei
19
patches/api/0005-Add-FastUtil-to-Bukkit.patch
Normale Datei
@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Fri, 1 Apr 2016 00:02:47 -0400
|
||||
Subject: [PATCH] Add FastUtil to Bukkit
|
||||
|
||||
Doesn't expose to plugins, just allows Paper-API to use it for optimization
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index f11a22ab01e97e51619c96f2d8a78a99297efc59..2f266350a787a4cfdfda1b0e760bfb7604cac43c 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -23,6 +23,7 @@ dependencies {
|
||||
api("com.googlecode.json-simple:json-simple:1.1.1") {
|
||||
isTransitive = false // includes junit
|
||||
}
|
||||
+ api("it.unimi.dsi:fastutil:8.5.6")
|
||||
// Paper end
|
||||
|
||||
compileOnly("org.apache.maven:maven-resolver-provider:3.9.6")
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
5492
patches/api/0006-Adventure.patch
Normale Datei
5492
patches/api/0006-Adventure.patch
Normale Datei
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@ -1,370 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Techcable <Techcable@outlook.com>
|
||||
Date: Thu, 3 Mar 2016 13:20:33 -0700
|
||||
Subject: [PATCH] Use ASM for event executors.
|
||||
|
||||
Uses method handles for private or static methods.
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 558fa62d87af1103efa703ef9114481cb928cf8d..359e7bd7e3c76cec89d638f940006dc9c944f98b 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -39,6 +39,9 @@ dependencies {
|
||||
apiAndDocs("net.kyori:adventure-text-serializer-legacy")
|
||||
apiAndDocs("net.kyori:adventure-text-serializer-plain")
|
||||
apiAndDocs("net.kyori:adventure-text-logger-slf4j")
|
||||
+
|
||||
+ implementation("org.ow2.asm:asm:9.2")
|
||||
+ implementation("org.ow2.asm:asm-commons:9.2")
|
||||
// Paper end
|
||||
|
||||
compileOnly("org.apache.maven:maven-resolver-provider:3.8.5")
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java b/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5b28e9b1daba7834af67dbc193dd656bedd9a994
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java
|
||||
@@ -0,0 +1,42 @@
|
||||
+package com.destroystokyo.paper.event.executor;
|
||||
+
|
||||
+import java.lang.invoke.MethodHandle;
|
||||
+import java.lang.invoke.MethodHandles;
|
||||
+import java.lang.reflect.Method;
|
||||
+
|
||||
+import com.destroystokyo.paper.util.SneakyThrow;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.EventException;
|
||||
+import org.bukkit.event.Listener;
|
||||
+import org.bukkit.plugin.EventExecutor;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+public class MethodHandleEventExecutor implements EventExecutor {
|
||||
+ private final Class<? extends Event> eventClass;
|
||||
+ private final MethodHandle handle;
|
||||
+
|
||||
+ public MethodHandleEventExecutor(@NotNull Class<? extends Event> eventClass, @NotNull MethodHandle handle) {
|
||||
+ this.eventClass = eventClass;
|
||||
+ this.handle = handle;
|
||||
+ }
|
||||
+
|
||||
+ public MethodHandleEventExecutor(@NotNull Class<? extends Event> eventClass, @NotNull Method m) {
|
||||
+ this.eventClass = eventClass;
|
||||
+ try {
|
||||
+ m.setAccessible(true);
|
||||
+ this.handle = MethodHandles.lookup().unreflect(m);
|
||||
+ } catch (IllegalAccessException e) {
|
||||
+ throw new AssertionError("Unable to set accessible", e);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException {
|
||||
+ if (!eventClass.isInstance(event)) return;
|
||||
+ try {
|
||||
+ handle.invoke(listener, event);
|
||||
+ } catch (Throwable t) {
|
||||
+ SneakyThrow.sneaky(t);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java b/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c83672427324bd068ed52916f700b68446a226f6
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java
|
||||
@@ -0,0 +1,43 @@
|
||||
+package com.destroystokyo.paper.event.executor;
|
||||
+
|
||||
+import java.lang.invoke.MethodHandle;
|
||||
+import java.lang.invoke.MethodHandles;
|
||||
+import java.lang.reflect.Method;
|
||||
+import java.lang.reflect.Modifier;
|
||||
+
|
||||
+import com.destroystokyo.paper.util.SneakyThrow;
|
||||
+import com.google.common.base.Preconditions;
|
||||
+
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.EventException;
|
||||
+import org.bukkit.event.Listener;
|
||||
+import org.bukkit.plugin.EventExecutor;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+public class StaticMethodHandleEventExecutor implements EventExecutor {
|
||||
+ private final Class<? extends Event> eventClass;
|
||||
+ private final MethodHandle handle;
|
||||
+
|
||||
+ public StaticMethodHandleEventExecutor(@NotNull Class<? extends Event> eventClass, @NotNull Method m) {
|
||||
+ Preconditions.checkArgument(Modifier.isStatic(m.getModifiers()), "Not a static method: %s", m);
|
||||
+ Preconditions.checkArgument(eventClass != null, "eventClass is null");
|
||||
+ this.eventClass = eventClass;
|
||||
+ try {
|
||||
+ m.setAccessible(true);
|
||||
+ this.handle = MethodHandles.lookup().unreflect(m);
|
||||
+ } catch (IllegalAccessException e) {
|
||||
+ throw new AssertionError("Unable to set accessible", e);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException {
|
||||
+ if (!eventClass.isInstance(event)) return;
|
||||
+ try {
|
||||
+ handle.invoke(event);
|
||||
+ } catch (Throwable throwable) {
|
||||
+ SneakyThrow.sneaky(throwable);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/asm/ASMEventExecutorGenerator.java b/src/main/java/com/destroystokyo/paper/event/executor/asm/ASMEventExecutorGenerator.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..084c31af1a7ba32bb4c3dc8f16f67fd09ce0b6a4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/executor/asm/ASMEventExecutorGenerator.java
|
||||
@@ -0,0 +1,54 @@
|
||||
+package com.destroystokyo.paper.event.executor.asm;
|
||||
+
|
||||
+import java.lang.reflect.Method;
|
||||
+import java.util.concurrent.atomic.AtomicInteger;
|
||||
+
|
||||
+import org.bukkit.plugin.EventExecutor;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.objectweb.asm.ClassWriter;
|
||||
+import org.objectweb.asm.Type;
|
||||
+import org.objectweb.asm.commons.GeneratorAdapter;
|
||||
+
|
||||
+import static org.objectweb.asm.Opcodes.*;
|
||||
+
|
||||
+public class ASMEventExecutorGenerator {
|
||||
+
|
||||
+ private static final String EXECUTE_DESCRIPTOR = "(Lorg/bukkit/event/Listener;Lorg/bukkit/event/Event;)V";
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static byte[] generateEventExecutor(@NotNull Method m, @NotNull String name) {
|
||||
+ ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
|
||||
+ writer.visit(V1_8, ACC_PUBLIC, name.replace('.', '/'), null, Type.getInternalName(Object.class), new String[] {Type.getInternalName(EventExecutor.class)});
|
||||
+ // Generate constructor
|
||||
+ GeneratorAdapter methodGenerator = new GeneratorAdapter(writer.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null), ACC_PUBLIC, "<init>", "()V");
|
||||
+ methodGenerator.loadThis();
|
||||
+ methodGenerator.visitMethodInsn(INVOKESPECIAL, Type.getInternalName(Object.class), "<init>", "()V", false); // Invoke the super class (Object) constructor
|
||||
+ methodGenerator.returnValue();
|
||||
+ methodGenerator.endMethod();
|
||||
+ // Generate the execute method
|
||||
+ methodGenerator = new GeneratorAdapter(writer.visitMethod(ACC_PUBLIC, "execute", EXECUTE_DESCRIPTOR, null, null), ACC_PUBLIC, "execute", EXECUTE_DESCRIPTOR);
|
||||
+ methodGenerator.loadArg(0);
|
||||
+ methodGenerator.checkCast(Type.getType(m.getDeclaringClass()));
|
||||
+ methodGenerator.loadArg(1);
|
||||
+ methodGenerator.checkCast(Type.getType(m.getParameterTypes()[0]));
|
||||
+ methodGenerator.visitMethodInsn(m.getDeclaringClass().isInterface() ? INVOKEINTERFACE : INVOKEVIRTUAL, Type.getInternalName(m.getDeclaringClass()), m.getName(), Type.getMethodDescriptor(m), m.getDeclaringClass().isInterface());
|
||||
+ // The only purpose of this switch statement is to generate the correct pop instruction, should the event handler method return something other than void.
|
||||
+ // Non-void event handlers will be unsupported in a future release.
|
||||
+ switch (Type.getType(m.getReturnType()).getSize()) {
|
||||
+ // case 0 is omitted because the only type that has size 0 is void - no pop instruction needed.
|
||||
+ case 1 -> methodGenerator.pop(); // handles reference types and most primitives
|
||||
+ case 2 -> methodGenerator.pop2(); // handles long and double
|
||||
+ }
|
||||
+ methodGenerator.returnValue();
|
||||
+ methodGenerator.endMethod();
|
||||
+ writer.visitEnd();
|
||||
+ return writer.toByteArray();
|
||||
+ }
|
||||
+
|
||||
+ public static AtomicInteger NEXT_ID = new AtomicInteger(1);
|
||||
+ @NotNull
|
||||
+ public static String generateName() {
|
||||
+ int id = NEXT_ID.getAndIncrement();
|
||||
+ return "com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor" + id;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/asm/ClassDefiner.java b/src/main/java/com/destroystokyo/paper/event/executor/asm/ClassDefiner.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f79685b48bb581277a6891927988b6f7a4389dc4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/executor/asm/ClassDefiner.java
|
||||
@@ -0,0 +1,34 @@
|
||||
+package com.destroystokyo.paper.event.executor.asm;
|
||||
+
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+public interface ClassDefiner {
|
||||
+
|
||||
+ /**
|
||||
+ * Returns if the defined classes can bypass access checks
|
||||
+ *
|
||||
+ * @return if classes bypass access checks
|
||||
+ */
|
||||
+ public default boolean isBypassAccessChecks() {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Define a class
|
||||
+ *
|
||||
+ * @param parentLoader the parent classloader
|
||||
+ * @param name the name of the class
|
||||
+ * @param data the class data to load
|
||||
+ * @return the defined class
|
||||
+ * @throws ClassFormatError if the class data is invalid
|
||||
+ * @throws NullPointerException if any of the arguments are null
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Class<?> defineClass(@NotNull ClassLoader parentLoader, @NotNull String name, @NotNull byte[] data);
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static ClassDefiner getInstance() {
|
||||
+ return SafeClassDefiner.INSTANCE;
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/asm/SafeClassDefiner.java b/src/main/java/com/destroystokyo/paper/event/executor/asm/SafeClassDefiner.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ac99477e9f2c08041aeff31abc1d1edee58d0a67
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/executor/asm/SafeClassDefiner.java
|
||||
@@ -0,0 +1,66 @@
|
||||
+package com.destroystokyo.paper.event.executor.asm;
|
||||
+
|
||||
+import java.util.concurrent.ConcurrentHashMap;
|
||||
+import java.util.concurrent.ConcurrentMap;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
+
|
||||
+import com.google.common.collect.MapMaker;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.objectweb.asm.Type;
|
||||
+
|
||||
+public class SafeClassDefiner implements ClassDefiner {
|
||||
+ /* default */ static final SafeClassDefiner INSTANCE = new SafeClassDefiner();
|
||||
+
|
||||
+ private SafeClassDefiner() {}
|
||||
+
|
||||
+ private final ConcurrentMap<ClassLoader, GeneratedClassLoader> loaders = new MapMaker().weakKeys().makeMap();
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public Class<?> defineClass(@NotNull ClassLoader parentLoader, @NotNull String name, @NotNull byte[] data) {
|
||||
+ GeneratedClassLoader loader = loaders.computeIfAbsent(parentLoader, GeneratedClassLoader::new);
|
||||
+ synchronized (loader.getClassLoadingLock(name)) {
|
||||
+ Preconditions.checkState(!loader.hasClass(name), "%s already defined", name);
|
||||
+ Class<?> c = loader.define(name, data);
|
||||
+ assert c.getName().equals(name);
|
||||
+ return c;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static class GeneratedClassLoader extends ClassLoader {
|
||||
+ static {
|
||||
+ ClassLoader.registerAsParallelCapable();
|
||||
+ }
|
||||
+
|
||||
+ protected GeneratedClassLoader(@NotNull ClassLoader parent) {
|
||||
+ super(parent);
|
||||
+ }
|
||||
+
|
||||
+ private Class<?> define(@NotNull String name, byte[] data) {
|
||||
+ synchronized (getClassLoadingLock(name)) {
|
||||
+ assert !hasClass(name);
|
||||
+ Class<?> c = defineClass(name, data, 0, data.length);
|
||||
+ resolveClass(c);
|
||||
+ return c;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public Object getClassLoadingLock(@NotNull String name) {
|
||||
+ return super.getClassLoadingLock(name);
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasClass(@NotNull String name) {
|
||||
+ synchronized (getClassLoadingLock(name)) {
|
||||
+ try {
|
||||
+ Class.forName(name);
|
||||
+ return true;
|
||||
+ } catch (ClassNotFoundException e) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/plugin/EventExecutor.java b/src/main/java/org/bukkit/plugin/EventExecutor.java
|
||||
index a850f0780de05463fc0d3f9e15ff7f19d88b2aed..9026e108ccd3a88aee1267ee275137befa646455 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/EventExecutor.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/EventExecutor.java
|
||||
@@ -5,9 +5,75 @@ import org.bukkit.event.EventException;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
+// Paper start
|
||||
+import java.lang.reflect.Method;
|
||||
+import java.lang.reflect.Modifier;
|
||||
+import java.util.concurrent.ConcurrentHashMap;
|
||||
+import java.util.concurrent.ConcurrentMap;
|
||||
+import java.util.function.Function;
|
||||
+
|
||||
+import com.destroystokyo.paper.event.executor.MethodHandleEventExecutor;
|
||||
+import com.destroystokyo.paper.event.executor.StaticMethodHandleEventExecutor;
|
||||
+import com.destroystokyo.paper.event.executor.asm.ASMEventExecutorGenerator;
|
||||
+import com.destroystokyo.paper.event.executor.asm.ClassDefiner;
|
||||
+import com.google.common.base.Preconditions;
|
||||
+// Paper end
|
||||
+
|
||||
/**
|
||||
* Interface which defines the class for event call backs to plugins
|
||||
*/
|
||||
public interface EventExecutor {
|
||||
public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException;
|
||||
+
|
||||
+ // Paper start
|
||||
+ ConcurrentMap<Method, Class<? extends EventExecutor>> eventExecutorMap = new ConcurrentHashMap<Method, Class<? extends EventExecutor>>() {
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public Class<? extends EventExecutor> computeIfAbsent(@NotNull Method key, @NotNull Function<? super Method, ? extends Class<? extends EventExecutor>> mappingFunction) {
|
||||
+ Class<? extends EventExecutor> executorClass = get(key);
|
||||
+ if (executorClass != null)
|
||||
+ return executorClass;
|
||||
+
|
||||
+ //noinspection SynchronizationOnLocalVariableOrMethodParameter
|
||||
+ synchronized (key) {
|
||||
+ executorClass = get(key);
|
||||
+ if (executorClass != null)
|
||||
+ return executorClass;
|
||||
+
|
||||
+ return super.computeIfAbsent(key, mappingFunction);
|
||||
+ }
|
||||
+ }
|
||||
+ };
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static EventExecutor create(@NotNull Method m, @NotNull Class<? extends Event> eventClass) {
|
||||
+ Preconditions.checkNotNull(m, "Null method");
|
||||
+ Preconditions.checkArgument(m.getParameterCount() != 0, "Incorrect number of arguments %s", m.getParameterCount());
|
||||
+ Preconditions.checkArgument(m.getParameterTypes()[0] == eventClass, "First parameter %s doesn't match event class %s", m.getParameterTypes()[0], eventClass);
|
||||
+ ClassDefiner definer = ClassDefiner.getInstance();
|
||||
+ if (Modifier.isStatic(m.getModifiers())) {
|
||||
+ return new StaticMethodHandleEventExecutor(eventClass, m);
|
||||
+ } else if (definer.isBypassAccessChecks() || Modifier.isPublic(m.getDeclaringClass().getModifiers()) && Modifier.isPublic(m.getModifiers())) {
|
||||
+ // get the existing generated EventExecutor class for the Method or generate one
|
||||
+ Class<? extends EventExecutor> executorClass = eventExecutorMap.computeIfAbsent(m, (__) -> {
|
||||
+ String name = ASMEventExecutorGenerator.generateName();
|
||||
+ byte[] classData = ASMEventExecutorGenerator.generateEventExecutor(m, name);
|
||||
+ return definer.defineClass(m.getDeclaringClass().getClassLoader(), name, classData).asSubclass(EventExecutor.class);
|
||||
+ });
|
||||
+
|
||||
+ try {
|
||||
+ EventExecutor asmExecutor = executorClass.newInstance();
|
||||
+ // Define a wrapper to conform to bukkit stupidity (passing in events that don't match and wrapper exception)
|
||||
+ return (listener, event) -> {
|
||||
+ if (!eventClass.isInstance(event)) return;
|
||||
+ asmExecutor.execute(listener, event);
|
||||
+ };
|
||||
+ } catch (InstantiationException | IllegalAccessException e) {
|
||||
+ throw new AssertionError("Unable to initialize generated event executor", e);
|
||||
+ }
|
||||
+ } else {
|
||||
+ return new MethodHandleEventExecutor(eventClass, m);
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
367
patches/api/0008-Use-ASM-for-event-executors.patch
Normale Datei
367
patches/api/0008-Use-ASM-for-event-executors.patch
Normale Datei
@ -0,0 +1,367 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Techcable <Techcable@outlook.com>
|
||||
Date: Thu, 3 Mar 2016 13:20:33 -0700
|
||||
Subject: [PATCH] Use ASM for event executors.
|
||||
|
||||
Uses method handles for private or static methods.
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index af3514113abdf3f42c41f1e7ff0f930cc1a417f5..ed0b67ac322aa22b191cd35502ae5b4f20af19f8 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -47,6 +47,9 @@ dependencies {
|
||||
apiAndDocs("net.kyori:adventure-text-serializer-legacy")
|
||||
apiAndDocs("net.kyori:adventure-text-serializer-plain")
|
||||
apiAndDocs("net.kyori:adventure-text-logger-slf4j")
|
||||
+
|
||||
+ implementation("org.ow2.asm:asm:9.7")
|
||||
+ implementation("org.ow2.asm:asm-commons:9.7")
|
||||
// Paper end
|
||||
|
||||
compileOnly("org.apache.maven:maven-resolver-provider:3.9.6")
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java b/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5b28e9b1daba7834af67dbc193dd656bedd9a994
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/executor/MethodHandleEventExecutor.java
|
||||
@@ -0,0 +1,42 @@
|
||||
+package com.destroystokyo.paper.event.executor;
|
||||
+
|
||||
+import java.lang.invoke.MethodHandle;
|
||||
+import java.lang.invoke.MethodHandles;
|
||||
+import java.lang.reflect.Method;
|
||||
+
|
||||
+import com.destroystokyo.paper.util.SneakyThrow;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.EventException;
|
||||
+import org.bukkit.event.Listener;
|
||||
+import org.bukkit.plugin.EventExecutor;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+public class MethodHandleEventExecutor implements EventExecutor {
|
||||
+ private final Class<? extends Event> eventClass;
|
||||
+ private final MethodHandle handle;
|
||||
+
|
||||
+ public MethodHandleEventExecutor(@NotNull Class<? extends Event> eventClass, @NotNull MethodHandle handle) {
|
||||
+ this.eventClass = eventClass;
|
||||
+ this.handle = handle;
|
||||
+ }
|
||||
+
|
||||
+ public MethodHandleEventExecutor(@NotNull Class<? extends Event> eventClass, @NotNull Method m) {
|
||||
+ this.eventClass = eventClass;
|
||||
+ try {
|
||||
+ m.setAccessible(true);
|
||||
+ this.handle = MethodHandles.lookup().unreflect(m);
|
||||
+ } catch (IllegalAccessException e) {
|
||||
+ throw new AssertionError("Unable to set accessible", e);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException {
|
||||
+ if (!eventClass.isInstance(event)) return;
|
||||
+ try {
|
||||
+ handle.invoke(listener, event);
|
||||
+ } catch (Throwable t) {
|
||||
+ SneakyThrow.sneaky(t);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java b/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..827f2b27f70a7ec0bc11d039305c3e58c02a4ef4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/executor/StaticMethodHandleEventExecutor.java
|
||||
@@ -0,0 +1,42 @@
|
||||
+package com.destroystokyo.paper.event.executor;
|
||||
+
|
||||
+import java.lang.invoke.MethodHandle;
|
||||
+import java.lang.invoke.MethodHandles;
|
||||
+import java.lang.reflect.Method;
|
||||
+import java.lang.reflect.Modifier;
|
||||
+
|
||||
+import com.destroystokyo.paper.util.SneakyThrow;
|
||||
+import com.google.common.base.Preconditions;
|
||||
+
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.EventException;
|
||||
+import org.bukkit.event.Listener;
|
||||
+import org.bukkit.plugin.EventExecutor;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+public class StaticMethodHandleEventExecutor implements EventExecutor {
|
||||
+ private final Class<? extends Event> eventClass;
|
||||
+ private final MethodHandle handle;
|
||||
+
|
||||
+ public StaticMethodHandleEventExecutor(@NotNull Class<? extends Event> eventClass, @NotNull Method m) {
|
||||
+ Preconditions.checkArgument(Modifier.isStatic(m.getModifiers()), "Not a static method: %s", m);
|
||||
+ Preconditions.checkArgument(eventClass != null, "eventClass is null");
|
||||
+ this.eventClass = eventClass;
|
||||
+ try {
|
||||
+ m.setAccessible(true);
|
||||
+ this.handle = MethodHandles.lookup().unreflect(m);
|
||||
+ } catch (IllegalAccessException e) {
|
||||
+ throw new AssertionError("Unable to set accessible", e);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException {
|
||||
+ if (!eventClass.isInstance(event)) return;
|
||||
+ try {
|
||||
+ handle.invoke(event);
|
||||
+ } catch (Throwable throwable) {
|
||||
+ SneakyThrow.sneaky(throwable);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/asm/ASMEventExecutorGenerator.java b/src/main/java/com/destroystokyo/paper/event/executor/asm/ASMEventExecutorGenerator.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..084c31af1a7ba32bb4c3dc8f16f67fd09ce0b6a4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/executor/asm/ASMEventExecutorGenerator.java
|
||||
@@ -0,0 +1,54 @@
|
||||
+package com.destroystokyo.paper.event.executor.asm;
|
||||
+
|
||||
+import java.lang.reflect.Method;
|
||||
+import java.util.concurrent.atomic.AtomicInteger;
|
||||
+
|
||||
+import org.bukkit.plugin.EventExecutor;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.objectweb.asm.ClassWriter;
|
||||
+import org.objectweb.asm.Type;
|
||||
+import org.objectweb.asm.commons.GeneratorAdapter;
|
||||
+
|
||||
+import static org.objectweb.asm.Opcodes.*;
|
||||
+
|
||||
+public class ASMEventExecutorGenerator {
|
||||
+
|
||||
+ private static final String EXECUTE_DESCRIPTOR = "(Lorg/bukkit/event/Listener;Lorg/bukkit/event/Event;)V";
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static byte[] generateEventExecutor(@NotNull Method m, @NotNull String name) {
|
||||
+ ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
|
||||
+ writer.visit(V1_8, ACC_PUBLIC, name.replace('.', '/'), null, Type.getInternalName(Object.class), new String[] {Type.getInternalName(EventExecutor.class)});
|
||||
+ // Generate constructor
|
||||
+ GeneratorAdapter methodGenerator = new GeneratorAdapter(writer.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null), ACC_PUBLIC, "<init>", "()V");
|
||||
+ methodGenerator.loadThis();
|
||||
+ methodGenerator.visitMethodInsn(INVOKESPECIAL, Type.getInternalName(Object.class), "<init>", "()V", false); // Invoke the super class (Object) constructor
|
||||
+ methodGenerator.returnValue();
|
||||
+ methodGenerator.endMethod();
|
||||
+ // Generate the execute method
|
||||
+ methodGenerator = new GeneratorAdapter(writer.visitMethod(ACC_PUBLIC, "execute", EXECUTE_DESCRIPTOR, null, null), ACC_PUBLIC, "execute", EXECUTE_DESCRIPTOR);
|
||||
+ methodGenerator.loadArg(0);
|
||||
+ methodGenerator.checkCast(Type.getType(m.getDeclaringClass()));
|
||||
+ methodGenerator.loadArg(1);
|
||||
+ methodGenerator.checkCast(Type.getType(m.getParameterTypes()[0]));
|
||||
+ methodGenerator.visitMethodInsn(m.getDeclaringClass().isInterface() ? INVOKEINTERFACE : INVOKEVIRTUAL, Type.getInternalName(m.getDeclaringClass()), m.getName(), Type.getMethodDescriptor(m), m.getDeclaringClass().isInterface());
|
||||
+ // The only purpose of this switch statement is to generate the correct pop instruction, should the event handler method return something other than void.
|
||||
+ // Non-void event handlers will be unsupported in a future release.
|
||||
+ switch (Type.getType(m.getReturnType()).getSize()) {
|
||||
+ // case 0 is omitted because the only type that has size 0 is void - no pop instruction needed.
|
||||
+ case 1 -> methodGenerator.pop(); // handles reference types and most primitives
|
||||
+ case 2 -> methodGenerator.pop2(); // handles long and double
|
||||
+ }
|
||||
+ methodGenerator.returnValue();
|
||||
+ methodGenerator.endMethod();
|
||||
+ writer.visitEnd();
|
||||
+ return writer.toByteArray();
|
||||
+ }
|
||||
+
|
||||
+ public static AtomicInteger NEXT_ID = new AtomicInteger(1);
|
||||
+ @NotNull
|
||||
+ public static String generateName() {
|
||||
+ int id = NEXT_ID.getAndIncrement();
|
||||
+ return "com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor" + id;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/asm/ClassDefiner.java b/src/main/java/com/destroystokyo/paper/event/executor/asm/ClassDefiner.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f79685b48bb581277a6891927988b6f7a4389dc4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/executor/asm/ClassDefiner.java
|
||||
@@ -0,0 +1,34 @@
|
||||
+package com.destroystokyo.paper.event.executor.asm;
|
||||
+
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+public interface ClassDefiner {
|
||||
+
|
||||
+ /**
|
||||
+ * Returns if the defined classes can bypass access checks
|
||||
+ *
|
||||
+ * @return if classes bypass access checks
|
||||
+ */
|
||||
+ public default boolean isBypassAccessChecks() {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Define a class
|
||||
+ *
|
||||
+ * @param parentLoader the parent classloader
|
||||
+ * @param name the name of the class
|
||||
+ * @param data the class data to load
|
||||
+ * @return the defined class
|
||||
+ * @throws ClassFormatError if the class data is invalid
|
||||
+ * @throws NullPointerException if any of the arguments are null
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Class<?> defineClass(@NotNull ClassLoader parentLoader, @NotNull String name, @NotNull byte[] data);
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static ClassDefiner getInstance() {
|
||||
+ return SafeClassDefiner.INSTANCE;
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/executor/asm/SafeClassDefiner.java b/src/main/java/com/destroystokyo/paper/event/executor/asm/SafeClassDefiner.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..abcc966d8ee01d73c1d1480237ab46fa0ab55fdc
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/executor/asm/SafeClassDefiner.java
|
||||
@@ -0,0 +1,64 @@
|
||||
+package com.destroystokyo.paper.event.executor.asm;
|
||||
+
|
||||
+import java.util.concurrent.ConcurrentMap;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
+
|
||||
+import com.google.common.collect.MapMaker;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+public class SafeClassDefiner implements ClassDefiner {
|
||||
+ /* default */ static final SafeClassDefiner INSTANCE = new SafeClassDefiner();
|
||||
+
|
||||
+ private SafeClassDefiner() {}
|
||||
+
|
||||
+ private final ConcurrentMap<ClassLoader, GeneratedClassLoader> loaders = new MapMaker().weakKeys().makeMap();
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public Class<?> defineClass(@NotNull ClassLoader parentLoader, @NotNull String name, @NotNull byte[] data) {
|
||||
+ GeneratedClassLoader loader = loaders.computeIfAbsent(parentLoader, GeneratedClassLoader::new);
|
||||
+ synchronized (loader.getClassLoadingLock(name)) {
|
||||
+ Preconditions.checkState(!loader.hasClass(name), "%s already defined", name);
|
||||
+ Class<?> c = loader.define(name, data);
|
||||
+ assert c.getName().equals(name);
|
||||
+ return c;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static class GeneratedClassLoader extends ClassLoader {
|
||||
+ static {
|
||||
+ ClassLoader.registerAsParallelCapable();
|
||||
+ }
|
||||
+
|
||||
+ protected GeneratedClassLoader(@NotNull ClassLoader parent) {
|
||||
+ super(parent);
|
||||
+ }
|
||||
+
|
||||
+ private Class<?> define(@NotNull String name, byte[] data) {
|
||||
+ synchronized (getClassLoadingLock(name)) {
|
||||
+ assert !hasClass(name);
|
||||
+ Class<?> c = defineClass(name, data, 0, data.length);
|
||||
+ resolveClass(c);
|
||||
+ return c;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public Object getClassLoadingLock(@NotNull String name) {
|
||||
+ return super.getClassLoadingLock(name);
|
||||
+ }
|
||||
+
|
||||
+ public boolean hasClass(@NotNull String name) {
|
||||
+ synchronized (getClassLoadingLock(name)) {
|
||||
+ try {
|
||||
+ Class.forName(name);
|
||||
+ return true;
|
||||
+ } catch (ClassNotFoundException e) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/plugin/EventExecutor.java b/src/main/java/org/bukkit/plugin/EventExecutor.java
|
||||
index a850f0780de05463fc0d3f9e15ff7f19d88b2aed..9026e108ccd3a88aee1267ee275137befa646455 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/EventExecutor.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/EventExecutor.java
|
||||
@@ -5,9 +5,75 @@ import org.bukkit.event.EventException;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
+// Paper start
|
||||
+import java.lang.reflect.Method;
|
||||
+import java.lang.reflect.Modifier;
|
||||
+import java.util.concurrent.ConcurrentHashMap;
|
||||
+import java.util.concurrent.ConcurrentMap;
|
||||
+import java.util.function.Function;
|
||||
+
|
||||
+import com.destroystokyo.paper.event.executor.MethodHandleEventExecutor;
|
||||
+import com.destroystokyo.paper.event.executor.StaticMethodHandleEventExecutor;
|
||||
+import com.destroystokyo.paper.event.executor.asm.ASMEventExecutorGenerator;
|
||||
+import com.destroystokyo.paper.event.executor.asm.ClassDefiner;
|
||||
+import com.google.common.base.Preconditions;
|
||||
+// Paper end
|
||||
+
|
||||
/**
|
||||
* Interface which defines the class for event call backs to plugins
|
||||
*/
|
||||
public interface EventExecutor {
|
||||
public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException;
|
||||
+
|
||||
+ // Paper start
|
||||
+ ConcurrentMap<Method, Class<? extends EventExecutor>> eventExecutorMap = new ConcurrentHashMap<Method, Class<? extends EventExecutor>>() {
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public Class<? extends EventExecutor> computeIfAbsent(@NotNull Method key, @NotNull Function<? super Method, ? extends Class<? extends EventExecutor>> mappingFunction) {
|
||||
+ Class<? extends EventExecutor> executorClass = get(key);
|
||||
+ if (executorClass != null)
|
||||
+ return executorClass;
|
||||
+
|
||||
+ //noinspection SynchronizationOnLocalVariableOrMethodParameter
|
||||
+ synchronized (key) {
|
||||
+ executorClass = get(key);
|
||||
+ if (executorClass != null)
|
||||
+ return executorClass;
|
||||
+
|
||||
+ return super.computeIfAbsent(key, mappingFunction);
|
||||
+ }
|
||||
+ }
|
||||
+ };
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static EventExecutor create(@NotNull Method m, @NotNull Class<? extends Event> eventClass) {
|
||||
+ Preconditions.checkNotNull(m, "Null method");
|
||||
+ Preconditions.checkArgument(m.getParameterCount() != 0, "Incorrect number of arguments %s", m.getParameterCount());
|
||||
+ Preconditions.checkArgument(m.getParameterTypes()[0] == eventClass, "First parameter %s doesn't match event class %s", m.getParameterTypes()[0], eventClass);
|
||||
+ ClassDefiner definer = ClassDefiner.getInstance();
|
||||
+ if (Modifier.isStatic(m.getModifiers())) {
|
||||
+ return new StaticMethodHandleEventExecutor(eventClass, m);
|
||||
+ } else if (definer.isBypassAccessChecks() || Modifier.isPublic(m.getDeclaringClass().getModifiers()) && Modifier.isPublic(m.getModifiers())) {
|
||||
+ // get the existing generated EventExecutor class for the Method or generate one
|
||||
+ Class<? extends EventExecutor> executorClass = eventExecutorMap.computeIfAbsent(m, (__) -> {
|
||||
+ String name = ASMEventExecutorGenerator.generateName();
|
||||
+ byte[] classData = ASMEventExecutorGenerator.generateEventExecutor(m, name);
|
||||
+ return definer.defineClass(m.getDeclaringClass().getClassLoader(), name, classData).asSubclass(EventExecutor.class);
|
||||
+ });
|
||||
+
|
||||
+ try {
|
||||
+ EventExecutor asmExecutor = executorClass.newInstance();
|
||||
+ // Define a wrapper to conform to bukkit stupidity (passing in events that don't match and wrapper exception)
|
||||
+ return (listener, event) -> {
|
||||
+ if (!eventClass.isInstance(event)) return;
|
||||
+ asmExecutor.execute(listener, event);
|
||||
+ };
|
||||
+ } catch (InstantiationException | IllegalAccessException e) {
|
||||
+ throw new AssertionError("Unable to initialize generated event executor", e);
|
||||
+ }
|
||||
+ } else {
|
||||
+ return new MethodHandleEventExecutor(eventClass, m);
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
@ -1,422 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sun, 20 Mar 2022 10:42:28 -0700
|
||||
Subject: [PATCH] Add Position
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/math/BlockPosition.java b/src/main/java/io/papermc/paper/math/BlockPosition.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f164d32cfbd5bfd84f3067a149d34bb1185a7e00
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/math/BlockPosition.java
|
||||
@@ -0,0 +1,98 @@
|
||||
+package io.papermc.paper.math;
|
||||
+
|
||||
+import org.bukkit.Axis;
|
||||
+import org.bukkit.block.BlockFace;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * A position represented with integers.
|
||||
+ * <p>
|
||||
+ * <b>May see breaking changes until Experimental annotation is removed.</b>
|
||||
+ * @see FinePosition
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+public interface BlockPosition extends Position {
|
||||
+
|
||||
+ @Override
|
||||
+ default double x() {
|
||||
+ return this.blockX();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default double y() {
|
||||
+ return this.blockY();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default double z() {
|
||||
+ return this.blockZ();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default boolean isBlock() {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default boolean isFine() {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default @NotNull BlockPosition toBlock() {
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default @NotNull BlockPosition offset(int x, int y, int z) {
|
||||
+ return x == 0 && y == 0 && z == 0 ? this : new BlockPositionImpl(this.blockX() + x, this.blockY() + y, this.blockZ() + z);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default @NotNull FinePosition offset(double x, double y, double z) {
|
||||
+ return new FinePositionImpl(this.blockX() + z, this.blockY() + y, this.blockZ() + z);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a block position offset by 1 in the direction specified.
|
||||
+ *
|
||||
+ * @param blockFace the block face to offset towards
|
||||
+ * @return the offset block position
|
||||
+ */
|
||||
+ @Contract(value = "_ -> new", pure = true)
|
||||
+ default @NotNull BlockPosition offset(@NotNull BlockFace blockFace) {
|
||||
+ return this.offset(blockFace, 1);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a block position offset in the direction specified
|
||||
+ * multiplied by the amount.
|
||||
+ *
|
||||
+ * @param blockFace the block face to offset towards
|
||||
+ * @param amount the number of times to move in that direction
|
||||
+ * @return the offset block position
|
||||
+ */
|
||||
+ @Contract(pure = true)
|
||||
+ default @NotNull BlockPosition offset(@NotNull BlockFace blockFace, int amount) {
|
||||
+ return amount == 0 ? this : new BlockPositionImpl(this.blockX() + (blockFace.getModX() * amount), this.blockY() + (blockFace.getModY() * amount), this.blockZ() + (blockFace.getModZ() * amount));
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a block position offset by the amount along
|
||||
+ * the specified axis.
|
||||
+ *
|
||||
+ * @param axis the axis to offset along
|
||||
+ * @param amount the amount to offset along that axis
|
||||
+ * @return the offset block position
|
||||
+ */
|
||||
+ @Contract(pure = true)
|
||||
+ default @NotNull BlockPosition offset(@NotNull Axis axis, int amount) {
|
||||
+ return amount == 0 ? this : switch (axis) {
|
||||
+ case X -> new BlockPositionImpl(this.blockX() + amount, this.blockY(), this.blockZ());
|
||||
+ case Y -> new BlockPositionImpl(this.blockX(), this.blockY() + amount, this.blockZ());
|
||||
+ case Z -> new BlockPositionImpl(this.blockX(), this.blockY(), this.blockZ() + amount);
|
||||
+ };
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/math/BlockPositionImpl.java b/src/main/java/io/papermc/paper/math/BlockPositionImpl.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..eb5a3f26c7ba56c6715827f52c0013a860ec7d9a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/math/BlockPositionImpl.java
|
||||
@@ -0,0 +1,4 @@
|
||||
+package io.papermc.paper.math;
|
||||
+
|
||||
+record BlockPositionImpl(int blockX, int blockY, int blockZ) implements BlockPosition {
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/math/FinePosition.java b/src/main/java/io/papermc/paper/math/FinePosition.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..d8df70d731573cf2446044925f218876d62fd7cf
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/math/FinePosition.java
|
||||
@@ -0,0 +1,56 @@
|
||||
+package io.papermc.paper.math;
|
||||
+
|
||||
+import org.bukkit.util.NumberConversions;
|
||||
+import org.bukkit.util.Vector;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * A position represented with doubles.
|
||||
+ * <p>
|
||||
+ * <b>May see breaking changes until Experimental annotation is removed.</b>
|
||||
+ * @see BlockPosition
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+public interface FinePosition extends Position {
|
||||
+
|
||||
+ @Override
|
||||
+ default int blockX() {
|
||||
+ return NumberConversions.floor(this.x());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default int blockY() {
|
||||
+ return NumberConversions.floor(this.y());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default int blockZ() {
|
||||
+ return NumberConversions.floor(this.z());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default boolean isBlock() {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default boolean isFine() {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default @NotNull BlockPosition toBlock() {
|
||||
+ return new BlockPositionImpl(this.blockX(), this.blockY(), this.blockZ());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default @NotNull FinePosition offset(int x, int y, int z) {
|
||||
+ return this.offset((double) x, y, z);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default @NotNull FinePosition offset(double x, double y, double z) {
|
||||
+ return x == 0.0 && y == 0.0 && z == 0.0 ? this : new FinePositionImpl(this.x() + x, this.y() + y, this.z() + z);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/math/FinePositionImpl.java b/src/main/java/io/papermc/paper/math/FinePositionImpl.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..93476aaf8d21efb5a30b6d2cc2eeda8100fb72d0
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/math/FinePositionImpl.java
|
||||
@@ -0,0 +1,4 @@
|
||||
+package io.papermc.paper.math;
|
||||
+
|
||||
+record FinePositionImpl(double x, double y, double z) implements FinePosition {
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/math/Position.java b/src/main/java/io/papermc/paper/math/Position.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..300da713dcc303b340efad70efe57facf5422964
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/math/Position.java
|
||||
@@ -0,0 +1,184 @@
|
||||
+package io.papermc.paper.math;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.World;
|
||||
+import org.bukkit.util.Vector;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Common interface for {@link FinePosition} and {@link BlockPosition}.
|
||||
+ * <p>
|
||||
+ * <b>May see breaking changes until Experimental annotation is removed.</b>
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+public interface Position {
|
||||
+
|
||||
+ FinePosition FINE_ZERO = new FinePositionImpl(0, 0, 0);
|
||||
+ BlockPosition BLOCK_ZERO = new BlockPositionImpl(0, 0, 0);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the block x value for this position
|
||||
+ *
|
||||
+ * @return the block x value
|
||||
+ */
|
||||
+ int blockX();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the block x value for this position
|
||||
+ *
|
||||
+ * @return the block x value
|
||||
+ */
|
||||
+ int blockY();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the block x value for this position
|
||||
+ *
|
||||
+ * @return the block x value
|
||||
+ */
|
||||
+ int blockZ();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the x value for this position
|
||||
+ *
|
||||
+ * @return the x value
|
||||
+ */
|
||||
+ double x();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the y value for this position
|
||||
+ *
|
||||
+ * @return the y value
|
||||
+ */
|
||||
+ double y();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the z value for this position
|
||||
+ *
|
||||
+ * @return the z value
|
||||
+ */
|
||||
+ double z();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks of this position represents a {@link BlockPosition}
|
||||
+ *
|
||||
+ * @return true if block
|
||||
+ */
|
||||
+ boolean isBlock();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if this position represents a {@link FinePosition}
|
||||
+ *
|
||||
+ * @return true if fine
|
||||
+ */
|
||||
+ boolean isFine();
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a position offset by the specified amounts.
|
||||
+ *
|
||||
+ * @param x x value to offset
|
||||
+ * @param y y value to offset
|
||||
+ * @param z z value to offset
|
||||
+ * @return the offset position
|
||||
+ */
|
||||
+ @NotNull Position offset(int x, int y, int z);
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a position offset by the specified amounts.
|
||||
+ *
|
||||
+ * @param x x value to offset
|
||||
+ * @param y y value to offset
|
||||
+ * @param z z value to offset
|
||||
+ * @return the offset position
|
||||
+ */
|
||||
+ @NotNull FinePosition offset(double x, double y, double z);
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a new position at the center of the block position this represents
|
||||
+ *
|
||||
+ * @return a new center position
|
||||
+ */
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ default @NotNull FinePosition toCenter() {
|
||||
+ return new FinePositionImpl(this.blockX() + 0.5, this.blockY() + 0.5, this.blockZ() + 0.5);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the block position of this position
|
||||
+ * or itself if it already is a block position
|
||||
+ *
|
||||
+ * @return the block position
|
||||
+ */
|
||||
+ @Contract(pure = true)
|
||||
+ @NotNull BlockPosition toBlock();
|
||||
+
|
||||
+ /**
|
||||
+ * Converts this position to a vector
|
||||
+ *
|
||||
+ * @return a new vector
|
||||
+ */
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ default @NotNull Vector toVector() {
|
||||
+ return new Vector(this.x(), this.y(), this.z());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a new location object at this position with the specified world
|
||||
+ *
|
||||
+ * @param world the world for the location object
|
||||
+ * @return a new location
|
||||
+ */
|
||||
+ @Contract(value = "_ -> new", pure = true)
|
||||
+ default @NotNull Location toLocation(@NotNull World world) {
|
||||
+ return new Location(world, this.x(), this.y(), this.z());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a position at the coordinates
|
||||
+ *
|
||||
+ * @param x x coord
|
||||
+ * @param y y coord
|
||||
+ * @param z z coord
|
||||
+ * @return a position with those coords
|
||||
+ */
|
||||
+ @Contract(value = "_, _, _ -> new", pure = true)
|
||||
+ static @NotNull BlockPosition block(int x, int y, int z) {
|
||||
+ return new BlockPositionImpl(x, y, z);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a position from the location.
|
||||
+ *
|
||||
+ * @param location the location to copy the position of
|
||||
+ * @return a new position at that location
|
||||
+ */
|
||||
+ @Contract(value = "_ -> new", pure = true)
|
||||
+ static @NotNull BlockPosition block(@NotNull Location location) {
|
||||
+ return new BlockPositionImpl(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a position at the coordinates
|
||||
+ *
|
||||
+ * @param x x coord
|
||||
+ * @param y y coord
|
||||
+ * @param z z coord
|
||||
+ * @return a position with those coords
|
||||
+ */
|
||||
+ @Contract(value = "_, _, _ -> new", pure = true)
|
||||
+ static @NotNull FinePosition fine(double x, double y, double z) {
|
||||
+ return new FinePositionImpl(x, y, z);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a position from the location.
|
||||
+ *
|
||||
+ * @param location the location to copy the position of
|
||||
+ * @return a new position at that location
|
||||
+ */
|
||||
+ @Contract(value = "_ -> new", pure = true)
|
||||
+ static @NotNull FinePosition fine(@NotNull Location location) {
|
||||
+ return new FinePositionImpl(location.getX(), location.getY(), location.getZ());
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
|
||||
index 7c4db051472fb6a6c6d24092dc6f75487356690a..3b99f359f556e6f2c341d55fa69b7462e69b6546 100644
|
||||
--- a/src/main/java/org/bukkit/Location.java
|
||||
+++ b/src/main/java/org/bukkit/Location.java
|
||||
@@ -20,7 +20,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* magnitude than 360 are valid, but may be normalized to any other equivalent
|
||||
* representation by the implementation.
|
||||
*/
|
||||
-public class Location implements Cloneable, ConfigurationSerializable {
|
||||
+public class Location implements Cloneable, ConfigurationSerializable, io.papermc.paper.math.FinePosition { // Paper
|
||||
private Reference<World> world;
|
||||
private double x;
|
||||
private double y;
|
||||
@@ -706,4 +706,26 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
||||
}
|
||||
return pitch;
|
||||
}
|
||||
+
|
||||
+ // Paper - add Position
|
||||
+ @Override
|
||||
+ public double x() {
|
||||
+ return this.getX();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public double y() {
|
||||
+ return this.getY();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public double z() {
|
||||
+ return this.getZ();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull Location toLocation(@NotNull World world) {
|
||||
+ return new Location(world, this.x(), this.y(), this.z(), this.getYaw(), this.getPitch());
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
2572
patches/api/0009-Paper-Plugins.patch
Normale Datei
2572
patches/api/0009-Paper-Plugins.patch
Normale Datei
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
434
patches/api/0010-Add-Position.patch
Normale Datei
434
patches/api/0010-Add-Position.patch
Normale Datei
@ -0,0 +1,434 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sun, 20 Mar 2022 10:42:28 -0700
|
||||
Subject: [PATCH] Add Position
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/math/BlockPosition.java b/src/main/java/io/papermc/paper/math/BlockPosition.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f0fdabce4af640da2a406412e67020761ded3ac1
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/math/BlockPosition.java
|
||||
@@ -0,0 +1,98 @@
|
||||
+package io.papermc.paper.math;
|
||||
+
|
||||
+import org.bukkit.Axis;
|
||||
+import org.bukkit.block.BlockFace;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * A position represented with integers.
|
||||
+ * <p>
|
||||
+ * <b>May see breaking changes until Experimental annotation is removed.</b>
|
||||
+ * @see FinePosition
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+public interface BlockPosition extends Position {
|
||||
+
|
||||
+ @Override
|
||||
+ default double x() {
|
||||
+ return this.blockX();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default double y() {
|
||||
+ return this.blockY();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default double z() {
|
||||
+ return this.blockZ();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default boolean isBlock() {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default boolean isFine() {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default @NotNull BlockPosition toBlock() {
|
||||
+ return this;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default @NotNull BlockPosition offset(int x, int y, int z) {
|
||||
+ return x == 0 && y == 0 && z == 0 ? this : new BlockPositionImpl(this.blockX() + x, this.blockY() + y, this.blockZ() + z);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default @NotNull FinePosition offset(double x, double y, double z) {
|
||||
+ return new FinePositionImpl(this.blockX() + x, this.blockY() + y, this.blockZ() + z);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a block position offset by 1 in the direction specified.
|
||||
+ *
|
||||
+ * @param blockFace the block face to offset towards
|
||||
+ * @return the offset block position
|
||||
+ */
|
||||
+ @Contract(value = "_ -> new", pure = true)
|
||||
+ default @NotNull BlockPosition offset(@NotNull BlockFace blockFace) {
|
||||
+ return this.offset(blockFace, 1);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a block position offset in the direction specified
|
||||
+ * multiplied by the amount.
|
||||
+ *
|
||||
+ * @param blockFace the block face to offset towards
|
||||
+ * @param amount the number of times to move in that direction
|
||||
+ * @return the offset block position
|
||||
+ */
|
||||
+ @Contract(pure = true)
|
||||
+ default @NotNull BlockPosition offset(@NotNull BlockFace blockFace, int amount) {
|
||||
+ return amount == 0 ? this : new BlockPositionImpl(this.blockX() + (blockFace.getModX() * amount), this.blockY() + (blockFace.getModY() * amount), this.blockZ() + (blockFace.getModZ() * amount));
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a block position offset by the amount along
|
||||
+ * the specified axis.
|
||||
+ *
|
||||
+ * @param axis the axis to offset along
|
||||
+ * @param amount the amount to offset along that axis
|
||||
+ * @return the offset block position
|
||||
+ */
|
||||
+ @Contract(pure = true)
|
||||
+ default @NotNull BlockPosition offset(@NotNull Axis axis, int amount) {
|
||||
+ return amount == 0 ? this : switch (axis) {
|
||||
+ case X -> new BlockPositionImpl(this.blockX() + amount, this.blockY(), this.blockZ());
|
||||
+ case Y -> new BlockPositionImpl(this.blockX(), this.blockY() + amount, this.blockZ());
|
||||
+ case Z -> new BlockPositionImpl(this.blockX(), this.blockY(), this.blockZ() + amount);
|
||||
+ };
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/math/BlockPositionImpl.java b/src/main/java/io/papermc/paper/math/BlockPositionImpl.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..eb5a3f26c7ba56c6715827f52c0013a860ec7d9a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/math/BlockPositionImpl.java
|
||||
@@ -0,0 +1,4 @@
|
||||
+package io.papermc.paper.math;
|
||||
+
|
||||
+record BlockPositionImpl(int blockX, int blockY, int blockZ) implements BlockPosition {
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/math/FinePosition.java b/src/main/java/io/papermc/paper/math/FinePosition.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..d8df70d731573cf2446044925f218876d62fd7cf
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/math/FinePosition.java
|
||||
@@ -0,0 +1,56 @@
|
||||
+package io.papermc.paper.math;
|
||||
+
|
||||
+import org.bukkit.util.NumberConversions;
|
||||
+import org.bukkit.util.Vector;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * A position represented with doubles.
|
||||
+ * <p>
|
||||
+ * <b>May see breaking changes until Experimental annotation is removed.</b>
|
||||
+ * @see BlockPosition
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+public interface FinePosition extends Position {
|
||||
+
|
||||
+ @Override
|
||||
+ default int blockX() {
|
||||
+ return NumberConversions.floor(this.x());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default int blockY() {
|
||||
+ return NumberConversions.floor(this.y());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default int blockZ() {
|
||||
+ return NumberConversions.floor(this.z());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default boolean isBlock() {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default boolean isFine() {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default @NotNull BlockPosition toBlock() {
|
||||
+ return new BlockPositionImpl(this.blockX(), this.blockY(), this.blockZ());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default @NotNull FinePosition offset(int x, int y, int z) {
|
||||
+ return this.offset((double) x, y, z);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ default @NotNull FinePosition offset(double x, double y, double z) {
|
||||
+ return x == 0.0 && y == 0.0 && z == 0.0 ? this : new FinePositionImpl(this.x() + x, this.y() + y, this.z() + z);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/math/FinePositionImpl.java b/src/main/java/io/papermc/paper/math/FinePositionImpl.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..93476aaf8d21efb5a30b6d2cc2eeda8100fb72d0
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/math/FinePositionImpl.java
|
||||
@@ -0,0 +1,4 @@
|
||||
+package io.papermc.paper.math;
|
||||
+
|
||||
+record FinePositionImpl(double x, double y, double z) implements FinePosition {
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/math/Position.java b/src/main/java/io/papermc/paper/math/Position.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..26bc5a0fa67855af87c8fd4cd8229b4d9f242740
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/math/Position.java
|
||||
@@ -0,0 +1,191 @@
|
||||
+package io.papermc.paper.math;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.World;
|
||||
+import org.bukkit.util.Vector;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Common interface for {@link FinePosition} and {@link BlockPosition}.
|
||||
+ * <p>
|
||||
+ * <b>May see breaking changes until Experimental annotation is removed.</b>
|
||||
+ */
|
||||
+@ApiStatus.Experimental
|
||||
+public interface Position {
|
||||
+
|
||||
+ FinePosition FINE_ZERO = new FinePositionImpl(0, 0, 0);
|
||||
+ BlockPosition BLOCK_ZERO = new BlockPositionImpl(0, 0, 0);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the block x value for this position
|
||||
+ *
|
||||
+ * @return the block x value
|
||||
+ */
|
||||
+ int blockX();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the block x value for this position
|
||||
+ *
|
||||
+ * @return the block x value
|
||||
+ */
|
||||
+ int blockY();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the block x value for this position
|
||||
+ *
|
||||
+ * @return the block x value
|
||||
+ */
|
||||
+ int blockZ();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the x value for this position
|
||||
+ *
|
||||
+ * @return the x value
|
||||
+ */
|
||||
+ double x();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the y value for this position
|
||||
+ *
|
||||
+ * @return the y value
|
||||
+ */
|
||||
+ double y();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the z value for this position
|
||||
+ *
|
||||
+ * @return the z value
|
||||
+ */
|
||||
+ double z();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks of this position represents a {@link BlockPosition}
|
||||
+ *
|
||||
+ * @return true if block
|
||||
+ */
|
||||
+ boolean isBlock();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if this position represents a {@link FinePosition}
|
||||
+ *
|
||||
+ * @return true if fine
|
||||
+ */
|
||||
+ boolean isFine();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if each component of this position is finite.
|
||||
+ */
|
||||
+ default boolean isFinite() {
|
||||
+ return Double.isFinite(this.x()) && Double.isFinite(this.y()) && Double.isFinite(this.z());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a position offset by the specified amounts.
|
||||
+ *
|
||||
+ * @param x x value to offset
|
||||
+ * @param y y value to offset
|
||||
+ * @param z z value to offset
|
||||
+ * @return the offset position
|
||||
+ */
|
||||
+ @NotNull Position offset(int x, int y, int z);
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a position offset by the specified amounts.
|
||||
+ *
|
||||
+ * @param x x value to offset
|
||||
+ * @param y y value to offset
|
||||
+ * @param z z value to offset
|
||||
+ * @return the offset position
|
||||
+ */
|
||||
+ @NotNull FinePosition offset(double x, double y, double z);
|
||||
+
|
||||
+ /**
|
||||
+ * Returns a new position at the center of the block position this represents
|
||||
+ *
|
||||
+ * @return a new center position
|
||||
+ */
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ default @NotNull FinePosition toCenter() {
|
||||
+ return new FinePositionImpl(this.blockX() + 0.5, this.blockY() + 0.5, this.blockZ() + 0.5);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the block position of this position
|
||||
+ * or itself if it already is a block position
|
||||
+ *
|
||||
+ * @return the block position
|
||||
+ */
|
||||
+ @Contract(pure = true)
|
||||
+ @NotNull BlockPosition toBlock();
|
||||
+
|
||||
+ /**
|
||||
+ * Converts this position to a vector
|
||||
+ *
|
||||
+ * @return a new vector
|
||||
+ */
|
||||
+ @Contract(value = "-> new", pure = true)
|
||||
+ default @NotNull Vector toVector() {
|
||||
+ return new Vector(this.x(), this.y(), this.z());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a new location object at this position with the specified world
|
||||
+ *
|
||||
+ * @param world the world for the location object
|
||||
+ * @return a new location
|
||||
+ */
|
||||
+ @Contract(value = "_ -> new", pure = true)
|
||||
+ default @NotNull Location toLocation(@NotNull World world) {
|
||||
+ return new Location(world, this.x(), this.y(), this.z());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a position at the coordinates
|
||||
+ *
|
||||
+ * @param x x coord
|
||||
+ * @param y y coord
|
||||
+ * @param z z coord
|
||||
+ * @return a position with those coords
|
||||
+ */
|
||||
+ @Contract(value = "_, _, _ -> new", pure = true)
|
||||
+ static @NotNull BlockPosition block(int x, int y, int z) {
|
||||
+ return new BlockPositionImpl(x, y, z);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a position from the location.
|
||||
+ *
|
||||
+ * @param location the location to copy the position of
|
||||
+ * @return a new position at that location
|
||||
+ */
|
||||
+ @Contract(value = "_ -> new", pure = true)
|
||||
+ static @NotNull BlockPosition block(@NotNull Location location) {
|
||||
+ return new BlockPositionImpl(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a position at the coordinates
|
||||
+ *
|
||||
+ * @param x x coord
|
||||
+ * @param y y coord
|
||||
+ * @param z z coord
|
||||
+ * @return a position with those coords
|
||||
+ */
|
||||
+ @Contract(value = "_, _, _ -> new", pure = true)
|
||||
+ static @NotNull FinePosition fine(double x, double y, double z) {
|
||||
+ return new FinePositionImpl(x, y, z);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a position from the location.
|
||||
+ *
|
||||
+ * @param location the location to copy the position of
|
||||
+ * @return a new position at that location
|
||||
+ */
|
||||
+ @Contract(value = "_ -> new", pure = true)
|
||||
+ static @NotNull FinePosition fine(@NotNull Location location) {
|
||||
+ return new FinePositionImpl(location.getX(), location.getY(), location.getZ());
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
|
||||
index 7c4db051472fb6a6c6d24092dc6f75487356690a..85c342fc50f2fe0ce9a1b3980df9e088c3dea92d 100644
|
||||
--- a/src/main/java/org/bukkit/Location.java
|
||||
+++ b/src/main/java/org/bukkit/Location.java
|
||||
@@ -20,7 +20,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
* magnitude than 360 are valid, but may be normalized to any other equivalent
|
||||
* representation by the implementation.
|
||||
*/
|
||||
-public class Location implements Cloneable, ConfigurationSerializable {
|
||||
+public class Location implements Cloneable, ConfigurationSerializable, io.papermc.paper.math.FinePosition { // Paper
|
||||
private Reference<World> world;
|
||||
private double x;
|
||||
private double y;
|
||||
@@ -706,4 +706,31 @@ public class Location implements Cloneable, ConfigurationSerializable {
|
||||
}
|
||||
return pitch;
|
||||
}
|
||||
+
|
||||
+ // Paper - add Position
|
||||
+ @Override
|
||||
+ public double x() {
|
||||
+ return this.getX();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public double y() {
|
||||
+ return this.getY();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public double z() {
|
||||
+ return this.getZ();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isFinite() {
|
||||
+ return io.papermc.paper.math.FinePosition.super.isFinite() && Float.isFinite(this.getYaw()) && Float.isFinite(this.getPitch());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull Location toLocation(@NotNull World world) {
|
||||
+ return new Location(world, this.x(), this.y(), this.z(), this.getYaw(), this.getPitch());
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@ -1,96 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
|
||||
Date: Tue, 18 May 2021 14:42:26 -0700
|
||||
Subject: [PATCH] Add command line option to load extra plugin jars not in the
|
||||
plugins folder
|
||||
|
||||
ex: java -jar paperclip.jar nogui -add-plugin=/path/to/plugin.jar -add-plugin=/path/to/another/plugin_jar.jar
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index e24589a4cb42b0163e4a1455b8b11d7130b5cd41..71a09ed2b9863d2d339967f41ab6373ec27429d3 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -76,6 +76,20 @@ public final class Bukkit {
|
||||
return server;
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * Returns the de facto plugins directory, generally used for storing plugin jars to be loaded,
|
||||
+ * as well as their {@link org.bukkit.plugin.Plugin#getDataFolder() data folders}.
|
||||
+ *
|
||||
+ * <p>Plugins should use {@link org.bukkit.plugin.Plugin#getDataFolder()} rather than traversing this
|
||||
+ * directory manually when determining the location in which to store their data and configuration files.</p>
|
||||
+ *
|
||||
+ * @return plugins directory
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public static File getPluginsFolder() {
|
||||
+ return server.getPluginsFolder();
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* Attempts to set the {@link Server} singleton.
|
||||
* <p>
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index ac087402c90dad4b3c499fcf8507e50e9099cea5..a4f8035b40eebff8afe01788781128b04247f28c 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -61,6 +61,18 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public interface Server extends PluginMessageRecipient, net.kyori.adventure.audience.ForwardingAudience { // Paper
|
||||
|
||||
+ /**
|
||||
+ * Returns the de facto plugins directory, generally used for storing plugin jars to be loaded,
|
||||
+ * as well as their {@link org.bukkit.plugin.Plugin#getDataFolder() data folders}.
|
||||
+ *
|
||||
+ * <p>Plugins should use {@link org.bukkit.plugin.Plugin#getDataFolder()} rather than traversing this
|
||||
+ * directory manually when determining the location in which to store their data and configuration files.</p>
|
||||
+ *
|
||||
+ * @return plugins directory
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ File getPluginsFolder();
|
||||
+
|
||||
/**
|
||||
* Used for all administrative messages, such as an operator using a
|
||||
* command.
|
||||
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
index f13dcbe448111b24b36105d25527ba87ccc9334e..3fcb73a0fc2daaeb76dd4c6757afce52c5b3118b 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
@@ -116,9 +116,22 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@Override
|
||||
@NotNull
|
||||
public Plugin[] loadPlugins(@NotNull File directory) {
|
||||
+ // Paper start - extra jars
|
||||
+ return this.loadPlugins(directory, java.util.Collections.emptyList());
|
||||
+ }
|
||||
+ @NotNull
|
||||
+ public Plugin[] loadPlugins(final @NotNull File directory, final @NotNull List<File> extraPluginJars) {
|
||||
+ // Paper end
|
||||
if (true) {
|
||||
List<Plugin> pluginList = new ArrayList<>();
|
||||
java.util.Collections.addAll(pluginList, this.paperPluginManager.loadPlugins(directory));
|
||||
+ for (File file : extraPluginJars) {
|
||||
+ try {
|
||||
+ pluginList.add(this.paperPluginManager.loadPlugin(file));
|
||||
+ } catch (Exception e) {
|
||||
+ this.server.getLogger().log(Level.SEVERE, "Plugin loading error!", e);
|
||||
+ }
|
||||
+ }
|
||||
return pluginList.toArray(new Plugin[0]);
|
||||
}
|
||||
Preconditions.checkArgument(directory != null, "Directory cannot be null");
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
index 02062284dbc1a6c923ceffa5e4d6a3be8c7429d3..88d852c1a729ffd5951da803da424b31591c9f9a 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
@@ -93,7 +93,7 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
throw new InvalidPluginException(ex);
|
||||
}
|
||||
|
||||
- final File parentFile = file.getParentFile();
|
||||
+ final File parentFile = this.server.getPluginsFolder(); // Paper
|
||||
final File dataFolder = new File(parentFile, description.getName());
|
||||
@SuppressWarnings("deprecation")
|
||||
final File oldDataFolder = new File(parentFile, description.getRawName());
|
3830
patches/api/0011-Timings-v2.patch
Normale Datei
3830
patches/api/0011-Timings-v2.patch
Normale Datei
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@ -0,0 +1,96 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
|
||||
Date: Tue, 18 May 2021 14:42:26 -0700
|
||||
Subject: [PATCH] Add command line option to load extra plugin jars not in the
|
||||
plugins folder
|
||||
|
||||
ex: java -jar paperclip.jar nogui -add-plugin=/path/to/plugin.jar -add-plugin=/path/to/another/plugin_jar.jar
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 6ecab28705afc0e3652677b516d8a5398e8b2666..db51751d2dc1ac419e8fac32466ad3a7727fa2fe 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -83,6 +83,20 @@ public final class Bukkit {
|
||||
return server;
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * Returns the de facto plugins directory, generally used for storing plugin jars to be loaded,
|
||||
+ * as well as their {@link org.bukkit.plugin.Plugin#getDataFolder() data folders}.
|
||||
+ *
|
||||
+ * <p>Plugins should use {@link org.bukkit.plugin.Plugin#getDataFolder()} rather than traversing this
|
||||
+ * directory manually when determining the location in which to store their data and configuration files.</p>
|
||||
+ *
|
||||
+ * @return plugins directory
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public static File getPluginsFolder() {
|
||||
+ return server.getPluginsFolder();
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* Attempts to set the {@link Server} singleton.
|
||||
* <p>
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index f4b2ad91c7a46af5fc16f31369d155e4e3ab3aae..638e98416fdf7ac065abe058d625b1c924be5abb 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -68,6 +68,18 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public interface Server extends PluginMessageRecipient, net.kyori.adventure.audience.ForwardingAudience { // Paper
|
||||
|
||||
+ /**
|
||||
+ * Returns the de facto plugins directory, generally used for storing plugin jars to be loaded,
|
||||
+ * as well as their {@link org.bukkit.plugin.Plugin#getDataFolder() data folders}.
|
||||
+ *
|
||||
+ * <p>Plugins should use {@link org.bukkit.plugin.Plugin#getDataFolder()} rather than traversing this
|
||||
+ * directory manually when determining the location in which to store their data and configuration files.</p>
|
||||
+ *
|
||||
+ * @return plugins directory
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ File getPluginsFolder();
|
||||
+
|
||||
/**
|
||||
* Used for all administrative messages, such as an operator using a
|
||||
* command.
|
||||
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
index 6018574cd15b802833613beefa88da15dc2730cb..e7b1895d3918487d711afcbe41d76863d85c0a62 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
@@ -117,9 +117,22 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@Override
|
||||
@NotNull
|
||||
public Plugin[] loadPlugins(@NotNull File directory) {
|
||||
+ // Paper start - extra jars
|
||||
+ return this.loadPlugins(directory, java.util.Collections.emptyList());
|
||||
+ }
|
||||
+ @NotNull
|
||||
+ public Plugin[] loadPlugins(final @NotNull File directory, final @NotNull List<File> extraPluginJars) {
|
||||
+ // Paper end
|
||||
if (true) {
|
||||
List<Plugin> pluginList = new ArrayList<>();
|
||||
java.util.Collections.addAll(pluginList, this.paperPluginManager.loadPlugins(directory));
|
||||
+ for (File file : extraPluginJars) {
|
||||
+ try {
|
||||
+ pluginList.add(this.paperPluginManager.loadPlugin(file));
|
||||
+ } catch (Exception e) {
|
||||
+ this.server.getLogger().log(Level.SEVERE, "Plugin loading error!", e);
|
||||
+ }
|
||||
+ }
|
||||
return pluginList.toArray(new Plugin[0]);
|
||||
}
|
||||
Preconditions.checkArgument(directory != null, "Directory cannot be null");
|
||||
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
index de6b6188587fd254ab96cbc1f95fda2056d9cbe2..eaefbb00e9993d54906cc8cf35cf753c0d6c7707 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||
@@ -93,7 +93,7 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||
throw new InvalidPluginException(ex);
|
||||
}
|
||||
|
||||
- final File parentFile = file.getParentFile();
|
||||
+ final File parentFile = this.server.getPluginsFolder(); // Paper
|
||||
final File dataFolder = new File(parentFile, description.getName());
|
||||
@SuppressWarnings("deprecation")
|
||||
final File oldDataFolder = new File(parentFile, description.getRawName());
|
@ -1,33 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jedediah Smith <jedediah@silencegreys.com>
|
||||
Date: Mon, 29 Feb 2016 17:22:34 -0600
|
||||
Subject: [PATCH] Player affects spawning API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 705644a2e0d209ef717470da07d34fafc88a0640..1c3d9ac922c189adc139c2646b4bdc97dbfadb43 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -1875,6 +1875,22 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@Deprecated // Paper
|
||||
public String getLocale();
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Get whether the player can affect mob spawning
|
||||
+ *
|
||||
+ * @return if the player can affect mob spawning
|
||||
+ */
|
||||
+ public boolean getAffectsSpawning();
|
||||
+
|
||||
+ /**
|
||||
+ * Set whether the player can affect mob spawning
|
||||
+ *
|
||||
+ * @param affects Whether the player can affect mob spawning
|
||||
+ */
|
||||
+ public void setAffectsSpawning(boolean affects);
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Update the list of commands sent to the client.
|
||||
* <br>
|
@ -1,49 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 29 Feb 2016 17:24:57 -0600
|
||||
Subject: [PATCH] Add getTPS method
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 71a09ed2b9863d2d339967f41ab6373ec27429d3..397f57f0ab4844fb88c60681bf6e6e3db8a98945 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -1891,6 +1891,17 @@ public final class Bukkit {
|
||||
return server.getEntity(uuid);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the current server TPS
|
||||
+ * @return current server TPS (1m, 5m, 15m in Paper-Server)
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public static double[] getTPS() {
|
||||
+ return server.getTPS();
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Get the advancement specified by this key.
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index a4f8035b40eebff8afe01788781128b04247f28c..3f3531e208472a0e76f76e2b1a08a699527cef8f 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -1605,6 +1605,16 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@Nullable
|
||||
Entity getEntity(@NotNull UUID uuid);
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the current server TPS
|
||||
+ *
|
||||
+ * @return current server TPS (1m, 5m, 15m in Paper-Server)
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public double[] getTPS();
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Get the advancement specified by this key.
|
||||
*
|
33
patches/api/0013-Player-affects-spawning-API.patch
Normale Datei
33
patches/api/0013-Player-affects-spawning-API.patch
Normale Datei
@ -0,0 +1,33 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jedediah Smith <jedediah@silencegreys.com>
|
||||
Date: Mon, 29 Feb 2016 17:22:34 -0600
|
||||
Subject: [PATCH] Player affects spawning API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 3594b0eb4068c83c93efe948a8ef4ba217edce17..1ba2f706a62ee6962451305b1895654453b485cd 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -2583,6 +2583,22 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@Deprecated // Paper
|
||||
public String getLocale();
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Get whether the player can affect mob spawning
|
||||
+ *
|
||||
+ * @return if the player can affect mob spawning
|
||||
+ */
|
||||
+ public boolean getAffectsSpawning();
|
||||
+
|
||||
+ /**
|
||||
+ * Set whether the player can affect mob spawning
|
||||
+ *
|
||||
+ * @param affects Whether the player can affect mob spawning
|
||||
+ */
|
||||
+ public void setAffectsSpawning(boolean affects);
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Update the list of commands sent to the client.
|
||||
* <br>
|
49
patches/api/0014-Add-getTPS-method.patch
Normale Datei
49
patches/api/0014-Add-getTPS-method.patch
Normale Datei
@ -0,0 +1,49 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Mon, 29 Feb 2016 17:24:57 -0600
|
||||
Subject: [PATCH] Add getTPS method
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index d978c72cdbc10792f852a4ba372518073893d02b..5780003631beae773231afe3afc6b834bfe1f84d 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -2108,6 +2108,17 @@ public final class Bukkit {
|
||||
return server.getEntity(uuid);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the current server TPS
|
||||
+ * @return current server TPS (1m, 5m, 15m in Paper-Server)
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public static double[] getTPS() {
|
||||
+ return server.getTPS();
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Get the advancement specified by this key.
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 8949b8e29ae7f412481291630a5cb7b5b8809842..ba28d9f3213ca4b5f15178dc637bff37a8896edc 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -1797,6 +1797,16 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@Nullable
|
||||
Entity getEntity(@NotNull UUID uuid);
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the current server TPS
|
||||
+ *
|
||||
+ * @return current server TPS (1m, 5m, 15m in Paper-Server)
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public double[] getTPS();
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Get the advancement specified by this key.
|
||||
*
|
@ -1,177 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach@zachbr.io>
|
||||
Date: Mon, 27 May 2019 01:10:06 -0500
|
||||
Subject: [PATCH] Version Command 2.0
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/util/VersionFetcher.java b/src/main/java/com/destroystokyo/paper/util/VersionFetcher.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..a736d7bcdc5861a01b66ba36158db1c716339346
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/util/VersionFetcher.java
|
||||
@@ -0,0 +1,45 @@
|
||||
+package com.destroystokyo.paper.util;
|
||||
+
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.kyori.adventure.text.format.NamedTextColor;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+public interface VersionFetcher {
|
||||
+ /**
|
||||
+ * Amount of time to cache results for in milliseconds
|
||||
+ * <p>
|
||||
+ * Negative values will never cache.
|
||||
+ *
|
||||
+ * @return cache time
|
||||
+ */
|
||||
+ long getCacheTime();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the version message to cache and show to command senders.
|
||||
+ *
|
||||
+ * <p>NOTE: This is run in a new thread separate from that of the command processing thread</p>
|
||||
+ *
|
||||
+ * @param serverVersion the current version of the server (will match {@link Bukkit#getVersion()})
|
||||
+ * @return the message to show when requesting a version
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Component getVersionMessage(@NotNull String serverVersion);
|
||||
+
|
||||
+ class DummyVersionFetcher implements VersionFetcher {
|
||||
+
|
||||
+ @Override
|
||||
+ public long getCacheTime() {
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public Component getVersionMessage(@NotNull String serverVersion) {
|
||||
+ Bukkit.getLogger().warning("Version provider has not been set, cannot check for updates!");
|
||||
+ Bukkit.getLogger().info("Override the default implementation of org.bukkit.UnsafeValues#getVersionFetcher()");
|
||||
+ new Throwable().printStackTrace();
|
||||
+ return Component.text("Unable to check for updates. No version provider set.", NamedTextColor.RED);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
index daf3ac72cae4d19c0273058dc6a1e1afe9a47f77..24fad8e59a3a5a174d24505cedda2a3fd52115b1 100644
|
||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -114,5 +114,12 @@ public interface UnsafeValues {
|
||||
* @return name
|
||||
*/
|
||||
String getTimingsServerName();
|
||||
+
|
||||
+ /**
|
||||
+ * Called once by the version command on first use, then cached.
|
||||
+ */
|
||||
+ default com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
|
||||
+ return new com.destroystokyo.paper.util.VersionFetcher.DummyVersionFetcher();
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
||||
index 04b4fb6859df0221f8f9f92c5a7ac2dda1073355..b50f614806f4634960d383e8a33f094c2f46935f 100644
|
||||
--- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
||||
+++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.bukkit.command.defaults;
|
||||
|
||||
+import com.destroystokyo.paper.util.VersionFetcher; // Paper - version supplier
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
@@ -26,6 +27,15 @@ import org.bukkit.util.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class VersionCommand extends BukkitCommand {
|
||||
+ private VersionFetcher versionFetcher;
|
||||
+ private VersionFetcher getVersionFetcher() { // lazy load because unsafe isn't available at command registration
|
||||
+ if (versionFetcher == null) {
|
||||
+ versionFetcher = Bukkit.getUnsafe().getVersionFetcher();
|
||||
+ }
|
||||
+
|
||||
+ return versionFetcher;
|
||||
+ }
|
||||
+
|
||||
public VersionCommand(@NotNull String name) {
|
||||
super(name);
|
||||
|
||||
@@ -40,7 +50,7 @@ public class VersionCommand extends BukkitCommand {
|
||||
if (!testPermission(sender)) return true;
|
||||
|
||||
if (args.length == 0) {
|
||||
- sender.sendMessage("This server is running " + Bukkit.getName() + " version " + Bukkit.getVersion() + " (Implementing API version " + Bukkit.getBukkitVersion() + ")");
|
||||
+ //sender.sendMessage("This server is running " + Bukkit.getName() + " version " + Bukkit.getVersion() + " (Implementing API version " + Bukkit.getBukkitVersion() + ")"); // Paper - moved to setVersionMessage
|
||||
sendVersion(sender);
|
||||
} else {
|
||||
StringBuilder name = new StringBuilder();
|
||||
@@ -146,14 +156,14 @@ public class VersionCommand extends BukkitCommand {
|
||||
|
||||
private final ReentrantLock versionLock = new ReentrantLock();
|
||||
private boolean hasVersion = false;
|
||||
- private String versionMessage = null;
|
||||
+ private net.kyori.adventure.text.Component versionMessage = null; // Paper
|
||||
private final Set<CommandSender> versionWaiters = new HashSet<CommandSender>();
|
||||
private boolean versionTaskStarted = false;
|
||||
private long lastCheck = 0;
|
||||
|
||||
private void sendVersion(@NotNull CommandSender sender) {
|
||||
if (hasVersion) {
|
||||
- if (System.currentTimeMillis() - lastCheck > 21600000) {
|
||||
+ if (System.currentTimeMillis() - lastCheck > getVersionFetcher().getCacheTime()) { // Paper - use version supplier
|
||||
lastCheck = System.currentTimeMillis();
|
||||
hasVersion = false;
|
||||
} else {
|
||||
@@ -168,7 +178,7 @@ public class VersionCommand extends BukkitCommand {
|
||||
return;
|
||||
}
|
||||
versionWaiters.add(sender);
|
||||
- sender.sendMessage("Checking version, please wait...");
|
||||
+ sender.sendMessage(net.kyori.adventure.text.Component.text("Checking version, please wait...", net.kyori.adventure.text.format.NamedTextColor.WHITE, net.kyori.adventure.text.format.TextDecoration.ITALIC)); // Paper
|
||||
if (!versionTaskStarted) {
|
||||
versionTaskStarted = true;
|
||||
new Thread(new Runnable() {
|
||||
@@ -186,6 +196,13 @@ public class VersionCommand extends BukkitCommand {
|
||||
|
||||
private void obtainVersion() {
|
||||
String version = Bukkit.getVersion();
|
||||
+ // Paper start
|
||||
+ if (version.startsWith("null")) { // running from ide?
|
||||
+ setVersionMessage(net.kyori.adventure.text.Component.text("Unknown version, custom build?", net.kyori.adventure.text.format.NamedTextColor.YELLOW));
|
||||
+ return;
|
||||
+ }
|
||||
+ setVersionMessage(getVersionFetcher().getVersionMessage(version));
|
||||
+ /*
|
||||
if (version == null) version = "Custom";
|
||||
String[] parts = version.substring(0, version.indexOf(' ')).split("-");
|
||||
if (parts.length == 4) {
|
||||
@@ -215,11 +232,24 @@ public class VersionCommand extends BukkitCommand {
|
||||
} else {
|
||||
setVersionMessage("Unknown version, custom build?");
|
||||
}
|
||||
+ */
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
- private void setVersionMessage(@NotNull String msg) {
|
||||
+ // Paper start
|
||||
+ private void setVersionMessage(final @NotNull net.kyori.adventure.text.Component msg) {
|
||||
lastCheck = System.currentTimeMillis();
|
||||
- versionMessage = msg;
|
||||
+ final net.kyori.adventure.text.Component message = net.kyori.adventure.text.TextComponent.ofChildren(
|
||||
+ net.kyori.adventure.text.Component.text("This server is running " + Bukkit.getName() + " version " + Bukkit.getVersion() + " (Implementing API version " + Bukkit.getBukkitVersion() + ")", net.kyori.adventure.text.format.NamedTextColor.WHITE),
|
||||
+ net.kyori.adventure.text.Component.newline(),
|
||||
+ msg
|
||||
+ );
|
||||
+ this.versionMessage = net.kyori.adventure.text.Component.text()
|
||||
+ .append(message)
|
||||
+ .hoverEvent(net.kyori.adventure.text.Component.text("Click to copy to clipboard", net.kyori.adventure.text.format.NamedTextColor.WHITE))
|
||||
+ .clickEvent(net.kyori.adventure.text.event.ClickEvent.copyToClipboard(net.kyori.adventure.text.serializer.plain.PlainComponentSerializer.plain().serialize(message)))
|
||||
+ .build();
|
||||
+ // Paper end
|
||||
versionLock.lock();
|
||||
try {
|
||||
hasVersion = true;
|
@ -1,66 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Byteflux <byte@byteflux.net>
|
||||
Date: Mon, 29 Feb 2016 17:50:31 -0600
|
||||
Subject: [PATCH] Entity Origin API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
|
||||
index bdcf5219ff1e4d4c0dc8a3423bc17b453b779473..a4dfac73b8510f0dddd65751b8430be1abdabbdd 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Entity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
||||
@@ -698,5 +698,15 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
||||
default net.kyori.adventure.text.event.HoverEvent<net.kyori.adventure.text.event.HoverEvent.ShowEntity> asHoverEvent(final @NotNull java.util.function.UnaryOperator<net.kyori.adventure.text.event.HoverEvent.ShowEntity> op) {
|
||||
return net.kyori.adventure.text.event.HoverEvent.showEntity(op.apply(net.kyori.adventure.text.event.HoverEvent.ShowEntity.of(this.getType().getKey(), this.getUniqueId(), this.customName())));
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the location where this entity originates from.
|
||||
+ * <p>
|
||||
+ * This value can be null if the entity hasn't yet been added to the world.
|
||||
+ *
|
||||
+ * @return Location where entity originates or null if not yet added
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ Location getOrigin();
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/entity/FallingBlock.java b/src/main/java/org/bukkit/entity/FallingBlock.java
|
||||
index 64f9d3fd870d65afd2ee9a85625b149163eee144..14cb0d770561151570ab4399ca5facff43076819 100644
|
||||
--- a/src/main/java/org/bukkit/entity/FallingBlock.java
|
||||
+++ b/src/main/java/org/bukkit/entity/FallingBlock.java
|
||||
@@ -54,4 +54,15 @@ public interface FallingBlock extends Entity {
|
||||
* @param hurtEntities whether entities will be damaged by this block.
|
||||
*/
|
||||
void setHurtEntities(boolean hurtEntities);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the source block location of the FallingBlock
|
||||
+ *
|
||||
+ * @return the source block location the FallingBlock was spawned from
|
||||
+ * @deprecated replaced by {@link Entity#getOrigin()}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ default org.bukkit.Location getSourceLoc() {
|
||||
+ return this.getOrigin();
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/entity/TNTPrimed.java b/src/main/java/org/bukkit/entity/TNTPrimed.java
|
||||
index a23cfdf66877f0a61eae700de084c76e6ee7b431..0813bd913c8fdb2001963ce3e82c07c2af105418 100644
|
||||
--- a/src/main/java/org/bukkit/entity/TNTPrimed.java
|
||||
+++ b/src/main/java/org/bukkit/entity/TNTPrimed.java
|
||||
@@ -53,4 +53,15 @@ public interface TNTPrimed extends Explosive {
|
||||
* @param source the source of this primed TNT
|
||||
*/
|
||||
public void setSource(@Nullable Entity source);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the source block location of the TNTPrimed
|
||||
+ *
|
||||
+ * @return the source block location the TNTPrimed was spawned from
|
||||
+ * @deprecated replaced by {@link Entity#getOrigin()}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ default org.bukkit.Location getSourceLoc() {
|
||||
+ return this.getOrigin();
|
||||
+ }
|
||||
}
|
528
patches/api/0015-Expose-server-build-information.patch
Normale Datei
528
patches/api/0015-Expose-server-build-information.patch
Normale Datei
@ -0,0 +1,528 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach@zachbr.io>
|
||||
Date: Mon, 27 May 2019 01:10:06 -0500
|
||||
Subject: [PATCH] Expose server build information
|
||||
|
||||
Co-authored-by: Professor Bloodstone <git@bloodstone.dev>
|
||||
Co-authored-by: Mark Vainomaa <mikroskeem@mikroskeem.eu>
|
||||
Co-authored-by: masmc05 <masmc05@gmail.com>
|
||||
Co-authored-by: Riley Park <rileysebastianpark@gmail.com>
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/util/VersionFetcher.java b/src/main/java/com/destroystokyo/paper/util/VersionFetcher.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..a736d7bcdc5861a01b66ba36158db1c716339346
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/util/VersionFetcher.java
|
||||
@@ -0,0 +1,45 @@
|
||||
+package com.destroystokyo.paper.util;
|
||||
+
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.kyori.adventure.text.format.NamedTextColor;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+public interface VersionFetcher {
|
||||
+ /**
|
||||
+ * Amount of time to cache results for in milliseconds
|
||||
+ * <p>
|
||||
+ * Negative values will never cache.
|
||||
+ *
|
||||
+ * @return cache time
|
||||
+ */
|
||||
+ long getCacheTime();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the version message to cache and show to command senders.
|
||||
+ *
|
||||
+ * <p>NOTE: This is run in a new thread separate from that of the command processing thread</p>
|
||||
+ *
|
||||
+ * @param serverVersion the current version of the server (will match {@link Bukkit#getVersion()})
|
||||
+ * @return the message to show when requesting a version
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ Component getVersionMessage(@NotNull String serverVersion);
|
||||
+
|
||||
+ class DummyVersionFetcher implements VersionFetcher {
|
||||
+
|
||||
+ @Override
|
||||
+ public long getCacheTime() {
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public Component getVersionMessage(@NotNull String serverVersion) {
|
||||
+ Bukkit.getLogger().warning("Version provider has not been set, cannot check for updates!");
|
||||
+ Bukkit.getLogger().info("Override the default implementation of org.bukkit.UnsafeValues#getVersionFetcher()");
|
||||
+ new Throwable().printStackTrace();
|
||||
+ return Component.text("Unable to check for updates. No version provider set.", NamedTextColor.RED);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/ServerBuildInfo.java b/src/main/java/io/papermc/paper/ServerBuildInfo.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9df9d09aa477d4cd3c496ba0933c816df1ef0964
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/ServerBuildInfo.java
|
||||
@@ -0,0 +1,121 @@
|
||||
+package io.papermc.paper;
|
||||
+
|
||||
+import java.time.Instant;
|
||||
+import java.util.Optional;
|
||||
+import java.util.OptionalInt;
|
||||
+import net.kyori.adventure.key.Key;
|
||||
+import net.kyori.adventure.util.Services;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Information about the current server build.
|
||||
+ */
|
||||
+@ApiStatus.NonExtendable
|
||||
+public interface ServerBuildInfo {
|
||||
+ /**
|
||||
+ * The brand id for Paper.
|
||||
+ */
|
||||
+ Key BRAND_PAPER_ID = Key.key("papermc", "paper");
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the {@code ServerBuildInfo}.
|
||||
+ *
|
||||
+ * @return the {@code ServerBuildInfo}
|
||||
+ */
|
||||
+ static @NotNull ServerBuildInfo buildInfo() {
|
||||
+ //<editor-fold defaultstate="collapsed" desc="Holder">
|
||||
+ final class Holder {
|
||||
+ static final Optional<ServerBuildInfo> INSTANCE = Services.service(ServerBuildInfo.class);
|
||||
+ }
|
||||
+ //</editor-fold>
|
||||
+ return Holder.INSTANCE.orElseThrow();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the brand id of the server.
|
||||
+ *
|
||||
+ * @return the brand id of the server (e.g. "papermc:paper")
|
||||
+ */
|
||||
+ @NotNull Key brandId();
|
||||
+
|
||||
+ /**
|
||||
+ * Checks if the current server supports the specified brand.
|
||||
+ *
|
||||
+ * @param brandId the brand to check (e.g. "papermc:folia")
|
||||
+ * @return {@code true} if the server supports the specified brand
|
||||
+ */
|
||||
+ @ApiStatus.Experimental
|
||||
+ boolean isBrandCompatible(final @NotNull Key brandId);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the brand name of the server.
|
||||
+ *
|
||||
+ * @return the brand name of the server (e.g. "Paper")
|
||||
+ */
|
||||
+ @NotNull String brandName();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the Minecraft version id.
|
||||
+ *
|
||||
+ * @return the Minecraft version id (e.g. "1.20.4", "1.20.2-pre2", "23w31a")
|
||||
+ */
|
||||
+ @NotNull String minecraftVersionId();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the Minecraft version name.
|
||||
+ *
|
||||
+ * @return the Minecraft version name (e.g. "1.20.4", "1.20.2 Pre-release 2", "23w31a")
|
||||
+ */
|
||||
+ @NotNull String minecraftVersionName();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the build number.
|
||||
+ *
|
||||
+ * @return the build number
|
||||
+ */
|
||||
+ @NotNull OptionalInt buildNumber();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the build time.
|
||||
+ *
|
||||
+ * @return the build time
|
||||
+ */
|
||||
+ @NotNull Instant buildTime();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the git commit branch.
|
||||
+ *
|
||||
+ * @return the git commit branch
|
||||
+ */
|
||||
+ @NotNull Optional<String> gitBranch();
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the git commit hash.
|
||||
+ *
|
||||
+ * @return the git commit hash
|
||||
+ */
|
||||
+ @NotNull Optional<String> gitCommit();
|
||||
+
|
||||
+ /**
|
||||
+ * Creates a string representation of the server build information.
|
||||
+ *
|
||||
+ * @param representation the type of representation
|
||||
+ * @return a string
|
||||
+ */
|
||||
+ @NotNull String asString(final @NotNull StringRepresentation representation);
|
||||
+
|
||||
+ /**
|
||||
+ * String representation types.
|
||||
+ */
|
||||
+ enum StringRepresentation {
|
||||
+ /**
|
||||
+ * A simple version string, in format {@code <minecraftVersionId>-<buildNumber>-<gitCommit>}.
|
||||
+ */
|
||||
+ VERSION_SIMPLE,
|
||||
+ /**
|
||||
+ * A simple version string, in format {@code <minecraftVersionId>-<buildNumber>-<gitBranch>@<gitCommit> (<buildTime>)}.
|
||||
+ */
|
||||
+ VERSION_FULL,
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/util/JarManifests.java b/src/main/java/io/papermc/paper/util/JarManifests.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..909617079db61b675cc7b60b44ef96b306076343
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/util/JarManifests.java
|
||||
@@ -0,0 +1,37 @@
|
||||
+package io.papermc.paper.util;
|
||||
+
|
||||
+import java.io.IOException;
|
||||
+import java.io.InputStream;
|
||||
+import java.net.URL;
|
||||
+import java.util.Collections;
|
||||
+import java.util.Map;
|
||||
+import java.util.WeakHashMap;
|
||||
+import java.util.jar.Manifest;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+@ApiStatus.Internal
|
||||
+public final class JarManifests {
|
||||
+ private JarManifests() {
|
||||
+ }
|
||||
+
|
||||
+ private static final Map<ClassLoader, Manifest> MANIFESTS = Collections.synchronizedMap(new WeakHashMap<>());
|
||||
+
|
||||
+ public static @Nullable Manifest manifest(final @NotNull Class<?> clazz) {
|
||||
+ return MANIFESTS.computeIfAbsent(clazz.getClassLoader(), classLoader -> {
|
||||
+ final String classLocation = "/" + clazz.getName().replace(".", "/") + ".class";
|
||||
+ final URL resource = clazz.getResource(classLocation);
|
||||
+ if (resource == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ final String classFilePath = resource.toString().replace("\\", "/");
|
||||
+ final String archivePath = classFilePath.substring(0, classFilePath.length() - classLocation.length());
|
||||
+ try (final InputStream stream = new URL(archivePath + "/META-INF/MANIFEST.MF").openStream()) {
|
||||
+ return new Manifest(stream);
|
||||
+ } catch (final IOException ex) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ });
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 5780003631beae773231afe3afc6b834bfe1f84d..a005d5f8879262c763d8c4fbd09b9a99810d5e8c 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -110,13 +110,26 @@ public final class Bukkit {
|
||||
}
|
||||
|
||||
Bukkit.server = server;
|
||||
- server.getLogger().info("This server is running " + getName() + " version " + getVersion() + " (Implementing API version " + getBukkitVersion() + ")");
|
||||
+ // Paper start - add git information
|
||||
+ server.getLogger().info(getVersionMessage());
|
||||
+ }
|
||||
+ /**
|
||||
+ * Gets message describing the version server is running.
|
||||
+ *
|
||||
+ * @return message describing the version server is running
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public static String getVersionMessage() {
|
||||
+ final io.papermc.paper.ServerBuildInfo version = io.papermc.paper.ServerBuildInfo.buildInfo();
|
||||
+ return "This server is running " + getName() + " version " + version.asString(io.papermc.paper.ServerBuildInfo.StringRepresentation.VERSION_FULL) + " (Implementing API version " + getBukkitVersion() + ")";
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of this server implementation.
|
||||
*
|
||||
* @return name of this server implementation
|
||||
+ * @see io.papermc.paper.ServerBuildInfo#brandName()
|
||||
*/
|
||||
@NotNull
|
||||
public static String getName() {
|
||||
@@ -127,6 +140,7 @@ public final class Bukkit {
|
||||
* Gets the version string of this server implementation.
|
||||
*
|
||||
* @return version of this server implementation
|
||||
+ * @see io.papermc.paper.ServerBuildInfo
|
||||
*/
|
||||
@NotNull
|
||||
public static String getVersion() {
|
||||
@@ -143,6 +157,20 @@ public final class Bukkit {
|
||||
return server.getBukkitVersion();
|
||||
}
|
||||
|
||||
+ // Paper start - expose game version
|
||||
+ /**
|
||||
+ * Gets the version of game this server implements
|
||||
+ *
|
||||
+ * @return version of game
|
||||
+ * @see io.papermc.paper.ServerBuildInfo#minecraftVersionId()
|
||||
+ * @see io.papermc.paper.ServerBuildInfo#minecraftVersionName()
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public static String getMinecraftVersion() {
|
||||
+ return server.getMinecraftVersion();
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Gets a view of all currently logged in players. This {@linkplain
|
||||
* Collections#unmodifiableCollection(Collection) view} is a reused
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index ba28d9f3213ca4b5f15178dc637bff37a8896edc..8a07f21eeb04fb54032ce377a1478f60303e1824 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -120,6 +120,16 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@NotNull
|
||||
public String getBukkitVersion();
|
||||
|
||||
+ // Paper start - expose game version
|
||||
+ /**
|
||||
+ * Gets the version of game this server implements
|
||||
+ *
|
||||
+ * @return version of game
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ String getMinecraftVersion();
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Gets a view of all currently logged in players. This {@linkplain
|
||||
* Collections#unmodifiableCollection(Collection) view} is a reused
|
||||
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
index 12ef99f1c91b92a133611c5f5aeaaeebd02ce232..6e67fdb091a006d2d13bc2d93db4d55348af4c8f 100644
|
||||
--- a/src/main/java/org/bukkit/UnsafeValues.java
|
||||
+++ b/src/main/java/org/bukkit/UnsafeValues.java
|
||||
@@ -163,5 +163,12 @@ public interface UnsafeValues {
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
String getTimingsServerName();
|
||||
+
|
||||
+ /**
|
||||
+ * Called once by the version command on first use, then cached.
|
||||
+ */
|
||||
+ default com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
|
||||
+ return new com.destroystokyo.paper.util.VersionFetcher.DummyVersionFetcher();
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
||||
index 263208d3cba36cb80c9ee4e3022ef702ea113df2..e64bb57f74e6d6f78927be228825b3e0bdf41f48 100644
|
||||
--- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
||||
+++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
|
||||
@@ -25,8 +25,25 @@ import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.util.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
+// Paper start - version command 2.0
|
||||
+import com.destroystokyo.paper.util.VersionFetcher;
|
||||
+import net.kyori.adventure.text.Component;
|
||||
+import net.kyori.adventure.text.format.NamedTextColor;
|
||||
+import net.kyori.adventure.text.event.ClickEvent;
|
||||
+import net.kyori.adventure.text.format.TextDecoration;
|
||||
+import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||
+// Paper end - version command 2.0
|
||||
|
||||
public class VersionCommand extends BukkitCommand {
|
||||
+ private VersionFetcher versionFetcher; // Paper - version command 2.0
|
||||
+ private VersionFetcher getVersionFetcher() { // lazy load because unsafe isn't available at command registration
|
||||
+ if (versionFetcher == null) {
|
||||
+ versionFetcher = Bukkit.getUnsafe().getVersionFetcher();
|
||||
+ }
|
||||
+
|
||||
+ return versionFetcher;
|
||||
+ }
|
||||
+
|
||||
public VersionCommand(@NotNull String name) {
|
||||
super(name);
|
||||
|
||||
@@ -41,7 +58,7 @@ public class VersionCommand extends BukkitCommand {
|
||||
if (!testPermission(sender)) return true;
|
||||
|
||||
if (args.length == 0) {
|
||||
- sender.sendMessage("This server is running " + Bukkit.getName() + " version " + Bukkit.getVersion() + " (Implementing API version " + Bukkit.getBukkitVersion() + ")");
|
||||
+ //sender.sendMessage("This server is running " + Bukkit.getName() + " version " + Bukkit.getVersion() + " (Implementing API version " + Bukkit.getBukkitVersion() + ")"); // Paper - moved to setVersionMessage
|
||||
sendVersion(sender);
|
||||
} else {
|
||||
StringBuilder name = new StringBuilder();
|
||||
@@ -80,8 +97,17 @@ public class VersionCommand extends BukkitCommand {
|
||||
|
||||
private void describeToSender(@NotNull Plugin plugin, @NotNull CommandSender sender) {
|
||||
PluginDescriptionFile desc = plugin.getDescription();
|
||||
- sender.sendMessage(ChatColor.GREEN + desc.getName() + ChatColor.WHITE + " version " + ChatColor.GREEN + desc.getVersion());
|
||||
-
|
||||
+ // Paper start - version command 2.0
|
||||
+ sender.sendMessage(
|
||||
+ Component.text()
|
||||
+ .append(Component.text(desc.getName(), NamedTextColor.GREEN))
|
||||
+ .append(Component.text(" version "))
|
||||
+ .append(Component.text(desc.getVersion(), NamedTextColor.GREEN)
|
||||
+ .hoverEvent(Component.text("Click to copy to clipboard", NamedTextColor.WHITE))
|
||||
+ .clickEvent(ClickEvent.copyToClipboard(desc.getVersion()))
|
||||
+ )
|
||||
+ );
|
||||
+ // Paper end - version command 2.0
|
||||
if (desc.getDescription() != null) {
|
||||
sender.sendMessage(desc.getDescription());
|
||||
}
|
||||
@@ -147,14 +173,14 @@ public class VersionCommand extends BukkitCommand {
|
||||
|
||||
private final ReentrantLock versionLock = new ReentrantLock();
|
||||
private boolean hasVersion = false;
|
||||
- private String versionMessage = null;
|
||||
+ private Component versionMessage = null; // Paper
|
||||
private final Set<CommandSender> versionWaiters = new HashSet<CommandSender>();
|
||||
private boolean versionTaskStarted = false;
|
||||
private long lastCheck = 0;
|
||||
|
||||
private void sendVersion(@NotNull CommandSender sender) {
|
||||
if (hasVersion) {
|
||||
- if (System.currentTimeMillis() - lastCheck > 21600000) {
|
||||
+ if (System.currentTimeMillis() - lastCheck > getVersionFetcher().getCacheTime()) { // Paper - use version supplier
|
||||
lastCheck = System.currentTimeMillis();
|
||||
hasVersion = false;
|
||||
} else {
|
||||
@@ -169,7 +195,7 @@ public class VersionCommand extends BukkitCommand {
|
||||
return;
|
||||
}
|
||||
versionWaiters.add(sender);
|
||||
- sender.sendMessage("Checking version, please wait...");
|
||||
+ sender.sendMessage(Component.text("Checking version, please wait...", NamedTextColor.WHITE, TextDecoration.ITALIC)); // Paper
|
||||
if (!versionTaskStarted) {
|
||||
versionTaskStarted = true;
|
||||
new Thread(new Runnable() {
|
||||
@@ -187,6 +213,13 @@ public class VersionCommand extends BukkitCommand {
|
||||
|
||||
private void obtainVersion() {
|
||||
String version = Bukkit.getVersion();
|
||||
+ // Paper start
|
||||
+ if (version.startsWith("null")) { // running from ide?
|
||||
+ setVersionMessage(Component.text("Unknown version, custom build?", NamedTextColor.YELLOW));
|
||||
+ return;
|
||||
+ }
|
||||
+ setVersionMessage(getVersionFetcher().getVersionMessage(version));
|
||||
+ /*
|
||||
if (version == null) version = "Custom";
|
||||
String[] parts = version.substring(0, version.indexOf(' ')).split("-");
|
||||
if (parts.length == 4) {
|
||||
@@ -216,11 +249,24 @@ public class VersionCommand extends BukkitCommand {
|
||||
} else {
|
||||
setVersionMessage("Unknown version, custom build?");
|
||||
}
|
||||
+ */
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
- private void setVersionMessage(@NotNull String msg) {
|
||||
+ // Paper start
|
||||
+ private void setVersionMessage(final @NotNull Component msg) {
|
||||
lastCheck = System.currentTimeMillis();
|
||||
- versionMessage = msg;
|
||||
+ final Component message = Component.textOfChildren(
|
||||
+ Component.text(Bukkit.getVersionMessage(), NamedTextColor.WHITE),
|
||||
+ Component.newline(),
|
||||
+ msg
|
||||
+ );
|
||||
+ this.versionMessage = Component.text()
|
||||
+ .append(message)
|
||||
+ .hoverEvent(Component.text("Click to copy to clipboard", NamedTextColor.WHITE))
|
||||
+ .clickEvent(ClickEvent.copyToClipboard(PlainTextComponentSerializer.plainText().serialize(message)))
|
||||
+ .build();
|
||||
+ // Paper end
|
||||
versionLock.lock();
|
||||
try {
|
||||
hasVersion = true;
|
||||
diff --git a/src/test/java/io/papermc/paper/TestServerBuildInfo.java b/src/test/java/io/papermc/paper/TestServerBuildInfo.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..17be27a869c1047a7a9440fb8f3717260d4abbd0
|
||||
--- /dev/null
|
||||
+++ b/src/test/java/io/papermc/paper/TestServerBuildInfo.java
|
||||
@@ -0,0 +1,59 @@
|
||||
+package io.papermc.paper;
|
||||
+
|
||||
+import java.time.Instant;
|
||||
+import java.util.Optional;
|
||||
+import java.util.OptionalInt;
|
||||
+import net.kyori.adventure.key.Key;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+public class TestServerBuildInfo implements ServerBuildInfo {
|
||||
+ @Override
|
||||
+ public @NotNull Key brandId() {
|
||||
+ throw new UnsupportedOperationException();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isBrandCompatible(final @NotNull Key brandId) {
|
||||
+ throw new UnsupportedOperationException();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull String brandName() {
|
||||
+ throw new UnsupportedOperationException();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull String minecraftVersionId() {
|
||||
+ throw new UnsupportedOperationException();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull String minecraftVersionName() {
|
||||
+ throw new UnsupportedOperationException();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull OptionalInt buildNumber() {
|
||||
+ throw new UnsupportedOperationException();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull Instant buildTime() {
|
||||
+ throw new UnsupportedOperationException();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull Optional<String> gitBranch() {
|
||||
+ throw new UnsupportedOperationException();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull Optional<String> gitCommit() {
|
||||
+ throw new UnsupportedOperationException();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull String asString(final @NotNull StringRepresentation representation) {
|
||||
+ return "";
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/test/resources/META-INF/services/io.papermc.paper.ServerBuildInfo b/src/test/resources/META-INF/services/io.papermc.paper.ServerBuildInfo
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..64e2f8559b9c5a52e0a3229d3d12f65e9af145b3
|
||||
--- /dev/null
|
||||
+++ b/src/test/resources/META-INF/services/io.papermc.paper.ServerBuildInfo
|
||||
@@ -0,0 +1 @@
|
||||
+io.papermc.paper.TestServerBuildInfo
|
@ -1,62 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Isaac Moore <rmsy@me.com>
|
||||
Date: Mon, 29 Feb 2016 18:02:25 -0600
|
||||
Subject: [PATCH] Add PlayerLocaleChangeEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..29dd763a99ce7c6ecb176b9fb346a400369d48a0
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.java
|
||||
@@ -0,0 +1,50 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+
|
||||
+/**
|
||||
+ * Called when the locale of the player is changed.
|
||||
+ *
|
||||
+ * @deprecated Replaced by {@link org.bukkit.event.player.PlayerLocaleChangeEvent} upstream
|
||||
+ */
|
||||
+@Deprecated
|
||||
+public class PlayerLocaleChangeEvent extends PlayerEvent {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final String oldLocale;
|
||||
+ private final String newLocale;
|
||||
+
|
||||
+ public PlayerLocaleChangeEvent(final Player player, final String oldLocale, final String newLocale) {
|
||||
+ super(player);
|
||||
+ this.oldLocale = oldLocale;
|
||||
+ this.newLocale = newLocale;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the locale the player switched from.
|
||||
+ *
|
||||
+ * @return player's old locale
|
||||
+ */
|
||||
+ public String getOldLocale() {
|
||||
+ return oldLocale;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the locale the player is changed to.
|
||||
+ *
|
||||
+ * @return player's new locale
|
||||
+ */
|
||||
+ public String getNewLocale() {
|
||||
+ return newLocale;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
66
patches/api/0016-Entity-Origin-API.patch
Normale Datei
66
patches/api/0016-Entity-Origin-API.patch
Normale Datei
@ -0,0 +1,66 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Byteflux <byte@byteflux.net>
|
||||
Date: Mon, 29 Feb 2016 17:50:31 -0600
|
||||
Subject: [PATCH] Entity Origin API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
|
||||
index c78fb359bd28b8dc1ba242642ec612e856525993..4e1fb0974d061d5bb64899cac576318d2e6f8bf6 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Entity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
||||
@@ -791,5 +791,15 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
||||
default net.kyori.adventure.text.event.HoverEvent<net.kyori.adventure.text.event.HoverEvent.ShowEntity> asHoverEvent(final @NotNull java.util.function.UnaryOperator<net.kyori.adventure.text.event.HoverEvent.ShowEntity> op) {
|
||||
return net.kyori.adventure.text.event.HoverEvent.showEntity(op.apply(net.kyori.adventure.text.event.HoverEvent.ShowEntity.of(this.getType().getKey(), this.getUniqueId(), this.customName())));
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the location where this entity originates from.
|
||||
+ * <p>
|
||||
+ * This value can be null if the entity hasn't yet been added to the world.
|
||||
+ *
|
||||
+ * @return Location where entity originates or null if not yet added
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ Location getOrigin();
|
||||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/entity/FallingBlock.java b/src/main/java/org/bukkit/entity/FallingBlock.java
|
||||
index d96fd494b523491fcf1ac54d164351fd487f65d6..ae1ce2ee2deb82f3f4144ec54b3ba119b437c5e9 100644
|
||||
--- a/src/main/java/org/bukkit/entity/FallingBlock.java
|
||||
+++ b/src/main/java/org/bukkit/entity/FallingBlock.java
|
||||
@@ -126,4 +126,15 @@ public interface FallingBlock extends Entity {
|
||||
* @param damage the max damage to set. Must be >= 0
|
||||
*/
|
||||
void setMaxDamage(int damage);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the source block location of the FallingBlock
|
||||
+ *
|
||||
+ * @return the source block location the FallingBlock was spawned from
|
||||
+ * @deprecated replaced by {@link Entity#getOrigin()}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ default org.bukkit.Location getSourceLoc() {
|
||||
+ return this.getOrigin();
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/entity/TNTPrimed.java b/src/main/java/org/bukkit/entity/TNTPrimed.java
|
||||
index a23cfdf66877f0a61eae700de084c76e6ee7b431..0813bd913c8fdb2001963ce3e82c07c2af105418 100644
|
||||
--- a/src/main/java/org/bukkit/entity/TNTPrimed.java
|
||||
+++ b/src/main/java/org/bukkit/entity/TNTPrimed.java
|
||||
@@ -53,4 +53,15 @@ public interface TNTPrimed extends Explosive {
|
||||
* @param source the source of this primed TNT
|
||||
*/
|
||||
public void setSource(@Nullable Entity source);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the source block location of the TNTPrimed
|
||||
+ *
|
||||
+ * @return the source block location the TNTPrimed was spawned from
|
||||
+ * @deprecated replaced by {@link Entity#getOrigin()}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ default org.bukkit.Location getSourceLoc() {
|
||||
+ return this.getOrigin();
|
||||
+ }
|
||||
}
|
@ -8,12 +8,12 @@ Add per player no-tick, tick, and send view distances.
|
||||
Also add send/no-tick view distance to World.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index ed57cd69d88504b78782271c9a3d423a29471674..8a6a548314eef8d486be908e38e3a4562f26bdb4 100644
|
||||
index 9732929b666b0a5e1a2a41c8e8794cc4f2535e41..0a3a66e04f8785874f10a76603bff46469543688 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -2698,6 +2698,62 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
int getSimulationDistance();
|
||||
// Spigot end
|
||||
@@ -2968,6 +2968,66 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
@NotNull
|
||||
public Set<FeatureFlag> getFeatureFlags();
|
||||
|
||||
+ // Paper start - view distance api
|
||||
+ /**
|
||||
@ -38,7 +38,9 @@ index ed57cd69d88504b78782271c9a3d423a29471674..8a6a548314eef8d486be908e38e3a456
|
||||
+ * @deprecated Use {@link #getViewDistance()}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ int getNoTickViewDistance();
|
||||
+ default int getNoTickViewDistance() {
|
||||
+ return this.getViewDistance();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the no-tick view distance for this world.
|
||||
@ -50,7 +52,9 @@ index ed57cd69d88504b78782271c9a3d423a29471674..8a6a548314eef8d486be908e38e3a456
|
||||
+ * @deprecated Use {@link #setViewDistance(int)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ void setNoTickViewDistance(int viewDistance);
|
||||
+ default void setNoTickViewDistance(int viewDistance) {
|
||||
+ this.setViewDistance(viewDistance);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the sending view distance for this world.
|
||||
@ -71,14 +75,14 @@ index ed57cd69d88504b78782271c9a3d423a29471674..8a6a548314eef8d486be908e38e3a456
|
||||
+ void setSendViewDistance(int viewDistance);
|
||||
+ // Paper end - view distance api
|
||||
+
|
||||
// Spigot start
|
||||
public class Spigot {
|
||||
|
||||
/**
|
||||
* Gets all generated structures that intersect the chunk at the given
|
||||
* coordinates. <br>
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 1c3d9ac922c189adc139c2646b4bdc97dbfadb43..7efbc8540d3a42ae8ec9b4e4343e1352e0cfa993 100644
|
||||
index 1ba2f706a62ee6962451305b1895654453b485cd..7d530bd0e4d833da760d1cf82aba966b7fb480b1 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -1889,6 +1889,78 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -2597,6 +2597,82 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
* @param affects Whether the player can affect mob spawning
|
||||
*/
|
||||
public void setAffectsSpawning(boolean affects);
|
||||
@ -123,7 +127,9 @@ index 1c3d9ac922c189adc139c2646b4bdc97dbfadb43..7efbc8540d3a42ae8ec9b4e4343e1352
|
||||
+ * @deprecated Use {@link #getViewDistance()}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public int getNoTickViewDistance();
|
||||
+ default int getNoTickViewDistance() {
|
||||
+ return this.getViewDistance();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the no-ticking view distance for this player.
|
||||
@ -135,7 +141,9 @@ index 1c3d9ac922c189adc139c2646b4bdc97dbfadb43..7efbc8540d3a42ae8ec9b4e4343e1352
|
||||
+ * @deprecated Use {@link #setViewDistance(int)}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public void setNoTickViewDistance(int viewDistance);
|
||||
+ default void setNoTickViewDistance(int viewDistance) {
|
||||
+ this.setViewDistance(viewDistance);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the sending view distance for this player.
|
||||
|
@ -6,10 +6,10 @@ Subject: [PATCH] Add BeaconEffectEvent
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java b/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..978813b94a5eae0afccbd3b38b463091a46b56ac
|
||||
index 0000000000000000000000000000000000000000..7270c1feece2dc15a4a0503c4bca93a1288f8f13
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java
|
||||
@@ -0,0 +1,86 @@
|
||||
@@ -0,0 +1,91 @@
|
||||
+package com.destroystokyo.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.block.Block;
|
||||
@ -18,18 +18,23 @@ index 0000000000000000000000000000000000000000..978813b94a5eae0afccbd3b38b463091
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockEvent;
|
||||
+import org.bukkit.potion.PotionEffect;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a beacon effect is being applied to a player.
|
||||
+ */
|
||||
+public class BeaconEffectEvent extends BlockEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled;
|
||||
+ private PotionEffect effect;
|
||||
+ private Player player;
|
||||
+ private boolean primary;
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Player player;
|
||||
+ private final boolean primary;
|
||||
+ private PotionEffect effect;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public BeaconEffectEvent(@NotNull Block block, @NotNull PotionEffect effect, @NotNull Player player, boolean primary) {
|
||||
+ super(block);
|
||||
+ this.effect = effect;
|
||||
@ -37,16 +42,6 @@ index 0000000000000000000000000000000000000000..978813b94a5eae0afccbd3b38b463091
|
||||
+ this.primary = primary;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancelled) {
|
||||
+ this.cancelled = cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the potion effect being applied.
|
||||
+ *
|
||||
@ -54,7 +49,7 @@ index 0000000000000000000000000000000000000000..978813b94a5eae0afccbd3b38b463091
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public PotionEffect getEffect() {
|
||||
+ return effect;
|
||||
+ return this.effect;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -73,26 +68,36 @@ index 0000000000000000000000000000000000000000..978813b94a5eae0afccbd3b38b463091
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Player getPlayer() {
|
||||
+ return player;
|
||||
+ return this.player;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets whether the effect is a primary beacon effect.
|
||||
+ *
|
||||
+ * @return true if this event represents a primary effect
|
||||
+ * @return {@code true} if this event represents a primary effect
|
||||
+ */
|
||||
+ public boolean isPrimary() {
|
||||
+ return primary;
|
||||
+ return this.primary;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
|
@ -1,30 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Steve Anton <anxuiz.nx@gmail.com>
|
||||
Date: Mon, 29 Feb 2016 18:13:58 -0600
|
||||
Subject: [PATCH] Add PlayerInitialSpawnEvent
|
||||
|
||||
For modifying a player's initial spawn location as they join the server
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..626e97bbcaa19d55475a0fc8770412d437af2733
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java
|
||||
@@ -0,0 +1,17 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.spigotmc.event.player.PlayerSpawnLocationEvent;
|
||||
+
|
||||
+/**
|
||||
+ * @deprecated Use {@link PlayerSpawnLocationEvent}, Duplicate API
|
||||
+ */
|
||||
+@Deprecated
|
||||
+public class PlayerInitialSpawnEvent extends PlayerSpawnLocationEvent {
|
||||
+
|
||||
+ public PlayerInitialSpawnEvent(@NotNull Player who, @NotNull Location spawnLocation) {
|
||||
+ super(who, spawnLocation);
|
||||
+ }
|
||||
+}
|
50
patches/api/0019-Expose-server-CommandMap.patch
Normale Datei
50
patches/api/0019-Expose-server-CommandMap.patch
Normale Datei
@ -0,0 +1,50 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: kashike <kashike@vq.lc>
|
||||
Date: Mon, 29 Feb 2016 19:48:59 -0600
|
||||
Subject: [PATCH] Expose server CommandMap
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index a005d5f8879262c763d8c4fbd09b9a99810d5e8c..26f3ac9c15ff554becfe8ea53a48f67b2de60ed6 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -2337,6 +2337,19 @@ public final class Bukkit {
|
||||
return server.getUnsafe();
|
||||
}
|
||||
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the active {@link org.bukkit.command.CommandMap}
|
||||
+ *
|
||||
+ * @return the active command map
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public static org.bukkit.command.CommandMap getCommandMap() {
|
||||
+ return server.getCommandMap();
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@NotNull
|
||||
public static Server.Spigot spigot() {
|
||||
return server.spigot();
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 8a07f21eeb04fb54032ce377a1478f60303e1824..d78481bf17818415524f14417caf86d5684b2235 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -1817,6 +1817,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
public double[] getTPS();
|
||||
// Paper end
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the active {@link org.bukkit.command.CommandMap}
|
||||
+ *
|
||||
+ * @return the active command map
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ org.bukkit.command.CommandMap getCommandMap();
|
||||
+
|
||||
/**
|
||||
* Get the advancement specified by this key.
|
||||
*
|
@ -1,50 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: kashike <kashike@vq.lc>
|
||||
Date: Mon, 29 Feb 2016 19:48:59 -0600
|
||||
Subject: [PATCH] Expose server CommandMap
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 397f57f0ab4844fb88c60681bf6e6e3db8a98945..1035ce181415a19f8d6460f70d3d900e3f7017d3 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -2092,6 +2092,19 @@ public final class Bukkit {
|
||||
return server.getUnsafe();
|
||||
}
|
||||
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the active {@link org.bukkit.command.CommandMap}
|
||||
+ *
|
||||
+ * @return the active command map
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public static org.bukkit.command.CommandMap getCommandMap() {
|
||||
+ return server.getCommandMap();
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@NotNull
|
||||
public static Server.Spigot spigot() {
|
||||
return server.spigot();
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 3f3531e208472a0e76f76e2b1a08a699527cef8f..6a7b91af3e738613cf79c13e2844efe9a2efd254 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -1615,6 +1615,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
public double[] getTPS();
|
||||
// Paper end
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the active {@link org.bukkit.command.CommandMap}
|
||||
+ *
|
||||
+ * @return the active command map
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ org.bukkit.command.CommandMap getCommandMap();
|
||||
+
|
||||
/**
|
||||
* Get the advancement specified by this key.
|
||||
*
|
@ -0,0 +1,124 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Mon, 29 Feb 2016 19:54:32 -0600
|
||||
Subject: [PATCH] Graduate bungeecord chat API from spigot subclasses
|
||||
|
||||
Change Javadoc to be accurate
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index fe074fe9553f61bdd72b64830532a78415348781..4c5327da1468cb1f9af00a99e7e79f578c47ee2a 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -472,6 +472,30 @@ public final class Bukkit {
|
||||
return server.broadcastMessage(message);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Sends the component to all online players.
|
||||
+ *
|
||||
+ * @param component the component to send
|
||||
+ * @deprecated use {@code sendMessage} methods on {@link #getServer()} that accept {@link net.kyori.adventure.text.Component}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static void broadcast(@NotNull net.md_5.bungee.api.chat.BaseComponent component) {
|
||||
+ server.broadcast(component);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sends an array of components as a single message to all online players.
|
||||
+ *
|
||||
+ * @param components the components to send
|
||||
+ * @deprecated use {@code sendMessage} methods on {@link #getServer()} that accept {@link net.kyori.adventure.text.Component}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public static void broadcast(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
|
||||
+ server.broadcast(components);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Gets the name of the update folder. The update folder is used to safely
|
||||
* update plugins at the right moment on a plugin load.
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 9545da2adacaf0bd719c2baef929588cd1042d25..19b75704ed9eee0c929df417e1e5d0ea3718e2f8 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -383,6 +383,30 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@Deprecated // Paper
|
||||
public int broadcastMessage(@NotNull String message);
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Sends the component to all online players.
|
||||
+ *
|
||||
+ * @param component the component to send
|
||||
+ * @deprecated use {@code sendMessage} methods that accept {@link net.kyori.adventure.text.Component}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public default void broadcast(@NotNull net.md_5.bungee.api.chat.BaseComponent component) {
|
||||
+ spigot().broadcast(component);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sends an array of components as a single message to all online players.
|
||||
+ *
|
||||
+ * @param components the components to send
|
||||
+ * @deprecated use {@code sendMessage} methods that accept {@link net.kyori.adventure.text.Component}
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public default void broadcast(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
|
||||
+ spigot().broadcast(components);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Gets the name of the update folder. The update folder is used to safely
|
||||
* update plugins at the right moment on a plugin load.
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 7d530bd0e4d833da760d1cf82aba966b7fb480b1..f9bacbfa223826b3b54525648080fda306a1ec36 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -1214,6 +1214,42 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
*/
|
||||
public void sendMap(@NotNull MapView map);
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Sends the component to the player
|
||||
+ *
|
||||
+ * @param component the components to send
|
||||
+ * @deprecated use {@code sendMessage} methods that accept {@link net.kyori.adventure.text.Component}
|
||||
+ */
|
||||
+ @Override
|
||||
+ @Deprecated
|
||||
+ public default void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent component) {
|
||||
+ spigot().sendMessage(component);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sends an array of components as a single message to the player
|
||||
+ *
|
||||
+ * @param components the components to send
|
||||
+ * @deprecated use {@code sendMessage} methods that accept {@link net.kyori.adventure.text.Component}
|
||||
+ */
|
||||
+ @Override
|
||||
+ @Deprecated
|
||||
+ public default void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
|
||||
+ spigot().sendMessage(components);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sends an array of components as a single message to the specified screen position of this player
|
||||
+ *
|
||||
+ * @param position the screen position
|
||||
+ * @param components the components to send
|
||||
+ */
|
||||
+ public default void sendMessage(net.md_5.bungee.api.ChatMessageType position, net.md_5.bungee.api.chat.BaseComponent... components) {
|
||||
+ spigot().sendMessage(position, components);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Send a hurt animation. This fakes incoming damage towards the player from
|
||||
* the given yaw relative to the player's direction.
|
583
patches/api/0021-Add-exception-reporting-event.patch
Normale Datei
583
patches/api/0021-Add-exception-reporting-event.patch
Normale Datei
@ -0,0 +1,583 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Mon, 29 Feb 2016 20:24:35 -0600
|
||||
Subject: [PATCH] Add exception reporting event
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java b/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9377ee1c2368ce058397037952d17bc010f66957
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java
|
||||
@@ -0,0 +1,45 @@
|
||||
+package com.destroystokyo.paper.event.server;
|
||||
+
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import com.destroystokyo.paper.exception.ServerException;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called whenever an exception is thrown in a recoverable section of the server.
|
||||
+ */
|
||||
+public class ServerExceptionEvent extends Event {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ @NotNull private final ServerException exception;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public ServerExceptionEvent(@NotNull ServerException exception) {
|
||||
+ super(!Bukkit.isPrimaryThread());
|
||||
+ this.exception = exception;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the wrapped exception that was thrown.
|
||||
+ *
|
||||
+ * @return Exception thrown
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ServerException getException() {
|
||||
+ return this.exception;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java b/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..6fb39af0479a818f7f1465bcdfe505ab4ff7da1a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java
|
||||
@@ -0,0 +1,64 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import org.bukkit.command.Command;
|
||||
+import org.bukkit.command.CommandSender;
|
||||
+
|
||||
+import static com.google.common.base.Preconditions.checkNotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Thrown when a command throws an exception
|
||||
+ */
|
||||
+public class ServerCommandException extends ServerException {
|
||||
+
|
||||
+ private final Command command;
|
||||
+ private final CommandSender commandSender;
|
||||
+ private final String[] arguments;
|
||||
+
|
||||
+ public ServerCommandException(String message, Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
|
||||
+ super(message, cause);
|
||||
+ this.commandSender = checkNotNull(commandSender, "commandSender");
|
||||
+ this.arguments = checkNotNull(arguments, "arguments");
|
||||
+ this.command = checkNotNull(command, "command");
|
||||
+ }
|
||||
+
|
||||
+ public ServerCommandException(Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
|
||||
+ super(cause);
|
||||
+ this.commandSender = checkNotNull(commandSender, "commandSender");
|
||||
+ this.arguments = checkNotNull(arguments, "arguments");
|
||||
+ this.command = checkNotNull(command, "command");
|
||||
+ }
|
||||
+
|
||||
+ protected ServerCommandException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Command command, CommandSender commandSender, String[] arguments) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace);
|
||||
+ this.commandSender = checkNotNull(commandSender, "commandSender");
|
||||
+ this.arguments = checkNotNull(arguments, "arguments");
|
||||
+ this.command = checkNotNull(command, "command");
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the command which threw the exception
|
||||
+ *
|
||||
+ * @return exception throwing command
|
||||
+ */
|
||||
+ public Command getCommand() {
|
||||
+ return command;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the command sender which executed the command request
|
||||
+ *
|
||||
+ * @return command sender of exception thrown command request
|
||||
+ */
|
||||
+ public CommandSender getCommandSender() {
|
||||
+ return commandSender;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the arguments which threw the exception for the command
|
||||
+ *
|
||||
+ * @return arguments of exception thrown command request
|
||||
+ */
|
||||
+ public String[] getArguments() {
|
||||
+ return arguments;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerEventException.java b/src/main/java/com/destroystokyo/paper/exception/ServerEventException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..410b24139535cd5d8439ad581c43c61b5757fbf6
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerEventException.java
|
||||
@@ -0,0 +1,52 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.Listener;
|
||||
+import org.bukkit.plugin.Plugin;
|
||||
+
|
||||
+import static com.google.common.base.Preconditions.*;
|
||||
+
|
||||
+/**
|
||||
+ * Exception thrown when a server event listener throws an exception
|
||||
+ */
|
||||
+public class ServerEventException extends ServerPluginException {
|
||||
+
|
||||
+ private final Listener listener;
|
||||
+ private final Event event;
|
||||
+
|
||||
+ public ServerEventException(String message, Throwable cause, Plugin responsiblePlugin, Listener listener, Event event) {
|
||||
+ super(message, cause, responsiblePlugin);
|
||||
+ this.listener = checkNotNull(listener, "listener");
|
||||
+ this.event = checkNotNull(event, "event");
|
||||
+ }
|
||||
+
|
||||
+ public ServerEventException(Throwable cause, Plugin responsiblePlugin, Listener listener, Event event) {
|
||||
+ super(cause, responsiblePlugin);
|
||||
+ this.listener = checkNotNull(listener, "listener");
|
||||
+ this.event = checkNotNull(event, "event");
|
||||
+ }
|
||||
+
|
||||
+ protected ServerEventException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin, Listener listener, Event event) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin);
|
||||
+ this.listener = checkNotNull(listener, "listener");
|
||||
+ this.event = checkNotNull(event, "event");
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the listener which threw the exception
|
||||
+ *
|
||||
+ * @return event listener
|
||||
+ */
|
||||
+ public Listener getListener() {
|
||||
+ return listener;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the event which caused the exception
|
||||
+ *
|
||||
+ * @return event
|
||||
+ */
|
||||
+ public Event getEvent() {
|
||||
+ return event;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerException.java b/src/main/java/com/destroystokyo/paper/exception/ServerException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c06ea3942447d4824b83ff839cb449fb818dede1
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerException.java
|
||||
@@ -0,0 +1,23 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+/**
|
||||
+ * Wrapper exception for all exceptions that are thrown by the server.
|
||||
+ */
|
||||
+public class ServerException extends Exception {
|
||||
+
|
||||
+ public ServerException(String message) {
|
||||
+ super(message);
|
||||
+ }
|
||||
+
|
||||
+ public ServerException(String message, Throwable cause) {
|
||||
+ super(message, cause);
|
||||
+ }
|
||||
+
|
||||
+ public ServerException(Throwable cause) {
|
||||
+ super(cause);
|
||||
+ }
|
||||
+
|
||||
+ protected ServerException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerInternalException.java b/src/main/java/com/destroystokyo/paper/exception/ServerInternalException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..2c3effca7c9d6c904cbe248d312b74e2cd360acf
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerInternalException.java
|
||||
@@ -0,0 +1,36 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import java.util.logging.Level;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import com.destroystokyo.paper.event.server.ServerExceptionEvent;
|
||||
+
|
||||
+/**
|
||||
+ * Thrown when the internal server throws a recoverable exception.
|
||||
+ */
|
||||
+public class ServerInternalException extends ServerException {
|
||||
+
|
||||
+ public ServerInternalException(String message) {
|
||||
+ super(message);
|
||||
+ }
|
||||
+
|
||||
+ public ServerInternalException(String message, Throwable cause) {
|
||||
+ super(message, cause);
|
||||
+ }
|
||||
+
|
||||
+ public ServerInternalException(Throwable cause) {
|
||||
+ super(cause);
|
||||
+ }
|
||||
+
|
||||
+ protected ServerInternalException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace);
|
||||
+ }
|
||||
+
|
||||
+ public static void reportInternalException(Throwable cause) {
|
||||
+ try {
|
||||
+ Bukkit.getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(cause)));
|
||||
+ ;
|
||||
+ } catch (Throwable t) {
|
||||
+ Bukkit.getLogger().log(Level.WARNING, "Exception posting ServerExceptionEvent", t); // Don't want to rethrow!
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerPluginEnableDisableException.java b/src/main/java/com/destroystokyo/paper/exception/ServerPluginEnableDisableException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f016ba3b1b62e554a9bacbb9635f2dbe441b3c4e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginEnableDisableException.java
|
||||
@@ -0,0 +1,20 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import org.bukkit.plugin.Plugin;
|
||||
+
|
||||
+/**
|
||||
+ * Thrown whenever there is an exception with any enabling or disabling of plugins.
|
||||
+ */
|
||||
+public class ServerPluginEnableDisableException extends ServerPluginException {
|
||||
+ public ServerPluginEnableDisableException(String message, Throwable cause, Plugin responsiblePlugin) {
|
||||
+ super(message, cause, responsiblePlugin);
|
||||
+ }
|
||||
+
|
||||
+ public ServerPluginEnableDisableException(Throwable cause, Plugin responsiblePlugin) {
|
||||
+ super(cause, responsiblePlugin);
|
||||
+ }
|
||||
+
|
||||
+ protected ServerPluginEnableDisableException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin);
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerPluginException.java b/src/main/java/com/destroystokyo/paper/exception/ServerPluginException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..be3f92e3c6bcefe8b78da701b75121275001882e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginException.java
|
||||
@@ -0,0 +1,36 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import org.bukkit.plugin.Plugin;
|
||||
+
|
||||
+import static com.google.common.base.Preconditions.checkNotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Wrapper exception for all cases to which a plugin can be immediately blamed for
|
||||
+ */
|
||||
+public class ServerPluginException extends ServerException {
|
||||
+ public ServerPluginException(String message, Throwable cause, Plugin responsiblePlugin) {
|
||||
+ super(message, cause);
|
||||
+ this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin");
|
||||
+ }
|
||||
+
|
||||
+ public ServerPluginException(Throwable cause, Plugin responsiblePlugin) {
|
||||
+ super(cause);
|
||||
+ this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin");
|
||||
+ }
|
||||
+
|
||||
+ protected ServerPluginException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace);
|
||||
+ this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin");
|
||||
+ }
|
||||
+
|
||||
+ private final Plugin responsiblePlugin;
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the plugin which is directly responsible for the exception being thrown
|
||||
+ *
|
||||
+ * @return plugin which is responsible for the exception throw
|
||||
+ */
|
||||
+ public Plugin getResponsiblePlugin() {
|
||||
+ return responsiblePlugin;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java b/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..2faef4cb358ec65e32a6aba6426f0dd7ddf90d2a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java
|
||||
@@ -0,0 +1,64 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.plugin.Plugin;
|
||||
+
|
||||
+import static com.google.common.base.Preconditions.*;
|
||||
+
|
||||
+/**
|
||||
+ * Thrown when an incoming plugin message channel throws an exception
|
||||
+ */
|
||||
+public class ServerPluginMessageException extends ServerPluginException {
|
||||
+
|
||||
+ private final Player player;
|
||||
+ private final String channel;
|
||||
+ private final byte[] data;
|
||||
+
|
||||
+ public ServerPluginMessageException(String message, Throwable cause, Plugin responsiblePlugin, Player player, String channel, byte[] data) {
|
||||
+ super(message, cause, responsiblePlugin);
|
||||
+ this.player = checkNotNull(player, "player");
|
||||
+ this.channel = checkNotNull(channel, "channel");
|
||||
+ this.data = checkNotNull(data, "data");
|
||||
+ }
|
||||
+
|
||||
+ public ServerPluginMessageException(Throwable cause, Plugin responsiblePlugin, Player player, String channel, byte[] data) {
|
||||
+ super(cause, responsiblePlugin);
|
||||
+ this.player = checkNotNull(player, "player");
|
||||
+ this.channel = checkNotNull(channel, "channel");
|
||||
+ this.data = checkNotNull(data, "data");
|
||||
+ }
|
||||
+
|
||||
+ protected ServerPluginMessageException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin, Player player, String channel, byte[] data) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin);
|
||||
+ this.player = checkNotNull(player, "player");
|
||||
+ this.channel = checkNotNull(channel, "channel");
|
||||
+ this.data = checkNotNull(data, "data");
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the channel to which the error occurred from receiving data from
|
||||
+ *
|
||||
+ * @return exception channel
|
||||
+ */
|
||||
+ public String getChannel() {
|
||||
+ return channel;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the data to which the error occurred from
|
||||
+ *
|
||||
+ * @return exception data
|
||||
+ */
|
||||
+ public byte[] getData() {
|
||||
+ return data;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the player which the plugin message causing the exception originated from
|
||||
+ *
|
||||
+ * @return exception player
|
||||
+ */
|
||||
+ public Player getPlayer() {
|
||||
+ return player;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerSchedulerException.java b/src/main/java/com/destroystokyo/paper/exception/ServerSchedulerException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..2d0b2d4a9b3e5bdeec0e4ea7ab69858d86aa3715
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerSchedulerException.java
|
||||
@@ -0,0 +1,37 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import org.bukkit.scheduler.BukkitTask;
|
||||
+
|
||||
+import static com.google.common.base.Preconditions.checkNotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Thrown when a plugin's scheduler fails with an exception
|
||||
+ */
|
||||
+public class ServerSchedulerException extends ServerPluginException {
|
||||
+
|
||||
+ private final BukkitTask task;
|
||||
+
|
||||
+ public ServerSchedulerException(String message, Throwable cause, BukkitTask task) {
|
||||
+ super(message, cause, task.getOwner());
|
||||
+ this.task = checkNotNull(task, "task");
|
||||
+ }
|
||||
+
|
||||
+ public ServerSchedulerException(Throwable cause, BukkitTask task) {
|
||||
+ super(cause, task.getOwner());
|
||||
+ this.task = checkNotNull(task, "task");
|
||||
+ }
|
||||
+
|
||||
+ protected ServerSchedulerException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, BukkitTask task) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace, task.getOwner());
|
||||
+ this.task = checkNotNull(task, "task");
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the task which threw the exception
|
||||
+ *
|
||||
+ * @return exception throwing task
|
||||
+ */
|
||||
+ public BukkitTask getTask() {
|
||||
+ return task;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerTabCompleteException.java b/src/main/java/com/destroystokyo/paper/exception/ServerTabCompleteException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5582999fe94c7a3dac655044ccc6d078cd9521a1
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/exception/ServerTabCompleteException.java
|
||||
@@ -0,0 +1,22 @@
|
||||
+package com.destroystokyo.paper.exception;
|
||||
+
|
||||
+import org.bukkit.command.Command;
|
||||
+import org.bukkit.command.CommandSender;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a tab-complete request throws an exception
|
||||
+ */
|
||||
+public class ServerTabCompleteException extends ServerCommandException {
|
||||
+
|
||||
+ public ServerTabCompleteException(String message, Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
|
||||
+ super(message, cause, command, commandSender, arguments);
|
||||
+ }
|
||||
+
|
||||
+ public ServerTabCompleteException(Throwable cause, Command command, CommandSender commandSender, String[] arguments) {
|
||||
+ super(cause, command, commandSender, arguments);
|
||||
+ }
|
||||
+
|
||||
+ protected ServerTabCompleteException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Command command, CommandSender commandSender, String[] arguments) {
|
||||
+ super(message, cause, enableSuppression, writableStackTrace, command, commandSender, arguments);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
index 36fc2c35395c72f8b81a2a2f3265fd205384ce26..c7fa1d235cea78bda4656ed66b8d42b119cc50fb 100644
|
||||
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
|
||||
@@ -156,11 +156,14 @@ public class SimpleCommandMap implements CommandMap {
|
||||
target.execute(sender, sentCommandLabel, Arrays.copyOfRange(args, 1, args.length));
|
||||
} // target.timings.stopTiming(); // Spigot // Paper
|
||||
} catch (CommandException ex) {
|
||||
+ server.getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerCommandException(ex, target, sender, args))); // Paper
|
||||
//target.timings.stopTiming(); // Spigot // Paper
|
||||
throw ex;
|
||||
} catch (Throwable ex) {
|
||||
//target.timings.stopTiming(); // Spigot // Paper
|
||||
- throw new CommandException("Unhandled exception executing '" + commandLine + "' in " + target, ex);
|
||||
+ String msg = "Unhandled exception executing '" + commandLine + "' in " + target;
|
||||
+ server.getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerCommandException(ex, target, sender, args))); // Paper
|
||||
+ throw new CommandException(msg, ex);
|
||||
}
|
||||
|
||||
// return true as command was handled
|
||||
@@ -239,7 +242,9 @@ public class SimpleCommandMap implements CommandMap {
|
||||
} catch (CommandException ex) {
|
||||
throw ex;
|
||||
} catch (Throwable ex) {
|
||||
- throw new CommandException("Unhandled exception executing tab-completer for '" + cmdLine + "' in " + target, ex);
|
||||
+ String msg = "Unhandled exception executing tab-completer for '" + cmdLine + "' in " + target;
|
||||
+ server.getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerTabCompleteException(msg, ex, target, sender, args))); // Paper
|
||||
+ throw new CommandException(msg, ex);
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
index e7b1895d3918487d711afcbe41d76863d85c0a62..003bece642b682985625db93cad93026352bfc66 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
@@ -528,7 +528,8 @@ public final class SimplePluginManager implements PluginManager {
|
||||
try {
|
||||
plugin.getPluginLoader().enablePlugin(plugin);
|
||||
} catch (Throwable ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
||||
+ handlePluginException("Error occurred (in the plugin loader) while enabling "
|
||||
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin);
|
||||
}
|
||||
|
||||
HandlerList.bakeAll();
|
||||
@@ -551,32 +552,37 @@ public final class SimplePluginManager implements PluginManager {
|
||||
try {
|
||||
plugin.getPluginLoader().disablePlugin(plugin);
|
||||
} catch (Throwable ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while disabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
||||
+ handlePluginException("Error occurred (in the plugin loader) while disabling "
|
||||
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
|
||||
}
|
||||
|
||||
try {
|
||||
server.getScheduler().cancelTasks(plugin);
|
||||
} catch (Throwable ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while cancelling tasks for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
||||
+ handlePluginException("Error occurred (in the plugin loader) while cancelling tasks for "
|
||||
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
|
||||
}
|
||||
|
||||
try {
|
||||
server.getServicesManager().unregisterAll(plugin);
|
||||
} catch (Throwable ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while unregistering services for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
||||
+ handlePluginException("Error occurred (in the plugin loader) while unregistering services for "
|
||||
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
|
||||
}
|
||||
|
||||
try {
|
||||
HandlerList.unregisterAll(plugin);
|
||||
} catch (Throwable ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while unregistering events for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
||||
+ handlePluginException("Error occurred (in the plugin loader) while unregistering events for "
|
||||
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
|
||||
}
|
||||
|
||||
try {
|
||||
server.getMessenger().unregisterIncomingPluginChannel(plugin);
|
||||
server.getMessenger().unregisterOutgoingPluginChannel(plugin);
|
||||
} catch (Throwable ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Error occurred (in the plugin loader) while unregistering plugin channels for " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
||||
+ handlePluginException("Error occurred (in the plugin loader) while unregistering plugin channels for "
|
||||
+ + plugin.getDescription().getFullName() + " (Is it up to date?)", ex, plugin); // Paper
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -589,6 +595,13 @@ public final class SimplePluginManager implements PluginManager {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ private void handlePluginException(String msg, Throwable ex, Plugin plugin) {
|
||||
+ server.getLogger().log(Level.SEVERE, msg, ex);
|
||||
+ callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerPluginEnableDisableException(msg, ex, plugin)));
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public void clearPlugins() {
|
||||
if (true) {this.paperPluginManager.clearPlugins(); return;} // Paper
|
||||
@@ -654,7 +667,13 @@ public final class SimplePluginManager implements PluginManager {
|
||||
));
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
- server.getLogger().log(Level.SEVERE, "Could not pass event " + event.getEventName() + " to " + registration.getPlugin().getDescription().getFullName(), ex);
|
||||
+ // Paper start - error reporting
|
||||
+ String msg = "Could not pass event " + event.getEventName() + " to " + registration.getPlugin().getDescription().getFullName();
|
||||
+ server.getLogger().log(Level.SEVERE, msg, ex);
|
||||
+ if (!(event instanceof com.destroystokyo.paper.event.server.ServerExceptionEvent)) { // We don't want to cause an endless event loop
|
||||
+ callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerEventException(msg, ex, registration.getPlugin(), registration.getListener(), event)));
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
}
|
||||
}
|
Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren