mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-04-23 19:56:24 +02:00
Compare commits
2829 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
52823f5024 | ||
![]() |
1326c257a0 | ||
![]() |
fc3137cd96 | ||
![]() |
c46cc73f52 | ||
![]() |
f11acacedd | ||
![]() |
d1bac90745 | ||
![]() |
e98f628d34 | ||
![]() |
b2ab61559c | ||
![]() |
dd6eb8e74f | ||
![]() |
97cdd03ea4 | ||
![]() |
f5118e6802 | ||
![]() |
94ca5cf679 | ||
![]() |
5a55a1f602 | ||
![]() |
ed33635a15 | ||
![]() |
888682e5d0 | ||
![]() |
72bb5f00b0 | ||
![]() |
773fd6f59f | ||
![]() |
5cce86d924 | ||
![]() |
84567bcb00 | ||
![]() |
d7c2ab1d16 | ||
![]() |
0d359ade0c | ||
![]() |
ffbec24290 | ||
![]() |
ab357deb48 | ||
![]() |
6130c3dfa5 | ||
![]() |
5787588500 | ||
![]() |
b40383b5a4 | ||
![]() |
be8903128d | ||
![]() |
08800ec16d | ||
![]() |
83e274ff9f | ||
![]() |
0dd8b1053c | ||
![]() |
0558fcf5d5 | ||
![]() |
c45bbe3ec5 | ||
![]() |
07e598e48f | ||
![]() |
f6f00dfcda | ||
![]() |
63a6bdc1d6 | ||
![]() |
abbac057ed | ||
![]() |
c978322036 | ||
![]() |
39d2f1a72c | ||
![]() |
86919b8841 | ||
![]() |
00722bc463 | ||
![]() |
6a34a1996f | ||
![]() |
1d201b04ba | ||
![]() |
e887a59158 | ||
![]() |
d1b8f652a7 | ||
![]() |
4aa7bc51bc | ||
![]() |
0f0030916f | ||
![]() |
bbf1e4fe61 | ||
![]() |
febac6fa40 | ||
![]() |
99ee8a780d | ||
![]() |
577a0d8ed9 | ||
![]() |
02ae14894a | ||
![]() |
78dbe7fbbc | ||
![]() |
669293566b | ||
![]() |
707c7be5bd | ||
![]() |
becd8c4eaf | ||
![]() |
339ca8e30f | ||
![]() |
742d78a505 | ||
![]() |
120bf37196 | ||
![]() |
2a40a6b35e | ||
![]() |
ea1f35b45a | ||
![]() |
15e63378a7 | ||
![]() |
f3bc504a6f | ||
![]() |
3a8fae47a0 | ||
![]() |
70cb1cd100 | ||
![]() |
2067cc1670 | ||
![]() |
e6338976dd | ||
![]() |
90ebd5d5ed | ||
![]() |
c973ee8649 | ||
![]() |
c1543f034c | ||
![]() |
6baf339ecb | ||
![]() |
11906ef1c9 | ||
![]() |
ee8902154a | ||
![]() |
b5bc1988e5 | ||
![]() |
2147012beb | ||
![]() |
52bb561689 | ||
![]() |
25ce7a83f1 | ||
![]() |
55c8a590e7 | ||
![]() |
28bd993680 | ||
![]() |
8330f37d8a | ||
![]() |
985fae65b6 | ||
![]() |
db2d590e8e | ||
![]() |
c8d356783a | ||
![]() |
4947450ff0 | ||
![]() |
de4e91ff62 | ||
![]() |
fe5e3d5f6d | ||
![]() |
b8b3098022 | ||
![]() |
0ae8fc46b8 | ||
![]() |
e0762f63a8 | ||
![]() |
9f3850000c | ||
![]() |
76c6be9ba7 | ||
![]() |
308a5aa781 | ||
![]() |
e244527538 | ||
![]() |
11dd013333 | ||
![]() |
b740d5854c | ||
![]() |
d5445cfbef | ||
![]() |
3effaefda7 | ||
![]() |
49b19e0eaf | ||
![]() |
caef3a923b | ||
![]() |
d4c3ceaf2b | ||
![]() |
25e6aecf13 | ||
![]() |
33c11fdee9 | ||
![]() |
316dd92667 | ||
![]() |
e53d2ac449 | ||
![]() |
5786e8cc7a | ||
![]() |
1b717c9b10 | ||
![]() |
35abae99ca | ||
![]() |
d1a85982fb | ||
![]() |
3446b913cd | ||
![]() |
8b8fd6aab7 | ||
![]() |
520bb64eca | ||
![]() |
60d266b2d7 | ||
![]() |
8deeef4f7d | ||
![]() |
9b0b071c0c | ||
![]() |
81a3f1098d | ||
![]() |
efc248dcdb | ||
![]() |
476f3d328d | ||
![]() |
69f5f88183 | ||
![]() |
6df63f7fc7 | ||
![]() |
295b8a0135 | ||
![]() |
fcc5bc5473 | ||
![]() |
408b834376 | ||
![]() |
986812b9e4 | ||
![]() |
8d4333ad9d | ||
![]() |
9ff9097ff9 | ||
![]() |
1ef424a2f1 | ||
![]() |
9fd96dbaa2 | ||
![]() |
b0a4e11c46 | ||
![]() |
77bce43ace | ||
![]() |
cba1927cc7 | ||
![]() |
3d19c5c2ad | ||
![]() |
e0eff15694 | ||
![]() |
0bdeeea83b | ||
![]() |
6f96daae56 | ||
![]() |
d1021d19da | ||
![]() |
ee589ac7f0 | ||
![]() |
3b747ffecf | ||
![]() |
4e5a2b9f96 | ||
![]() |
aeb4350ccb | ||
![]() |
9609990832 | ||
![]() |
0e4319b757 | ||
![]() |
c8f4907f77 | ||
![]() |
dcf98c2298 | ||
![]() |
ae59c7442f | ||
![]() |
98708118d8 | ||
![]() |
276d8f8e1e | ||
![]() |
87f89541b5 | ||
![]() |
93f6de7029 | ||
![]() |
73d2686b17 | ||
![]() |
c446a95b07 | ||
![]() |
3676e1df35 | ||
![]() |
12e2705260 | ||
![]() |
31e777a03a | ||
![]() |
7f436c405b | ||
![]() |
4d4d2ab087 | ||
![]() |
91017acce4 | ||
![]() |
e90fd231d9 | ||
![]() |
cd9f0789de | ||
![]() |
5f4c8d92df | ||
![]() |
263cb47a21 | ||
![]() |
005600c99e | ||
![]() |
26bec7fe2f | ||
![]() |
f4b886d977 | ||
![]() |
c09d0d882e | ||
![]() |
312cb2996c | ||
![]() |
f218902581 | ||
![]() |
f27009216c | ||
![]() |
dda52ebc2e | ||
![]() |
9ac8d38bab | ||
![]() |
6a54328f7d | ||
![]() |
7279862def | ||
![]() |
08ce4c872c | ||
![]() |
2b0c5b1e21 | ||
![]() |
3d5c694daa | ||
![]() |
d153232969 | ||
![]() |
bb0aa8d5cc | ||
![]() |
d69f3b0893 | ||
![]() |
565838ad43 | ||
![]() |
8b52461271 | ||
![]() |
d08381dfed | ||
![]() |
b6c45f2df3 | ||
![]() |
b9479405e1 | ||
![]() |
a238ff19bf | ||
![]() |
c93b08d0c7 | ||
![]() |
1470b7117a | ||
![]() |
7cbc67f4fc | ||
![]() |
0a76bbb2b0 | ||
![]() |
09cc59a1c1 | ||
![]() |
bf646be482 | ||
![]() |
cc7e17960b | ||
![]() |
3c75b170f0 | ||
![]() |
a79c474957 | ||
![]() |
4bb480a238 | ||
![]() |
9ffa935c0c | ||
![]() |
0a32268784 | ||
![]() |
ae3b8c06f6 | ||
![]() |
713c4ad0d2 | ||
![]() |
48386c0828 | ||
![]() |
625b3921e1 | ||
![]() |
48aa37d173 | ||
![]() |
2c2314e95c | ||
![]() |
5eb2fc3ad0 | ||
![]() |
82cd9a092c | ||
![]() |
62754362c2 | ||
![]() |
2e9dfd6f6f | ||
![]() |
fc9fe1462f | ||
![]() |
41f546ca6b | ||
![]() |
d037da33cb | ||
![]() |
dc2d08c67e | ||
![]() |
96dfc27411 | ||
![]() |
171d2e5e99 | ||
![]() |
4433892431 | ||
![]() |
98a07dad1b | ||
![]() |
0ffa22b7a6 | ||
![]() |
60a0129fe9 | ||
![]() |
d5f8a0842b | ||
![]() |
f7d55ce105 | ||
![]() |
85911646f3 | ||
![]() |
8b75dece69 | ||
![]() |
7d6e515ba8 | ||
![]() |
13d7357c85 | ||
![]() |
16e26b910c | ||
![]() |
faadebd30e | ||
![]() |
2aeacb3dcf | ||
![]() |
9db7791835 | ||
![]() |
f49ddb819d | ||
![]() |
d71c62771e | ||
![]() |
a6aaa9538f | ||
![]() |
0974fb2834 | ||
![]() |
8982b33b6c | ||
![]() |
a7b3b3b7df | ||
![]() |
888bb20e78 | ||
![]() |
b11bb6fa22 | ||
![]() |
e5764b958d | ||
![]() |
bfe3141ff1 | ||
![]() |
73c82deeb0 | ||
![]() |
38682ecff6 | ||
![]() |
6a54dc7eff | ||
![]() |
8454c29c91 | ||
![]() |
b2c9311a47 | ||
![]() |
c4aa497a2b | ||
![]() |
c13f544390 | ||
![]() |
c28177d6af | ||
![]() |
8a80f252cf | ||
![]() |
93571c72d1 | ||
![]() |
6fd7379221 | ||
![]() |
dc5c80d812 | ||
![]() |
96e9a61e7c | ||
![]() |
b9bd9b81e6 | ||
![]() |
ec77812879 | ||
![]() |
efc2083798 | ||
![]() |
3a6f845c01 | ||
![]() |
7efd42ae45 | ||
![]() |
f43f4cbf5d | ||
![]() |
104cc4b7a4 | ||
![]() |
218be43143 | ||
![]() |
308dba5601 | ||
![]() |
5f233bb5d1 | ||
![]() |
5e188d114f | ||
![]() |
660e05d27f | ||
![]() |
4c0ad148bf | ||
![]() |
5c7bfb988c | ||
![]() |
b46f486680 | ||
![]() |
05797d0c78 | ||
![]() |
36ef2cf9ba | ||
![]() |
26ec31a012 | ||
![]() |
fd4a542062 | ||
![]() |
dc13f2565f | ||
![]() |
9f632af0ae | ||
![]() |
d698c6a1e5 | ||
![]() |
40e1bd9897 | ||
![]() |
75f31c5bf6 | ||
![]() |
954c813cef | ||
![]() |
05e055e9cf | ||
![]() |
2ea21c150f | ||
![]() |
c2fd4edad5 | ||
![]() |
78b8696778 | ||
![]() |
e653961385 | ||
![]() |
b21d12fd52 | ||
![]() |
7557df96c7 | ||
![]() |
61797c3aff | ||
![]() |
78125ff1e2 | ||
![]() |
d7c8715b25 | ||
![]() |
34f005c244 | ||
![]() |
6fbd1376ca | ||
![]() |
951767dc64 | ||
![]() |
16928b05f1 | ||
![]() |
fff14b05cb | ||
![]() |
e619c867e9 | ||
![]() |
543284e016 | ||
![]() |
0d78ba5f35 | ||
![]() |
9ba2b62fc2 | ||
![]() |
f10ee27fdd | ||
![]() |
3278ce1fe9 | ||
![]() |
fefb0334bd | ||
![]() |
d06a827e31 | ||
![]() |
10bb520f3a | ||
![]() |
126aa53b61 | ||
![]() |
ac71046feb | ||
![]() |
7c290e6bd0 | ||
![]() |
4d297cc829 | ||
![]() |
5ab410a5c5 | ||
![]() |
1f28bac955 | ||
![]() |
92c54de5e9 | ||
![]() |
ff5d79699d | ||
![]() |
a0594c19ee | ||
![]() |
da41c136fe | ||
![]() |
6a5859ee0f | ||
![]() |
59e0b4b67a | ||
![]() |
5fc153d896 | ||
![]() |
a003836dbc | ||
![]() |
42bf413528 | ||
![]() |
827f46566c | ||
![]() |
6f4d2f6d5a | ||
![]() |
6073b96317 | ||
![]() |
74a490f9f0 | ||
![]() |
3a752db698 | ||
![]() |
7cdde5a822 | ||
![]() |
8b6e7b2f2b | ||
![]() |
06f0b42a97 | ||
![]() |
9a85080bf6 | ||
![]() |
d14d2caa2d | ||
![]() |
bcfe7c58dd | ||
![]() |
289f0f3bfd | ||
![]() |
6fc4005c72 | ||
![]() |
8f7c2e4c02 | ||
![]() |
b43d08f4aa | ||
![]() |
2c55c6a92e | ||
![]() |
31f48cc7d1 | ||
![]() |
4b77f1ab28 | ||
![]() |
7cc38b5fa8 | ||
![]() |
0c76d08b10 | ||
![]() |
9c474570c8 | ||
![]() |
7e1d56c849 | ||
![]() |
07d0f124b4 | ||
![]() |
8d6c621763 | ||
![]() |
cef7098014 | ||
![]() |
e1efa7266e | ||
![]() |
f363941719 | ||
![]() |
25095f4546 | ||
![]() |
fd0c2050d8 | ||
![]() |
07fdc94dd8 | ||
![]() |
b501a81e21 | ||
![]() |
eb334b3aac | ||
![]() |
a77a51b6f2 | ||
![]() |
7d981bc610 | ||
![]() |
3eb485e900 | ||
![]() |
9f4af889f7 | ||
![]() |
2559c889e2 | ||
![]() |
2cf268b99c | ||
![]() |
e6fad8309c | ||
![]() |
7551450cf9 | ||
![]() |
e042566bb7 | ||
![]() |
1f26808c7b | ||
![]() |
a7026047d0 | ||
![]() |
af2613202d | ||
![]() |
3da1e9255a | ||
![]() |
9394906a79 | ||
![]() |
d881cb6084 | ||
![]() |
b9d43897af | ||
![]() |
76b58485a9 | ||
![]() |
7002df0bc7 | ||
![]() |
958aac3cb1 | ||
![]() |
a93402e27b | ||
![]() |
92f41f43c5 | ||
![]() |
392ee9fa07 | ||
![]() |
8859871e89 | ||
![]() |
93d99630a9 | ||
![]() |
47ae79e123 | ||
![]() |
f9ad00c2c8 | ||
![]() |
566af259db | ||
![]() |
d9a6431078 | ||
![]() |
e9c9375e78 | ||
![]() |
7c99c8aabf | ||
![]() |
88eb8f88a7 | ||
![]() |
fd118c2c37 | ||
![]() |
858b6b5471 | ||
![]() |
f086826942 | ||
![]() |
9c84dc2bc0 | ||
![]() |
cba0f3ac1f | ||
![]() |
b9a130ab00 | ||
![]() |
688056352b | ||
![]() |
2a40f52dea | ||
![]() |
3ed369de19 | ||
![]() |
bec51401a3 | ||
![]() |
109f884b5f | ||
![]() |
8f3fa419c4 | ||
![]() |
a9f08bc885 | ||
![]() |
a8923ec729 | ||
![]() |
4eafd043a3 | ||
![]() |
826cc8c835 | ||
![]() |
d1dbf777a4 | ||
![]() |
823e78377b | ||
![]() |
87a2e81ec3 | ||
![]() |
88775334b7 | ||
![]() |
e126547e97 | ||
![]() |
c1163cdb2e | ||
![]() |
30d06b7801 | ||
![]() |
a5cf7bf2c2 | ||
![]() |
3d4d413de8 | ||
![]() |
b97e843849 | ||
![]() |
48c7a3e94e | ||
![]() |
7263290bbe | ||
![]() |
e99c4e3289 | ||
![]() |
87cb26189f | ||
![]() |
2dae336a5f | ||
![]() |
258ed1469b | ||
![]() |
6f3eabba0e | ||
![]() |
804228fa6c | ||
![]() |
be85708e5a | ||
![]() |
f2368f97df | ||
![]() |
df87bcb743 | ||
![]() |
5653d0f175 | ||
![]() |
b022a97196 | ||
![]() |
cb596ee6ea | ||
![]() |
4e391136c0 | ||
![]() |
a6a0e1d12f | ||
![]() |
d2776eed5a | ||
![]() |
6528c60f4d | ||
![]() |
7ee46be2ac | ||
![]() |
13bc231091 | ||
![]() |
55d1a40394 | ||
![]() |
d70f99b489 | ||
![]() |
fde9735da2 | ||
![]() |
20f0aa3656 | ||
![]() |
0b7bf2d26d | ||
![]() |
f10e38af63 | ||
![]() |
21727ebfc7 | ||
![]() |
e322ee85fd | ||
![]() |
541255fe7e | ||
![]() |
20c2f36f6c | ||
![]() |
744f7a18ae | ||
![]() |
18eece0b71 | ||
![]() |
4f12dcf966 | ||
![]() |
ee832528db | ||
![]() |
bb5d6c91da | ||
![]() |
6d4adecb32 | ||
![]() |
c37b13dcb3 | ||
![]() |
086dac2ea4 | ||
![]() |
b2b8598b5b | ||
![]() |
61e5d9f1b6 | ||
![]() |
c8989b3332 | ||
![]() |
9f54472dd6 | ||
![]() |
115932c65a | ||
![]() |
04821f777e | ||
![]() |
cfae804780 | ||
![]() |
4568b17c54 | ||
![]() |
7bc76a3824 | ||
![]() |
4b8180807c | ||
![]() |
d77a8c8fa4 | ||
![]() |
27a8fcd739 | ||
![]() |
c25a0c65a2 | ||
![]() |
b224a8d1b8 | ||
![]() |
87d134215f | ||
![]() |
93e280dba4 | ||
![]() |
732f79bbfc | ||
![]() |
8e5e33eec2 | ||
![]() |
da3fb1abec | ||
![]() |
62d6b21081 | ||
![]() |
4caaead7ee | ||
![]() |
be38086f6c | ||
![]() |
c18b0f943c | ||
![]() |
f036980dc5 | ||
![]() |
0e4f54e9c0 | ||
![]() |
7a3d5bd737 | ||
![]() |
2ab1973668 | ||
![]() |
387c6e79ba | ||
![]() |
e3e00d34ef | ||
![]() |
40e651188e | ||
![]() |
b2915d9bd7 | ||
![]() |
6ec136a03d | ||
![]() |
a8fc6662e0 | ||
![]() |
fb8e749411 | ||
![]() |
4b26a7e300 | ||
![]() |
8a53b41b52 | ||
![]() |
daa8ffc38f | ||
![]() |
34f0236e9f | ||
![]() |
8f0ae7e51d | ||
![]() |
2988ad6b11 | ||
![]() |
252d6a2866 | ||
![]() |
b8c9ae2b0b | ||
![]() |
bfe2dda5b1 | ||
![]() |
33a79595af | ||
![]() |
eb2848e5d7 | ||
![]() |
da4ae9f4f5 | ||
![]() |
b841a7c03b | ||
![]() |
4ee5e3d134 | ||
![]() |
0e05935ad4 | ||
![]() |
78a775530a | ||
![]() |
dd36036334 | ||
![]() |
3b2a04e4db | ||
![]() |
5ab8d50b86 | ||
![]() |
391476ba26 | ||
![]() |
25a69f4ca0 | ||
![]() |
c8c946cc10 | ||
![]() |
a405611b3a | ||
![]() |
fd4cec39c4 | ||
![]() |
e7fa057abe | ||
![]() |
a86c06bb81 | ||
![]() |
9afaead81c | ||
![]() |
6e7bd0a536 | ||
![]() |
89e17bb468 | ||
![]() |
8fc9e0b13f | ||
![]() |
6ad51bba65 | ||
![]() |
9d396fa91f | ||
![]() |
a8c3ac6cee | ||
![]() |
9a9365a04d | ||
![]() |
c9b012ea5b | ||
![]() |
9dd35e87d6 | ||
![]() |
82f0b4194f | ||
![]() |
3b27b6c850 | ||
![]() |
1e41734826 | ||
![]() |
a83a79c17e | ||
![]() |
8a77d5a450 | ||
![]() |
2676b76107 | ||
![]() |
51ff043af9 | ||
![]() |
fbde60fcf9 | ||
![]() |
a0557112a1 | ||
![]() |
6d71e0f8be | ||
![]() |
62e17f5fc5 | ||
![]() |
613a92eeb9 | ||
![]() |
31522b6502 | ||
![]() |
2e64ac6d25 | ||
![]() |
fe65a0c548 | ||
![]() |
cc60d50dd2 | ||
![]() |
a797d748ea | ||
![]() |
2d1e3b8c03 | ||
![]() |
635e18e7ed | ||
![]() |
b9cb6842e2 | ||
![]() |
991703914c | ||
![]() |
fdb6367351 | ||
![]() |
bbee330f4f | ||
![]() |
8b8ac76852 | ||
![]() |
3b5b51b40c | ||
![]() |
5395ddc6a3 | ||
![]() |
60c701d20b | ||
![]() |
eb11d9e3aa | ||
![]() |
7898313b0b | ||
![]() |
8e23b10f7c | ||
![]() |
c46647d491 | ||
![]() |
013e8fcda5 | ||
![]() |
f4ff9c0336 | ||
![]() |
7c4d96e176 | ||
![]() |
2c920bd016 | ||
![]() |
a5452012b5 | ||
![]() |
43dd35f54b | ||
![]() |
67bbd64fa1 | ||
![]() |
8f48b83c79 | ||
![]() |
6a57a5c369 | ||
![]() |
20df062d9f | ||
![]() |
9fa0a8b27b | ||
![]() |
9acf9f4f19 | ||
![]() |
0e84cf085b | ||
![]() |
ca9e371067 | ||
![]() |
56920fe833 | ||
![]() |
f2e6fd9692 | ||
![]() |
b2966cbc45 | ||
![]() |
45c566859e | ||
![]() |
654f7ed3ae | ||
![]() |
f1ef07bee0 | ||
![]() |
3e28d39285 | ||
![]() |
8eb8c24209 | ||
![]() |
4dbbf8f599 | ||
![]() |
a3ebabacb8 | ||
![]() |
440afcca5d | ||
![]() |
8220d4aa31 | ||
![]() |
b196c9ce8e | ||
![]() |
93568f9f7f | ||
![]() |
b01291c4ff | ||
![]() |
a9d896eb45 | ||
![]() |
3cd9b76805 | ||
![]() |
e2700d3b28 | ||
![]() |
942d799c9c | ||
![]() |
f0cbc4f23e | ||
![]() |
9bd14b142b | ||
![]() |
4ba1217b84 | ||
![]() |
50d4353045 | ||
![]() |
19e97a7738 | ||
![]() |
2ac5fe45e3 | ||
![]() |
7f3d3ecb00 | ||
![]() |
331a6ea1b3 | ||
![]() |
8f2f673438 | ||
![]() |
66e12e2a0c | ||
![]() |
2b3ecc178a | ||
![]() |
df842c355e | ||
![]() |
9b043b7444 | ||
![]() |
ce287cf218 | ||
![]() |
24945efc7d | ||
![]() |
a01ad5aa04 | ||
![]() |
fa14c40283 | ||
![]() |
d8f19cec66 | ||
![]() |
955341ff9f | ||
![]() |
cb342de934 | ||
![]() |
ea0342f100 | ||
![]() |
cd57741a51 | ||
![]() |
f4552e358d | ||
![]() |
1dc225362d | ||
![]() |
a6b3e97cda | ||
![]() |
8a244d12fc | ||
![]() |
5a5d1f5e62 | ||
![]() |
21214814b7 | ||
![]() |
3ac93dcfca | ||
![]() |
c509882a18 | ||
![]() |
c146d6207d | ||
![]() |
2045a4988d | ||
![]() |
dc7e6010cb | ||
![]() |
b1fc17e045 | ||
![]() |
daf0e6e1ba | ||
![]() |
6f263735f0 | ||
![]() |
1d2aa74e51 | ||
![]() |
a69b1d895c | ||
![]() |
399d77c60f | ||
![]() |
b768ee6d41 | ||
![]() |
58faffed6d | ||
![]() |
87706d471b | ||
![]() |
eb7eb15ee7 | ||
![]() |
a17085bb18 | ||
![]() |
cde27899dd | ||
![]() |
93ff778de0 | ||
![]() |
17f91c8eb9 | ||
![]() |
7775cd0073 | ||
![]() |
cc48f273c0 | ||
![]() |
c8406681d7 | ||
![]() |
a05dd19986 | ||
![]() |
aae350c1b3 | ||
![]() |
c48559410f | ||
![]() |
9c59bfde52 | ||
![]() |
eb9d7e97d9 | ||
![]() |
24eebe6711 | ||
![]() |
a2b8e4493f | ||
![]() |
7c4a85325c | ||
![]() |
94ba90d694 | ||
![]() |
e97bc25fb8 | ||
![]() |
73936bb10d | ||
![]() |
23e65ac5d3 | ||
![]() |
9dc0396411 | ||
![]() |
cc6db9ae9e | ||
![]() |
3748d8e246 | ||
![]() |
0341111f8f | ||
![]() |
a7c4b40fcc | ||
![]() |
e7fb3571ac | ||
![]() |
58ad9db5ed | ||
![]() |
6fd55b47c2 | ||
![]() |
3d7c191d1c | ||
![]() |
9344e1ca79 | ||
![]() |
68eb5cd74f | ||
![]() |
ca7ac71e76 | ||
![]() |
3a280f3b6a | ||
![]() |
19cea0e129 | ||
![]() |
2c40648a60 | ||
![]() |
48815649a8 | ||
![]() |
f690e14a14 | ||
![]() |
b37ad79e50 | ||
![]() |
a990205d41 | ||
![]() |
891230c78e | ||
![]() |
8bfdf8ecf2 | ||
![]() |
78655102b9 | ||
![]() |
491a171409 | ||
![]() |
b3aec8f839 | ||
![]() |
0106a4222d | ||
![]() |
11af33f2d5 | ||
![]() |
812442fbbc | ||
![]() |
1750dd3b97 | ||
![]() |
ffe298710d | ||
![]() |
5cdb7e76fd | ||
![]() |
361b936aa0 | ||
![]() |
9503b0bfc4 | ||
![]() |
823beaf268 | ||
![]() |
3ada55989f | ||
![]() |
de597391dc | ||
![]() |
59599261ff | ||
![]() |
e1fb8c1ae5 | ||
![]() |
ba4146f82c | ||
![]() |
a5c43bb823 | ||
![]() |
050cf3edb3 | ||
![]() |
84d5ebfa41 | ||
![]() |
6bc4e5b45c | ||
![]() |
496fe09f78 | ||
![]() |
19daf1bd52 | ||
![]() |
74a9c2f6b4 | ||
![]() |
dd9edb68b2 | ||
![]() |
b02177e1d0 | ||
![]() |
600d38d3e2 | ||
![]() |
07fd7e497f | ||
![]() |
932873ba02 | ||
![]() |
567f1d4247 | ||
![]() |
3f05dfe4bf | ||
![]() |
fbebcf57c1 | ||
![]() |
30d3a458e2 | ||
![]() |
7591d88d00 | ||
![]() |
22baabf751 | ||
![]() |
0cdda8b0ae | ||
![]() |
295a63087f | ||
![]() |
797d3ed362 | ||
![]() |
31de7de385 | ||
![]() |
5780ad370a | ||
![]() |
3833d2cd83 | ||
![]() |
38b60205e8 | ||
![]() |
027456fd77 | ||
![]() |
10e2d65221 | ||
![]() |
d9b5dc5dd7 | ||
![]() |
c7e6564667 | ||
![]() |
da45813a06 | ||
![]() |
6cc9b5c62b | ||
![]() |
1172e02f1b | ||
![]() |
46fbc05040 | ||
![]() |
fee1ffa2e9 | ||
![]() |
22be81b5cb | ||
![]() |
12d260ca82 | ||
![]() |
82e90553bc | ||
![]() |
18c1a0e4f6 | ||
![]() |
c42102d1c4 | ||
![]() |
aca2d2e510 | ||
![]() |
666938b738 | ||
![]() |
a75db92007 | ||
![]() |
aaf2fa8807 | ||
![]() |
e549235d83 | ||
![]() |
86e8457574 | ||
![]() |
8292ed9e31 | ||
![]() |
57fc51d013 | ||
![]() |
8b332adbe7 | ||
![]() |
ae0ee1ebdd | ||
![]() |
3cea734b9b | ||
![]() |
7ac3f7ca03 | ||
![]() |
0a5c73478d | ||
![]() |
495952acb0 | ||
![]() |
25a8f1522a | ||
![]() |
f13f7ce129 | ||
![]() |
cc90127af9 | ||
![]() |
98e8476a88 | ||
![]() |
ec8bdc9af6 | ||
![]() |
9598416932 | ||
![]() |
4c0bc79e49 | ||
![]() |
01dd2d8097 | ||
![]() |
e09444d94f | ||
![]() |
0c76833997 | ||
![]() |
ad99ca1723 | ||
![]() |
f47561b580 | ||
![]() |
4f60da292a | ||
![]() |
70fb86a1c3 | ||
![]() |
bf79639d07 | ||
![]() |
e8642df674 | ||
![]() |
b648717079 | ||
![]() |
3702caa25f | ||
![]() |
4200bbfd0a | ||
![]() |
0fcca4c141 | ||
![]() |
fafdae9ba9 | ||
![]() |
ef215b1b0c | ||
![]() |
1d0721034d | ||
![]() |
3cfbe9585a | ||
![]() |
71305e636c | ||
![]() |
ce23c153ee | ||
![]() |
019da4d2f4 | ||
![]() |
ffc31f565b | ||
![]() |
7f01f2d716 | ||
![]() |
bf20b0dd79 | ||
![]() |
867826759b | ||
![]() |
3be370071c | ||
![]() |
2b9a194244 | ||
![]() |
67a928b1ae | ||
![]() |
67a7211b77 | ||
![]() |
1d4fe01db0 | ||
![]() |
07491d8028 | ||
![]() |
7f1baca872 | ||
![]() |
8c3a0a8275 | ||
![]() |
eba6043d26 | ||
![]() |
397692d113 | ||
![]() |
035ecc1517 | ||
![]() |
bb52301200 | ||
![]() |
f4adf5d7e7 | ||
![]() |
e4a8459798 | ||
![]() |
14fa738fbe | ||
![]() |
4da7aa38ea | ||
![]() |
5147d67318 | ||
![]() |
cbc599cb20 | ||
![]() |
09c84e25bf | ||
![]() |
224e3b6ad4 | ||
![]() |
992a683ba2 | ||
![]() |
e8e116312a | ||
![]() |
de3ba9a25c | ||
![]() |
5e88cabb4b | ||
![]() |
6d71177394 | ||
![]() |
edd9ae5118 | ||
![]() |
23ae3b5830 | ||
![]() |
6746aab7ef | ||
![]() |
c85ff7ddda | ||
![]() |
cf70efabb0 | ||
![]() |
6eb2958afc | ||
![]() |
18f13b7d15 | ||
![]() |
0bb959d26a | ||
![]() |
b4f3e85001 | ||
![]() |
25100c46f7 | ||
![]() |
540f4c0958 | ||
![]() |
8930ebe572 | ||
![]() |
8f93f2b6d2 | ||
![]() |
9ba91889e0 | ||
![]() |
67683fbddb | ||
![]() |
824f9d7ad0 | ||
![]() |
3e99f90eb1 | ||
![]() |
3ca8a94419 | ||
![]() |
714837dd00 | ||
![]() |
bc1d3ddd5d | ||
![]() |
bf7b75b619 | ||
![]() |
469d6ab907 | ||
![]() |
a4dd5bb62f | ||
![]() |
60859de0bd | ||
![]() |
ff70d5db14 | ||
![]() |
c8ad936d26 | ||
![]() |
60b5f5fe48 | ||
![]() |
14ec7fb816 | ||
![]() |
b4ea230ff1 | ||
![]() |
410879d154 | ||
![]() |
f14121e99c | ||
![]() |
19d7444946 | ||
![]() |
d9aaed0035 | ||
![]() |
cfd3c159f9 | ||
![]() |
4ff50525ed | ||
![]() |
34e02e9f3a | ||
![]() |
62690c2a53 | ||
![]() |
5d30e0854f | ||
![]() |
ec683cdf88 | ||
![]() |
39feed6fac | ||
![]() |
ee7f683b76 | ||
![]() |
209d52e920 | ||
![]() |
585111ca38 | ||
![]() |
ef95334fe6 | ||
![]() |
4595534a6f | ||
![]() |
be9d9264ae | ||
![]() |
a8495c67d4 | ||
![]() |
eec369ea4f | ||
![]() |
abed07b613 | ||
![]() |
6cfdedb823 | ||
![]() |
db903ebb0a | ||
![]() |
e12c83fd83 | ||
![]() |
12861f6c07 | ||
![]() |
52065b8313 | ||
![]() |
f6ff843cfb | ||
![]() |
aedf402c17 | ||
![]() |
0745b03271 | ||
![]() |
bb5c0de367 | ||
![]() |
9478251d44 | ||
![]() |
47cb85d3db | ||
![]() |
ce7ceccc1c | ||
![]() |
5d4cf3b705 | ||
![]() |
f33fc092e3 | ||
![]() |
0ff8abcd6f | ||
![]() |
b0d55d434d | ||
![]() |
092690e9f0 | ||
![]() |
5b11175cf3 | ||
![]() |
7a203a12a3 | ||
![]() |
f7dd8af35e | ||
![]() |
7a9b3442d2 | ||
![]() |
b66e2359d1 | ||
![]() |
81c72ee5d9 | ||
![]() |
fed7f89f96 | ||
![]() |
aefa629509 | ||
![]() |
bc32581cbd | ||
![]() |
3f7f6af051 | ||
![]() |
ee9b2e8bf8 | ||
![]() |
0b968abfe4 | ||
![]() |
7e7ecd6a0f | ||
![]() |
7e9a9e14c7 | ||
![]() |
333493f351 | ||
![]() |
38333a6d11 | ||
![]() |
4213957d76 | ||
![]() |
565f9e3e29 | ||
![]() |
a1bfc1cb26 | ||
![]() |
cfd432886d | ||
![]() |
191666a2f2 | ||
![]() |
aeeae7c167 | ||
![]() |
08c7d4d15e | ||
![]() |
29b92659c7 | ||
![]() |
209f25a5cf | ||
![]() |
4622f4b51d | ||
![]() |
4d51dc9b6c | ||
![]() |
76b992509b | ||
![]() |
925978db8f | ||
![]() |
c0e90ddb33 | ||
![]() |
a7a29eaf97 | ||
![]() |
a451d2d6f2 | ||
![]() |
914429ab4f | ||
![]() |
f721a7c66c | ||
![]() |
bba499649b | ||
![]() |
f9cd54c445 | ||
![]() |
0d89125a8e | ||
![]() |
6b37d678df | ||
![]() |
02698b3a0e | ||
![]() |
6f0512c18c | ||
![]() |
e46b38b301 | ||
![]() |
5841817fb5 | ||
![]() |
e28fb49015 | ||
![]() |
841eef6a52 | ||
![]() |
2eee1ef203 | ||
![]() |
cd605f4996 | ||
![]() |
54a8482a88 | ||
![]() |
e15b5a07fb | ||
![]() |
c198305b5e | ||
![]() |
a637a8970b | ||
![]() |
d97f68eec0 | ||
![]() |
c3069a425d | ||
![]() |
9b1dc7d42e | ||
![]() |
ec23fcdd75 | ||
![]() |
544d57c720 | ||
![]() |
b55d836871 | ||
![]() |
a210f523a5 | ||
![]() |
e6237d68d0 | ||
![]() |
56e6922279 | ||
![]() |
6e2f738d86 | ||
![]() |
81d0bf6f04 | ||
![]() |
95f509d337 | ||
![]() |
2f5ce67154 | ||
![]() |
89318be5f4 | ||
![]() |
f80e8c8d11 | ||
![]() |
8c4bb4140a | ||
![]() |
ff83931a3f | ||
![]() |
2468be4736 | ||
![]() |
4e835ed3ff | ||
![]() |
41f494fbff | ||
![]() |
e974fe5dc7 | ||
![]() |
85a23442cc | ||
![]() |
a822a70f00 | ||
![]() |
819902c24e | ||
![]() |
554efbb057 | ||
![]() |
8547533210 | ||
![]() |
d843d1715d | ||
![]() |
1552a8e74b | ||
![]() |
f0e9a8c5fe | ||
![]() |
648953ec1f | ||
![]() |
9e85748b2e | ||
![]() |
a98b23af02 | ||
![]() |
5463f15633 | ||
![]() |
0c6113b0d1 | ||
![]() |
c5906e780a | ||
![]() |
f2355a76d6 | ||
![]() |
0aeca40137 | ||
![]() |
5c48e4ad19 | ||
![]() |
f6d1e2b3b8 | ||
![]() |
37010d92ee | ||
![]() |
babad3ab6d | ||
![]() |
b12e9832c9 | ||
![]() |
0f9554c717 | ||
![]() |
d19dde2f85 | ||
![]() |
7a529e156d | ||
![]() |
cba2474df7 | ||
![]() |
03c889383b | ||
![]() |
da54478767 | ||
![]() |
acf9c2554f | ||
![]() |
7c53bfc870 | ||
![]() |
32a8dcd411 | ||
![]() |
20b4cec0ca | ||
![]() |
c51c938e8d | ||
![]() |
49984f2560 | ||
![]() |
b3c77ef099 | ||
![]() |
97e34844b4 | ||
![]() |
e924a1920e | ||
![]() |
1441cc293c | ||
![]() |
311a2ddc75 | ||
![]() |
551d1d9f1a | ||
![]() |
a5dea9e7f6 | ||
![]() |
02bd83bd90 | ||
![]() |
c42d5390a4 | ||
![]() |
31ea7297c2 | ||
![]() |
c53cffb745 | ||
![]() |
26a99a122a | ||
![]() |
acb0bd95f2 | ||
![]() |
5d73b17415 | ||
![]() |
3a8fa9f5b6 | ||
![]() |
e93d7feb2c | ||
![]() |
116b870152 | ||
![]() |
667c7b07b6 | ||
![]() |
45e75cc06e | ||
![]() |
5c08db2f44 | ||
![]() |
28fc29c3ab | ||
![]() |
b2ac67692e | ||
![]() |
1064d777c2 | ||
![]() |
62f675adbe | ||
![]() |
cee0bbb805 | ||
![]() |
77eb75fcc6 | ||
![]() |
55211907f2 | ||
![]() |
e1e7cd1479 | ||
![]() |
2d3c729215 | ||
![]() |
f391cfd432 | ||
![]() |
352136f0c6 | ||
![]() |
b6e7f90f6a | ||
![]() |
86cfeb76b6 | ||
![]() |
d91357a807 | ||
![]() |
3c8d7a808b | ||
![]() |
d6a80c7ea5 | ||
![]() |
05a15ac689 | ||
![]() |
580cc359e5 | ||
![]() |
630284e7ae | ||
![]() |
cc562033e7 | ||
![]() |
fabb9b6fd7 | ||
![]() |
e8ffcaae46 | ||
![]() |
47d9895077 | ||
![]() |
aacf15757f | ||
![]() |
914b44069b | ||
![]() |
4789327378 | ||
![]() |
c55f2945ac | ||
![]() |
c6a368d6f2 | ||
![]() |
869a579655 | ||
![]() |
7cd1e8ea76 | ||
![]() |
351ae1b2c7 | ||
![]() |
457f3e25cc | ||
![]() |
41c670450b | ||
![]() |
f636db49f7 | ||
![]() |
505bba7612 | ||
![]() |
72507aba4b | ||
![]() |
9b086b3f2a | ||
![]() |
f9d7d2d1dd | ||
![]() |
e9efa3f2d3 | ||
![]() |
665a72a08f | ||
![]() |
61d1dcc231 | ||
![]() |
6c9b73b100 | ||
![]() |
a4c9ed90b7 | ||
![]() |
28d6d4db92 | ||
![]() |
12def37194 | ||
![]() |
ed2302e545 | ||
![]() |
618adb913d | ||
![]() |
4a220f9bfb | ||
![]() |
300abd868a | ||
![]() |
87f0b1fc97 | ||
![]() |
78a6e72fe1 | ||
![]() |
8f1b2a9d2a | ||
![]() |
5b27b652e7 | ||
![]() |
556ff0baf4 | ||
![]() |
8cc536b20f | ||
![]() |
5e20c871a5 | ||
![]() |
56fb892818 | ||
![]() |
7f104c249a | ||
![]() |
0eeface374 | ||
![]() |
ffe1e1e40d | ||
![]() |
5efdef19cf | ||
![]() |
c9fae6a070 | ||
![]() |
2b17f730d4 | ||
![]() |
808bddbfbb | ||
![]() |
d6dfa9a0b9 | ||
![]() |
924b73f070 | ||
![]() |
64181c6ab8 | ||
![]() |
a1b10a2900 | ||
![]() |
6315b9ea52 | ||
![]() |
7c756304b5 | ||
![]() |
9fd11fbe13 | ||
![]() |
7cd9a03b0f | ||
![]() |
f8bd844c6c | ||
![]() |
987d9a267c | ||
![]() |
98d1bb9264 | ||
![]() |
b46a19f5ca | ||
![]() |
6e16ef1246 | ||
![]() |
7bad242944 | ||
![]() |
74a5c48214 | ||
![]() |
11af906c79 | ||
![]() |
c31c4b4286 | ||
![]() |
7f29b5d1e8 | ||
![]() |
6012705e95 | ||
![]() |
21a97863ac | ||
![]() |
50cfecb3fd | ||
![]() |
1461804039 | ||
![]() |
dc3f45acd4 | ||
![]() |
6970dfa5f8 | ||
![]() |
48d3c2105d | ||
![]() |
18f630ba15 | ||
![]() |
f68eb9c778 | ||
![]() |
4a960d9f2c | ||
![]() |
c745b99922 | ||
![]() |
f1e3902fea | ||
![]() |
41a623a643 | ||
![]() |
d3fe1d3b2b | ||
![]() |
3fd3baaa47 | ||
![]() |
01d2b0024f | ||
![]() |
01e66f8833 | ||
![]() |
afd9b56e71 | ||
![]() |
e2f9b4245b | ||
![]() |
22a007b514 | ||
![]() |
38988b4819 | ||
![]() |
704e92c3d0 | ||
![]() |
97b1a60ae8 | ||
![]() |
3288721259 | ||
![]() |
ab121c7eee | ||
![]() |
240362a16d | ||
![]() |
f2dcbce490 | ||
![]() |
88df434404 | ||
![]() |
b3ddabda29 | ||
![]() |
b8b3e1e72a | ||
![]() |
615a5212bf | ||
![]() |
221d299052 | ||
![]() |
3180d2ddf2 | ||
![]() |
7aaa075ba8 | ||
![]() |
4fb590889a | ||
![]() |
115ca903b2 | ||
![]() |
e90170a384 | ||
![]() |
1d0760c630 | ||
![]() |
af44fe74ff | ||
![]() |
72c0021306 | ||
![]() |
18918eb3a3 | ||
![]() |
416e181992 | ||
![]() |
d7a49e3316 | ||
![]() |
cf13f13fbf | ||
![]() |
f53a8d3b06 | ||
![]() |
8c5c1922c9 | ||
![]() |
707559e023 | ||
![]() |
97a2ccbfe0 | ||
![]() |
95f2a7a908 | ||
![]() |
e53c53bb4a | ||
![]() |
d906a85095 | ||
![]() |
dc1f669a1f | ||
![]() |
0ea862b572 | ||
![]() |
fe7a57b2b7 | ||
![]() |
c9c62a1083 | ||
![]() |
5608c5a901 | ||
![]() |
722361aedb | ||
![]() |
d2f40612f4 | ||
![]() |
6a63e5bb51 | ||
![]() |
ad40ab7e1e | ||
![]() |
05ce67fbfe | ||
![]() |
555860cf83 | ||
![]() |
2575787bd0 | ||
![]() |
2cfb646065 | ||
![]() |
a1da452c41 | ||
![]() |
420e38bead | ||
![]() |
41c4018a27 | ||
![]() |
4d4f755607 | ||
![]() |
d8e5daf12b | ||
![]() |
c3322021d0 | ||
![]() |
45cc88091e | ||
![]() |
27498f68fb | ||
![]() |
d8e80daa93 | ||
![]() |
384a6730a4 | ||
![]() |
a7de76d150 | ||
![]() |
2154e237ff | ||
![]() |
5fda3e9765 | ||
![]() |
b302bb9379 | ||
![]() |
bfbb81030f | ||
![]() |
63ce3292aa | ||
![]() |
b9a8846ee9 | ||
![]() |
6ae1d28f80 | ||
![]() |
17d358f8fe | ||
![]() |
cfd71457d2 | ||
![]() |
87285e08dc | ||
![]() |
b3a63123fd | ||
![]() |
7fc8238fb0 | ||
![]() |
32a0765484 | ||
![]() |
c5e1b87c61 | ||
![]() |
603d1ee9bb | ||
![]() |
86a0816b26 | ||
![]() |
287cb0f5ad | ||
![]() |
3009db3aa7 | ||
![]() |
32e095ce15 | ||
![]() |
9d6744ec15 | ||
![]() |
532f2caa37 | ||
![]() |
da2fa24e74 | ||
![]() |
8d04728ebc | ||
![]() |
2aa5c276c9 | ||
![]() |
6dba31b257 | ||
![]() |
6040e1bb5e | ||
![]() |
20e9d13f60 | ||
![]() |
73e3572c72 | ||
![]() |
5f76cc4f7b | ||
![]() |
186a810bf6 | ||
![]() |
207e56969b | ||
![]() |
94b6a27cf3 | ||
![]() |
21693e344c | ||
![]() |
d2443f6de8 | ||
![]() |
ed27422e69 | ||
![]() |
d24c89405a | ||
![]() |
2d518dfe2b | ||
![]() |
f357fa74f3 | ||
![]() |
335cf5d2e9 | ||
![]() |
ed3eedd238 | ||
![]() |
23783b8b0b | ||
![]() |
193054f1fc | ||
![]() |
87a8ff742f | ||
![]() |
656700b5be | ||
![]() |
3e84f3b3a4 | ||
![]() |
5360df6012 | ||
![]() |
39fdaa367c | ||
![]() |
7e0cdb12d7 | ||
![]() |
03983e8886 | ||
![]() |
57af50ed49 | ||
![]() |
e80ade65c7 | ||
![]() |
4d24112ec7 | ||
![]() |
1a269a1227 | ||
![]() |
d077fafd29 | ||
![]() |
5478e70576 | ||
![]() |
66b94ab9f1 | ||
![]() |
74c6fc954e | ||
![]() |
22bd2eb238 | ||
![]() |
2a72f274c9 | ||
![]() |
3a1b56494a | ||
![]() |
932052772c | ||
![]() |
43d058d3db | ||
![]() |
020b030667 | ||
![]() |
5a3eacde0b | ||
![]() |
7f412f5472 | ||
![]() |
33b6ef66d6 | ||
![]() |
9fefe57c90 | ||
![]() |
ed77522c08 | ||
![]() |
09aca839a8 | ||
![]() |
def9a1bcf8 | ||
![]() |
57435fdf34 | ||
![]() |
01ff9a34c2 | ||
![]() |
ff3a94933a | ||
![]() |
97a356c4a0 | ||
![]() |
10ab28c1ec | ||
![]() |
2d9cf8b759 | ||
![]() |
32b28a4ca5 | ||
![]() |
4996d8bcd1 | ||
![]() |
e5963a8590 | ||
![]() |
e8c155763b | ||
![]() |
a52249513e | ||
![]() |
5d2d4ac12b | ||
![]() |
64f5580edd | ||
![]() |
b989531a60 | ||
![]() |
34655b8d41 | ||
![]() |
30327d2fa3 | ||
![]() |
2e4c43c251 | ||
![]() |
c0a0d36e5d | ||
![]() |
b68d7150f1 | ||
![]() |
198bcfdf4d | ||
![]() |
8eb903ad72 | ||
![]() |
c853147635 | ||
![]() |
0294397021 | ||
![]() |
97fed21811 | ||
![]() |
510ea56431 | ||
![]() |
7897d78f0d | ||
![]() |
25a58a5c46 | ||
![]() |
f9e5fd714d | ||
![]() |
55eefd09da | ||
![]() |
0ce1f3e0f6 | ||
![]() |
99be181aea | ||
![]() |
fbf6a3517d | ||
![]() |
1dc4da8beb | ||
![]() |
1908588fcb | ||
![]() |
af7db08036 | ||
![]() |
e72ce9c90e | ||
![]() |
32264ae5e3 | ||
![]() |
33f2ff7e6d | ||
![]() |
6664d49928 | ||
![]() |
d648a6d3db | ||
![]() |
a1f262b5b2 | ||
![]() |
b109b76120 | ||
![]() |
1388f280e6 | ||
![]() |
d141b040d6 | ||
![]() |
e84d82315c | ||
![]() |
c6962ef4d2 | ||
![]() |
f93714a44e | ||
![]() |
564efd77f7 | ||
![]() |
5442c7cc2e | ||
![]() |
0fa5a16cd0 | ||
![]() |
1881cdc9ab | ||
![]() |
fb2aa44f78 | ||
![]() |
e88da3cea9 | ||
![]() |
14b6f84816 | ||
![]() |
ac8841447c | ||
![]() |
6cf2c0ad97 | ||
![]() |
c045ef698c | ||
![]() |
5cdb3f4fd5 | ||
![]() |
5a5c5721cc | ||
![]() |
3a11ffc77a | ||
![]() |
916675fb08 | ||
![]() |
a2ec404014 | ||
![]() |
6f6cb4b630 | ||
![]() |
c0f69f321d | ||
![]() |
55bf41d2da | ||
![]() |
7687d7705b | ||
![]() |
21ad9a36c8 | ||
![]() |
afb72aa102 | ||
![]() |
d00dc658df | ||
![]() |
2dab7c8dda | ||
![]() |
c37cc40ad9 | ||
![]() |
5341015cb1 | ||
![]() |
2fb76e6636 | ||
![]() |
5b260ea8da | ||
![]() |
55139eb134 | ||
![]() |
5e44bb60c6 | ||
![]() |
96740fd282 | ||
![]() |
cf1b027db9 | ||
![]() |
fb050ac3da | ||
![]() |
b36c6427d1 | ||
![]() |
63c308971b | ||
![]() |
cfd389883b | ||
![]() |
4576cfd961 | ||
![]() |
89cb6450fb | ||
![]() |
699eb71e2a | ||
![]() |
6b07f38cff | ||
![]() |
904f5485ab | ||
![]() |
e05d817482 | ||
![]() |
db37077af7 | ||
![]() |
61de18190f | ||
![]() |
1310f9470e | ||
![]() |
d652225f36 | ||
![]() |
2936b806f3 | ||
![]() |
3fa532a3c0 | ||
![]() |
d267d1bb98 | ||
![]() |
9792d4cc4b | ||
![]() |
090bd69be5 | ||
![]() |
c36e311520 | ||
![]() |
f2191cb731 | ||
![]() |
265c10ec1c | ||
![]() |
51bd21a464 | ||
![]() |
5004005c5a | ||
![]() |
67a49a2ca7 | ||
![]() |
57127537f7 | ||
![]() |
3476522c00 | ||
![]() |
3d087b1bbe | ||
![]() |
c058614fcc | ||
![]() |
9e9db0f1df | ||
![]() |
e826836c36 | ||
![]() |
196df855ac | ||
![]() |
d76c9dad52 | ||
![]() |
298e65a394 | ||
![]() |
078b776f60 | ||
![]() |
4d61a345c6 | ||
![]() |
dc0358957e | ||
![]() |
42d648e338 | ||
![]() |
1c254984c1 | ||
![]() |
f287cc34e7 | ||
![]() |
c8a8806e7d | ||
![]() |
d061f728bd | ||
![]() |
b5818bfefc | ||
![]() |
6bf5bc60d1 | ||
![]() |
c784c69eb3 | ||
![]() |
e3759d059a | ||
![]() |
429f5e55c3 | ||
![]() |
0e7a6d7a62 | ||
![]() |
ad1ec42b12 | ||
![]() |
580212d66d | ||
![]() |
b71de856a8 | ||
![]() |
35cff29917 | ||
![]() |
2910176b97 | ||
![]() |
c5ec8e1931 | ||
![]() |
82a887fd3b | ||
![]() |
eff410d1da | ||
![]() |
cbe8875b94 | ||
![]() |
49c35ec084 | ||
![]() |
f80cadcd7f | ||
![]() |
fa2ad8ab22 | ||
![]() |
600f757046 | ||
![]() |
3a2e932d17 | ||
![]() |
a2aaa3633a | ||
![]() |
bd9bdc9e03 | ||
![]() |
3b793929d8 | ||
![]() |
e139550949 | ||
![]() |
181c5b134f | ||
![]() |
74876f9e64 | ||
![]() |
02f3c3ef50 | ||
![]() |
9c3d2cfb02 | ||
![]() |
9d609c2dfe | ||
![]() |
cb04c183a8 | ||
![]() |
38425a1eae | ||
![]() |
4b997d42df | ||
![]() |
d1ecf9232e | ||
![]() |
e833403e3c | ||
![]() |
f64026af1a | ||
![]() |
efab6e92f7 | ||
![]() |
f69cc5cc98 | ||
![]() |
f6f26c6102 | ||
![]() |
159b35c717 | ||
![]() |
7fbac4f286 | ||
![]() |
29080de860 | ||
![]() |
e17222dd19 | ||
![]() |
55cf34508a | ||
![]() |
c52603921d | ||
![]() |
f4724a3c87 | ||
![]() |
2b4e2fc793 | ||
![]() |
14baead342 | ||
![]() |
2d6e6ceaeb | ||
![]() |
1dcf8d3995 | ||
![]() |
d07d32e28b | ||
![]() |
cb969e37a6 | ||
![]() |
6259287dff | ||
![]() |
3e2e61d2be | ||
![]() |
a3586791b5 | ||
![]() |
bb298ab660 | ||
![]() |
8c0f581ff0 | ||
![]() |
033b87deb5 | ||
![]() |
b6f1610a7e | ||
![]() |
e3fbb32399 | ||
![]() |
67b80bb8e8 | ||
![]() |
ae1427b189 | ||
![]() |
5165c439fc | ||
![]() |
b15c48e074 | ||
![]() |
c5bfde330f | ||
![]() |
d12ecc8616 | ||
![]() |
950640a557 | ||
![]() |
86746e7843 | ||
![]() |
2c74d2479f | ||
![]() |
f1b79a3b0d | ||
![]() |
6442922d86 | ||
![]() |
edbacb8e47 | ||
![]() |
71e22f41b1 | ||
![]() |
b9b0d89b5f | ||
![]() |
fdf82d0d1e | ||
![]() |
09327b0128 | ||
![]() |
8a3ee4cdc2 | ||
![]() |
8d1033f725 | ||
![]() |
1d8bad3a80 | ||
![]() |
67fbfb0f2d | ||
![]() |
4b0df80878 | ||
![]() |
52b90b6757 | ||
![]() |
31b71ade69 | ||
![]() |
0021b114de | ||
![]() |
28a7d027f6 | ||
![]() |
e32a2e2723 | ||
![]() |
46b68e489d | ||
![]() |
2436a6a402 | ||
![]() |
862467c0fa | ||
![]() |
69cfb431b1 | ||
![]() |
172bd6f0f2 | ||
![]() |
a882555d1b | ||
![]() |
0b12c4e5b2 | ||
![]() |
0ac6383c2c | ||
![]() |
76913d4a78 | ||
![]() |
a0d1da3274 | ||
![]() |
1aa144e47d | ||
![]() |
6b31743fb3 | ||
![]() |
508fdce704 | ||
![]() |
e912909aad | ||
![]() |
98322d5d11 | ||
![]() |
7b97130af7 | ||
![]() |
cc168d5ae9 | ||
![]() |
d19df3b6eb | ||
![]() |
75dbc2db98 | ||
![]() |
2875b050c5 | ||
![]() |
6c6c2b57a1 | ||
![]() |
113da81f29 | ||
![]() |
4dd2613f2f | ||
![]() |
8c37cc5340 | ||
![]() |
47c74cfa6d | ||
![]() |
32a55127f1 | ||
![]() |
6d0458281b | ||
![]() |
6090c7ccac | ||
![]() |
5e6b27e21f | ||
![]() |
eee04ab87d | ||
![]() |
a833803bdf | ||
![]() |
d2af342a5d | ||
![]() |
93619b3988 | ||
![]() |
dd4c5014fc | ||
![]() |
1e3379b00a | ||
![]() |
bbde2f5e06 | ||
![]() |
b61dfd6f97 | ||
![]() |
f16fa0a3ed | ||
![]() |
d4bd08415a | ||
![]() |
9ad276eeae | ||
![]() |
a3179bf114 | ||
![]() |
0d20dad2a3 | ||
![]() |
7c080770f0 | ||
![]() |
9752e5f62b | ||
![]() |
3b7057ad4f | ||
![]() |
38a7c771be | ||
![]() |
1c6075df2b | ||
![]() |
3ede0447b0 | ||
![]() |
f01b242e4a | ||
![]() |
2417dace2d | ||
![]() |
f82a111518 | ||
![]() |
525ba648ae | ||
![]() |
0160c2bb55 | ||
![]() |
ea41c842bc | ||
![]() |
8efc78e1c9 | ||
![]() |
973c18623f | ||
![]() |
7aba70ea65 | ||
![]() |
123ca8efe9 | ||
![]() |
22c26fe962 | ||
![]() |
761803f777 | ||
![]() |
d5d18a60fb | ||
![]() |
37b065a097 | ||
![]() |
fdfc61cf97 | ||
![]() |
31c84ab18f | ||
![]() |
a47527857c | ||
![]() |
12f2cb0d58 | ||
![]() |
67bf90e92f | ||
![]() |
b5f92f5003 | ||
![]() |
58989c9311 | ||
![]() |
736004d88b | ||
![]() |
49f51f24f7 | ||
![]() |
95df62e59b | ||
![]() |
64cfe240f9 | ||
![]() |
29f2863cf4 | ||
![]() |
792fa1f11d | ||
![]() |
7591c440c2 | ||
![]() |
c58309b385 | ||
![]() |
5ae70743b1 | ||
![]() |
29e0479081 | ||
![]() |
441a73839e | ||
![]() |
ff8f7a0867 | ||
![]() |
31edffcb63 | ||
![]() |
5442d43918 | ||
![]() |
25d4d23958 | ||
![]() |
86edb20c15 | ||
![]() |
3d30885daf | ||
![]() |
194c5aa27b | ||
![]() |
20c487238a | ||
![]() |
6814b4bef2 | ||
![]() |
e1a25907f2 | ||
![]() |
5f896dd39a | ||
![]() |
f4729310fa | ||
![]() |
2f02f4392a | ||
![]() |
b7f708dcd6 | ||
![]() |
501fd9c8e6 | ||
![]() |
7ba7df5cb2 | ||
![]() |
9dd9201b67 | ||
![]() |
8fb9f29ab7 | ||
![]() |
dd852801cc | ||
![]() |
1fa41e6209 | ||
![]() |
a2db2e8268 | ||
![]() |
617abf89e6 | ||
![]() |
98b4ceab7d | ||
![]() |
86a996b2ff | ||
![]() |
e6a9daf31a | ||
![]() |
8c0f7b207e | ||
![]() |
ec347f8738 | ||
![]() |
19fe2efb6e | ||
![]() |
e6878d7804 | ||
![]() |
435d877262 | ||
![]() |
3deff629b0 | ||
![]() |
a038cb6d1b | ||
![]() |
637dd7d0c2 | ||
![]() |
d20fa39cf5 | ||
![]() |
be6910d5d9 | ||
![]() |
2d6a5a3804 | ||
![]() |
630e81fbfb | ||
![]() |
6488aafd9d | ||
![]() |
4ad90d423d | ||
![]() |
d2dae45082 | ||
![]() |
85c9bd7ceb | ||
![]() |
d0ee579069 | ||
![]() |
10dbcbcdbd | ||
![]() |
e8dd5fe903 | ||
![]() |
32c23e6ced | ||
![]() |
81aaba328a | ||
![]() |
3c5dd3d0d2 | ||
![]() |
2dc07d9321 | ||
![]() |
841dd5e189 | ||
![]() |
b2bc2887d2 | ||
![]() |
e20319f4e1 | ||
![]() |
d40160d205 | ||
![]() |
f7167d5e83 | ||
![]() |
282773a43f | ||
![]() |
8944be5319 | ||
![]() |
df01f9bea7 | ||
![]() |
3c17b76b1c | ||
![]() |
7a6909dab1 | ||
![]() |
3064ae80d1 | ||
![]() |
06bb6856a8 | ||
![]() |
702caa6feb | ||
![]() |
fc74c582bf | ||
![]() |
658361f825 | ||
![]() |
e0c9a802d8 | ||
![]() |
c4a70c0945 | ||
![]() |
f7d6ac00e4 | ||
![]() |
8ed5a21b36 | ||
![]() |
773a993ee1 | ||
![]() |
6fb63c9609 | ||
![]() |
079289eb74 | ||
![]() |
59f96d4455 | ||
![]() |
cdab52fcbe | ||
![]() |
63c9037b10 | ||
![]() |
bbc86eba39 | ||
![]() |
e0fb6f5440 | ||
![]() |
2bd30af361 | ||
![]() |
b136f44f12 | ||
![]() |
d0dbb495b0 | ||
![]() |
8715a27a93 | ||
![]() |
503fc44208 | ||
![]() |
d3bfaeb5a4 | ||
![]() |
7adecd0808 | ||
![]() |
c99e081ae0 | ||
![]() |
285b6bf62d | ||
![]() |
723e29cdd0 | ||
![]() |
667098268f | ||
![]() |
e6408b35a2 | ||
![]() |
3eb0de68c4 | ||
![]() |
dd1b944205 | ||
![]() |
ae11f0610e | ||
![]() |
55fc963673 | ||
![]() |
198c7ca58d | ||
![]() |
5a2f70238a | ||
![]() |
8257b0b563 | ||
![]() |
9b997d2195 | ||
![]() |
a19fa1b92c | ||
![]() |
2c060db9c0 | ||
![]() |
a8621a15ad | ||
![]() |
179e9e1e74 | ||
![]() |
df5feff9ec | ||
![]() |
9226aaff1f | ||
![]() |
afe874a59b | ||
![]() |
4ad9f12d5d | ||
![]() |
228c37815a | ||
![]() |
a37ab10414 | ||
![]() |
d73dbf0c81 | ||
![]() |
daee26681a | ||
![]() |
729469e030 | ||
![]() |
c6dc9ee189 | ||
![]() |
85a75ad868 | ||
![]() |
8ec8b8d803 | ||
![]() |
d864792d09 | ||
![]() |
ed2e9a80ed | ||
![]() |
36948ed351 | ||
![]() |
e06429f3b0 | ||
![]() |
fd4a9a16de | ||
![]() |
acba10ac09 | ||
![]() |
d6d49e0912 | ||
![]() |
b5de5f30ac | ||
![]() |
17698065a0 | ||
![]() |
135c6f2c15 | ||
![]() |
a263fe2f2d | ||
![]() |
cbe46539ca | ||
![]() |
5e842f1572 | ||
![]() |
b56d4d0fea | ||
![]() |
42106bb97a | ||
![]() |
e7216d4aef | ||
![]() |
0751e9cea3 | ||
![]() |
0091580ae0 | ||
![]() |
4a16f9c1a7 | ||
![]() |
894d673c90 | ||
![]() |
577fe3037f | ||
![]() |
53ca62e8fc | ||
![]() |
670f6d9f8b | ||
![]() |
8a21334e66 | ||
![]() |
a130d801d5 | ||
![]() |
51b6f41eff | ||
![]() |
a829799b36 | ||
![]() |
ccb43d0661 | ||
![]() |
5bd53436df | ||
![]() |
caa4a08b26 | ||
![]() |
0fa99d7940 | ||
![]() |
73dae7842d | ||
![]() |
92a18d810c | ||
![]() |
591eb60a71 | ||
![]() |
9081a5aff6 | ||
![]() |
8ff4566905 | ||
![]() |
c8d8fb6aff | ||
![]() |
6da4994955 | ||
![]() |
4780fcd534 | ||
![]() |
5b30711470 | ||
![]() |
336f27f078 | ||
![]() |
92ef0d723b | ||
![]() |
ffee7a518e | ||
![]() |
8d61e6f111 | ||
![]() |
67736bfbca | ||
![]() |
84108b60c2 | ||
![]() |
59f8f2fdff | ||
![]() |
5c6175badb | ||
![]() |
8db8a30455 | ||
![]() |
cbe8fda1df | ||
![]() |
558df450b5 | ||
![]() |
f1d10c96bc | ||
![]() |
4d1b08a628 | ||
![]() |
2eda56bc1f | ||
![]() |
c391fee100 | ||
![]() |
06d255ccc2 | ||
![]() |
bb291b947f | ||
![]() |
3c8b22688a | ||
![]() |
cdd1fad85c | ||
![]() |
ab6fd06657 | ||
![]() |
3bb32a5630 | ||
![]() |
bf5862942a | ||
![]() |
cbea595fa0 | ||
![]() |
952ea0b090 | ||
![]() |
af951ac11c | ||
![]() |
165614efe9 | ||
![]() |
95335df84d | ||
![]() |
100861484a | ||
![]() |
70eb588f1f | ||
![]() |
c206de263b | ||
![]() |
0c12972c03 | ||
![]() |
546c4defb7 | ||
![]() |
814fca3832 | ||
![]() |
3ee29297e0 | ||
![]() |
6d9d0fff10 | ||
![]() |
714b8dad87 | ||
![]() |
a44807d47b | ||
![]() |
4aac3bf7e4 | ||
![]() |
ee2ed8222d | ||
![]() |
edaf396894 | ||
![]() |
6f052f0001 | ||
![]() |
ba40a56c32 | ||
![]() |
780be3776a | ||
![]() |
98235b3fdc | ||
![]() |
f5a9abfc8d | ||
![]() |
a8619fe2ad | ||
![]() |
c812bb1295 | ||
![]() |
4e7bcc788b | ||
![]() |
79bd69e599 | ||
![]() |
5772af37fe | ||
![]() |
6324bb1134 | ||
![]() |
658f2a3fc3 | ||
![]() |
6e536f81ac | ||
![]() |
dd9450d36a | ||
![]() |
8ef3a90ce0 | ||
![]() |
e6c76ad3f3 | ||
![]() |
4a249843eb | ||
![]() |
5c1f0f51df | ||
![]() |
2377ce1123 | ||
![]() |
6f2b31f4a3 | ||
![]() |
c5590440d6 | ||
![]() |
7931390ae4 | ||
![]() |
546b857b9d | ||
![]() |
ce10d54a9c | ||
![]() |
965bbb9f3b | ||
![]() |
e88b331155 | ||
![]() |
ce177c3c46 | ||
![]() |
5a6dbfda36 | ||
![]() |
6c1caac731 | ||
![]() |
9c3c42c3e6 | ||
![]() |
5fc33dcc06 | ||
![]() |
c196ced0e2 | ||
![]() |
dfa977a020 | ||
![]() |
5be2dfa747 | ||
![]() |
f9ea99fa1d | ||
![]() |
79583c011f | ||
![]() |
172bcc7677 | ||
![]() |
fa51cb94a3 | ||
![]() |
c2060ea1a7 | ||
![]() |
7962004215 | ||
![]() |
45476f2867 | ||
![]() |
280ced7904 | ||
![]() |
474795367e | ||
![]() |
ce756411cf | ||
![]() |
bdba2b33fb | ||
![]() |
0d26111fa7 | ||
![]() |
dada7dbb86 | ||
![]() |
cb05d34d20 | ||
![]() |
7c25c60252 | ||
![]() |
86149224d1 | ||
![]() |
f717589074 | ||
![]() |
254a0541cc | ||
![]() |
271109a726 | ||
![]() |
38de74c4ff | ||
![]() |
865d11e844 | ||
![]() |
ebba9a2290 | ||
![]() |
bc45b8b695 | ||
![]() |
7ac389b698 | ||
![]() |
616d22ceac | ||
![]() |
f6332d2cd9 | ||
![]() |
4ca7a81e96 | ||
![]() |
ae2867136a | ||
![]() |
ef04ed9151 | ||
![]() |
1522632f5a | ||
![]() |
be6bcafccc | ||
![]() |
5d332e7d58 | ||
![]() |
283ff945f3 | ||
![]() |
0d4af3023d | ||
![]() |
7fdb7961ce | ||
![]() |
e161209a46 | ||
![]() |
5e2e4a8631 | ||
![]() |
e4a6bd0ca5 | ||
![]() |
5547185b3f | ||
![]() |
7841ee3dcc | ||
![]() |
099a680c85 | ||
![]() |
9764d4d226 | ||
![]() |
37336fffe2 | ||
![]() |
a285404847 | ||
![]() |
2994b2c158 | ||
![]() |
3a3a06631d | ||
![]() |
f9bf576d2e | ||
![]() |
f2f7fbce09 | ||
![]() |
412a3ee344 | ||
![]() |
2f4eea118a | ||
![]() |
7310506ed4 | ||
![]() |
26b5ee7482 | ||
![]() |
58280a20a8 | ||
![]() |
3d47d7e73f | ||
![]() |
d9f9d7dc34 | ||
![]() |
4bcd926543 | ||
![]() |
05626c2c8f | ||
![]() |
30b83faab6 | ||
![]() |
9868648fcb | ||
![]() |
b99631f1bd | ||
![]() |
6be26e8047 | ||
![]() |
c7de9379ad | ||
![]() |
86ea69b65e | ||
![]() |
f2aa9dccd1 | ||
![]() |
464f5e09ae | ||
![]() |
17e4bde720 | ||
![]() |
6d779dad05 | ||
![]() |
38d0cc1b29 | ||
![]() |
fc9a221127 | ||
![]() |
95394ec54f | ||
![]() |
a3759f93a2 | ||
![]() |
2632283431 | ||
![]() |
8a014e3ad5 | ||
![]() |
1b3427837e | ||
![]() |
b3c91d866b | ||
![]() |
10dd531cdb | ||
![]() |
6953187cac | ||
![]() |
7b83f0146e | ||
![]() |
4ed108b5c0 | ||
![]() |
24b6b23d25 | ||
![]() |
5ea03f12fb | ||
![]() |
99a53cb005 | ||
![]() |
d7af409d01 | ||
![]() |
0304e98b00 | ||
![]() |
b16db904cc | ||
![]() |
4b306d454b | ||
![]() |
e53ea2377c | ||
![]() |
f79f2ac29e | ||
![]() |
1516edbeca | ||
![]() |
54348d824c | ||
![]() |
f32cb0c16e | ||
![]() |
4a03cb0701 | ||
![]() |
76e25953b1 | ||
![]() |
2f0bf97162 | ||
![]() |
d0b6badf09 | ||
![]() |
30f37e1e8b | ||
![]() |
4e1c90bbcc | ||
![]() |
c31c855952 | ||
![]() |
312b2ad1a8 | ||
![]() |
0953b5627e | ||
![]() |
57af89f1d0 | ||
![]() |
f71f481ff3 | ||
![]() |
0ba31ed56b | ||
![]() |
edc81bc668 | ||
![]() |
7797e33ec5 | ||
![]() |
118adb42b9 | ||
![]() |
2efe604b9b | ||
![]() |
cadd0cd9b4 | ||
![]() |
f3187a465c | ||
![]() |
6fe856c002 | ||
![]() |
9a626ea1de | ||
![]() |
026233b7e7 | ||
![]() |
6ee9d91aef | ||
![]() |
808a1ed703 | ||
![]() |
7142e9e0e3 | ||
![]() |
66a2e5427e | ||
![]() |
3aa554c52b | ||
![]() |
4322f4c31d | ||
![]() |
33f8df3afe | ||
![]() |
42a83b56c3 | ||
![]() |
0f39df0e0b | ||
![]() |
a17588199f | ||
![]() |
fad835c029 | ||
![]() |
568e9537ec | ||
![]() |
58bb0509f7 | ||
![]() |
0ad2682210 | ||
![]() |
f97e52ea0b | ||
![]() |
4c90523121 | ||
![]() |
519d3ee2d6 | ||
![]() |
3abb35e506 | ||
![]() |
c6e36fd70e | ||
![]() |
ccc7b0ec65 | ||
![]() |
4d1d3a165c | ||
![]() |
e54cf24248 | ||
![]() |
7103969bba | ||
![]() |
3bb40a8fff | ||
![]() |
f4dcc9e786 | ||
![]() |
9fd29b264e | ||
![]() |
478c761750 | ||
![]() |
dbd6feed4e | ||
![]() |
480c9f11b8 | ||
![]() |
ed8fa0a2a5 | ||
![]() |
3af05e7960 | ||
![]() |
07b6942690 | ||
![]() |
7d8a5213dd | ||
![]() |
241589fdb0 | ||
![]() |
eb09e0a633 | ||
![]() |
4e2c90e399 | ||
![]() |
1097f44feb | ||
![]() |
e5423b5e08 | ||
![]() |
4ba5b6da1d | ||
![]() |
c1a7844f4a | ||
![]() |
781a4d8d78 | ||
![]() |
3ba29583fc | ||
![]() |
7760631751 | ||
![]() |
05d6d557b8 | ||
![]() |
9925a320f5 | ||
![]() |
dca5d84d29 | ||
![]() |
0b470f8e01 | ||
![]() |
7e58f4341e | ||
![]() |
d8933afb50 | ||
![]() |
4bb45fc220 | ||
![]() |
09f913cba4 | ||
![]() |
006d730185 | ||
![]() |
cf558d8f62 | ||
![]() |
a65d546f3b | ||
![]() |
bf02c9fe5f | ||
![]() |
6908b9f29b | ||
![]() |
cd06dbc915 | ||
![]() |
977dfa807f | ||
![]() |
8b7e8ec635 | ||
![]() |
c14e1d7add | ||
![]() |
7377366372 | ||
![]() |
9c9841663a | ||
![]() |
612e96201c | ||
![]() |
d7aa4a0e1f | ||
![]() |
8b7414770f | ||
![]() |
a26ede4dae | ||
![]() |
7591770c40 | ||
![]() |
7623698a00 | ||
![]() |
f518c47e09 | ||
![]() |
c23086259d | ||
![]() |
765a021ecd | ||
![]() |
7e21107120 | ||
![]() |
322e186c4b | ||
![]() |
59b8776814 | ||
![]() |
5bb7069c7f | ||
![]() |
1a2c15684e | ||
![]() |
b02565532f | ||
![]() |
7d7414ebb9 | ||
![]() |
55d6217c32 | ||
![]() |
10e5760ba8 | ||
![]() |
f797141a29 | ||
![]() |
968c23113c | ||
![]() |
bf4d953f3c | ||
![]() |
d34f5cc97e | ||
![]() |
d254633b77 | ||
![]() |
be93e6efdf | ||
![]() |
1d9ad94822 | ||
![]() |
fe438fd62a | ||
![]() |
93894aca96 | ||
![]() |
f1b8510708 | ||
![]() |
7dcecf486d | ||
![]() |
8c1985f9c0 | ||
![]() |
34eb7d05dc | ||
![]() |
729452038b | ||
![]() |
3e30e9554f | ||
![]() |
009bcaf6d4 | ||
![]() |
baca8808ee | ||
![]() |
1a923063b5 | ||
![]() |
c512189478 | ||
![]() |
c155c65a8f | ||
![]() |
a221d6fd07 | ||
![]() |
37280779b0 | ||
![]() |
ed588476e0 | ||
![]() |
19fe39ce2e | ||
![]() |
07fcd53bf8 | ||
![]() |
834d786037 | ||
![]() |
72c6f1165a | ||
![]() |
1570c4d08a | ||
![]() |
252fdefef3 | ||
![]() |
fed5169724 | ||
![]() |
2cb734bba2 | ||
![]() |
46926a4d99 | ||
![]() |
88732bb88c | ||
![]() |
ba3ff08d6c | ||
![]() |
8f7f6a4f40 | ||
![]() |
e8bf3f0d2c | ||
![]() |
7e6dc48d69 | ||
![]() |
37f608258f | ||
![]() |
a25511c849 | ||
![]() |
930dee9326 | ||
![]() |
315f26fb82 | ||
![]() |
e972cb4c1a | ||
![]() |
7309e61221 | ||
![]() |
17e784c283 | ||
![]() |
627ecd2b71 | ||
![]() |
1c5bd55c96 | ||
![]() |
6ec3951e4e | ||
![]() |
d1115d62a7 | ||
![]() |
e29727827d | ||
![]() |
1f89948948 | ||
![]() |
1067e5f2c2 | ||
![]() |
25ca011bfe | ||
![]() |
3be0be1b60 | ||
![]() |
2e15934666 | ||
![]() |
cb52ee8cfb | ||
![]() |
01eee306f1 | ||
![]() |
a601739fbd | ||
![]() |
cb1767347b | ||
![]() |
32654e1f25 | ||
![]() |
91108a5df9 | ||
![]() |
e5e522bc31 | ||
![]() |
5741d5f6a0 | ||
![]() |
8b30d6a7ff | ||
![]() |
108b84d8b1 | ||
![]() |
469a4f25e5 | ||
![]() |
c49369bc7e | ||
![]() |
46b5f01bbc | ||
![]() |
d7d9b1793f | ||
![]() |
e029cc3fa1 | ||
![]() |
53e80e4359 | ||
![]() |
427cf081e3 | ||
![]() |
c103504fc8 | ||
![]() |
20957a75d5 | ||
![]() |
dd715a9c8a | ||
![]() |
24d82e562a | ||
![]() |
9ad2537ca2 | ||
![]() |
4a3c015524 | ||
![]() |
53e94cc001 | ||
![]() |
039b7aee9e | ||
![]() |
0bcaaf3c0b | ||
![]() |
5315e1e337 | ||
![]() |
1f4f78a179 | ||
![]() |
599ef8aa44 | ||
![]() |
e445f96e0c | ||
![]() |
9a8aa7a4e5 | ||
![]() |
a3905c68cf | ||
![]() |
3d1cd46053 | ||
![]() |
ec6c9dac49 | ||
![]() |
8068671200 | ||
![]() |
8927f50cc6 | ||
![]() |
b806a30639 | ||
![]() |
ae0f1d2a15 | ||
![]() |
120d36e413 | ||
![]() |
c8c5d777a1 | ||
![]() |
b92d42e7cc | ||
![]() |
59bc6f19e5 | ||
![]() |
ca25b7b3c8 | ||
![]() |
b074e6e198 | ||
![]() |
267bebd0e8 | ||
![]() |
58dbe96bd8 | ||
![]() |
becac84e6e | ||
![]() |
ae1273a7f3 | ||
![]() |
05ef076ef0 | ||
![]() |
d20d95d29b | ||
![]() |
6e387f3321 | ||
![]() |
68a5166d2f | ||
![]() |
2bf47478b2 | ||
![]() |
07b88e3147 | ||
![]() |
26e851fcf1 | ||
![]() |
5b3426f4ac | ||
![]() |
ecfb71b08f | ||
![]() |
fd6fbebd69 | ||
![]() |
758c343e52 | ||
![]() |
04f789d404 | ||
![]() |
fe730574c9 | ||
![]() |
20b0fa31d0 | ||
![]() |
ec0281768d | ||
![]() |
3bec76e27a | ||
![]() |
462c113ce8 | ||
![]() |
12538c7c27 | ||
![]() |
e01b470493 | ||
![]() |
f7b78595a9 | ||
![]() |
b3136b4ebe | ||
![]() |
4d0bd8a3a3 | ||
![]() |
e1db27010c | ||
![]() |
40e3b7fa06 | ||
![]() |
a7012814ab | ||
![]() |
213fd80894 | ||
![]() |
5e8909883d | ||
![]() |
08cd39749b | ||
![]() |
a0d666ae14 | ||
![]() |
fa8b18f3d5 | ||
![]() |
267dea4693 | ||
![]() |
434d219f41 | ||
![]() |
589a69ac6d | ||
![]() |
dc0126b53c | ||
![]() |
0ca69d4f03 | ||
![]() |
ec84b91f84 | ||
![]() |
a63f8650e5 | ||
![]() |
59a1d619d3 | ||
![]() |
76dc60194d | ||
![]() |
cc9c1f63d8 | ||
![]() |
e5da93f359 | ||
![]() |
008237b2a4 | ||
![]() |
920796d8ec | ||
![]() |
c6a4206266 | ||
![]() |
1cf85ff2c6 | ||
![]() |
be20b2404b | ||
![]() |
011baba140 | ||
![]() |
b22919a278 | ||
![]() |
49b7c71fbb | ||
![]() |
31c81fc9fe | ||
![]() |
8653b9b0a2 | ||
![]() |
b3e53e34b6 | ||
![]() |
fbaef13553 | ||
![]() |
3473f5dc85 | ||
![]() |
b4c33aaa18 | ||
![]() |
a910b542a0 | ||
![]() |
705d0294b5 | ||
![]() |
403916748c | ||
![]() |
fd9e716ec4 | ||
![]() |
3e6b0b8394 | ||
![]() |
56e055c671 | ||
![]() |
1341100f03 | ||
![]() |
d7c72d5f75 | ||
![]() |
265f0c6615 | ||
![]() |
9642777750 | ||
![]() |
41052b27a0 | ||
![]() |
0ac4b7728f | ||
![]() |
bb97fb8e19 | ||
![]() |
b1391bd6d7 | ||
![]() |
f1c190028e | ||
![]() |
ad7bcd19d4 | ||
![]() |
ca954ccc97 | ||
![]() |
8ab10de4ad | ||
![]() |
df9d5ae2ac | ||
![]() |
5ddbf3def4 | ||
![]() |
289f01f7a2 | ||
![]() |
f3aa9c43ef | ||
![]() |
165cf26818 | ||
![]() |
e6a7f4e5a7 | ||
![]() |
8f685b754a | ||
![]() |
539ad9f05c | ||
![]() |
5b8f6e466a | ||
![]() |
520be48198 | ||
![]() |
e4a345880e | ||
![]() |
392ef51a6f | ||
![]() |
f06903f1b8 | ||
![]() |
fe83ef0975 | ||
![]() |
9e8a6c702d | ||
![]() |
3e8b8a7575 | ||
![]() |
d3e37e5eab | ||
![]() |
0c8b11cedd | ||
![]() |
cd26b1647d | ||
![]() |
cdc01a5bc4 | ||
![]() |
1295f7c4bf | ||
![]() |
20dd98d3b9 | ||
![]() |
bd51292f4c | ||
![]() |
cc45208605 | ||
![]() |
7542dbeab8 | ||
![]() |
01dfdbe2ef | ||
![]() |
bb21abb110 | ||
![]() |
59517647b5 | ||
![]() |
1eba425087 | ||
![]() |
16fcb2f505 | ||
![]() |
6d0849eb66 | ||
![]() |
dbf5084fa1 | ||
![]() |
d6779d977a | ||
![]() |
e8df39d3c4 | ||
![]() |
feda094273 | ||
![]() |
23b88a375d | ||
![]() |
095dccd30f | ||
![]() |
246845607f | ||
![]() |
3074e45d2c | ||
![]() |
83d1f1d629 | ||
![]() |
485415c551 | ||
![]() |
d6401d1638 | ||
![]() |
7f404e1cf5 | ||
![]() |
a94c588a17 | ||
![]() |
d106262454 | ||
![]() |
c5bca66618 | ||
![]() |
6b3960fc3f | ||
![]() |
908a5784a1 | ||
![]() |
bbff898073 | ||
![]() |
19f8704cb4 | ||
![]() |
b366b0d261 | ||
![]() |
941821e453 | ||
![]() |
427523644c | ||
![]() |
475e9b50e1 | ||
![]() |
812d41092e | ||
![]() |
41299e6851 | ||
![]() |
95cb0d84f0 | ||
![]() |
fb478de164 | ||
![]() |
1bd7c8ca5f | ||
![]() |
fe471c3571 | ||
![]() |
8ff833de36 | ||
![]() |
5dd2610b5e | ||
![]() |
4e3a927323 | ||
![]() |
595a68ecba | ||
![]() |
6f5cb30734 | ||
![]() |
427504fd7c | ||
![]() |
b66734a472 | ||
![]() |
84911c1a8c | ||
![]() |
adefe2eeef | ||
![]() |
549a4df834 | ||
![]() |
4daf1c7721 | ||
![]() |
728082723c | ||
![]() |
4522d98934 | ||
![]() |
0d67c174aa | ||
![]() |
a841b4ea86 | ||
![]() |
f232334bcc | ||
![]() |
d8ac6115c7 | ||
![]() |
885d1b9d7e | ||
![]() |
f6e492638d | ||
![]() |
46beb90112 | ||
![]() |
0a6fad73c3 | ||
![]() |
5796db51a7 | ||
![]() |
2998f45b27 | ||
![]() |
e156d58769 | ||
![]() |
eb9d98d289 | ||
![]() |
2ec13e4e76 | ||
![]() |
f72d39ed85 | ||
![]() |
72291b09f2 | ||
![]() |
ac5cdfae64 | ||
![]() |
db6115eae5 | ||
![]() |
9e324762b6 | ||
![]() |
299fac95fb | ||
![]() |
906c1081fa | ||
![]() |
237b10a2a2 | ||
![]() |
b7909cc6e5 | ||
![]() |
dca8594542 | ||
![]() |
0b7e63bafb | ||
![]() |
9f792fa54b | ||
![]() |
d0be0780fd | ||
![]() |
bef3dbc6f4 | ||
![]() |
d352804b5d | ||
![]() |
9485f82ea9 | ||
![]() |
c7ba94f959 | ||
![]() |
5ac00c4920 | ||
![]() |
bd1217810f | ||
![]() |
1e97392244 | ||
![]() |
9b3ca4468c | ||
![]() |
b2b2f3cd05 | ||
![]() |
bae3774eb6 | ||
![]() |
1118901ca2 | ||
![]() |
0c0a696d36 | ||
![]() |
21a5b04b7b | ||
![]() |
6fa41efbf5 | ||
![]() |
ef8d33db41 | ||
![]() |
1abe444205 | ||
![]() |
145af1e091 | ||
![]() |
f5fa15080c | ||
![]() |
0c0d0104d7 | ||
![]() |
406dd22703 | ||
![]() |
bb44c2ea92 | ||
![]() |
ea26ec628d | ||
![]() |
815e513093 | ||
![]() |
8ac23b92d8 | ||
![]() |
d31dbc7c7c | ||
![]() |
000e3de35d | ||
![]() |
7e63ffe745 | ||
![]() |
27eda9eb7c | ||
![]() |
0fdc5eafbd | ||
![]() |
59f89980a3 | ||
![]() |
50acf4f51f | ||
![]() |
04779d28fb | ||
![]() |
1e78368115 | ||
![]() |
0c46df65e6 | ||
![]() |
4c788cb51e | ||
![]() |
1c915905c6 | ||
![]() |
9f3e3c83e0 | ||
![]() |
6916752434 | ||
![]() |
b0b328e50b | ||
![]() |
6cea26f436 | ||
![]() |
533edc5f40 | ||
![]() |
97903f3870 | ||
![]() |
d571f54c65 | ||
![]() |
e0bd8e3f9d | ||
![]() |
9225a13808 | ||
![]() |
3f712ed5f0 | ||
![]() |
259fe94f83 | ||
![]() |
3651b3ac8d | ||
![]() |
b32b8a98e2 | ||
![]() |
5d515b3863 | ||
![]() |
a3cb4e5ffb | ||
![]() |
676ef0159a | ||
![]() |
34d11bf23d | ||
![]() |
0c00eb2061 | ||
![]() |
3e3951a3e7 | ||
![]() |
c71fe00741 | ||
![]() |
69a029a555 | ||
![]() |
3f194f90ce | ||
![]() |
7e401a83cf | ||
![]() |
69b05932eb | ||
![]() |
ac2d43db68 | ||
![]() |
b5418e4dce | ||
![]() |
6b422582a6 | ||
![]() |
f5388b9737 | ||
![]() |
6323fb0041 | ||
![]() |
b1835f0998 | ||
![]() |
1c9c0d0207 | ||
![]() |
0f8b7cd588 | ||
![]() |
c450e4aed3 | ||
![]() |
14badf8cfc | ||
![]() |
df3e78ee40 | ||
![]() |
11689bf855 | ||
![]() |
4152582ae0 | ||
![]() |
3be7511b7c | ||
![]() |
f3adeeac0e | ||
![]() |
67cf1b45ed | ||
![]() |
e396da8ee5 | ||
![]() |
04b9b67c9d | ||
![]() |
45360f0979 | ||
![]() |
ae57264487 | ||
![]() |
08ebf57c90 | ||
![]() |
d9407d6329 | ||
![]() |
c6ae2456f2 | ||
![]() |
c9f38430c6 | ||
![]() |
3a761b3b5f | ||
![]() |
c48116b723 | ||
![]() |
0b77b863ba | ||
![]() |
832d60ce87 | ||
![]() |
f863dfee42 | ||
![]() |
c44d180352 | ||
![]() |
a17cb735b7 | ||
![]() |
806124b047 | ||
![]() |
61cb288382 | ||
![]() |
3956adf291 | ||
![]() |
672fb0f829 | ||
![]() |
7f14e88c4c | ||
![]() |
e146b6a88d | ||
![]() |
cf1764723f | ||
![]() |
7b788c07b8 | ||
![]() |
dffbaf89a3 | ||
![]() |
578069b3c9 | ||
![]() |
ed3cadd439 | ||
![]() |
aa894b8ad9 | ||
![]() |
ed10877431 | ||
![]() |
1d327ec346 | ||
![]() |
56c24a6a56 | ||
![]() |
4c8457ad14 | ||
![]() |
f93cfb9f8b | ||
![]() |
1755272f81 | ||
![]() |
25530ed7f0 | ||
![]() |
53e732b4fe | ||
![]() |
7aebd9b74b | ||
![]() |
be51d8e159 | ||
![]() |
bfc6b62213 | ||
![]() |
a9bebb10da | ||
![]() |
2f18ef6828 | ||
![]() |
f2d68642f9 | ||
![]() |
350e151214 | ||
![]() |
72b031e3e5 | ||
![]() |
d0a4465985 | ||
![]() |
0ef8b4ad14 | ||
![]() |
c5d9412c6c | ||
![]() |
92718a5ec8 | ||
![]() |
099a807ce0 | ||
![]() |
df47697ca6 | ||
![]() |
b7aeeb151d | ||
![]() |
2e22dfe056 | ||
![]() |
a64d764cc1 | ||
![]() |
4f27abb4a0 | ||
![]() |
b999cb4195 | ||
![]() |
745fd58e2e | ||
![]() |
57981a870e | ||
![]() |
130e1b6300 | ||
![]() |
477e698f7e | ||
![]() |
11c4a90cc9 | ||
![]() |
35493662da | ||
![]() |
8710f2f83b | ||
![]() |
3e8308ecd7 | ||
![]() |
dae7bbdf9d | ||
![]() |
d0994f1b4b | ||
![]() |
cae95343ca | ||
![]() |
17027e6292 | ||
![]() |
e891873d28 | ||
![]() |
b39ea1b68b | ||
![]() |
3d8179a4e6 | ||
![]() |
9101cb9218 | ||
![]() |
6ec6c26a10 | ||
![]() |
d6a801d854 | ||
![]() |
6711788dd0 | ||
![]() |
e41060ad65 | ||
![]() |
7e7f14a66b | ||
![]() |
0c780166e0 | ||
![]() |
87547834ef | ||
![]() |
ccc53278a1 | ||
![]() |
9a23b718f3 | ||
![]() |
e3d43509cf | ||
![]() |
dfbcecb081 | ||
![]() |
cf82bc5efb | ||
![]() |
14e1296e13 | ||
![]() |
6d6087b1e3 | ||
![]() |
51afbdfcdc | ||
![]() |
9c90928d07 | ||
![]() |
8ac9b862f8 | ||
![]() |
cd8a1a0816 | ||
![]() |
a4c3fb26c7 | ||
![]() |
fd4a5f2aaa | ||
![]() |
25ed9d2798 | ||
![]() |
c96a1afaed | ||
![]() |
344a2afeff | ||
![]() |
e54f964eca | ||
![]() |
8733dc6dab | ||
![]() |
7e56e47046 | ||
![]() |
7edfc313d6 | ||
![]() |
d37f5b9aa8 | ||
![]() |
1fbfc767c4 | ||
![]() |
bd797b59fe | ||
![]() |
0609b3d7f6 | ||
![]() |
ca883c211a | ||
![]() |
330ab83ece | ||
![]() |
d846bc7a2e | ||
![]() |
db2e245b13 | ||
![]() |
4e79a3aa16 | ||
![]() |
ea422b5561 | ||
![]() |
f366f5e406 | ||
![]() |
223064567f | ||
![]() |
0817d7de5a | ||
![]() |
0e0a534620 | ||
![]() |
61f8ceaaaa | ||
![]() |
7e6b11a21b | ||
![]() |
28c219c694 | ||
![]() |
f679d3f873 | ||
![]() |
232b7ccfc1 | ||
![]() |
44fc8a55ea | ||
![]() |
b2d035cf69 | ||
![]() |
d81d3c72e4 | ||
![]() |
f62777bc1a | ||
![]() |
8ba661aa35 | ||
![]() |
15ea0f3210 | ||
![]() |
0d76e46fa2 | ||
![]() |
daf3e3dde5 | ||
![]() |
222585bf01 | ||
![]() |
63af0de9f0 | ||
![]() |
5df6f2a13e | ||
![]() |
c5f1c60ad7 | ||
![]() |
3ac7785cc3 | ||
![]() |
3bbd97e7e1 | ||
![]() |
e47b4fef20 | ||
![]() |
7302480728 | ||
![]() |
457c520eb6 | ||
![]() |
053edb823d | ||
![]() |
727d120e70 | ||
![]() |
ea01a5171b | ||
![]() |
77ddeabca2 | ||
![]() |
e12a7bb85f | ||
![]() |
c7b9bfeb4b | ||
![]() |
ae9e52f093 | ||
![]() |
00a5d5ff64 | ||
![]() |
29868bdd29 | ||
![]() |
38a382f8e5 | ||
![]() |
f8ce00c2df | ||
![]() |
6a9038c306 | ||
![]() |
7bcc4c4ce3 | ||
![]() |
8c52e20736 | ||
![]() |
3156741664 | ||
![]() |
750be6c5fe | ||
![]() |
6292bff7c9 | ||
![]() |
f25581c3f1 | ||
![]() |
12b8ae3eed | ||
![]() |
660754511b | ||
![]() |
2846363a2c | ||
![]() |
3521b8aa22 | ||
![]() |
249b5d4068 | ||
![]() |
76113cb0ab | ||
![]() |
a529518b91 | ||
![]() |
75bcd1adec | ||
![]() |
fba7eac6d8 | ||
![]() |
6e127db982 | ||
![]() |
d12bdcfda4 | ||
![]() |
f1cf541606 | ||
![]() |
2b9fe5afda | ||
![]() |
ba47a21971 | ||
![]() |
8cb2bdc846 | ||
![]() |
5bdc5a0fcc | ||
![]() |
2ebb7d11a8 | ||
![]() |
1d08f4d4ff | ||
![]() |
b05316c000 | ||
![]() |
f1378013c1 | ||
![]() |
edc758334c | ||
![]() |
beb0f5708f | ||
![]() |
71baee063c | ||
![]() |
1ca50cdbd2 | ||
![]() |
afb0a9f17f | ||
![]() |
c14b76b324 | ||
![]() |
af23d3d98e | ||
![]() |
9fe9c2662b | ||
![]() |
9e0c226632 | ||
![]() |
4f43788307 | ||
![]() |
8dae2555db | ||
![]() |
1bf621fb4b | ||
![]() |
2ede77318a | ||
![]() |
5c678e86bb | ||
![]() |
02937cc543 | ||
![]() |
165cac8b13 | ||
![]() |
25b34b419f | ||
![]() |
c1fa6c842d | ||
![]() |
7900a95b25 | ||
![]() |
fe12d03916 | ||
![]() |
23b9eca4ab | ||
![]() |
3c48488c61 | ||
![]() |
dff64c5c68 | ||
![]() |
886081e27f | ||
![]() |
e757c3e13c | ||
![]() |
5fdb60f85d | ||
![]() |
aaed3f622a | ||
![]() |
130274de86 | ||
![]() |
8bc0bcd9e6 | ||
![]() |
28f3be56b3 | ||
![]() |
c53cd1ec91 | ||
![]() |
90682e9f8b | ||
![]() |
341e386df8 | ||
![]() |
f4140ae728 | ||
![]() |
1021c6f2b0 | ||
![]() |
780d3d7703 | ||
![]() |
6ac7948f72 | ||
![]() |
4e10682748 | ||
![]() |
096ad1febe | ||
![]() |
1543ac50cd | ||
![]() |
442473368d | ||
![]() |
b35221bf4f | ||
![]() |
568b4c8e85 | ||
![]() |
e939b8237e | ||
![]() |
ffe5cddead | ||
![]() |
821e828f07 | ||
![]() |
2596f37f66 | ||
![]() |
cbc2b70336 | ||
![]() |
5aac7d07d2 | ||
![]() |
ee6d52efa3 | ||
![]() |
adc2d980f4 | ||
![]() |
11ccfe7ac4 | ||
![]() |
fa2dbb2b89 | ||
![]() |
e7b25d3fc8 | ||
![]() |
444222c7f9 | ||
![]() |
e724aa8caf | ||
![]() |
8f23299e7d | ||
![]() |
361cc9e9f7 | ||
![]() |
865de73a83 | ||
![]() |
531d8cc706 | ||
![]() |
4b02bb1df8 | ||
![]() |
1d3270d869 | ||
![]() |
3be23a3d37 | ||
![]() |
af9418552a | ||
![]() |
10b87f5728 | ||
![]() |
ccad0bced9 | ||
![]() |
fb7bcef05f | ||
![]() |
b9482fe5b4 | ||
![]() |
be48507599 | ||
![]() |
8ad75efa0e | ||
![]() |
820710721e | ||
![]() |
152e9e0e90 | ||
![]() |
3fc7fb0a7a | ||
![]() |
18e969227c | ||
![]() |
0252cf724a | ||
![]() |
4395ca06b4 | ||
![]() |
a4a923c23c | ||
![]() |
06f64aeff0 | ||
![]() |
a8b4729845 | ||
![]() |
3c64376abe | ||
![]() |
8cd54929e7 | ||
![]() |
8df7f63931 | ||
![]() |
16dbbe5244 | ||
![]() |
ae2869a29b | ||
![]() |
40e7df8d69 | ||
![]() |
ea5ffbeb77 | ||
![]() |
302051a6ca | ||
![]() |
b6d4872ca4 | ||
![]() |
4b7ca2ff37 | ||
![]() |
e4e4694a1c | ||
![]() |
ba6818a5bd | ||
![]() |
1734c0e357 | ||
![]() |
e2e34f24d6 | ||
![]() |
765db2df0c | ||
![]() |
e1e6d95f75 | ||
![]() |
70584a338c | ||
![]() |
11e2777f60 | ||
![]() |
b6303a7615 | ||
![]() |
88e80f54f7 | ||
![]() |
c6f8a6ddc1 | ||
![]() |
9e9b21779c | ||
![]() |
eab918bcd4 | ||
![]() |
2e7d95f5a6 | ||
![]() |
906f16d075 | ||
![]() |
979b3c0408 | ||
![]() |
5b2428559a | ||
![]() |
f001eebad4 | ||
![]() |
f5a981fda7 | ||
![]() |
032484b0f5 | ||
![]() |
587c942d88 | ||
![]() |
e98c648244 | ||
![]() |
be9fb3bd3a | ||
![]() |
01a927ccad | ||
![]() |
3c86531b58 | ||
![]() |
847ce7f20d | ||
![]() |
4b8c434669 | ||
![]() |
9105294965 | ||
![]() |
5378c9007c | ||
![]() |
40e91de111 | ||
![]() |
b1246adac2 | ||
![]() |
86e7f4e2b3 | ||
![]() |
af461e1fc2 | ||
![]() |
d9bc1fcfe7 | ||
![]() |
369ccb7c8d | ||
![]() |
724fb34b1f | ||
![]() |
2898e9ae2b | ||
![]() |
b551424ced | ||
![]() |
b0348cfc34 | ||
![]() |
1646cd0f5a | ||
![]() |
02ee1e8fa1 | ||
![]() |
a2813a2427 | ||
![]() |
bbcd508bc3 | ||
![]() |
a4f176fd07 | ||
![]() |
3d8d75170d | ||
![]() |
2c11a292f4 | ||
![]() |
cd9d22cb9b | ||
![]() |
645c5fb529 | ||
![]() |
2d98da47cf | ||
![]() |
1b08d54be0 | ||
![]() |
be8172ce91 | ||
![]() |
768e21d1b5 | ||
![]() |
bbee2debff | ||
![]() |
d5b01aced2 | ||
![]() |
f533efb2c8 | ||
![]() |
aaa70888bd | ||
![]() |
d673537026 | ||
![]() |
ae1e58c0ac | ||
![]() |
5d04c64d48 | ||
![]() |
185fe39942 | ||
![]() |
18c92bea38 | ||
![]() |
79e1ea9a8f | ||
![]() |
1772fdab16 | ||
![]() |
9020d740d1 | ||
![]() |
df6914fb1e | ||
![]() |
da5478f141 | ||
![]() |
d454602888 | ||
![]() |
3039331976 | ||
![]() |
6ed6f607b5 | ||
![]() |
37b0cdeace | ||
![]() |
9897890e6a | ||
![]() |
ce3e3be59e | ||
![]() |
9ed5847c0a | ||
![]() |
dc5fc5af47 | ||
![]() |
eca67c7d84 | ||
![]() |
c7a1526e12 | ||
![]() |
740de4932b | ||
![]() |
442513b592 | ||
![]() |
40635255e3 | ||
![]() |
550df7f232 | ||
![]() |
4ffc4e67ab | ||
![]() |
d6c472fcdf | ||
![]() |
a83b51eb12 | ||
![]() |
67a70d4ade | ||
![]() |
f479a70594 | ||
![]() |
9f9527d2e2 | ||
![]() |
98b7a84119 | ||
![]() |
5cb94f3e45 | ||
![]() |
ecf94b8706 | ||
![]() |
3006e941ba | ||
![]() |
244ccb71cf | ||
![]() |
2d617fc05e | ||
![]() |
e13785edfe | ||
![]() |
59e06c2319 | ||
![]() |
9a7ce84e1c | ||
![]() |
ef54775ca7 | ||
![]() |
d49bfa612e | ||
![]() |
72f30d8aef | ||
![]() |
ef6b1cb932 | ||
![]() |
154bad6188 | ||
![]() |
613d79fb39 | ||
![]() |
5f9bd853ec | ||
![]() |
ef83b5a1b7 | ||
![]() |
9fe1e53d9d | ||
![]() |
4f63cdf560 | ||
![]() |
7f257e2bf3 | ||
![]() |
c5b332246e | ||
![]() |
0c7be7e11d | ||
![]() |
c5a30bd708 | ||
![]() |
90c3fac4fa | ||
![]() |
e4f6c39bb7 | ||
![]() |
39084be791 | ||
![]() |
ded33aa9be | ||
![]() |
3565e67137 | ||
![]() |
0e5483c050 | ||
![]() |
fb706e0d60 | ||
![]() |
368b9a0168 | ||
![]() |
c208c530ff | ||
![]() |
b36d42811a | ||
![]() |
5921e1865b | ||
![]() |
515405aa9e | ||
![]() |
8f5e2eb439 | ||
![]() |
5b18b918a9 | ||
![]() |
7dcb85d5d4 | ||
![]() |
1cd30b84d5 | ||
![]() |
eb1c3263ec | ||
![]() |
c98f2b4261 | ||
![]() |
d9a17bd379 | ||
![]() |
c5d5b52df4 | ||
![]() |
73d0068d07 | ||
![]() |
4b50276ba0 | ||
![]() |
8815c83ba1 | ||
![]() |
c5778137f6 | ||
![]() |
d22c0349f7 | ||
![]() |
785ba10ca1 | ||
![]() |
0e183f5627 | ||
![]() |
b239cb4a18 | ||
![]() |
02b358133e | ||
![]() |
4f464439e5 | ||
![]() |
4716104951 | ||
![]() |
bc8b2af164 | ||
![]() |
03337fe080 | ||
![]() |
4ff02831f3 | ||
![]() |
09e83bcbf8 | ||
![]() |
57ae3945d7 | ||
![]() |
17e4c1ec60 | ||
![]() |
b9a4f2256e | ||
![]() |
5ddefcea22 | ||
![]() |
47314ce00d | ||
![]() |
452bf593e0 | ||
![]() |
a9bd6566b7 | ||
![]() |
59557cf889 | ||
![]() |
48bdfd75e5 | ||
![]() |
6c06e48a1f | ||
![]() |
70a82d9fc6 | ||
![]() |
61e045aa50 | ||
![]() |
d373a4dafa | ||
![]() |
9daf13c897 | ||
![]() |
7d39d09317 | ||
![]() |
3779b17720 | ||
![]() |
06208696db | ||
![]() |
f27b12a211 | ||
![]() |
9413ce0880 | ||
![]() |
734c4bb5fe | ||
![]() |
6b7adcdf34 | ||
![]() |
a752780eeb | ||
![]() |
01fafc3be4 | ||
![]() |
c281620d75 | ||
![]() |
c3f93a1960 | ||
![]() |
b4e8d782a1 | ||
![]() |
a2eb727e25 | ||
![]() |
6e9c103b55 | ||
![]() |
cbf7956a32 | ||
![]() |
6e841543b8 | ||
![]() |
585f1b75a1 | ||
![]() |
534d627b05 | ||
![]() |
fe534bccbe | ||
![]() |
37f1da0715 | ||
![]() |
515aca5f06 | ||
![]() |
530803c738 | ||
![]() |
faa24bbdf4 | ||
![]() |
5b6d5664e4 | ||
![]() |
22429fc3e0 | ||
![]() |
7e2a911530 | ||
![]() |
7b04ec9ff3 | ||
![]() |
097159d606 | ||
![]() |
04bfe73c29 | ||
![]() |
d4614007ae | ||
![]() |
9480c70655 | ||
![]() |
8b6cc7a193 | ||
![]() |
0d608245f5 | ||
![]() |
92f94ecedc | ||
![]() |
2360782234 | ||
![]() |
1d20ae2777 | ||
![]() |
6b55b8cd67 | ||
![]() |
c645c4a6cb | ||
![]() |
8e55860f77 | ||
![]() |
abfbeffbb0 | ||
![]() |
31908090b8 | ||
![]() |
d97ff94465 | ||
![]() |
ce90b36d28 | ||
![]() |
20d7a0eea2 | ||
![]() |
24b3b60983 | ||
![]() |
17154ef1d5 | ||
![]() |
538e2a6002 | ||
![]() |
84a6a6daf4 | ||
![]() |
a2324190bb | ||
![]() |
af99c6a706 | ||
![]() |
c9cee8a4a8 | ||
![]() |
da51be20a3 | ||
![]() |
c808257b7c | ||
![]() |
c3759f8963 | ||
![]() |
c36ef1d237 | ||
![]() |
f49d43d6a3 | ||
![]() |
cc1324f581 | ||
![]() |
ac9042bbe4 | ||
![]() |
b280644661 | ||
![]() |
b924809c91 | ||
![]() |
a913983d99 | ||
![]() |
3633576e03 | ||
![]() |
73318f23a1 | ||
![]() |
248751378b | ||
![]() |
1918000668 | ||
![]() |
9037b74720 | ||
![]() |
f6540bbfcb | ||
![]() |
507d0f19e4 | ||
![]() |
355e16fe92 | ||
![]() |
2b1905889c | ||
![]() |
7ee67c8b41 | ||
![]() |
f8ab36b67c | ||
![]() |
b5ef5df20d | ||
![]() |
509b1f1c3d | ||
![]() |
bfe98f3285 | ||
![]() |
47915b8b86 | ||
![]() |
3c110bb125 | ||
![]() |
a87fee1224 | ||
![]() |
757b9c695f | ||
![]() |
193948d4fd | ||
![]() |
b616951e23 | ||
![]() |
37977f1da4 | ||
![]() |
7eb7cd9b53 | ||
![]() |
ddfcc5b077 | ||
![]() |
9f6bf14649 | ||
![]() |
f99994737c | ||
![]() |
6e0ade4f63 | ||
![]() |
c1a6c75ebe | ||
![]() |
022372e9b7 | ||
![]() |
3f54ba23c2 | ||
![]() |
e8672df760 | ||
![]() |
5d6f4c6668 | ||
![]() |
a07ed4eafd | ||
![]() |
5262ff665a | ||
![]() |
1129a80329 | ||
![]() |
a628c5927f | ||
![]() |
478ad9670b | ||
![]() |
8e3407505a | ||
![]() |
e208d7f72a | ||
![]() |
b0df79bb80 | ||
![]() |
411c75b219 | ||
![]() |
491cc50440 | ||
![]() |
e9723f5be1 | ||
![]() |
a015039dad | ||
![]() |
a0640a1e66 | ||
![]() |
0b6d2d3dd6 | ||
![]() |
ad11ad3472 | ||
![]() |
93717e670c | ||
![]() |
38a33248e7 | ||
![]() |
52496af9a1 | ||
![]() |
4d4950090d | ||
![]() |
c8c144b6da | ||
![]() |
e94adb04ea | ||
![]() |
395c1c743f | ||
![]() |
b1fb01303d | ||
![]() |
aa7b770c03 | ||
![]() |
e7990a06e2 | ||
![]() |
88f5e5b0bc | ||
![]() |
47db330764 | ||
![]() |
35ebc8c830 | ||
![]() |
686a6c499f | ||
![]() |
cb6d839214 | ||
![]() |
6af96f43d4 | ||
![]() |
e3eccfd476 | ||
![]() |
15d4b6d34b | ||
![]() |
c3e2421d51 | ||
![]() |
f7793f027c | ||
![]() |
6ec96870c0 | ||
![]() |
a843203ca3 | ||
![]() |
3240fc9559 | ||
![]() |
5fd1486cec | ||
![]() |
d648148f51 | ||
![]() |
d554dab8c8 | ||
![]() |
9ad45750ee | ||
![]() |
a554ae5633 | ||
![]() |
7b1c4a5042 | ||
![]() |
9fc464e896 | ||
![]() |
bec11b244e | ||
![]() |
dc94418b51 | ||
![]() |
72ab10c079 | ||
![]() |
f50d32f06b | ||
![]() |
6cc744a2e6 | ||
![]() |
e40dc37f89 | ||
![]() |
7e34d9e20a | ||
![]() |
c891abce09 | ||
![]() |
2b561f2efa | ||
![]() |
dea0a452df | ||
![]() |
81418b07a8 | ||
![]() |
a3c1ad3ec8 | ||
![]() |
7c6c19ba63 | ||
![]() |
2e23ae0811 | ||
![]() |
28e7f5bc08 | ||
![]() |
7a1417dc56 | ||
![]() |
e7fa9e01be | ||
![]() |
93414d54c1 | ||
![]() |
5642fd3899 | ||
![]() |
f3d950f6e1 | ||
![]() |
95f8aaa2fe | ||
![]() |
878010255c | ||
![]() |
8edc357d01 | ||
![]() |
588639d9c2 |
387
.editorconfig
Normal file
387
.editorconfig
Normal file
@ -0,0 +1,387 @@
|
|||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
indent_size = 4
|
||||||
|
indent_style = space
|
||||||
|
insert_final_newline = true
|
||||||
|
max_line_length = 130
|
||||||
|
tab_width = 4
|
||||||
|
ij_continuation_indent_size = 8
|
||||||
|
ij_formatter_off_tag = @formatter:off
|
||||||
|
ij_formatter_on_tag = @formatter:on
|
||||||
|
ij_formatter_tags_enabled = false
|
||||||
|
ij_smart_tabs = false
|
||||||
|
ij_wrap_on_typing = true
|
||||||
|
|
||||||
|
[*.java]
|
||||||
|
ij_java_align_consecutive_assignments = false
|
||||||
|
ij_java_align_consecutive_variable_declarations = false
|
||||||
|
ij_java_align_group_field_declarations = false
|
||||||
|
ij_java_align_multiline_annotation_parameters = false
|
||||||
|
ij_java_align_multiline_array_initializer_expression = false
|
||||||
|
ij_java_align_multiline_assignment = false
|
||||||
|
ij_java_align_multiline_binary_operation = false
|
||||||
|
ij_java_align_multiline_chained_methods = false
|
||||||
|
ij_java_align_multiline_extends_list = false
|
||||||
|
ij_java_align_multiline_for = true
|
||||||
|
ij_java_align_multiline_method_parentheses = false
|
||||||
|
ij_java_align_multiline_parameters = true
|
||||||
|
ij_java_align_multiline_parameters_in_calls = false
|
||||||
|
ij_java_align_multiline_parenthesized_expression = false
|
||||||
|
ij_java_align_multiline_records = true
|
||||||
|
ij_java_align_multiline_resources = true
|
||||||
|
ij_java_align_multiline_ternary_operation = false
|
||||||
|
ij_java_align_multiline_text_blocks = false
|
||||||
|
ij_java_align_multiline_throws_list = false
|
||||||
|
ij_java_align_subsequent_simple_methods = false
|
||||||
|
ij_java_align_throws_keyword = false
|
||||||
|
ij_java_annotation_parameter_wrap = off
|
||||||
|
ij_java_array_initializer_new_line_after_left_brace = false
|
||||||
|
ij_java_array_initializer_right_brace_on_new_line = false
|
||||||
|
ij_java_array_initializer_wrap = off
|
||||||
|
ij_java_assert_statement_colon_on_next_line = false
|
||||||
|
ij_java_assert_statement_wrap = off
|
||||||
|
ij_java_assignment_wrap = off
|
||||||
|
ij_java_binary_operation_sign_on_next_line = false
|
||||||
|
ij_java_binary_operation_wrap = off
|
||||||
|
ij_java_blank_lines_after_anonymous_class_header = 0
|
||||||
|
ij_java_blank_lines_after_class_header = 1
|
||||||
|
ij_java_blank_lines_after_imports = 1
|
||||||
|
ij_java_blank_lines_after_package = 1
|
||||||
|
ij_java_blank_lines_around_class = 1
|
||||||
|
ij_java_blank_lines_around_field = 0
|
||||||
|
ij_java_blank_lines_around_field_in_interface = 0
|
||||||
|
ij_java_blank_lines_around_initializer = 1
|
||||||
|
ij_java_blank_lines_around_method = 1
|
||||||
|
ij_java_blank_lines_around_method_in_interface = 1
|
||||||
|
ij_java_blank_lines_before_class_end = 1
|
||||||
|
ij_java_blank_lines_before_imports = 1
|
||||||
|
ij_java_blank_lines_before_method_body = 0
|
||||||
|
ij_java_blank_lines_before_package = 0
|
||||||
|
ij_java_block_brace_style = end_of_line
|
||||||
|
ij_java_block_comment_at_first_column = true
|
||||||
|
ij_java_call_parameters_new_line_after_left_paren = true
|
||||||
|
ij_java_call_parameters_right_paren_on_new_line = true
|
||||||
|
ij_java_call_parameters_wrap = on_every_item
|
||||||
|
ij_java_case_statement_on_separate_line = true
|
||||||
|
ij_java_catch_on_new_line = false
|
||||||
|
ij_java_class_annotation_wrap = split_into_lines
|
||||||
|
ij_java_class_brace_style = end_of_line
|
||||||
|
ij_java_class_count_to_use_import_on_demand = 100000
|
||||||
|
ij_java_class_names_in_javadoc = 1
|
||||||
|
ij_java_do_not_indent_top_level_class_members = false
|
||||||
|
ij_java_do_not_wrap_after_single_annotation = false
|
||||||
|
ij_java_do_while_brace_force = always
|
||||||
|
ij_java_doc_add_blank_line_after_description = true
|
||||||
|
ij_java_doc_add_blank_line_after_param_comments = false
|
||||||
|
ij_java_doc_add_blank_line_after_return = false
|
||||||
|
ij_java_doc_add_p_tag_on_empty_lines = true
|
||||||
|
ij_java_doc_align_exception_comments = true
|
||||||
|
ij_java_doc_align_param_comments = true
|
||||||
|
ij_java_doc_do_not_wrap_if_one_line = false
|
||||||
|
ij_java_doc_enable_formatting = true
|
||||||
|
ij_java_doc_enable_leading_asterisks = true
|
||||||
|
ij_java_doc_indent_on_continuation = true
|
||||||
|
ij_java_doc_keep_empty_lines = true
|
||||||
|
ij_java_doc_keep_empty_parameter_tag = true
|
||||||
|
ij_java_doc_keep_empty_return_tag = true
|
||||||
|
ij_java_doc_keep_empty_throws_tag = true
|
||||||
|
ij_java_doc_keep_invalid_tags = false
|
||||||
|
ij_java_doc_param_description_on_new_line = false
|
||||||
|
ij_java_doc_preserve_line_breaks = false
|
||||||
|
ij_java_doc_use_throws_not_exception_tag = true
|
||||||
|
ij_java_else_on_new_line = false
|
||||||
|
ij_java_enum_constants_wrap = split_into_lines
|
||||||
|
ij_java_extends_keyword_wrap = off
|
||||||
|
ij_java_extends_list_wrap = normal
|
||||||
|
ij_java_field_annotation_wrap = split_into_lines
|
||||||
|
ij_java_finally_on_new_line = false
|
||||||
|
ij_java_for_brace_force = always
|
||||||
|
ij_java_for_statement_new_line_after_left_paren = false
|
||||||
|
ij_java_for_statement_right_paren_on_new_line = false
|
||||||
|
ij_java_for_statement_wrap = off
|
||||||
|
ij_java_generate_final_locals = true
|
||||||
|
ij_java_generate_final_parameters = true
|
||||||
|
ij_java_if_brace_force = always
|
||||||
|
ij_java_imports_layout = *, |, javax.**, java.**, |, $*
|
||||||
|
ij_java_indent_case_from_switch = true
|
||||||
|
ij_java_insert_inner_class_imports = false
|
||||||
|
ij_java_insert_override_annotation = true
|
||||||
|
ij_java_keep_blank_lines_before_right_brace = 2
|
||||||
|
ij_java_keep_blank_lines_between_package_declaration_and_header = 2
|
||||||
|
ij_java_keep_blank_lines_in_code = 2
|
||||||
|
ij_java_keep_blank_lines_in_declarations = 2
|
||||||
|
ij_java_keep_control_statement_in_one_line = true
|
||||||
|
ij_java_keep_first_column_comment = true
|
||||||
|
ij_java_keep_indents_on_empty_lines = false
|
||||||
|
ij_java_keep_line_breaks = true
|
||||||
|
ij_java_keep_multiple_expressions_in_one_line = false
|
||||||
|
ij_java_keep_simple_blocks_in_one_line = false
|
||||||
|
ij_java_keep_simple_classes_in_one_line = false
|
||||||
|
ij_java_keep_simple_lambdas_in_one_line = false
|
||||||
|
ij_java_keep_simple_methods_in_one_line = false
|
||||||
|
ij_java_label_indent_absolute = false
|
||||||
|
ij_java_label_indent_size = 0
|
||||||
|
ij_java_lambda_brace_style = end_of_line
|
||||||
|
ij_java_layout_static_imports_separately = true
|
||||||
|
ij_java_line_comment_add_space = false
|
||||||
|
ij_java_line_comment_at_first_column = true
|
||||||
|
ij_java_method_annotation_wrap = split_into_lines
|
||||||
|
ij_java_method_brace_style = end_of_line
|
||||||
|
ij_java_method_call_chain_wrap = on_every_item
|
||||||
|
ij_java_method_parameters_new_line_after_left_paren = true
|
||||||
|
ij_java_method_parameters_right_paren_on_new_line = true
|
||||||
|
ij_java_method_parameters_wrap = on_every_item
|
||||||
|
ij_java_modifier_list_wrap = false
|
||||||
|
ij_java_names_count_to_use_import_on_demand = 100000
|
||||||
|
ij_java_new_line_after_lparen_in_record_header = false
|
||||||
|
ij_java_parameter_annotation_wrap = off
|
||||||
|
ij_java_parentheses_expression_new_line_after_left_paren = false
|
||||||
|
ij_java_parentheses_expression_right_paren_on_new_line = false
|
||||||
|
ij_java_place_assignment_sign_on_next_line = false
|
||||||
|
ij_java_prefer_longer_names = false
|
||||||
|
ij_java_prefer_parameters_wrap = true
|
||||||
|
ij_java_record_components_wrap = normal
|
||||||
|
ij_java_repeat_synchronized = true
|
||||||
|
ij_java_replace_instanceof_and_cast = false
|
||||||
|
ij_java_replace_null_check = true
|
||||||
|
ij_java_replace_sum_lambda_with_method_ref = true
|
||||||
|
ij_java_resource_list_new_line_after_left_paren = false
|
||||||
|
ij_java_resource_list_right_paren_on_new_line = false
|
||||||
|
ij_java_resource_list_wrap = off
|
||||||
|
ij_java_rparen_on_new_line_in_record_header = false
|
||||||
|
ij_java_space_after_closing_angle_bracket_in_type_argument = false
|
||||||
|
ij_java_space_after_colon = true
|
||||||
|
ij_java_space_after_comma = true
|
||||||
|
ij_java_space_after_comma_in_type_arguments = true
|
||||||
|
ij_java_space_after_for_semicolon = true
|
||||||
|
ij_java_space_after_quest = true
|
||||||
|
ij_java_space_after_type_cast = true
|
||||||
|
ij_java_space_before_annotation_array_initializer_left_brace = false
|
||||||
|
ij_java_space_before_annotation_parameter_list = false
|
||||||
|
ij_java_space_before_array_initializer_left_brace = false
|
||||||
|
ij_java_space_before_catch_keyword = true
|
||||||
|
ij_java_space_before_catch_left_brace = true
|
||||||
|
ij_java_space_before_catch_parentheses = true
|
||||||
|
ij_java_space_before_class_left_brace = true
|
||||||
|
ij_java_space_before_colon = true
|
||||||
|
ij_java_space_before_colon_in_foreach = true
|
||||||
|
ij_java_space_before_comma = false
|
||||||
|
ij_java_space_before_do_left_brace = true
|
||||||
|
ij_java_space_before_else_keyword = true
|
||||||
|
ij_java_space_before_else_left_brace = true
|
||||||
|
ij_java_space_before_finally_keyword = true
|
||||||
|
ij_java_space_before_finally_left_brace = true
|
||||||
|
ij_java_space_before_for_left_brace = true
|
||||||
|
ij_java_space_before_for_parentheses = true
|
||||||
|
ij_java_space_before_for_semicolon = false
|
||||||
|
ij_java_space_before_if_left_brace = true
|
||||||
|
ij_java_space_before_if_parentheses = true
|
||||||
|
ij_java_space_before_method_call_parentheses = false
|
||||||
|
ij_java_space_before_method_left_brace = true
|
||||||
|
ij_java_space_before_method_parentheses = false
|
||||||
|
ij_java_space_before_opening_angle_bracket_in_type_parameter = false
|
||||||
|
ij_java_space_before_quest = true
|
||||||
|
ij_java_space_before_switch_left_brace = true
|
||||||
|
ij_java_space_before_switch_parentheses = true
|
||||||
|
ij_java_space_before_synchronized_left_brace = true
|
||||||
|
ij_java_space_before_synchronized_parentheses = true
|
||||||
|
ij_java_space_before_try_left_brace = true
|
||||||
|
ij_java_space_before_try_parentheses = true
|
||||||
|
ij_java_space_before_type_parameter_list = false
|
||||||
|
ij_java_space_before_while_keyword = true
|
||||||
|
ij_java_space_before_while_left_brace = true
|
||||||
|
ij_java_space_before_while_parentheses = true
|
||||||
|
ij_java_space_inside_one_line_enum_braces = false
|
||||||
|
ij_java_space_within_empty_array_initializer_braces = false
|
||||||
|
ij_java_space_within_empty_method_call_parentheses = false
|
||||||
|
ij_java_space_within_empty_method_parentheses = false
|
||||||
|
ij_java_spaces_around_additive_operators = true
|
||||||
|
ij_java_spaces_around_assignment_operators = true
|
||||||
|
ij_java_spaces_around_bitwise_operators = true
|
||||||
|
ij_java_spaces_around_equality_operators = true
|
||||||
|
ij_java_spaces_around_lambda_arrow = true
|
||||||
|
ij_java_spaces_around_logical_operators = true
|
||||||
|
ij_java_spaces_around_method_ref_dbl_colon = false
|
||||||
|
ij_java_spaces_around_multiplicative_operators = true
|
||||||
|
ij_java_spaces_around_relational_operators = true
|
||||||
|
ij_java_spaces_around_shift_operators = true
|
||||||
|
ij_java_spaces_around_type_bounds_in_type_parameters = true
|
||||||
|
ij_java_spaces_around_unary_operator = false
|
||||||
|
ij_java_spaces_within_angle_brackets = false
|
||||||
|
ij_java_spaces_within_annotation_parentheses = false
|
||||||
|
ij_java_spaces_within_array_initializer_braces = false
|
||||||
|
ij_java_spaces_within_braces = false
|
||||||
|
ij_java_spaces_within_brackets = false
|
||||||
|
ij_java_spaces_within_cast_parentheses = false
|
||||||
|
ij_java_spaces_within_catch_parentheses = false
|
||||||
|
ij_java_spaces_within_for_parentheses = false
|
||||||
|
ij_java_spaces_within_if_parentheses = false
|
||||||
|
ij_java_spaces_within_method_call_parentheses = false
|
||||||
|
ij_java_spaces_within_method_parentheses = false
|
||||||
|
ij_java_spaces_within_parentheses = false
|
||||||
|
ij_java_spaces_within_switch_parentheses = false
|
||||||
|
ij_java_spaces_within_synchronized_parentheses = false
|
||||||
|
ij_java_spaces_within_try_parentheses = false
|
||||||
|
ij_java_spaces_within_while_parentheses = false
|
||||||
|
ij_java_special_else_if_treatment = true
|
||||||
|
ij_java_subclass_name_suffix = Impl
|
||||||
|
ij_java_ternary_operation_signs_on_next_line = true
|
||||||
|
ij_java_ternary_operation_wrap = on_every_item
|
||||||
|
ij_java_test_name_suffix = Test
|
||||||
|
ij_java_throws_keyword_wrap = off
|
||||||
|
ij_java_throws_list_wrap = normal
|
||||||
|
ij_java_use_external_annotations = false
|
||||||
|
ij_java_use_fq_class_names = false
|
||||||
|
ij_java_use_relative_indents = false
|
||||||
|
ij_java_use_single_class_imports = true
|
||||||
|
ij_java_variable_annotation_wrap = off
|
||||||
|
ij_java_visibility = public
|
||||||
|
ij_java_while_brace_force = always
|
||||||
|
ij_java_while_on_new_line = false
|
||||||
|
ij_java_wrap_comments = false
|
||||||
|
ij_java_wrap_first_method_in_call_chain = true
|
||||||
|
ij_java_wrap_long_lines = false
|
||||||
|
|
||||||
|
[*.properties]
|
||||||
|
ij_properties_align_group_field_declarations = false
|
||||||
|
ij_properties_keep_blank_lines = false
|
||||||
|
ij_properties_key_value_delimiter = equals
|
||||||
|
ij_properties_spaces_around_key_value_delimiter = false
|
||||||
|
|
||||||
|
[.editorconfig]
|
||||||
|
ij_editorconfig_align_group_field_declarations = false
|
||||||
|
ij_editorconfig_space_after_colon = false
|
||||||
|
ij_editorconfig_space_after_comma = true
|
||||||
|
ij_editorconfig_space_before_colon = false
|
||||||
|
ij_editorconfig_space_before_comma = false
|
||||||
|
ij_editorconfig_spaces_around_assignment_operators = true
|
||||||
|
|
||||||
|
[{*.gradle.kts, *.kt, *.kts, *.main.kts}]
|
||||||
|
ij_kotlin_align_in_columns_case_branch = false
|
||||||
|
ij_kotlin_align_multiline_binary_operation = false
|
||||||
|
ij_kotlin_align_multiline_extends_list = false
|
||||||
|
ij_kotlin_align_multiline_method_parentheses = false
|
||||||
|
ij_kotlin_align_multiline_parameters = true
|
||||||
|
ij_kotlin_align_multiline_parameters_in_calls = false
|
||||||
|
ij_kotlin_allow_trailing_comma = false
|
||||||
|
ij_kotlin_allow_trailing_comma_on_call_site = false
|
||||||
|
ij_kotlin_assignment_wrap = off
|
||||||
|
ij_kotlin_blank_lines_after_class_header = 0
|
||||||
|
ij_kotlin_blank_lines_around_block_when_branches = 0
|
||||||
|
ij_kotlin_blank_lines_before_declaration_with_comment_or_annotation_on_separate_line = 1
|
||||||
|
ij_kotlin_block_comment_at_first_column = true
|
||||||
|
ij_kotlin_call_parameters_new_line_after_left_paren = false
|
||||||
|
ij_kotlin_call_parameters_right_paren_on_new_line = false
|
||||||
|
ij_kotlin_call_parameters_wrap = off
|
||||||
|
ij_kotlin_catch_on_new_line = false
|
||||||
|
ij_kotlin_class_annotation_wrap = split_into_lines
|
||||||
|
ij_kotlin_continuation_indent_for_chained_calls = true
|
||||||
|
ij_kotlin_continuation_indent_for_expression_bodies = true
|
||||||
|
ij_kotlin_continuation_indent_in_argument_lists = true
|
||||||
|
ij_kotlin_continuation_indent_in_elvis = true
|
||||||
|
ij_kotlin_continuation_indent_in_if_conditions = true
|
||||||
|
ij_kotlin_continuation_indent_in_parameter_lists = true
|
||||||
|
ij_kotlin_continuation_indent_in_supertype_lists = true
|
||||||
|
ij_kotlin_else_on_new_line = false
|
||||||
|
ij_kotlin_enum_constants_wrap = off
|
||||||
|
ij_kotlin_extends_list_wrap = off
|
||||||
|
ij_kotlin_field_annotation_wrap = split_into_lines
|
||||||
|
ij_kotlin_finally_on_new_line = false
|
||||||
|
ij_kotlin_if_rparen_on_new_line = false
|
||||||
|
ij_kotlin_import_nested_classes = false
|
||||||
|
ij_kotlin_insert_whitespaces_in_simple_one_line_method = true
|
||||||
|
ij_kotlin_keep_blank_lines_before_right_brace = 2
|
||||||
|
ij_kotlin_keep_blank_lines_in_code = 2
|
||||||
|
ij_kotlin_keep_blank_lines_in_declarations = 2
|
||||||
|
ij_kotlin_keep_first_column_comment = true
|
||||||
|
ij_kotlin_keep_indents_on_empty_lines = false
|
||||||
|
ij_kotlin_keep_line_breaks = true
|
||||||
|
ij_kotlin_lbrace_on_next_line = false
|
||||||
|
ij_kotlin_line_comment_add_space = false
|
||||||
|
ij_kotlin_line_comment_at_first_column = true
|
||||||
|
ij_kotlin_method_annotation_wrap = split_into_lines
|
||||||
|
ij_kotlin_method_call_chain_wrap = off
|
||||||
|
ij_kotlin_method_parameters_new_line_after_left_paren = false
|
||||||
|
ij_kotlin_method_parameters_right_paren_on_new_line = false
|
||||||
|
ij_kotlin_method_parameters_wrap = off
|
||||||
|
ij_kotlin_name_count_to_use_star_import = 5
|
||||||
|
ij_kotlin_name_count_to_use_star_import_for_members = 3
|
||||||
|
ij_kotlin_parameter_annotation_wrap = off
|
||||||
|
ij_kotlin_space_after_comma = true
|
||||||
|
ij_kotlin_space_after_extend_colon = true
|
||||||
|
ij_kotlin_space_after_type_colon = true
|
||||||
|
ij_kotlin_space_before_catch_parentheses = true
|
||||||
|
ij_kotlin_space_before_comma = false
|
||||||
|
ij_kotlin_space_before_extend_colon = true
|
||||||
|
ij_kotlin_space_before_for_parentheses = true
|
||||||
|
ij_kotlin_space_before_if_parentheses = true
|
||||||
|
ij_kotlin_space_before_lambda_arrow = true
|
||||||
|
ij_kotlin_space_before_type_colon = false
|
||||||
|
ij_kotlin_space_before_when_parentheses = true
|
||||||
|
ij_kotlin_space_before_while_parentheses = true
|
||||||
|
ij_kotlin_spaces_around_additive_operators = true
|
||||||
|
ij_kotlin_spaces_around_assignment_operators = true
|
||||||
|
ij_kotlin_spaces_around_equality_operators = true
|
||||||
|
ij_kotlin_spaces_around_function_type_arrow = true
|
||||||
|
ij_kotlin_spaces_around_logical_operators = true
|
||||||
|
ij_kotlin_spaces_around_multiplicative_operators = true
|
||||||
|
ij_kotlin_spaces_around_range = false
|
||||||
|
ij_kotlin_spaces_around_relational_operators = true
|
||||||
|
ij_kotlin_spaces_around_unary_operator = false
|
||||||
|
ij_kotlin_spaces_around_when_arrow = true
|
||||||
|
ij_kotlin_variable_annotation_wrap = off
|
||||||
|
ij_kotlin_while_on_new_line = false
|
||||||
|
ij_kotlin_wrap_elvis_expressions = 1
|
||||||
|
ij_kotlin_wrap_expression_body_functions = 0
|
||||||
|
ij_kotlin_wrap_first_method_in_call_chain = false
|
||||||
|
|
||||||
|
|
||||||
|
[*.json]
|
||||||
|
indent_size = 2
|
||||||
|
ij_json_keep_blank_lines_in_code = 0
|
||||||
|
ij_json_keep_indents_on_empty_lines = false
|
||||||
|
ij_json_keep_line_breaks = true
|
||||||
|
ij_json_space_after_colon = true
|
||||||
|
ij_json_space_after_comma = true
|
||||||
|
ij_json_space_before_colon = true
|
||||||
|
ij_json_space_before_comma = false
|
||||||
|
ij_json_spaces_within_braces = false
|
||||||
|
ij_json_spaces_within_brackets = false
|
||||||
|
ij_json_wrap_long_lines = false
|
||||||
|
|
||||||
|
[{*.htm, *.html, *.sht, *.shtm, *.shtml}]
|
||||||
|
ij_html_add_new_line_before_tags = body, div, p, form, h1, h2, h3
|
||||||
|
ij_html_align_attributes = true
|
||||||
|
ij_html_align_text = false
|
||||||
|
ij_html_attribute_wrap = normal
|
||||||
|
ij_html_block_comment_at_first_column = true
|
||||||
|
ij_html_do_not_align_children_of_min_lines = 0
|
||||||
|
ij_html_do_not_break_if_inline_tags = title, h1, h2, h3, h4, h5, h6, p
|
||||||
|
ij_html_do_not_indent_children_of_tags = html, body, thead, tbody, tfoot
|
||||||
|
ij_html_enforce_quotes = false
|
||||||
|
ij_html_inline_tags = a, abbr, acronym, b, basefont, bdo, big, br, cite, cite, code, dfn, em, font, i, img, input, kbd, label, q, s, samp, select, small, span, strike, strong, sub, sup, textarea, tt, u, var
|
||||||
|
ij_html_keep_blank_lines = 2
|
||||||
|
ij_html_keep_indents_on_empty_lines = false
|
||||||
|
ij_html_keep_line_breaks = true
|
||||||
|
ij_html_keep_line_breaks_in_text = true
|
||||||
|
ij_html_keep_whitespaces = false
|
||||||
|
ij_html_keep_whitespaces_inside = span, pre, textarea
|
||||||
|
ij_html_line_comment_at_first_column = true
|
||||||
|
ij_html_new_line_after_last_attribute = never
|
||||||
|
ij_html_new_line_before_first_attribute = never
|
||||||
|
ij_html_quote_style = double
|
||||||
|
ij_html_remove_new_line_before_tags = br
|
||||||
|
ij_html_space_after_tag_name = false
|
||||||
|
ij_html_space_around_equality_in_attribute = false
|
||||||
|
ij_html_space_inside_empty_tag = false
|
||||||
|
ij_html_text_wrap = normal
|
||||||
|
ij_html_uniform_ident = false
|
||||||
|
|
||||||
|
[{*.yaml, *.yml}]
|
||||||
|
indent_size = 2
|
||||||
|
ij_yaml_keep_indents_on_empty_lines = false
|
||||||
|
ij_yaml_keep_line_breaks = true
|
||||||
|
ij_yaml_space_before_colon = false
|
||||||
|
ij_yaml_spaces_within_braces = true
|
||||||
|
ij_yaml_spaces_within_brackets = true
|
4
.gitattributes
vendored
Normal file
4
.gitattributes
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
* text=auto
|
||||||
|
|
||||||
|
*.java text
|
||||||
|
*.jar binary
|
1
.github/CODEOWNERS
vendored
Normal file
1
.github/CODEOWNERS
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
* @IntellectualSites/plotsquared-team
|
2
.github/CONTRIBUTING.md
vendored
2
.github/CONTRIBUTING.md
vendored
@ -1,2 +0,0 @@
|
|||||||
### Bugs
|
|
||||||
Please provide a `/plot debugpaste` if you are reporting a bug.
|
|
12
.github/ISSUE_TEMPLATE.md
vendored
12
.github/ISSUE_TEMPLATE.md
vendored
@ -1,12 +0,0 @@
|
|||||||
# Bug report template (Follow this template unless you are making a feature request.)
|
|
||||||
**Debug paste link**:
|
|
||||||
|
|
||||||
**Description of the problem:**
|
|
||||||
|
|
||||||
**How to replicate**:
|
|
||||||
|
|
||||||
Make sure you've completed the following steps (put an X between of brackets):
|
|
||||||
- [] Include `/plot debugpaste`
|
|
||||||
- [] Made sure there aren't duplicates of this report [(Use Search)](https://github.com/IntellectualSites/PlotSquared/issues?utf8=%E2%9C%93&q=is%3Aissue)
|
|
||||||
- [] Made sure you're using an up-to-date version of PlotSquared
|
|
||||||
- [] Made sure the bug/error isn't caused by any other plugin
|
|
105
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
105
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
name: Bug report
|
||||||
|
description: Create a report to help us improve
|
||||||
|
labels: 'Requires Testing'
|
||||||
|
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Thanks for taking the time to fill out this bug report for PlotSquared! Fill out the following form to your best ability to help us fix the problem.
|
||||||
|
Only use this if you're absolutely sure that you found a bug and can reproduce it. For anything else, use: [our Discord server](https://discord.gg/intellectualsites) or [the wiki](https://intellectualsites.github.io/plotsquared-documentation/).
|
||||||
|
Do NOT use the public issue tracker to report security vulnerabilities! They are disclosed using [this](https://forms.gle/btgdRn9yhGtzEiGW8) form!
|
||||||
|
|
||||||
|
- type: dropdown
|
||||||
|
attributes:
|
||||||
|
label: Server Implementation
|
||||||
|
description: Which server Implementation are you using? If your server implementation is not listed, it is not supported. Switch to a supported version first.
|
||||||
|
multiple: false
|
||||||
|
options:
|
||||||
|
- Paper
|
||||||
|
- Spigot
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: dropdown
|
||||||
|
attributes:
|
||||||
|
label: Server Version
|
||||||
|
description: Which server version version you using? If your server version is not listed, it is not supported. Update to a supported version first.
|
||||||
|
multiple: false
|
||||||
|
options:
|
||||||
|
- '1.19.3'
|
||||||
|
- '1.19.2'
|
||||||
|
- '1.19.1'
|
||||||
|
- '1.19'
|
||||||
|
- '1.18.2'
|
||||||
|
- '1.18.1'
|
||||||
|
- '1.17.1'
|
||||||
|
- '1.16.5'
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Describe the bug
|
||||||
|
description: A clear and concise description of what the bug is.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: To Reproduce
|
||||||
|
description: Steps to reproduce this behaviour
|
||||||
|
placeholder: |
|
||||||
|
1. Go to '...'
|
||||||
|
2. Click on '...'
|
||||||
|
3. Scroll down to '...'
|
||||||
|
4. See error
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Expected behaviour
|
||||||
|
description: A clear and concise description of what you expected to happen.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Screenshots / Videos
|
||||||
|
description: If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
|
- type: input
|
||||||
|
attributes:
|
||||||
|
label: Error log (if applicable)
|
||||||
|
description: If you are reporting a console error, upload any relevant log excerpts to either https://paste.gg/ or https://gist.github.com, save and the paste the link in this box.
|
||||||
|
|
||||||
|
- type: input
|
||||||
|
attributes:
|
||||||
|
label: Plot Debugpaste
|
||||||
|
description: Run `/plot debugpaste` in your console or ingame and provide the output link here.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: input
|
||||||
|
attributes:
|
||||||
|
label: PlotSquared Version
|
||||||
|
description: What version of PlotSquared are you running? (`/version PlotSquared`)
|
||||||
|
placeholder: "For example: PlotSquared version 5.13.11-Premium"
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: checkboxes
|
||||||
|
attributes:
|
||||||
|
label: Checklist
|
||||||
|
description: Make sure you have followed each of the steps outlined here.
|
||||||
|
options:
|
||||||
|
- label: I have included a Plot debugpaste.
|
||||||
|
required: true
|
||||||
|
- label: I am using the newest build from https://www.spigotmc.org/resources/77506/ and the issue still persists.
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Anything else?
|
||||||
|
description: You can provide additional context below.
|
8
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
8
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
blank_issues_enabled: false
|
||||||
|
contact_links:
|
||||||
|
- name: IntellectualSites Discord
|
||||||
|
url: https://discord.gg/intellectualsites
|
||||||
|
about: Our support Discord, please ask questions and seek support here.
|
||||||
|
- name: PlotSquared Wiki
|
||||||
|
url: https://intellectualsites.github.io/plotsquared-documentation/
|
||||||
|
about: Take a look at the wiki page for instructions how to setup PlotSquared and use its commands.
|
29
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
29
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
name: Feature request
|
||||||
|
description: Suggest an idea for this project
|
||||||
|
labels: 'Enhancement'
|
||||||
|
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Thanks for taking the time to fill out this feature request for PlotSquared! Fill out the following form to your best ability to help us understand your feature request and greately improve the change of it getting added.
|
||||||
|
For anything else than a feature request, use: [our Discord server](https://discord.gg/intellectualsites) or [the wiki](https://intellectualsites.github.io/plotsquared-documentation/).
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: What feature do you want to see added?
|
||||||
|
description: A clear and concise description of your feature request.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Are there any alternatives?
|
||||||
|
description: List any alternatives you might have tried
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Anything else?
|
||||||
|
description: You can provide additional context below.
|
1
.github/release-drafter.yml
vendored
Normal file
1
.github/release-drafter.yml
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
_extends: .github
|
18
.github/stale.yml
vendored
Normal file
18
.github/stale.yml
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
daysUntilStale: 30
|
||||||
|
daysUntilClose: 7
|
||||||
|
only: issues
|
||||||
|
exemptLabels:
|
||||||
|
- "Bug"
|
||||||
|
- "Enhancement"
|
||||||
|
- "Approved"
|
||||||
|
- "Priority"
|
||||||
|
- "Under investigation"
|
||||||
|
staleLabel: "resolution: stale"
|
||||||
|
markComment: >
|
||||||
|
This issue has been automatically marked as stale because it has not had
|
||||||
|
recent activity. It will be closed if no further activity occurs. If the issue is still present and can be reproduced, please let the team know.
|
||||||
|
Thank you for your contributions.
|
||||||
|
closeComment: >
|
||||||
|
This issue has been automatically closed because it has not had activity in
|
||||||
|
a long time. If the issue still applies to the most recent supported
|
||||||
|
version, please reply to this issue and the team will reopen it.
|
24
.github/workflows/announce-release-on-discord.yml
vendored
Normal file
24
.github/workflows/announce-release-on-discord.yml
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
name: Announce release on discord
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
jobs:
|
||||||
|
send_announcement:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: send custom message with args
|
||||||
|
env:
|
||||||
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||||
|
DISCORD_USERNAME: PlotSquared Release
|
||||||
|
DISCORD_AVATAR: https://raw.githubusercontent.com/IntellectualSites/Assets/main/plugins/PlotSquared/PlotSquared.png
|
||||||
|
uses: Ilshidur/action-discord@08d9328877d6954120eef2b07abbc79249bb6210 # ratchet:Ilshidur/action-discord@0.3.2
|
||||||
|
with:
|
||||||
|
args: |
|
||||||
|
"<@&525015541815967744> <@&679322738552471574> <@&699293353862496266>"
|
||||||
|
""
|
||||||
|
"<:plotsquared:730750385886593039> **PlotSquared ${{ github.event.release.tag_name }} has been released!**"
|
||||||
|
""
|
||||||
|
"Click here to view changelog: https://github.com/IntellectualSites/PlotSquared/releases/tag/${{ github.event.release.tag_name }}"
|
||||||
|
""
|
||||||
|
"The download is available at:"
|
||||||
|
"- Spigot: <https://www.spigotmc.org/resources/77506/>"
|
21
.github/workflows/build-pr.yml
vendored
Normal file
21
.github/workflows/build-pr.yml
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
name: Build PR
|
||||||
|
on: [pull_request]
|
||||||
|
jobs:
|
||||||
|
build_pr:
|
||||||
|
if: github.repository_owner == 'IntellectualSites'
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Validate Gradle Wrapper
|
||||||
|
uses: gradle/wrapper-validation-action@55e685c48d84285a5b0418cd094606e199cca3b6 # v1
|
||||||
|
- name: Setup Java
|
||||||
|
uses: actions/setup-java@v3
|
||||||
|
with:
|
||||||
|
distribution: temurin
|
||||||
|
java-version: 17
|
||||||
|
- name: Clean Build
|
||||||
|
run: ./gradlew clean build
|
67
.github/workflows/build.yml
vendored
Normal file
67
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
name: build
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- v6
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
if: github.repository_owner == 'IntellectualSites'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Validate Gradle Wrapper
|
||||||
|
uses: gradle/wrapper-validation-action@55e685c48d84285a5b0418cd094606e199cca3b6 # v1
|
||||||
|
- name: Setup Java
|
||||||
|
uses: actions/setup-java@v3
|
||||||
|
with:
|
||||||
|
distribution: temurin
|
||||||
|
java-version: 17
|
||||||
|
- name: Clean Build
|
||||||
|
run: ./gradlew clean build
|
||||||
|
- name: Determine release status
|
||||||
|
if: ${{ runner.os == 'Linux' }}
|
||||||
|
run: |
|
||||||
|
if [ "$(./gradlew properties | awk '/^version:/ { print $2; }' | grep '\-SNAPSHOT')" ]; then
|
||||||
|
echo "STATUS=snapshot" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "STATUS=release" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
- name: Publish Release
|
||||||
|
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/v6'}}
|
||||||
|
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
|
||||||
|
env:
|
||||||
|
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
|
||||||
|
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
|
||||||
|
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
|
||||||
|
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
|
||||||
|
- name: Publish Snapshot
|
||||||
|
if: ${{ runner.os == 'Linux' && env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/v6' }}
|
||||||
|
run: ./gradlew publishToSonatype
|
||||||
|
env:
|
||||||
|
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
|
||||||
|
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
|
||||||
|
- name: Publish core javadoc
|
||||||
|
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/v6'}}
|
||||||
|
uses: cpina/github-action-push-to-another-repository@0a14457bb28b04dfa1652e0ffdfda866d2845c73 # main
|
||||||
|
env:
|
||||||
|
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
|
||||||
|
with:
|
||||||
|
source-directory: 'Core/build/docs/javadoc'
|
||||||
|
destination-github-username: 'IntellectualSites'
|
||||||
|
destination-repository-name: 'plotsquared-javadocs'
|
||||||
|
user-email: ${{ secrets.USER_EMAIL }}
|
||||||
|
target-branch: main
|
||||||
|
target-directory: core
|
||||||
|
- name: Publish bukkit javadoc
|
||||||
|
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/v6'}}
|
||||||
|
uses: cpina/github-action-push-to-another-repository@0a14457bb28b04dfa1652e0ffdfda866d2845c73 # main
|
||||||
|
env:
|
||||||
|
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
|
||||||
|
with:
|
||||||
|
source-directory: 'Bukkit/build/docs/javadoc'
|
||||||
|
destination-github-username: 'IntellectualSites'
|
||||||
|
destination-repository-name: 'plotsquared-javadocs'
|
||||||
|
user-email: ${{ secrets.USER_EMAIL }}
|
||||||
|
target-branch: main
|
||||||
|
target-directory: bukkit
|
28
.github/workflows/codeql.yml
vendored
Normal file
28
.github/workflows/codeql.yml
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
name: "CodeQL"
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
# The branches below must be a subset of the branches above
|
||||||
|
branches: [v6]
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
name: Analyze
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
actions: read
|
||||||
|
contents: read
|
||||||
|
security-events: write
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
language: ['java']
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@32dc499307d133bb5085bae78498c0ac2cf762d5 # v2
|
||||||
|
with:
|
||||||
|
languages: ${{ matrix.language }}
|
||||||
|
- name: Autobuild
|
||||||
|
uses: github/codeql-action/autobuild@32dc499307d133bb5085bae78498c0ac2cf762d5 # v2
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@32dc499307d133bb5085bae78498c0ac2cf762d5 # v2
|
17
.github/workflows/release-drafter.yml
vendored
Normal file
17
.github/workflows/release-drafter.yml
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
name: draft release
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- v6
|
||||||
|
pull_request:
|
||||||
|
types: [opened, reopened, synchronize]
|
||||||
|
pull_request_target:
|
||||||
|
types: [opened, reopened, synchronize]
|
||||||
|
jobs:
|
||||||
|
update_release_draft:
|
||||||
|
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: release-drafter/release-drafter@v5
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
277
.gitignore
vendored
277
.gitignore
vendored
@ -1,138 +1,139 @@
|
|||||||
### Others ###
|
### Others ###
|
||||||
*.cmd
|
*.cmd
|
||||||
*.sh
|
*.sh
|
||||||
*.prefs
|
*.prefs
|
||||||
Sponge/build
|
Core/build
|
||||||
Core/build
|
|
||||||
Bukkit/build
|
### Maven ###
|
||||||
|
/mvn
|
||||||
### Maven ###
|
/target/lib
|
||||||
/target/lib
|
/target/maven-archiver
|
||||||
/target/maven-archiver
|
/target/classes
|
||||||
/target/classes
|
/target/maven-status
|
||||||
/target/maven-status
|
pom.xml.tag
|
||||||
pom.xml.tag
|
pom.xml.releaseBackup
|
||||||
pom.xml.releaseBackup
|
pom.xml.versionsBackup
|
||||||
pom.xml.versionsBackup
|
pom.xml.next
|
||||||
pom.xml.next
|
release.properties
|
||||||
release.properties
|
dependency-reduced-pom.xml
|
||||||
dependency-reduced-pom.xml
|
buildNumber.properties
|
||||||
buildNumber.properties
|
.mvn/timing.properties
|
||||||
.mvn/timing.properties
|
out/
|
||||||
|
|
||||||
|
|
||||||
### Java ###
|
### Java ###
|
||||||
*.class
|
*.class
|
||||||
|
|
||||||
# Mobile Tools for Java (J2ME)
|
# Mobile Tools for Java (J2ME)
|
||||||
.mtj.tmp/
|
.mtj.tmp/
|
||||||
|
|
||||||
# Package Files #
|
# Package Files #
|
||||||
*.jar
|
*.war
|
||||||
*.war
|
*.ear
|
||||||
*.ear
|
|
||||||
|
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
hs_err_pid*
|
||||||
hs_err_pid*
|
|
||||||
|
|
||||||
|
### Intellij ###
|
||||||
### Intellij ###
|
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
|
||||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
|
|
||||||
|
*.iml
|
||||||
*.iml
|
|
||||||
|
## Directory-based project format:
|
||||||
## Directory-based project format:
|
/.idea/*
|
||||||
.idea/
|
!/.idea/icon.svg
|
||||||
# if you remove the above rule, at least ignore the following:
|
# if you remove the above rule, at least ignore the following:
|
||||||
|
|
||||||
# User-specific stuff:
|
# User-specific stuff:
|
||||||
# .idea/workspace.xml
|
# .idea/workspace.xml
|
||||||
# .idea/tasks.xml
|
# .idea/tasks.xml
|
||||||
# .idea/dictionaries
|
# .idea/dictionaries
|
||||||
# .idea/shelf
|
# .idea/shelf
|
||||||
|
|
||||||
# Sensitive or high-churn files:
|
# Sensitive or high-churn files:
|
||||||
# .idea/dataSources.ids
|
# .idea/dataSources.ids
|
||||||
# .idea/dataSources.xml
|
# .idea/dataSources.xml
|
||||||
# .idea/sqlDataSources.xml
|
# .idea/sqlDataSources.xml
|
||||||
# .idea/dynamic.xml
|
# .idea/dynamic.xml
|
||||||
# .idea/uiDesigner.xml
|
# .idea/uiDesigner.xml
|
||||||
|
|
||||||
# Gradle:
|
# Gradle:
|
||||||
# .idea/gradle.xml
|
# .idea/gradle.xml
|
||||||
# .idea/libraries
|
# .idea/libraries
|
||||||
.gradle
|
.gradle
|
||||||
|
|
||||||
# Mongo Explorer plugin:
|
# Mongo Explorer plugin:
|
||||||
# .idea/mongoSettings.xml
|
# .idea/mongoSettings.xml
|
||||||
|
|
||||||
## File-based project format:
|
## File-based project format:
|
||||||
*.ipr
|
*.ipr
|
||||||
*.iws
|
*.iws
|
||||||
|
|
||||||
## Plugin-specific files:
|
## Plugin-specific files:
|
||||||
|
|
||||||
# IntelliJ
|
# IntelliJ
|
||||||
/out/
|
/out/
|
||||||
|
|
||||||
# mpeltonen/sbt-idea plugin
|
# JIRA plugin
|
||||||
.idea_modules/
|
atlassian-ide-plugin.xml
|
||||||
|
|
||||||
# JIRA plugin
|
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||||
atlassian-ide-plugin.xml
|
com_crashlytics_export_strings.xml
|
||||||
|
crashlytics.properties
|
||||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
crashlytics-build.properties
|
||||||
com_crashlytics_export_strings.xml
|
fabric.properties
|
||||||
crashlytics.properties
|
|
||||||
crashlytics-build.properties
|
|
||||||
fabric.properties
|
### Eclipse ###
|
||||||
|
*.pydevproject
|
||||||
|
.metadata
|
||||||
### Eclipse ###
|
bin/
|
||||||
*.pydevproject
|
tmp/
|
||||||
.metadata
|
*.tmp
|
||||||
bin/
|
*.bak
|
||||||
tmp/
|
*.swp
|
||||||
*.tmp
|
*~.nib
|
||||||
*.bak
|
local.properties
|
||||||
*.swp
|
.settings/
|
||||||
*~.nib
|
.loadpath
|
||||||
local.properties
|
|
||||||
.settings/
|
# Eclipse Core
|
||||||
.loadpath
|
.project
|
||||||
|
|
||||||
# Eclipse Core
|
# External tool builders
|
||||||
.project
|
.externalToolBuilders/
|
||||||
|
|
||||||
# External tool builders
|
# Locally stored "Eclipse launch configurations"
|
||||||
.externalToolBuilders/
|
*.launch
|
||||||
|
|
||||||
# Locally stored "Eclipse launch configurations"
|
# CDT-specific
|
||||||
*.launch
|
.cproject
|
||||||
|
|
||||||
# CDT-specific
|
# JDT-specific (Eclipse Java Development Tools)
|
||||||
.cproject
|
.classpath
|
||||||
|
|
||||||
# JDT-specific (Eclipse Java Development Tools)
|
# Java annotation processor (APT)
|
||||||
.classpath
|
.factorypath
|
||||||
|
|
||||||
# Java annotation processor (APT)
|
# PDT-specific
|
||||||
.factorypath
|
.buildpath
|
||||||
|
|
||||||
# PDT-specific
|
# sbteclipse plugin
|
||||||
.buildpath
|
.target
|
||||||
|
|
||||||
# sbteclipse plugin
|
# TeXlipse plugin
|
||||||
.target
|
.texlipse
|
||||||
|
|
||||||
# TeXlipse plugin
|
# STS (Spring Tool Suite)
|
||||||
.texlipse
|
.springBeans
|
||||||
|
/target/
|
||||||
# STS (Spring Tool Suite)
|
checkstyle.xml
|
||||||
.springBeans
|
classes/
|
||||||
/target/
|
*.bat
|
||||||
Nukkit/build/classes/
|
|
||||||
Nukkit/build/dependency-cache/
|
# Other
|
||||||
checkstyle.xml
|
docs/
|
||||||
classes/
|
build/
|
||||||
p2error.txt
|
|
||||||
|
.DS_Store
|
||||||
|
50
.idea/icon.svg
generated
Normal file
50
.idea/icon.svg
generated
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" id="svg2" xml:space="preserve" width="4000" height="3333.3333" viewBox="0 0 4000 3333.3333" sodipodi:docname="PlotSquared.ai">
|
||||||
|
<metadata id="metadata8">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<defs id="defs6">
|
||||||
|
<clipPath clipPathUnits="userSpaceOnUse" id="clipPath18">
|
||||||
|
<path d="M 0,2500 H 3000 V 0 H 0 Z" id="path16" />
|
||||||
|
</clipPath>
|
||||||
|
</defs>
|
||||||
|
<sodipodi:namedview pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10" gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="640" inkscape:window-height="480" id="namedview4" />
|
||||||
|
<g id="g10" inkscape:groupmode="layer" inkscape:label="PlotSquared" transform="matrix(1.3333333,0,0,-1.3333333,0,3333.3333)">
|
||||||
|
<g id="g12">
|
||||||
|
<g id="g14" clip-path="url(#clipPath18)">
|
||||||
|
<g id="g20" transform="translate(1486.1511,2242.6453)">
|
||||||
|
<path d="m 0,0 c 16.533,10.846 33.211,21.453 50.104,31.699 78.972,-48.281 153.985,-102.704 227.269,-159.144 148.61,-115.422 287.884,-243.01 414.393,-382.333 111.39,-122.861 212.751,-255.152 298.898,-396.971 52.744,-87.322 100.544,-177.884 139.514,-272.214 -11.638,-3.551 -23.108,-7.655 -34.362,-12.286 l -0.24,0.288 c -11.135,12.982 -24.141,24.212 -34.915,37.506 -22.557,23.013 -45.425,45.737 -68.03,68.678 -19.725,20.253 -40.601,39.45 -58.958,60.974 -36.355,36.451 -72.517,73.093 -108.944,109.471 -22.628,26.013 -48.064,49.385 -71.965,74.197 -19.029,19.485 -38.706,38.346 -57.519,57.999 -12.166,14.998 -26.684,27.716 -39.93,41.658 -27.668,27.524 -54.903,55.479 -82.571,82.979 -23.924,27.956 -51.664,52.264 -76.692,79.164 -4.68,4.487 -8.855,10.774 -15.886,11.326 -22.34,34.027 -58.311,57.327 -97.377,67.502 -104.312,99.153 -215.487,191.202 -332.661,274.782 -117.942,-83.94 -229.476,-176.781 -334.484,-276.39 -26.684,-0.024 -53.368,0.024 -80.076,-0.024 0.024,-26.564 0.048,-53.104 0,-79.668 -72.229,-73.021 -139.491,-150.937 -202.385,-232.092 -63.758,-82.619 -121.973,-169.51 -173.541,-260.264 131.932,-69.061 257.864,-149.521 375.926,-240.275 0.096,-26.444 -0.12,-52.888 0.096,-79.332 l 0.744,-0.984 c 20.109,-24.14 43.409,-45.233 65.126,-67.861 15.118,-15.382 30.571,-30.404 45.569,-45.881 17.565,-20.733 37.698,-39.042 56.607,-58.503 19.917,-20.781 41.25,-40.218 59.967,-62.151 29.156,-29.299 58.167,-58.815 87.515,-87.922 29.155,-33.043 61.502,-63.111 92.169,-94.738 13.726,-12.67 25.124,-27.571 38.634,-40.457 25.029,-25.365 50.129,-50.657 75.325,-75.853 -37.914,-51.208 -73.741,-103.952 -107.192,-158.183 -167.83,273.317 -397.235,507.305 -662.37,687.158 -81.875,55.335 -167.23,105.584 -255.681,149.641 -52.815,26.276 -106.831,50.248 -162.239,70.381 99.393,233.628 242.795,446.715 410.289,636.79 93.562,106.088 194.634,205.433 301.466,298.13 C -217.335,-155.808 -111.439,-73.789 0,0" style="fill:#062f4c;fill-opacity:1;fill-rule:nonzero;stroke:none" id="path22" />
|
||||||
|
</g>
|
||||||
|
<g id="g24" transform="translate(1201.7948,1741.5303)">
|
||||||
|
<path d="M 0,0 C 105.008,99.609 216.543,192.45 334.485,276.39 451.659,192.81 562.833,100.76 667.146,1.608 c -34.987,8.83 -71.51,9.718 -107.264,6.431 -41.202,-4.296 -82.907,-19.077 -112.543,-48.953 -33.019,-32.155 -49.456,-77.604 -55.311,-122.501 -28.124,27.908 -56.104,55.983 -84.035,84.083 -2.976,2.976 -6.839,4.823 -10.391,6.911 -19.029,26.348 -45.953,46.673 -76.62,57.495 C 187.555,-2.472 151.513,-0.12 116.166,0 Z" style="fill:#4c8fcc;fill-opacity:1;fill-rule:nonzero;stroke:none" id="path26" />
|
||||||
|
</g>
|
||||||
|
<g id="g28" transform="translate(919.3342,1429.7462)">
|
||||||
|
<path d="m 0,0 c 62.894,81.156 130.156,159.072 202.385,232.092 0.048,-244.21 0.024,-488.421 0,-732.631 C 84.323,-409.785 -41.61,-329.325 -173.541,-260.264 -121.973,-169.51 -63.758,-82.619 0,0" style="fill:#4c8fcc;fill-opacity:1;fill-rule:nonzero;stroke:none" id="path30" />
|
||||||
|
</g>
|
||||||
|
<g id="g32" transform="translate(1649.134,1700.6166)">
|
||||||
|
<path d="m 0,0 c 29.635,29.875 71.341,44.657 112.543,48.952 35.754,3.288 72.277,2.4 107.263,-6.431 39.066,-10.174 75.037,-33.474 97.377,-67.501 11.879,-17.661 20.181,-37.411 26.42,-57.687 10.871,-38.802 11.95,-79.356 11.446,-119.358 -44.345,-0.072 -88.69,0.048 -133.035,-0.072 -1.032,30.907 3.263,63.686 -10.175,92.626 -9.526,20.325 -32.107,31.243 -53.751,32.131 -21.453,1.44 -45.065,-4.32 -59.175,-21.597 -12.79,-15.861 -15.382,-37.002 -16.558,-56.655 -1.295,-29.132 3.696,-59.031 17.518,-84.923 16.821,-30.619 39.378,-57.783 64.526,-81.9 31.387,-32.634 67.501,-60.374 97.857,-94.041 27.332,-28.988 51.256,-61.479 68.005,-97.785 20.541,-41.13 26.972,-87.827 25.82,-133.372 -0.912,-32.107 -5.231,-64.406 -16.149,-94.737 -11.59,-31.699 -31.123,-61.047 -58.335,-81.371 -25.124,-19.125 -55.696,-29.852 -86.651,-34.771 -49.552,-6.743 -101.888,-4.847 -148.465,14.854 -35.227,14.829 -64.238,42.689 -81.708,76.548 -20.996,40.242 -27.115,86.339 -27.259,131.212 0.048,17.829 0,35.658 0.048,53.463 44.345,0.048 88.69,-0.023 133.059,0.048 1.728,-35.538 -4.055,-72.06 5.663,-106.807 5.783,-22.173 26.204,-37.794 48.185,-41.754 20.733,-3.431 43.577,-2.015 61.622,9.791 15.502,9.43 23.949,26.78 26.78,44.225 5.903,35.922 1.872,74.293 -15.381,106.688 -16.918,30.595 -39.474,57.711 -64.55,81.899 -33.187,34.099 -71.173,63.254 -102.585,99.081 -26.756,28.867 -49.408,61.646 -65.486,97.641 -24.572,52.48 -26.731,112.422 -20.18,169.102 C -49.456,-77.604 -33.019,-32.155 0,0" style="fill:#feeeee;fill-opacity:1;fill-rule:nonzero;stroke:none" id="path34" />
|
||||||
|
</g>
|
||||||
|
<g id="g36" transform="translate(1262.7214,1613.126)">
|
||||||
|
<path d="m 0,0 v -301.13 c 23.204,0.024 46.409,-0.048 69.613,0.024 18.525,0.288 38.202,6.575 50.153,21.429 12.43,17.277 13.917,39.522 14.613,60.111 0.024,43.985 -0.048,87.994 0.024,131.979 -0.48,23.637 -0.983,50.369 -17.277,69.23 C 104.864,-5.711 86.867,-0.24 69.589,0 46.385,0.048 23.204,0.024 0,0 m -141.002,128.38 c 26.708,0.048 53.392,0 80.075,0.024 H 55.24 c 35.346,-0.12 71.389,-2.471 104.815,-14.925 30.668,-10.823 57.592,-31.148 76.621,-57.496 26.852,-39.09 36.69,-87.202 38.058,-133.947 0.024,-48.833 0.096,-97.689 -0.024,-146.521 -1.728,-47.993 -11.974,-97.953 -41.514,-136.971 -22.748,-30.644 -57.495,-50.801 -94.281,-59.583 -45.377,-11.878 -92.578,-6.791 -138.891,-7.847 -0.072,-111.799 0,-223.574 -0.024,-335.373 -13.942,0 -27.86,0.024 -41.778,-0.024 -32.802,0.072 -65.605,0 -98.384,0.048 l -0.744,0.984 c -0.216,26.444 0,52.888 -0.096,79.332 0.024,244.211 0.048,488.421 0,732.632 0.048,26.563 0.024,53.103 0,79.667" style="fill:#feeeee;fill-opacity:1;fill-rule:nonzero;stroke:none" id="path38" />
|
||||||
|
</g>
|
||||||
|
<g id="g40" transform="translate(1966.3174,1675.6364)">
|
||||||
|
<path d="m 0,0 c 7.031,-0.552 11.206,-6.839 15.885,-11.326 25.029,-26.9 52.768,-51.208 76.693,-79.164 27.667,-27.5 54.903,-55.456 82.571,-82.979 13.246,-13.942 27.764,-26.66 39.93,-41.658 18.813,-19.653 38.49,-38.514 57.519,-57.999 23.9,-24.812 49.337,-48.185 71.965,-74.197 36.427,-36.378 72.589,-73.02 108.943,-109.471 18.358,-21.524 39.234,-40.722 58.959,-60.974 22.605,-22.941 45.473,-45.665 68.03,-68.678 10.774,-13.294 23.78,-24.524 34.914,-37.506 -103.904,-41.97 -203.488,-94.114 -298.922,-152.761 -246.994,-152.28 -466.224,-350.298 -639.333,-583.398 -25.197,25.196 -50.297,50.488 -75.325,75.852 -13.51,12.886 -24.908,27.788 -38.634,40.458 -30.667,31.627 -63.014,61.695 -92.17,94.738 -29.347,29.107 -58.359,58.623 -87.514,87.922 -18.717,21.933 -40.05,41.37 -59.967,62.151 -18.909,19.461 -39.042,37.77 -56.607,58.503 -14.998,15.477 -30.452,30.499 -45.569,45.88 -21.717,22.629 -45.017,43.722 -65.126,67.862 32.779,-0.048 65.582,0.024 98.384,-0.048 114.391,-98.097 220.407,-205.984 315.384,-322.99 92.914,114.318 196.242,220.022 307.753,316.271 30.955,4.919 61.526,15.646 86.65,34.771 27.212,20.325 46.745,49.672 58.335,81.371 107.312,77.988 219.327,149.929 337.509,210.376 -35.299,64.67 -75.829,126.437 -118.254,186.643 C 176.253,-228.037 104.24,-140.115 26.42,-57.687 20.181,-37.41 11.878,-17.661 0,0" style="fill:#042338;fill-opacity:1;fill-rule:nonzero;stroke:none" id="path42" />
|
||||||
|
</g>
|
||||||
|
<g id="g44" transform="translate(1499.3971,1669.1094)">
|
||||||
|
<path d="m 0,0 c 3.551,-2.088 7.415,-3.935 10.39,-6.911 27.932,-28.1 55.912,-56.175 84.036,-84.083 -6.551,-56.679 -4.392,-116.622 20.18,-169.102 16.078,-35.994 38.73,-68.774 65.486,-97.641 31.412,-35.826 69.398,-64.982 102.585,-99.081 25.076,-24.188 47.632,-51.304 64.55,-81.899 17.253,-32.395 21.284,-70.765 15.381,-106.688 -2.831,-17.445 -11.278,-34.794 -26.78,-44.225 -18.045,-11.806 -40.889,-13.222 -61.622,-9.79 -21.981,3.959 -42.402,19.58 -48.185,41.753 -9.718,34.747 -3.935,71.269 -5.663,106.808 -44.369,-0.072 -88.714,0 -133.059,-0.048 -0.048,-17.806 0,-35.635 -0.048,-53.464 0.144,-44.873 6.263,-90.97 27.259,-131.212 17.47,-33.859 46.481,-61.718 81.708,-76.548 46.577,-19.701 98.913,-21.597 148.465,-14.854 -111.511,-96.249 -214.839,-201.953 -307.753,-316.271 -94.977,117.006 -200.993,224.893 -315.383,322.99 13.918,0.048 27.836,0.024 41.777,0.024 0.024,111.799 -0.048,223.574 0.024,335.372 46.313,1.056 93.514,-4.031 138.891,7.847 36.786,8.783 71.533,28.94 94.282,59.583 29.539,39.018 39.785,88.978 41.513,136.971 0.12,48.833 0.048,97.689 0.024,146.522 C 36.69,-87.203 26.852,-39.09 0,0" style="fill:#1c72ba;fill-opacity:1;fill-rule:nonzero;stroke:none" id="path46" />
|
||||||
|
</g>
|
||||||
|
<g id="g48" transform="translate(1748.0469,1601.6797)">
|
||||||
|
<path d="M 0,0 C 14.11,17.277 37.722,23.036 59.175,21.597 80.82,20.709 103.4,9.791 112.927,-10.534 c 13.438,-28.94 9.142,-61.719 10.174,-92.626 44.345,0.12 88.691,0 133.036,0.072 0.504,40.002 -0.576,80.556 -11.447,119.358 77.82,-82.428 149.833,-170.35 215.583,-262.664 42.426,-60.207 82.956,-121.973 118.254,-186.643 -118.182,-60.447 -230.196,-132.388 -337.508,-210.376 10.918,30.331 15.238,62.63 16.149,94.737 1.152,45.545 -5.279,92.242 -25.82,133.372 -16.749,36.306 -40.673,68.797 -68.005,97.785 -30.355,33.667 -66.47,61.406 -97.857,94.041 -25.148,24.117 -47.705,51.28 -64.526,81.9 -13.822,25.892 -18.813,55.791 -17.517,84.923 C -15.382,-37.002 -12.79,-15.862 0,0" style="fill:#1c72ba;fill-opacity:1;fill-rule:nonzero;stroke:none" id="path50" />
|
||||||
|
</g>
|
||||||
|
<g id="g52" transform="translate(1262.7214,1613.126)">
|
||||||
|
<path d="m 0,0 c 23.204,0.024 46.385,0.048 69.589,0 17.278,-0.24 35.275,-5.711 47.537,-18.357 16.294,-18.861 16.797,-45.593 17.277,-69.23 -0.072,-43.985 0,-87.994 -0.024,-131.979 -0.696,-20.589 -2.183,-42.834 -14.613,-60.111 -11.951,-14.854 -31.628,-21.141 -50.153,-21.429 -23.204,-0.072 -46.409,0 -69.613,-0.024 z" style="fill:#1c72ba;fill-opacity:1;fill-rule:nonzero;stroke:none" id="path54" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 11 KiB |
@ -1,45 +0,0 @@
|
|||||||
repositories {
|
|
||||||
maven {url "https://hub.spigotmc.org/nexus/content/groups/public/"}
|
|
||||||
maven { url = "https://oss.sonatype.org/content/repositories/snapshots/"}
|
|
||||||
maven {url "http://nexus.hc.to/content/repositories/pub_releases"}
|
|
||||||
mavenLocal()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compile project(':Core')
|
|
||||||
compile 'org.spigotmc:spigot-api:1.11-R0.1-SNAPSHOT'
|
|
||||||
compile("net.milkbowl.vault:VaultAPI:1.6") {
|
|
||||||
exclude module: 'bukkit'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceCompatibility = 1.7
|
|
||||||
targetCompatibility = 1.7
|
|
||||||
|
|
||||||
processResources {
|
|
||||||
from('src/main/resources') {
|
|
||||||
include 'plugin.yml'
|
|
||||||
expand(
|
|
||||||
name: project.parent.name,
|
|
||||||
version: project.parent.version
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// We only want the shadow jar produced
|
|
||||||
jar.enabled = false
|
|
||||||
|
|
||||||
shadowJar {
|
|
||||||
dependencies {
|
|
||||||
include(dependency(':Core'))
|
|
||||||
}
|
|
||||||
relocate('org.mcstats', 'com.plotsquared.stats')
|
|
||||||
archiveName = "${parent.name}-${project.name}-${parent.version}.jar"
|
|
||||||
destinationDir = file '../target'
|
|
||||||
}
|
|
||||||
|
|
||||||
shadowJar.doLast {
|
|
||||||
task ->
|
|
||||||
ant.checksum file: task.archivePath
|
|
||||||
}
|
|
||||||
|
|
||||||
build.dependsOn(shadowJar);
|
|
116
Bukkit/build.gradle.kts
Normal file
116
Bukkit/build.gradle.kts
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = "PlaceholderAPI"
|
||||||
|
url = uri("https://repo.extendedclip.com/content/repositories/placeholderapi/")
|
||||||
|
}
|
||||||
|
|
||||||
|
maven {
|
||||||
|
name = "PaperMC"
|
||||||
|
url = uri("https://repo.papermc.io/repository/maven-public/")
|
||||||
|
}
|
||||||
|
|
||||||
|
maven {
|
||||||
|
name = "EssentialsX"
|
||||||
|
url = uri("https://repo.essentialsx.net/releases/")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
api(projects.plotSquaredCore)
|
||||||
|
|
||||||
|
// Metrics
|
||||||
|
implementation("org.bstats:bstats-bukkit")
|
||||||
|
|
||||||
|
// Paper
|
||||||
|
compileOnly("io.papermc.paper:paper-api")
|
||||||
|
implementation("io.papermc:paperlib")
|
||||||
|
|
||||||
|
// Plugins
|
||||||
|
compileOnly(libs.worldeditBukkit) {
|
||||||
|
exclude(group = "org.bukkit")
|
||||||
|
exclude(group = "org.spigotmc")
|
||||||
|
}
|
||||||
|
compileOnly("com.fastasyncworldedit:FastAsyncWorldEdit-Bukkit") { isTransitive = false }
|
||||||
|
testImplementation("com.fastasyncworldedit:FastAsyncWorldEdit-Bukkit") { isTransitive = false }
|
||||||
|
compileOnly("com.github.MilkBowl:VaultAPI") {
|
||||||
|
exclude(group = "org.bukkit")
|
||||||
|
}
|
||||||
|
compileOnly(libs.placeholderapi)
|
||||||
|
compileOnly(libs.luckperms)
|
||||||
|
compileOnly(libs.essentialsx)
|
||||||
|
compileOnly(libs.mvdwapi) { isTransitive = false }
|
||||||
|
|
||||||
|
// Other libraries
|
||||||
|
implementation(libs.squirrelid) { isTransitive = false }
|
||||||
|
implementation("dev.notmyfault.serverlib:ServerLib")
|
||||||
|
|
||||||
|
// Our libraries
|
||||||
|
implementation(libs.arkitektonika)
|
||||||
|
implementation(libs.http4j)
|
||||||
|
implementation("com.intellectualsites.paster:Paster")
|
||||||
|
implementation("com.intellectualsites.informative-annotations:informative-annotations")
|
||||||
|
|
||||||
|
// Adventure
|
||||||
|
implementation("net.kyori:adventure-platform-bukkit")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.processResources {
|
||||||
|
filesMatching("plugin.yml") {
|
||||||
|
expand("version" to project.version)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named<ShadowJar>("shadowJar") {
|
||||||
|
dependencies {
|
||||||
|
exclude(dependency("org.checkerframework:"))
|
||||||
|
}
|
||||||
|
|
||||||
|
relocate("net.kyori.adventure", "com.plotsquared.core.configuration.adventure")
|
||||||
|
relocate("net.kyori.examination", "com.plotsquared.core.configuration.examination")
|
||||||
|
relocate("io.papermc.lib", "com.plotsquared.bukkit.paperlib")
|
||||||
|
relocate("org.bstats", "com.plotsquared.metrics")
|
||||||
|
relocate("org.enginehub", "com.plotsquared.squirrelid")
|
||||||
|
relocate("org.khelekore.prtree", "com.plotsquared.prtree")
|
||||||
|
relocate("com.google.inject", "com.plotsquared.google")
|
||||||
|
relocate("org.aopalliance", "com.plotsquared.core.aopalliance")
|
||||||
|
relocate("cloud.commandframework.services", "com.plotsquared.core.services")
|
||||||
|
relocate("io.leangen.geantyref", "com.plotsquared.core.geantyref")
|
||||||
|
relocate("com.intellectualsites.arkitektonika", "com.plotsquared.core.arkitektonika")
|
||||||
|
relocate("com.intellectualsites.http", "com.plotsquared.core.http")
|
||||||
|
relocate("com.intellectualsites.paster", "com.plotsquared.core.paster")
|
||||||
|
relocate("org.incendo.serverlib", "com.plotsquared.bukkit.serverlib")
|
||||||
|
relocate("org.jetbrains", "com.plotsquared.core.annotations")
|
||||||
|
relocate("org.intellij.lang", "com.plotsquared.core.intellij.annotations")
|
||||||
|
relocate("javax.annotation", "com.plotsquared.core.annotation")
|
||||||
|
relocate("com.github.spotbugs", "com.plotsquared.core.spotbugs")
|
||||||
|
relocate("javax.inject", "com.plotsquared.core.annotation.inject")
|
||||||
|
relocate("net.jcip", "com.plotsquared.core.annotations.jcip")
|
||||||
|
relocate("edu.umd.cs.findbugs", "com.plotsquared.core.annotations.findbugs")
|
||||||
|
relocate("com.intellectualsites.informative-annotations", "com.plotsquared.core.annotation.informative")
|
||||||
|
|
||||||
|
// Get rid of all the libs which are 100% unused.
|
||||||
|
minimize()
|
||||||
|
|
||||||
|
mergeServiceFiles()
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks {
|
||||||
|
withType<Javadoc> {
|
||||||
|
val isRelease = if (rootProject.version.toString().endsWith("-SNAPSHOT")) "TODO" else rootProject.version.toString()
|
||||||
|
val opt = options as StandardJavadocDocletOptions
|
||||||
|
opt.links("https://jd.papermc.io/paper/1.18/")
|
||||||
|
opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-bukkit/" + libs.worldeditBukkit.get().versionConstraint.toString())
|
||||||
|
opt.links("https://intellectualsites.github.io/plotsquared-javadocs/core/")
|
||||||
|
opt.links("https://jd.adventure.kyori.net/api/4.9.3/")
|
||||||
|
opt.links("https://google.github.io/guice/api-docs/" + libs.guice.get().versionConstraint.toString() + "/javadoc/")
|
||||||
|
opt.links("https://checkerframework.org/api/")
|
||||||
|
opt.isLinkSource = true
|
||||||
|
opt.bottom(File("$rootDir/javadocfooter.html").readText())
|
||||||
|
opt.isUse = true
|
||||||
|
opt.encoding("UTF-8")
|
||||||
|
opt.keyWords()
|
||||||
|
opt.addStringOption("-since", isRelease)
|
||||||
|
}
|
||||||
|
}
|
@ -1,733 +0,0 @@
|
|||||||
package com.intellectualcrafters.plot.api;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.configuration.file.YamlConfiguration;
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
|
||||||
import com.intellectualcrafters.plot.commands.SubCommand;
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
|
||||||
import com.intellectualcrafters.plot.flag.Flag;
|
|
||||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
|
||||||
import com.intellectualcrafters.plot.flag.Flags;
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotArea;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotManager;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
|
||||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
|
||||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
|
||||||
import com.intellectualcrafters.plot.util.block.GlobalBlockQueue;
|
|
||||||
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
|
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.OfflinePlayer;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PlotSquared API.
|
|
||||||
*
|
|
||||||
* <p>Useful classes:
|
|
||||||
* <ul>
|
|
||||||
* <li>{@link BukkitUtil}</li>
|
|
||||||
* <li>{@link PlotPlayer}</li>
|
|
||||||
* <li>{@link Plot}</li>
|
|
||||||
* <li>{@link com.intellectualcrafters.plot.object.Location}</li>
|
|
||||||
* <li>{@link PlotArea}</li>
|
|
||||||
* <li>{@link PS}</li>
|
|
||||||
* </ul>
|
|
||||||
* @version 3.3.3
|
|
||||||
*/
|
|
||||||
public class PlotAPI {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deprecated, does nothing.
|
|
||||||
* @param plugin not needed
|
|
||||||
* @deprecated Not needed
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public PlotAPI(JavaPlugin plugin) {}
|
|
||||||
|
|
||||||
public PlotAPI(){}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all plots.
|
|
||||||
*
|
|
||||||
* @return all plots
|
|
||||||
*
|
|
||||||
* @see PS#getPlots()
|
|
||||||
*/
|
|
||||||
public Set<Plot> getAllPlots() {
|
|
||||||
return PS.get().getPlots();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return all plots for a player.
|
|
||||||
*
|
|
||||||
* @param player Player, whose plots to search for
|
|
||||||
*
|
|
||||||
* @return all plots that a player owns
|
|
||||||
*/
|
|
||||||
public Set<Plot> getPlayerPlots(Player player) {
|
|
||||||
return PS.get().getPlots(BukkitUtil.getPlayer(player));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a plot world.
|
|
||||||
*
|
|
||||||
* @param plotArea Plot World Object
|
|
||||||
* @see PS#addPlotArea(PlotArea)
|
|
||||||
*/
|
|
||||||
public void addPlotArea(PlotArea plotArea) {
|
|
||||||
PS.get().addPlotArea(plotArea);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the PlotSquared configurations file.
|
|
||||||
* @return main configuration
|
|
||||||
*
|
|
||||||
* @see PS#config
|
|
||||||
*/
|
|
||||||
public YamlConfiguration getConfig() {
|
|
||||||
return PS.get().config;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the PlotSquared storage file.
|
|
||||||
* @return storage configuration
|
|
||||||
*
|
|
||||||
* @see PS#storage
|
|
||||||
*/
|
|
||||||
public YamlConfiguration getStorage() {
|
|
||||||
return PS.get().storage;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the main class for this plugin. Only use this if you really need it.
|
|
||||||
*
|
|
||||||
* @return PlotSquared PlotSquared Main Class
|
|
||||||
*
|
|
||||||
* @see PS
|
|
||||||
*/
|
|
||||||
public PS getMain() {
|
|
||||||
return PS.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ChunkManager class contains several useful methods.
|
|
||||||
* <ul>
|
|
||||||
* <li>Chunk deletion</li>
|
|
||||||
* <li>Moving or copying regions</li>
|
|
||||||
* <li>Plot swapping</li>
|
|
||||||
* <li>Entity Tracking</li>
|
|
||||||
* <li>Region Regeneration</li>
|
|
||||||
* </ul>
|
|
||||||
*
|
|
||||||
* @return ChunkManager
|
|
||||||
*
|
|
||||||
* @see ChunkManager
|
|
||||||
*/
|
|
||||||
public ChunkManager getChunkManager() {
|
|
||||||
return ChunkManager.manager;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the block/biome set queue
|
|
||||||
* @return GlobalBlockQueue.IMP
|
|
||||||
*/
|
|
||||||
public GlobalBlockQueue getBlockQueue() {
|
|
||||||
return GlobalBlockQueue.IMP;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* UUIDWrapper class has basic methods for getting UUIDS. It's recommended
|
|
||||||
* to use the UUIDHandler class instead.
|
|
||||||
*
|
|
||||||
* @return UUIDWrapper
|
|
||||||
*
|
|
||||||
* @see UUIDWrapper
|
|
||||||
*/
|
|
||||||
public UUIDWrapper getUUIDWrapper() {
|
|
||||||
return UUIDHandler.getUUIDWrapper();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Do not use this. Instead use FlagManager.[method] in your code.
|
|
||||||
* - Flag related stuff
|
|
||||||
*
|
|
||||||
* @return FlagManager
|
|
||||||
*
|
|
||||||
* @deprecated Use {@link FlagManager} directly
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public FlagManager getFlagManager() {
|
|
||||||
return new FlagManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Do not use this. Instead use MainUtil.[method] in your code.
|
|
||||||
*
|
|
||||||
* @return MainUtil
|
|
||||||
* @deprecated Use {@link MainUtil} directly
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public MainUtil getMainUtil() {
|
|
||||||
return new MainUtil();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Do not use this. Instead use C.PERMISSION_[method] in your code.
|
|
||||||
*
|
|
||||||
* @return Array of strings
|
|
||||||
*
|
|
||||||
* @see Permissions
|
|
||||||
* @deprecated Use {@link C} to list all the permissions
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public String[] getPermissions() {
|
|
||||||
ArrayList<String> perms = new ArrayList<>();
|
|
||||||
for (C caption : C.values()) {
|
|
||||||
if ("static.permissions".equals(caption.getCategory())) {
|
|
||||||
perms.add(caption.s());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return perms.toArray(new String[perms.size()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SchematicHandler class contains methods related to pasting, reading
|
|
||||||
* and writing schematics.
|
|
||||||
*
|
|
||||||
* @return SchematicHandler
|
|
||||||
*
|
|
||||||
* @see SchematicHandler
|
|
||||||
*/
|
|
||||||
public SchematicHandler getSchematicHandler() {
|
|
||||||
return SchematicHandler.manager;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use C.[caption] instead
|
|
||||||
*
|
|
||||||
* @return C
|
|
||||||
* @deprecated Use {@link C}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public C[] getCaptions() {
|
|
||||||
return C.values();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the plot manager for a world. Most of these methods can be accessed
|
|
||||||
* through the MainUtil.
|
|
||||||
*
|
|
||||||
* @param world the world to retrieve the manager from
|
|
||||||
*
|
|
||||||
* @return PlotManager
|
|
||||||
*
|
|
||||||
* @see PlotManager
|
|
||||||
* @see PS#getPlotManager(Plot)
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Deprecated
|
|
||||||
public PlotManager getPlotManager(World world) {
|
|
||||||
if (world == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return getPlotManager(world.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a list of PlotAreas in the world.
|
|
||||||
* @param world The world to check for plot areas
|
|
||||||
* @return A set of PlotAreas
|
|
||||||
*/
|
|
||||||
public Set<PlotArea> getPlotAreas(World world) {
|
|
||||||
if (world == null) {
|
|
||||||
return Collections.emptySet();
|
|
||||||
}
|
|
||||||
return PS.get().getPlotAreas(world.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the plot manager for a world. Contains useful low level methods for
|
|
||||||
* plot merging, clearing, and tessellation.
|
|
||||||
*
|
|
||||||
* @param world The world
|
|
||||||
*
|
|
||||||
* @return PlotManager
|
|
||||||
*
|
|
||||||
* @see PS#getPlotManager(Plot)
|
|
||||||
* @see PlotManager
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public PlotManager getPlotManager(String world) {
|
|
||||||
Set<PlotArea> areas = PS.get().getPlotAreas(world);
|
|
||||||
switch (areas.size()) {
|
|
||||||
case 0:
|
|
||||||
return null;
|
|
||||||
case 1:
|
|
||||||
return areas.iterator().next().manager;
|
|
||||||
default:
|
|
||||||
PS.debug("PlotAPI#getPlotManager(org.bukkit.World) is deprecated and doesn't support multi plot area worlds.");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the settings for a world (settings bundled in PlotArea class). You
|
|
||||||
* will need to downcast for the specific settings a Generator has. e.g.
|
|
||||||
* DefaultPlotWorld class implements PlotArea
|
|
||||||
*
|
|
||||||
* @param world The World
|
|
||||||
*
|
|
||||||
* @return The {@link PlotArea} for the world or null if not in plotworld
|
|
||||||
*
|
|
||||||
* @see #getPlotAreas(World)
|
|
||||||
* @see PlotArea
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Deprecated
|
|
||||||
public PlotArea getWorldSettings(World world) {
|
|
||||||
if (world == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return getWorldSettings(world.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the settings for a world.
|
|
||||||
*
|
|
||||||
* @param world the world to retrieve settings from
|
|
||||||
*
|
|
||||||
* @return The {@link PlotArea} for the world or null if not in plotworld
|
|
||||||
*
|
|
||||||
* @see PS#getPlotArea(String, String)
|
|
||||||
* @see PlotArea
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public PlotArea getWorldSettings(String world) {
|
|
||||||
if (world == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
Set<PlotArea> areas = PS.get().getPlotAreas(world);
|
|
||||||
switch (areas.size()) {
|
|
||||||
case 0:
|
|
||||||
return null;
|
|
||||||
case 1:
|
|
||||||
return areas.iterator().next();
|
|
||||||
default:
|
|
||||||
PS.debug("PlotAPI#getWorldSettings(org.bukkit.World) is deprecated and doesn't support multi plot area worlds.");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Send a message to a player.
|
|
||||||
*
|
|
||||||
* @param player the recipient of the message
|
|
||||||
* @param caption the message
|
|
||||||
*
|
|
||||||
* @see MainUtil#sendMessage(PlotPlayer, C, String...)
|
|
||||||
*/
|
|
||||||
public void sendMessage(Player player, C caption) {
|
|
||||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), caption);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Send a message to a player. The message supports color codes.
|
|
||||||
*
|
|
||||||
* @param player the recipient of the message
|
|
||||||
* @param string the message
|
|
||||||
*
|
|
||||||
* @see MainUtil#sendMessage(PlotPlayer, String)
|
|
||||||
*/
|
|
||||||
public void sendMessage(Player player, String string) {
|
|
||||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), string);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Send a message to the console. The message supports color codes.
|
|
||||||
*
|
|
||||||
* @param message the message
|
|
||||||
*
|
|
||||||
* @see MainUtil#sendConsoleMessage(C, String...)
|
|
||||||
*/
|
|
||||||
public void sendConsoleMessage(String message) {
|
|
||||||
PS.log(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Send a message to the console.
|
|
||||||
*
|
|
||||||
* @param caption the message
|
|
||||||
*
|
|
||||||
* @see #sendConsoleMessage(String)
|
|
||||||
* @see C
|
|
||||||
*/
|
|
||||||
public void sendConsoleMessage(C caption) {
|
|
||||||
sendConsoleMessage(caption.s());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Registers a flag for use in plots.
|
|
||||||
*
|
|
||||||
* @param flag the flag to register
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void addFlag(Flag<?> flag) {
|
|
||||||
Flags.registerFlag(flag);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a plot based on the ID.
|
|
||||||
*
|
|
||||||
* @param world the world the plot is located in
|
|
||||||
* @param x The PlotID x coordinate
|
|
||||||
* @param z The PlotID y coordinate
|
|
||||||
*
|
|
||||||
* @return plot, null if ID is wrong
|
|
||||||
*
|
|
||||||
* @see PlotArea#getPlot(PlotId)
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Deprecated
|
|
||||||
public Plot getPlot(World world, int x, int z) {
|
|
||||||
if (world == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
PlotArea area = getWorldSettings(world);
|
|
||||||
if (area == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return area.getPlot(new PlotId(x, z));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a plot based on the location.
|
|
||||||
*
|
|
||||||
* @param location the location to check
|
|
||||||
*
|
|
||||||
* @return plot if found, otherwise it creates a temporary plot
|
|
||||||
*
|
|
||||||
* @see Plot
|
|
||||||
*/
|
|
||||||
public Plot getPlot(Location location) {
|
|
||||||
if (location == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return BukkitUtil.getLocation(location).getPlot();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a plot based on the player location.
|
|
||||||
*
|
|
||||||
* @param player the player to check
|
|
||||||
*
|
|
||||||
* @return plot if found, otherwise it creates a temporary plot
|
|
||||||
*
|
|
||||||
* @see #getPlot(Location)
|
|
||||||
* @see Plot
|
|
||||||
*/
|
|
||||||
public Plot getPlot(Player player) {
|
|
||||||
return this.getPlot(player.getLocation());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check whether or not a player has a plot.
|
|
||||||
*
|
|
||||||
* @param player Player that you want to check for
|
|
||||||
* @param world The world to check
|
|
||||||
* @return true if player has a plot, false if not.
|
|
||||||
*
|
|
||||||
* @see #getPlots(World, Player, boolean)
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Deprecated
|
|
||||||
public boolean hasPlot(World world, Player player) {
|
|
||||||
return getPlots(world, player, true).length > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all plots for the player.
|
|
||||||
*
|
|
||||||
* @param world The world to retrieve plots from
|
|
||||||
* @param player The player to search for
|
|
||||||
* @param justOwner should we just search for owner? Or with rights?
|
|
||||||
* @return An array of plots for the player
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public Plot[] getPlots(World world, Player player, boolean justOwner) {
|
|
||||||
ArrayList<Plot> pPlots = new ArrayList<>();
|
|
||||||
UUID uuid = BukkitUtil.getPlayer(player).getUUID();
|
|
||||||
for (Plot plot : PS.get().getPlots(world.getName())) {
|
|
||||||
if (justOwner) {
|
|
||||||
if (plot.hasOwner() && plot.isOwner(uuid)) {
|
|
||||||
pPlots.add(plot);
|
|
||||||
}
|
|
||||||
} else if (plot.isAdded(uuid)) {
|
|
||||||
pPlots.add(plot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return pPlots.toArray(new Plot[pPlots.size()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all plots for the world.
|
|
||||||
*
|
|
||||||
* @param world to get plots of
|
|
||||||
*
|
|
||||||
* @return Plot[] - array of plot objects in world
|
|
||||||
*
|
|
||||||
* @see PS#getPlots(String)
|
|
||||||
* @see Plot
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public Plot[] getPlots(World world) {
|
|
||||||
if (world == null) {
|
|
||||||
return new Plot[0];
|
|
||||||
}
|
|
||||||
Collection<Plot> plots = PS.get().getPlots(world.getName());
|
|
||||||
return plots.toArray(new Plot[plots.size()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all plot worlds.
|
|
||||||
*
|
|
||||||
* @return World[] - array of plot worlds
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Deprecated
|
|
||||||
public String[] getPlotWorlds() {
|
|
||||||
Set<String> plotWorldStrings = PS.get().getPlotWorldStrings();
|
|
||||||
return plotWorldStrings.toArray(new String[plotWorldStrings.size()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get if plotworld.
|
|
||||||
*
|
|
||||||
* @param world The world to check
|
|
||||||
*
|
|
||||||
* @return boolean (if plot world or not)
|
|
||||||
*
|
|
||||||
* @see PS#hasPlotArea(String)
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public boolean isPlotWorld(World world) {
|
|
||||||
return PS.get().hasPlotArea(world.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get plot locations.
|
|
||||||
*
|
|
||||||
* @param plot Plot to get the locations for
|
|
||||||
*
|
|
||||||
* @return [0] = bottomLc, [1] = topLoc, [2] = home
|
|
||||||
*
|
|
||||||
* @deprecated As merged plots may not have a rectangular shape
|
|
||||||
*
|
|
||||||
* @see Plot
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Deprecated
|
|
||||||
public Location[] getLocations(Plot plot) {
|
|
||||||
Location bukkitBottom = BukkitUtil.getLocation(plot.getCorners()[0]);
|
|
||||||
Location bukkitTop = BukkitUtil.getLocation(plot.getCorners()[1]);
|
|
||||||
Location bukkitHome = BukkitUtil.getLocation(plot.getHome());
|
|
||||||
return new Location[]{bukkitBottom, bukkitTop, bukkitHome};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get home location.
|
|
||||||
*
|
|
||||||
* @param plot Plot that you want to get the location for
|
|
||||||
*
|
|
||||||
* @return plot bottom location
|
|
||||||
*
|
|
||||||
* @see Plot
|
|
||||||
*/
|
|
||||||
public Location getHomeLocation(Plot plot) {
|
|
||||||
return BukkitUtil.getLocation(plot.getHome());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Bottom Location (min, min, min).
|
|
||||||
*
|
|
||||||
* @param plot Plot that you want to get the location for
|
|
||||||
*
|
|
||||||
* @return plot bottom location
|
|
||||||
*
|
|
||||||
* @deprecated As merged plots may not have a rectangular shape
|
|
||||||
*
|
|
||||||
* @see Plot
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Deprecated
|
|
||||||
public Location getBottomLocation(Plot plot) {
|
|
||||||
return BukkitUtil.getLocation(plot.getCorners()[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Top Location (max, max, max).
|
|
||||||
*
|
|
||||||
* @param plot Plot that you want to get the location for
|
|
||||||
*
|
|
||||||
* @return plot top location
|
|
||||||
*
|
|
||||||
* @deprecated As merged plots may not have a rectangular shape
|
|
||||||
*
|
|
||||||
* @see Plot
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Deprecated
|
|
||||||
public Location getTopLocation(Plot plot) {
|
|
||||||
return BukkitUtil.getLocation(plot.getCorners()[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check whether or not a player is in a plot.
|
|
||||||
*
|
|
||||||
* @param player who we're checking for
|
|
||||||
*
|
|
||||||
* @return true if the player is in a plot, false if not-
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public boolean isInPlot(Player player) {
|
|
||||||
return getPlot(player) != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register a subcommand.
|
|
||||||
* @deprecated Command registration is done on object creation
|
|
||||||
* @param c SubCommand, that we want to register
|
|
||||||
* @see SubCommand
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void registerCommand(SubCommand c) {
|
|
||||||
PS.debug("SubCommands are now registered on creation");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the PlotSquared class.
|
|
||||||
*
|
|
||||||
* @return PlotSquared Class
|
|
||||||
*
|
|
||||||
* @see PS
|
|
||||||
*/
|
|
||||||
public PS getPlotSquared() {
|
|
||||||
return PS.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the player plot count.
|
|
||||||
*
|
|
||||||
* @param world Specify the world we want to select the plots from
|
|
||||||
* @param player Player, for whom we're getting the plot count
|
|
||||||
*
|
|
||||||
* @return the number of plots the player has
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public int getPlayerPlotCount(World world, Player player) {
|
|
||||||
if (world == null) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return BukkitUtil.getPlayer(player).getPlotCount(world.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a collection containing the players plots.
|
|
||||||
*
|
|
||||||
* @param world Specify the world we want to select the plots from
|
|
||||||
* @param player Player, for whom we're getting the plots
|
|
||||||
*
|
|
||||||
* @return a set containing the players plots
|
|
||||||
*
|
|
||||||
* @see PS#getPlots(String, PlotPlayer)
|
|
||||||
*
|
|
||||||
* @see Plot
|
|
||||||
*/
|
|
||||||
public Set<Plot> getPlayerPlots(World world, Player player) {
|
|
||||||
if (world == null) {
|
|
||||||
return new HashSet<>();
|
|
||||||
}
|
|
||||||
return PlotPlayer.wrap(player).getPlots(world.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the number of plots, which the player is able to build in.
|
|
||||||
*
|
|
||||||
* @param player player, for whom we're getting the plots
|
|
||||||
*
|
|
||||||
* @return the number of allowed plots
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public int getAllowedPlots(Player player) {
|
|
||||||
PlotPlayer plotPlayer = PlotPlayer.wrap(player);
|
|
||||||
return plotPlayer.getAllowedPlots();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the PlotPlayer for a player. The PlotPlayer is usually cached and
|
|
||||||
* will provide useful functions relating to players.
|
|
||||||
*
|
|
||||||
* @see PlotPlayer#wrap(Object)
|
|
||||||
*
|
|
||||||
* @param player the player to wrap
|
|
||||||
* @return a {@code PlotPlayer}
|
|
||||||
*/
|
|
||||||
public PlotPlayer wrapPlayer(Player player) {
|
|
||||||
return PlotPlayer.wrap(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the PlotPlayer for a UUID.
|
|
||||||
*
|
|
||||||
* <p><i>Please note that PlotSquared can be configured to provide
|
|
||||||
* different UUIDs than bukkit</i>
|
|
||||||
*
|
|
||||||
* @see PlotPlayer#wrap(Object)
|
|
||||||
*
|
|
||||||
* @param uuid the uuid of the player to wrap
|
|
||||||
* @return a {@code PlotPlayer}
|
|
||||||
*/
|
|
||||||
public PlotPlayer wrapPlayer(UUID uuid) {
|
|
||||||
return PlotPlayer.wrap(uuid);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the PlotPlayer for a username.
|
|
||||||
*
|
|
||||||
* @see PlotPlayer#wrap(Object)
|
|
||||||
*
|
|
||||||
* @param player the player to wrap
|
|
||||||
* @return a {@code PlotPlayer}
|
|
||||||
*/
|
|
||||||
public PlotPlayer wrapPlayer(String player) {
|
|
||||||
return PlotPlayer.wrap(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the PlotPlayer for an offline player.
|
|
||||||
*
|
|
||||||
* <p>Note that this will work if the player is offline, however not all
|
|
||||||
* functionality will work.
|
|
||||||
*
|
|
||||||
* @see PlotPlayer#wrap(Object)
|
|
||||||
*
|
|
||||||
* @param player the player to wrap
|
|
||||||
* @return a {@code PlotPlayer}
|
|
||||||
*/
|
|
||||||
public PlotPlayer wrapPlayer(OfflinePlayer player) {
|
|
||||||
return PlotPlayer.wrap(player);
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,86 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit;
|
||||||
|
|
||||||
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
|
import com.plotsquared.core.command.MainCommand;
|
||||||
|
import com.plotsquared.core.configuration.Settings;
|
||||||
|
import com.plotsquared.core.player.ConsolePlayer;
|
||||||
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
|
import org.bukkit.command.ProxiedCommandSender;
|
||||||
|
import org.bukkit.command.RemoteConsoleCommandSender;
|
||||||
|
import org.bukkit.command.TabCompleter;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
public class BukkitCommand implements CommandExecutor, TabCompleter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(
|
||||||
|
CommandSender commandSender, Command command, String commandLabel,
|
||||||
|
String[] args
|
||||||
|
) {
|
||||||
|
if (commandSender instanceof Player) {
|
||||||
|
return MainCommand.onCommand(BukkitUtil.adapt((Player) commandSender), args);
|
||||||
|
}
|
||||||
|
if (commandSender instanceof ConsoleCommandSender
|
||||||
|
|| commandSender instanceof ProxiedCommandSender
|
||||||
|
|| commandSender instanceof RemoteConsoleCommandSender) {
|
||||||
|
return MainCommand.onCommand(ConsolePlayer.getConsole(), args);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> onTabComplete(
|
||||||
|
CommandSender commandSender, Command command, String label,
|
||||||
|
String[] args
|
||||||
|
) {
|
||||||
|
if (!(commandSender instanceof Player)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
PlotPlayer<?> player = BukkitUtil.adapt((Player) commandSender);
|
||||||
|
if (args.length == 0) {
|
||||||
|
return Collections.singletonList("plots");
|
||||||
|
}
|
||||||
|
if (!Settings.Enabled_Components.TAB_COMPLETED_ALIASES.contains(label.toLowerCase(Locale.ENGLISH))) {
|
||||||
|
return List.of();
|
||||||
|
}
|
||||||
|
Collection<com.plotsquared.core.command.Command> objects =
|
||||||
|
MainCommand.getInstance().tab(player, args, label.endsWith(" "));
|
||||||
|
if (objects == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
List<String> result = new ArrayList<>();
|
||||||
|
for (com.plotsquared.core.command.Command o : objects) {
|
||||||
|
result.add(o.toString());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,759 +0,0 @@
|
|||||||
package com.plotsquared.bukkit;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.configuration.ConfigurationSection;
|
|
||||||
import com.intellectualcrafters.plot.IPlotMain;
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
|
||||||
import com.intellectualcrafters.plot.config.ConfigurationNode;
|
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
|
||||||
import com.intellectualcrafters.plot.generator.GeneratorWrapper;
|
|
||||||
import com.intellectualcrafters.plot.generator.HybridGen;
|
|
||||||
import com.intellectualcrafters.plot.generator.HybridUtils;
|
|
||||||
import com.intellectualcrafters.plot.generator.IndependentPlotGenerator;
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotArea;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
|
||||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
|
||||||
import com.intellectualcrafters.plot.object.SetupObject;
|
|
||||||
import com.intellectualcrafters.plot.object.chat.PlainChatManager;
|
|
||||||
import com.intellectualcrafters.plot.util.AbstractTitle;
|
|
||||||
import com.intellectualcrafters.plot.util.ChatManager;
|
|
||||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
|
||||||
import com.intellectualcrafters.plot.util.ConsoleColors;
|
|
||||||
import com.intellectualcrafters.plot.util.EconHandler;
|
|
||||||
import com.intellectualcrafters.plot.util.EventUtil;
|
|
||||||
import com.intellectualcrafters.plot.util.InventoryUtil;
|
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
|
||||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
|
||||||
import com.intellectualcrafters.plot.util.SetupUtils;
|
|
||||||
import com.intellectualcrafters.plot.util.StringMan;
|
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandlerImplementation;
|
|
||||||
import com.intellectualcrafters.plot.util.WorldUtil;
|
|
||||||
import com.intellectualcrafters.plot.util.block.QueueProvider;
|
|
||||||
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
|
|
||||||
import com.plotsquared.bukkit.database.plotme.ClassicPlotMeConnector;
|
|
||||||
import com.plotsquared.bukkit.database.plotme.LikePlotMeConverter;
|
|
||||||
import com.plotsquared.bukkit.database.plotme.PlotMeConnector_017;
|
|
||||||
import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
|
|
||||||
import com.plotsquared.bukkit.listeners.ChunkListener;
|
|
||||||
import com.plotsquared.bukkit.listeners.EntitySpawnListener;
|
|
||||||
import com.plotsquared.bukkit.listeners.PlayerEvents;
|
|
||||||
import com.plotsquared.bukkit.listeners.PlayerEvents183;
|
|
||||||
import com.plotsquared.bukkit.listeners.PlayerEvents_1_8;
|
|
||||||
import com.plotsquared.bukkit.listeners.PlayerEvents_1_9;
|
|
||||||
import com.plotsquared.bukkit.listeners.PlotPlusListener;
|
|
||||||
import com.plotsquared.bukkit.listeners.WorldEvents;
|
|
||||||
import com.plotsquared.bukkit.titles.DefaultTitle_19;
|
|
||||||
import com.plotsquared.bukkit.util.BukkitChatManager;
|
|
||||||
import com.plotsquared.bukkit.util.BukkitChunkManager;
|
|
||||||
import com.plotsquared.bukkit.util.BukkitCommand;
|
|
||||||
import com.plotsquared.bukkit.util.BukkitEconHandler;
|
|
||||||
import com.plotsquared.bukkit.util.BukkitEventUtil;
|
|
||||||
import com.plotsquared.bukkit.util.BukkitHybridUtils;
|
|
||||||
import com.plotsquared.bukkit.util.BukkitInventoryUtil;
|
|
||||||
import com.plotsquared.bukkit.util.BukkitSchematicHandler;
|
|
||||||
import com.plotsquared.bukkit.util.BukkitSetupUtils;
|
|
||||||
import com.plotsquared.bukkit.util.BukkitTaskManager;
|
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
|
||||||
import com.plotsquared.bukkit.util.BukkitVersion;
|
|
||||||
import com.plotsquared.bukkit.util.Metrics;
|
|
||||||
import com.plotsquared.bukkit.util.SendChunk;
|
|
||||||
import com.plotsquared.bukkit.util.SetGenCB;
|
|
||||||
import com.plotsquared.bukkit.util.block.BukkitLocalQueue;
|
|
||||||
import com.plotsquared.bukkit.util.block.BukkitLocalQueue_1_7;
|
|
||||||
import com.plotsquared.bukkit.util.block.BukkitLocalQueue_1_8;
|
|
||||||
import com.plotsquared.bukkit.util.block.BukkitLocalQueue_1_8_3;
|
|
||||||
import com.plotsquared.bukkit.util.block.BukkitLocalQueue_1_9;
|
|
||||||
import com.plotsquared.bukkit.uuid.DefaultUUIDWrapper;
|
|
||||||
import com.plotsquared.bukkit.uuid.FileUUIDHandler;
|
|
||||||
import com.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper;
|
|
||||||
import com.plotsquared.bukkit.uuid.OfflineUUIDWrapper;
|
|
||||||
import com.plotsquared.bukkit.uuid.SQLUUIDHandler;
|
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.OfflinePlayer;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.command.PluginCommand;
|
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
|
||||||
import org.bukkit.metadata.MetadataValue;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
import org.bukkit.plugin.PluginManager;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
|
||||||
|
|
||||||
private static ConcurrentHashMap<String, Plugin> pluginMap;
|
|
||||||
|
|
||||||
static {
|
|
||||||
// Disable AWE as otherwise both fail to load
|
|
||||||
PluginManager manager = Bukkit.getPluginManager();
|
|
||||||
try {
|
|
||||||
Settings.load(new File("plugins/PlotSquared/config/settings.yml"));
|
|
||||||
if (Settings.Enabled_Components.PLOTME_CONVERTER) { // Only disable PlotMe if conversion is enabled
|
|
||||||
Field pluginsField = manager.getClass().getDeclaredField("plugins");
|
|
||||||
Field lookupNamesField = manager.getClass().getDeclaredField("lookupNames");
|
|
||||||
pluginsField.setAccessible(true);
|
|
||||||
lookupNamesField.setAccessible(true);
|
|
||||||
List<Plugin> plugins = (List<Plugin>) pluginsField.get(manager);
|
|
||||||
Iterator<Plugin> iter = plugins.iterator();
|
|
||||||
while (iter.hasNext()) {
|
|
||||||
if (iter.next().getName().startsWith("PlotMe")) {
|
|
||||||
iter.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Map<String, Plugin> lookupNames = (Map<String, Plugin>) lookupNamesField.get(manager);
|
|
||||||
lookupNames.remove("PlotMe");
|
|
||||||
lookupNames.remove("PlotMe-DefaultGenerator");
|
|
||||||
pluginsField.set(manager, new ArrayList<Plugin>(plugins) {
|
|
||||||
@Override
|
|
||||||
public boolean add(Plugin plugin) {
|
|
||||||
if (plugin.getName().startsWith("PlotMe")) {
|
|
||||||
System.out.print("Disabling `" + plugin.getName() + "` for PlotMe conversion (configure in PlotSquared settings.yml)");
|
|
||||||
} else {
|
|
||||||
return super.add(plugin);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
pluginMap = new ConcurrentHashMap<String, Plugin>(lookupNames) {
|
|
||||||
@Override
|
|
||||||
public Plugin put(String key, Plugin plugin) {
|
|
||||||
if (!plugin.getName().startsWith("PlotMe")) {
|
|
||||||
return super.put(key, plugin);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
lookupNamesField.set(manager, pluginMap);
|
|
||||||
}
|
|
||||||
} catch (Throwable ignore) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static WorldEdit worldEdit;
|
|
||||||
|
|
||||||
private int[] version;
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int[] getServerVersion() {
|
|
||||||
if (this.version == null) {
|
|
||||||
try {
|
|
||||||
this.version = new int[3];
|
|
||||||
String[] split = Bukkit.getBukkitVersion().split("-")[0].split("\\.");
|
|
||||||
this.version[0] = Integer.parseInt(split[0]);
|
|
||||||
this.version[1] = Integer.parseInt(split[1]);
|
|
||||||
if (split.length == 3) {
|
|
||||||
this.version[2] = Integer.parseInt(split[2]);
|
|
||||||
}
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
PS.debug(StringMan.getString(Bukkit.getBukkitVersion()));
|
|
||||||
PS.debug(StringMan.getString(Bukkit.getBukkitVersion().split("-")[0].split("\\.")));
|
|
||||||
return new int[]{1, 10, 0};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return this.version;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onEnable() {
|
|
||||||
if (pluginMap != null) {
|
|
||||||
pluginMap.put("PlotMe-DefaultGenerator", this);
|
|
||||||
}
|
|
||||||
this.name = getDescription().getName();
|
|
||||||
getServer().getName();
|
|
||||||
new PS(this, "Bukkit");
|
|
||||||
if (Settings.Enabled_Components.METRICS) {
|
|
||||||
new Metrics(this).start();
|
|
||||||
PS.log(C.PREFIX + "&6Metrics enabled.");
|
|
||||||
} else {
|
|
||||||
PS.log(C.CONSOLE_PLEASE_ENABLE_METRICS.f(getPluginName()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDisable() {
|
|
||||||
PS.get().disable();
|
|
||||||
Bukkit.getScheduler().cancelTasks(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void log(String message) {
|
|
||||||
try {
|
|
||||||
message = C.color(message);
|
|
||||||
if (!Settings.Chat.CONSOLE_COLOR) {
|
|
||||||
message = ChatColor.stripColor(message);
|
|
||||||
}
|
|
||||||
this.getServer().getConsoleSender().sendMessage(message);
|
|
||||||
} catch (Throwable ignored) {
|
|
||||||
System.out.println(ConsoleColors.fromString(message));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void disable() {
|
|
||||||
onDisable();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int[] getPluginVersion() {
|
|
||||||
String ver = getDescription().getVersion();
|
|
||||||
if (ver.contains("-")) {
|
|
||||||
ver = ver.split("-")[0];
|
|
||||||
}
|
|
||||||
String[] split = ver.split("\\.");
|
|
||||||
return new int[]{Integer.parseInt(split[0]), Integer.parseInt(split[1]), Integer.parseInt(split[2])};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public String getPluginVersionString() {
|
|
||||||
return getDescription().getVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPluginName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerCommands() {
|
|
||||||
BukkitCommand bukkitCommand = new BukkitCommand();
|
|
||||||
PluginCommand plotCommand = getCommand("plots");
|
|
||||||
plotCommand.setExecutor(bukkitCommand);
|
|
||||||
plotCommand.setAliases(Arrays.asList("p", "ps", "plotme", "plot"));
|
|
||||||
plotCommand.setTabCompleter(bukkitCommand);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public File getDirectory() {
|
|
||||||
return getDataFolder();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public File getWorldContainer() {
|
|
||||||
return Bukkit.getWorldContainer();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TaskManager getTaskManager() {
|
|
||||||
return new BukkitTaskManager(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void runEntityTask() {
|
|
||||||
PS.log(C.PREFIX + "KillAllEntities started.");
|
|
||||||
TaskManager.runTaskRepeat(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
PS.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
|
||||||
@Override
|
|
||||||
public void run(PlotArea plotArea) {
|
|
||||||
World world = Bukkit.getWorld(plotArea.worldname);
|
|
||||||
try {
|
|
||||||
if (world == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
List<Entity> entities = world.getEntities();
|
|
||||||
Iterator<Entity> iterator = entities.iterator();
|
|
||||||
while (iterator.hasNext()) {
|
|
||||||
Entity entity = iterator.next();
|
|
||||||
switch (entity.getType()) {
|
|
||||||
case EGG:
|
|
||||||
case COMPLEX_PART:
|
|
||||||
case FISHING_HOOK:
|
|
||||||
case ENDER_SIGNAL:
|
|
||||||
case LINGERING_POTION:
|
|
||||||
case AREA_EFFECT_CLOUD:
|
|
||||||
case EXPERIENCE_ORB:
|
|
||||||
case LEASH_HITCH:
|
|
||||||
case FIREWORK:
|
|
||||||
case WEATHER:
|
|
||||||
case LIGHTNING:
|
|
||||||
case WITHER_SKULL:
|
|
||||||
case UNKNOWN:
|
|
||||||
case PLAYER:
|
|
||||||
// non moving / unmovable
|
|
||||||
continue;
|
|
||||||
case THROWN_EXP_BOTTLE:
|
|
||||||
case SPLASH_POTION:
|
|
||||||
case SNOWBALL:
|
|
||||||
case SHULKER_BULLET:
|
|
||||||
case SPECTRAL_ARROW:
|
|
||||||
case TIPPED_ARROW:
|
|
||||||
case ENDER_PEARL:
|
|
||||||
case ARROW:
|
|
||||||
case LLAMA_SPIT:
|
|
||||||
// managed elsewhere | projectile
|
|
||||||
continue;
|
|
||||||
case ITEM_FRAME:
|
|
||||||
case PAINTING:
|
|
||||||
// Not vehicles
|
|
||||||
continue;
|
|
||||||
case ARMOR_STAND:
|
|
||||||
// Temporarily classify as vehicle
|
|
||||||
case MINECART:
|
|
||||||
case MINECART_CHEST:
|
|
||||||
case MINECART_COMMAND:
|
|
||||||
case MINECART_FURNACE:
|
|
||||||
case MINECART_HOPPER:
|
|
||||||
case MINECART_MOB_SPAWNER:
|
|
||||||
case ENDER_CRYSTAL:
|
|
||||||
case MINECART_TNT:
|
|
||||||
case BOAT:
|
|
||||||
if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) {
|
|
||||||
com.intellectualcrafters.plot.object.Location location = BukkitUtil.getLocation(entity.getLocation());
|
|
||||||
Plot plot = location.getPlot();
|
|
||||||
if (plot == null) {
|
|
||||||
if (location.isPlotArea()) {
|
|
||||||
iterator.remove();
|
|
||||||
entity.remove();
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
List<MetadataValue> meta = entity.getMetadata("plot");
|
|
||||||
if (meta.isEmpty()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
Plot origin = (Plot) meta.get(0).value();
|
|
||||||
if (!plot.equals(origin.getBasePlot(false))) {
|
|
||||||
iterator.remove();
|
|
||||||
entity.remove();
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
case SMALL_FIREBALL:
|
|
||||||
case FIREBALL:
|
|
||||||
case DRAGON_FIREBALL:
|
|
||||||
case DROPPED_ITEM:
|
|
||||||
// dropped item
|
|
||||||
continue;
|
|
||||||
case PRIMED_TNT:
|
|
||||||
case FALLING_BLOCK:
|
|
||||||
// managed elsewhere
|
|
||||||
continue;
|
|
||||||
case LLAMA:
|
|
||||||
case DONKEY:
|
|
||||||
case MULE:
|
|
||||||
case ZOMBIE_HORSE:
|
|
||||||
case SKELETON_HORSE:
|
|
||||||
case HUSK:
|
|
||||||
case ELDER_GUARDIAN:
|
|
||||||
case WITHER_SKELETON:
|
|
||||||
case STRAY:
|
|
||||||
case ZOMBIE_VILLAGER:
|
|
||||||
case EVOKER:
|
|
||||||
case EVOKER_FANGS:
|
|
||||||
case VEX:
|
|
||||||
case VINDICATOR:
|
|
||||||
case POLAR_BEAR:
|
|
||||||
case BAT:
|
|
||||||
case BLAZE:
|
|
||||||
case CAVE_SPIDER:
|
|
||||||
case CHICKEN:
|
|
||||||
case COW:
|
|
||||||
case CREEPER:
|
|
||||||
case ENDERMAN:
|
|
||||||
case ENDERMITE:
|
|
||||||
case ENDER_DRAGON:
|
|
||||||
case GHAST:
|
|
||||||
case GIANT:
|
|
||||||
case GUARDIAN:
|
|
||||||
case HORSE:
|
|
||||||
case IRON_GOLEM:
|
|
||||||
case MAGMA_CUBE:
|
|
||||||
case MUSHROOM_COW:
|
|
||||||
case OCELOT:
|
|
||||||
case PIG:
|
|
||||||
case PIG_ZOMBIE:
|
|
||||||
case RABBIT:
|
|
||||||
case SHEEP:
|
|
||||||
case SILVERFISH:
|
|
||||||
case SKELETON:
|
|
||||||
case SLIME:
|
|
||||||
case SNOWMAN:
|
|
||||||
case SPIDER:
|
|
||||||
case SQUID:
|
|
||||||
case VILLAGER:
|
|
||||||
case WITCH:
|
|
||||||
case WITHER:
|
|
||||||
case WOLF:
|
|
||||||
case ZOMBIE:
|
|
||||||
case SHULKER:
|
|
||||||
default:
|
|
||||||
if (Settings.Enabled_Components.KILL_ROAD_MOBS) {
|
|
||||||
Location location = entity.getLocation();
|
|
||||||
if (BukkitUtil.getLocation(location).isPlotRoad()) {
|
|
||||||
if (entity instanceof LivingEntity) {
|
|
||||||
LivingEntity livingEntity = (LivingEntity) entity;
|
|
||||||
if (!livingEntity.isLeashed() || !entity.hasMetadata("keep")) {
|
|
||||||
Entity passenger = entity.getPassenger();
|
|
||||||
if (!(passenger instanceof Player) && entity.getMetadata("keep").isEmpty()) {
|
|
||||||
iterator.remove();
|
|
||||||
entity.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Entity passenger = entity.getPassenger();
|
|
||||||
if (!(passenger instanceof Player) && entity.getMetadata("keep").isEmpty()) {
|
|
||||||
iterator.remove();
|
|
||||||
entity.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, 20);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final ChunkGenerator getDefaultWorldGenerator(String world, String id) {
|
|
||||||
if (Settings.Enabled_Components.PLOTME_CONVERTER) {
|
|
||||||
initPlotMeConverter();
|
|
||||||
Settings.Enabled_Components.PLOTME_CONVERTER = false;
|
|
||||||
}
|
|
||||||
IndependentPlotGenerator result = PS.get().IMP.getDefaultGenerator();
|
|
||||||
if (!PS.get().setupPlotWorld(world, id, result)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return (ChunkGenerator) result.specify(world);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerPlayerEvents() {
|
|
||||||
PlayerEvents main = new PlayerEvents();
|
|
||||||
getServer().getPluginManager().registerEvents(main, this);
|
|
||||||
try {
|
|
||||||
getServer().getClass().getMethod("spigot");
|
|
||||||
getServer().getPluginManager().registerEvents(new EntitySpawnListener(), this);
|
|
||||||
} catch (NoSuchMethodException ignored) {
|
|
||||||
PS.debug("Not running Spigot. Skipping EntitySpawnListener event.");
|
|
||||||
}
|
|
||||||
if (PS.get().checkVersion(getServerVersion(), BukkitVersion.v1_8_0)) {
|
|
||||||
try {
|
|
||||||
getServer().getPluginManager().registerEvents(new PlayerEvents_1_8(), this);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (PS.get().checkVersion(getServerVersion(), BukkitVersion.v1_8_3)) {
|
|
||||||
try {
|
|
||||||
getServer().getPluginManager().registerEvents(new PlayerEvents183(), this);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (PS.get().checkVersion(getServerVersion(), BukkitVersion.v1_9_0)) {
|
|
||||||
try {
|
|
||||||
getServer().getPluginManager().registerEvents(new PlayerEvents_1_9(main), this);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerInventoryEvents() {
|
|
||||||
// Part of PlayerEvents - can be moved if necessary
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerPlotPlusEvents() {
|
|
||||||
PlotPlusListener.startRunnable(this);
|
|
||||||
getServer().getPluginManager().registerEvents(new PlotPlusListener(), this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerForceFieldEvents() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean initWorldEdit() {
|
|
||||||
if (getServer().getPluginManager().getPlugin("WorldEdit") != null) {
|
|
||||||
worldEdit = WorldEdit.getInstance();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EconHandler getEconomyHandler() {
|
|
||||||
try {
|
|
||||||
BukkitEconHandler econ = new BukkitEconHandler();
|
|
||||||
if (econ.init()) {
|
|
||||||
return econ;
|
|
||||||
}
|
|
||||||
} catch (Throwable ignored) {
|
|
||||||
PS.debug("No economy detected!");
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public QueueProvider initBlockQueue() {
|
|
||||||
try {
|
|
||||||
new SendChunk();
|
|
||||||
MainUtil.canSendChunk = true;
|
|
||||||
} catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException e) {
|
|
||||||
PS.debug(SendChunk.class + " does not support " + StringMan.getString(getServerVersion()));
|
|
||||||
MainUtil.canSendChunk = false;
|
|
||||||
}
|
|
||||||
if (PS.get().checkVersion(getServerVersion(), BukkitVersion.v1_9_0)) {
|
|
||||||
return QueueProvider.of(BukkitLocalQueue_1_9.class, BukkitLocalQueue.class);
|
|
||||||
}
|
|
||||||
if (PS.get().checkVersion(getServerVersion(), BukkitVersion.v1_8_3)) {
|
|
||||||
return QueueProvider.of(BukkitLocalQueue_1_8_3.class, BukkitLocalQueue.class);
|
|
||||||
}
|
|
||||||
if (PS.get().checkVersion(getServerVersion(), BukkitVersion.v1_8_0)) {
|
|
||||||
return QueueProvider.of(BukkitLocalQueue_1_8.class, BukkitLocalQueue.class);
|
|
||||||
}
|
|
||||||
return QueueProvider.of(BukkitLocalQueue_1_7.class, BukkitLocalQueue.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public WorldUtil initWorldUtil() {
|
|
||||||
return new BukkitUtil();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean initPlotMeConverter() {
|
|
||||||
if (new LikePlotMeConverter("PlotMe").run(new ClassicPlotMeConnector())) {
|
|
||||||
return true;
|
|
||||||
} else if (new LikePlotMeConverter("PlotMe").run(new PlotMeConnector_017())) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public GeneratorWrapper<?> getGenerator(String world, String name) {
|
|
||||||
if (name == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
Plugin genPlugin = Bukkit.getPluginManager().getPlugin(name);
|
|
||||||
if (genPlugin != null && genPlugin.isEnabled()) {
|
|
||||||
ChunkGenerator gen = genPlugin.getDefaultWorldGenerator(world, "");
|
|
||||||
if (gen instanceof GeneratorWrapper<?>) {
|
|
||||||
return (GeneratorWrapper<?>) gen;
|
|
||||||
}
|
|
||||||
return new BukkitPlotGenerator(world, gen);
|
|
||||||
} else {
|
|
||||||
return new BukkitPlotGenerator(PS.get().IMP.getDefaultGenerator());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HybridUtils initHybridUtils() {
|
|
||||||
return new BukkitHybridUtils();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SetupUtils initSetupUtils() {
|
|
||||||
return new BukkitSetupUtils();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UUIDHandlerImplementation initUUIDHandler() {
|
|
||||||
boolean checkVersion = PS.get().checkVersion(getServerVersion(), BukkitVersion.v1_7_6);
|
|
||||||
UUIDWrapper wrapper;
|
|
||||||
if (Settings.UUID.OFFLINE) {
|
|
||||||
if (Settings.UUID.FORCE_LOWERCASE) {
|
|
||||||
wrapper = new LowerOfflineUUIDWrapper();
|
|
||||||
} else {
|
|
||||||
wrapper = new OfflineUUIDWrapper();
|
|
||||||
}
|
|
||||||
Settings.UUID.OFFLINE = true;
|
|
||||||
} else if (checkVersion) {
|
|
||||||
wrapper = new DefaultUUIDWrapper();
|
|
||||||
Settings.UUID.OFFLINE = false;
|
|
||||||
} else {
|
|
||||||
if (Settings.UUID.FORCE_LOWERCASE) {
|
|
||||||
wrapper = new LowerOfflineUUIDWrapper();
|
|
||||||
} else {
|
|
||||||
wrapper = new OfflineUUIDWrapper();
|
|
||||||
}
|
|
||||||
Settings.UUID.OFFLINE = true;
|
|
||||||
}
|
|
||||||
if (!checkVersion) {
|
|
||||||
PS.log(C.PREFIX + " &c[WARN] Titles are disabled - please update your version of Bukkit to support this feature.");
|
|
||||||
Settings.TITLES = false;
|
|
||||||
} else {
|
|
||||||
AbstractTitle.TITLE_CLASS = new DefaultTitle_19();
|
|
||||||
if (wrapper instanceof DefaultUUIDWrapper || wrapper.getClass() == OfflineUUIDWrapper.class && !Bukkit.getOnlineMode()) {
|
|
||||||
Settings.UUID.NATIVE_UUID_PROVIDER = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Settings.UUID.OFFLINE) {
|
|
||||||
PS.log(C.PREFIX
|
|
||||||
+ " &6" + getPluginName() + " is using Offline Mode UUIDs either because of user preference, or because you are using an old version of "
|
|
||||||
+ "Bukkit");
|
|
||||||
} else {
|
|
||||||
PS.log(C.PREFIX + " &6" + getPluginName() + " is using online UUIDs");
|
|
||||||
}
|
|
||||||
if (Settings.UUID.USE_SQLUUIDHANDLER) {
|
|
||||||
return new SQLUUIDHandler(wrapper);
|
|
||||||
} else {
|
|
||||||
return new FileUUIDHandler(wrapper);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ChunkManager initChunkManager() {
|
|
||||||
return new BukkitChunkManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EventUtil initEventUtil() {
|
|
||||||
return new BukkitEventUtil();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void unregister(PlotPlayer player) {
|
|
||||||
BukkitUtil.removePlayer(player.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerChunkProcessor() {
|
|
||||||
getServer().getPluginManager().registerEvents(new ChunkListener(), this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerWorldEvents() {
|
|
||||||
getServer().getPluginManager().registerEvents(new WorldEvents(), this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IndependentPlotGenerator getDefaultGenerator() {
|
|
||||||
return new HybridGen();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public InventoryUtil initInventoryUtil() {
|
|
||||||
return new BukkitInventoryUtil();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void startMetrics() {
|
|
||||||
new Metrics(this).start();
|
|
||||||
PS.log(C.PREFIX + "&6Metrics enabled.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setGenerator(String worldName) {
|
|
||||||
World world = BukkitUtil.getWorld(worldName);
|
|
||||||
if (world == null) {
|
|
||||||
// create world
|
|
||||||
ConfigurationSection worldConfig = PS.get().worlds.getConfigurationSection("worlds." + worldName);
|
|
||||||
String manager = worldConfig.getString("generator.plugin", getPluginName());
|
|
||||||
SetupObject setup = new SetupObject();
|
|
||||||
setup.plotManager = manager;
|
|
||||||
setup.setupGenerator = worldConfig.getString("generator.init", manager);
|
|
||||||
setup.type = worldConfig.getInt("generator.type");
|
|
||||||
setup.terrain = worldConfig.getInt("generator.terrain");
|
|
||||||
setup.step = new ConfigurationNode[0];
|
|
||||||
setup.world = worldName;
|
|
||||||
SetupUtils.manager.setupWorld(setup);
|
|
||||||
world = Bukkit.getWorld(worldName);
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
if (!PS.get().hasPlotArea(worldName)) {
|
|
||||||
SetGenCB.setGenerator(BukkitUtil.getWorld(worldName));
|
|
||||||
}
|
|
||||||
} catch (Exception ignored) {
|
|
||||||
PS.log("Failed to reload world: " + world + " | " + ignored.getMessage());
|
|
||||||
Bukkit.getServer().unloadWorld(world, false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ChunkGenerator gen = world.getGenerator();
|
|
||||||
if (gen instanceof BukkitPlotGenerator) {
|
|
||||||
PS.get().loadWorld(worldName, (BukkitPlotGenerator) gen);
|
|
||||||
} else if (gen != null) {
|
|
||||||
PS.get().loadWorld(worldName, new BukkitPlotGenerator(worldName, gen));
|
|
||||||
} else if (PS.get().worlds.contains("worlds." + worldName)) {
|
|
||||||
PS.get().loadWorld(worldName, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SchematicHandler initSchematicHandler() {
|
|
||||||
return new BukkitSchematicHandler();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AbstractTitle initTitleManager() {
|
|
||||||
// Already initialized in UUID handler
|
|
||||||
return AbstractTitle.TITLE_CLASS;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PlotPlayer wrapPlayer(Object player) {
|
|
||||||
if (player instanceof Player) {
|
|
||||||
return BukkitUtil.getPlayer((Player) player);
|
|
||||||
}
|
|
||||||
if (player instanceof OfflinePlayer) {
|
|
||||||
return BukkitUtil.getPlayer((OfflinePlayer) player);
|
|
||||||
}
|
|
||||||
if (player instanceof String) {
|
|
||||||
return UUIDHandler.getPlayer((String) player);
|
|
||||||
}
|
|
||||||
if (player instanceof UUID) {
|
|
||||||
return UUIDHandler.getPlayer((UUID) player);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getNMSPackage() {
|
|
||||||
String name = Bukkit.getServer().getClass().getPackage().getName();
|
|
||||||
return name.substring(name.lastIndexOf('.') + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ChatManager<?> initChatManager() {
|
|
||||||
if (Settings.Chat.INTERACTIVE) {
|
|
||||||
return new BukkitChatManager();
|
|
||||||
} else {
|
|
||||||
return new PlainChatManager();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public GeneratorWrapper<?> wrapPlotGenerator(String world, IndependentPlotGenerator generator) {
|
|
||||||
return new BukkitPlotGenerator(generator);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> getPluginIds() {
|
|
||||||
ArrayList<String> names = new ArrayList<>();
|
|
||||||
for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
|
|
||||||
names.add(plugin.getName() + ';' + plugin.getDescription().getVersion() + ':' + plugin.isEnabled());
|
|
||||||
}
|
|
||||||
return names;
|
|
||||||
}
|
|
||||||
}
|
|
1266
Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java
Normal file
1266
Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,111 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.chat;
|
|
||||||
|
|
||||||
import org.apache.commons.lang.Validate;
|
|
||||||
|
|
||||||
import java.lang.reflect.Array;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a wrapper around an array class of an arbitrary reference type,
|
|
||||||
* which properly implements "value" hash code and equality functions.
|
|
||||||
* <p>
|
|
||||||
* This class is intended for use as a key to a map.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param <E> The type of elements in the array.
|
|
||||||
* @author Glen Husman
|
|
||||||
* @see Arrays
|
|
||||||
*/
|
|
||||||
public final class ArrayWrapper<E> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates an array wrapper with some elements.
|
|
||||||
*
|
|
||||||
* @param elements The elements of the array.
|
|
||||||
*/
|
|
||||||
public ArrayWrapper(E... elements) {
|
|
||||||
setArray(elements);
|
|
||||||
}
|
|
||||||
|
|
||||||
private E[] _array;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves a reference to the wrapped array instance.
|
|
||||||
*
|
|
||||||
* @return The array wrapped by this instance.
|
|
||||||
*/
|
|
||||||
public E[] getArray() {
|
|
||||||
return _array;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set this wrapper to wrap a new array instance.
|
|
||||||
*
|
|
||||||
* @param array The new wrapped array.
|
|
||||||
*/
|
|
||||||
public void setArray(E[] array) {
|
|
||||||
Validate.notNull(array, "The array must not be null.");
|
|
||||||
_array = array;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determines if this object has a value equivalent to another object.
|
|
||||||
*
|
|
||||||
* @see Arrays#equals(Object[], Object[])
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("rawtypes")
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object other) {
|
|
||||||
if (!(other instanceof ArrayWrapper)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return Arrays.equals(_array, ((ArrayWrapper) other)._array);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the hash code represented by this objects value.
|
|
||||||
*
|
|
||||||
* @return This object's hash code.
|
|
||||||
* @see Arrays#hashCode(Object[])
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Arrays.hashCode(_array);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts an iterable element collection to an array of elements.
|
|
||||||
* The iteration order of the specified object will be used as the array element order.
|
|
||||||
*
|
|
||||||
* @param list The iterable of objects which will be converted to an array.
|
|
||||||
* @param c The type of the elements of the array.
|
|
||||||
* @return An array of elements in the specified iterable.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static <T> T[] toArray(Iterable<? extends T> list, Class<T> c) {
|
|
||||||
int size = -1;
|
|
||||||
if (list instanceof Collection<?>) {
|
|
||||||
@SuppressWarnings("rawtypes")
|
|
||||||
Collection coll = (Collection) list;
|
|
||||||
size = coll.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (size < 0) {
|
|
||||||
size = 0;
|
|
||||||
// Ugly hack: Count it ourselves
|
|
||||||
for (@SuppressWarnings("unused") T element : list) {
|
|
||||||
size++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
T[] result = (T[]) Array.newInstance(c, size);
|
|
||||||
int i = 0;
|
|
||||||
for (T element : list) { // Assumes iteration order is consistent
|
|
||||||
result[i++] = element; // Assign array element at index THEN increment counter
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,886 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.chat;
|
|
||||||
|
|
||||||
import static com.plotsquared.bukkit.chat.TextualComponent.rawText;
|
|
||||||
|
|
||||||
import com.google.gson.JsonArray;
|
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import com.google.gson.JsonParser;
|
|
||||||
import com.google.gson.stream.JsonWriter;
|
|
||||||
import org.bukkit.Achievement;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.Statistic;
|
|
||||||
import org.bukkit.Statistic.Type;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
|
||||||
import org.bukkit.configuration.serialization.ConfigurationSerialization;
|
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.StringWriter;
|
|
||||||
import java.lang.reflect.Constructor;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.lang.reflect.Modifier;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a formattable message. Such messages can use elements such as colors, formatting codes, hover and click data, and other features provided by the vanilla Minecraft <a href="http://minecraft.gamepedia.com/Tellraw#Raw_JSON_Text">JSON message formatter</a>.
|
|
||||||
* This class allows plugins to emulate the functionality of the vanilla Minecraft <a href="http://minecraft.gamepedia.com/Commands#tellraw">tellraw command</a>.
|
|
||||||
* <p>
|
|
||||||
* This class follows the builder pattern, allowing for method chaining.
|
|
||||||
* It is set up such that invocations of property-setting methods will affect the current editing component,
|
|
||||||
* and a call to {@link #then()} or {@link #then(String)} will append a new editing component to the end of the message,
|
|
||||||
* optionally initializing it with text. Further property-setting method calls will affect that editing component.
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
public class FancyMessage implements JsonRepresentedObject, Cloneable, Iterable<MessagePart>, ConfigurationSerializable {
|
|
||||||
|
|
||||||
static {
|
|
||||||
ConfigurationSerialization.registerClass(FancyMessage.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<MessagePart> messageParts;
|
|
||||||
private String jsonString;
|
|
||||||
private boolean dirty;
|
|
||||||
|
|
||||||
private static Constructor<?> nmsPacketPlayOutChatConstructor;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public FancyMessage clone() throws CloneNotSupportedException {
|
|
||||||
FancyMessage instance = (FancyMessage) super.clone();
|
|
||||||
instance.messageParts = new ArrayList<>(messageParts.size());
|
|
||||||
for (int i = 0; i < messageParts.size(); i++) {
|
|
||||||
instance.messageParts.add(i, messageParts.get(i).clone());
|
|
||||||
}
|
|
||||||
instance.dirty = false;
|
|
||||||
instance.jsonString = null;
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a JSON message with text.
|
|
||||||
*
|
|
||||||
* @param firstPartText The existing text in the message.
|
|
||||||
*/
|
|
||||||
public FancyMessage(final String firstPartText) {
|
|
||||||
this(rawText(firstPartText));
|
|
||||||
}
|
|
||||||
|
|
||||||
private FancyMessage(final TextualComponent firstPartText) {
|
|
||||||
messageParts = new ArrayList<>();
|
|
||||||
messageParts.add(new MessagePart(firstPartText));
|
|
||||||
jsonString = null;
|
|
||||||
dirty = false;
|
|
||||||
if (nmsPacketPlayOutChatConstructor == null) {
|
|
||||||
try {
|
|
||||||
nmsPacketPlayOutChatConstructor = Reflection.getNMSClass("PacketPlayOutChat").getDeclaredConstructor(Reflection.getNMSClass("IChatBaseComponent"));
|
|
||||||
nmsPacketPlayOutChatConstructor.setAccessible(true);
|
|
||||||
} catch (NoSuchMethodException e) {
|
|
||||||
Bukkit.getLogger().log(Level.SEVERE, "Could not find Minecraft method or constructor.", e);
|
|
||||||
} catch (SecurityException e) {
|
|
||||||
Bukkit.getLogger().log(Level.WARNING, "Could not access constructor.", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a JSON message without text.
|
|
||||||
*/
|
|
||||||
public FancyMessage() {
|
|
||||||
this((TextualComponent) null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the text of the current editing component to a value.
|
|
||||||
*
|
|
||||||
* @param text The new text of the current editing component.
|
|
||||||
* @return This builder instance.
|
|
||||||
*/
|
|
||||||
public FancyMessage text(String text) {
|
|
||||||
MessagePart latest = latest();
|
|
||||||
latest.text = rawText(text);
|
|
||||||
dirty = true;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the text of the current editing component to a value.
|
|
||||||
*
|
|
||||||
* @param text The new text of the current editing component.
|
|
||||||
* @return This builder instance.
|
|
||||||
*/
|
|
||||||
public FancyMessage text(TextualComponent text) {
|
|
||||||
MessagePart latest = latest();
|
|
||||||
latest.text = text;
|
|
||||||
dirty = true;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the color of the current editing component to a value.
|
|
||||||
*
|
|
||||||
* @param color The new color of the current editing component.
|
|
||||||
* @return This builder instance.
|
|
||||||
* @throws IllegalArgumentException If the specified {@code ChatColor} enumeration value is not a color (but a format value).
|
|
||||||
*/
|
|
||||||
public FancyMessage color(final ChatColor color) {
|
|
||||||
if (!color.isColor()) {
|
|
||||||
throw new IllegalArgumentException(color.name() + " is not a color");
|
|
||||||
}
|
|
||||||
latest().color = color;
|
|
||||||
dirty = true;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the stylization of the current editing component.
|
|
||||||
*
|
|
||||||
* @param styles The array of styles to apply to the editing component.
|
|
||||||
* @return This builder instance.
|
|
||||||
* @throws IllegalArgumentException If any of the enumeration values in the array do not represent formatters.
|
|
||||||
*/
|
|
||||||
public FancyMessage style(ChatColor... styles) {
|
|
||||||
for (final ChatColor style : styles) {
|
|
||||||
if (!style.isFormat()) {
|
|
||||||
throw new IllegalArgumentException(style.name() + " is not a style");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
latest().styles.addAll(Arrays.asList(styles));
|
|
||||||
dirty = true;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the behavior of the current editing component to instruct the client to open a file on the client side filesystem when the currently edited part of the {@code FancyMessage} is clicked.
|
|
||||||
*
|
|
||||||
* @param path The path of the file on the client filesystem.
|
|
||||||
* @return This builder instance.
|
|
||||||
*/
|
|
||||||
public FancyMessage file(final String path) {
|
|
||||||
onClick("open_file", path);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the behavior of the current editing component to instruct the client to open a webpage in the client's web browser when the currently edited part of the {@code FancyMessage} is clicked.
|
|
||||||
*
|
|
||||||
* @param url The URL of the page to open when the link is clicked.
|
|
||||||
* @return This builder instance.
|
|
||||||
*/
|
|
||||||
public FancyMessage link(final String url) {
|
|
||||||
onClick("open_url", url);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the behavior of the current editing component to instruct the client to replace the chat input box content with the specified string when the currently edited part of the {@code FancyMessage} is clicked.
|
|
||||||
* The client will not immediately send the command to the server to be executed unless the client player submits the command/chat message, usually with the enter key.
|
|
||||||
*
|
|
||||||
* @param command The text to display in the chat bar of the client.
|
|
||||||
* @return This builder instance.
|
|
||||||
*/
|
|
||||||
public FancyMessage suggest(final String command) {
|
|
||||||
onClick("suggest_command", command);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the behavior of the current editing component to instruct the client to append the chat input box content with the specified string when the currently edited part of the {@code FancyMessage} is SHIFT-CLICKED.
|
|
||||||
* The client will not immediately send the command to the server to be executed unless the client player submits the command/chat message, usually with the enter key.
|
|
||||||
*
|
|
||||||
* @param command The text to append to the chat bar of the client.
|
|
||||||
* @return This builder instance.
|
|
||||||
*/
|
|
||||||
public FancyMessage insert(final String command) {
|
|
||||||
latest().insertionData = command;
|
|
||||||
dirty = true;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the behavior of the current editing component to instruct the client to send the specified string to the server as a chat message when the currently edited part of the {@code FancyMessage} is clicked.
|
|
||||||
* The client <b>will</b> immediately send the command to the server to be executed when the editing component is clicked.
|
|
||||||
*
|
|
||||||
* @param command The text to display in the chat bar of the client.
|
|
||||||
* @return This builder instance.
|
|
||||||
*/
|
|
||||||
public FancyMessage command(final String command) {
|
|
||||||
onClick("run_command", command);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the behavior of the current editing component to display information about an achievement when the client hovers over the text.
|
|
||||||
* <p>Tooltips do not inherit display characteristics, such as color and styles, from the message component on which they are applied.</p>
|
|
||||||
*
|
|
||||||
* @param name The name of the achievement to display, excluding the "achievement." prefix.
|
|
||||||
* @return This builder instance.
|
|
||||||
*/
|
|
||||||
public FancyMessage achievementTooltip(final String name) {
|
|
||||||
onHover("show_achievement", new JsonString("achievement." + name));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the behavior of the current editing component to display information about an achievement when the client hovers over the text.
|
|
||||||
* <p>Tooltips do not inherit display characteristics, such as color and styles, from the message component on which they are applied.</p>
|
|
||||||
*
|
|
||||||
* @param which The achievement to display.
|
|
||||||
* @return This builder instance.
|
|
||||||
*/
|
|
||||||
public FancyMessage achievementTooltip(final Achievement which) {
|
|
||||||
try {
|
|
||||||
Object achievement = Reflection.getMethod(Reflection.getOBCClass("CraftStatistic"), "getNMSAchievement", Achievement.class).invoke(null, which);
|
|
||||||
return achievementTooltip((String) Reflection.getField(Reflection.getNMSClass("Achievement"), "name").get(achievement));
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
Bukkit.getLogger().log(Level.WARNING, "Could not access method.", e);
|
|
||||||
return this;
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
Bukkit.getLogger().log(Level.WARNING, "Argument could not be passed.", e);
|
|
||||||
return this;
|
|
||||||
} catch (InvocationTargetException e) {
|
|
||||||
Bukkit.getLogger().log(Level.WARNING, "A error has occurred during invoking of method.", e);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the behavior of the current editing component to display information about a parameterless statistic when the client hovers over the text.
|
|
||||||
* <p>Tooltips do not inherit display characteristics, such as color and styles, from the message component on which they are applied.</p>
|
|
||||||
*
|
|
||||||
* @param which The statistic to display.
|
|
||||||
* @return This builder instance.
|
|
||||||
* @throws IllegalArgumentException If the statistic requires a parameter which was not supplied.
|
|
||||||
*/
|
|
||||||
public FancyMessage statisticTooltip(final Statistic which) {
|
|
||||||
Type type = which.getType();
|
|
||||||
if (type != Type.UNTYPED) {
|
|
||||||
throw new IllegalArgumentException("That statistic requires an additional " + type + " parameter!");
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
Object statistic = Reflection.getMethod(Reflection.getOBCClass("CraftStatistic"), "getNMSStatistic", Statistic.class).invoke(null, which);
|
|
||||||
return achievementTooltip((String) Reflection.getField(Reflection.getNMSClass("Statistic"), "name").get(statistic));
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
Bukkit.getLogger().log(Level.WARNING, "Could not access method.", e);
|
|
||||||
return this;
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
Bukkit.getLogger().log(Level.WARNING, "Argument could not be passed.", e);
|
|
||||||
return this;
|
|
||||||
} catch (InvocationTargetException e) {
|
|
||||||
Bukkit.getLogger().log(Level.WARNING, "A error has occurred during invoking of method.", e);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the behavior of the current editing component to display information about a statistic parameter with a material when the client hovers over the text.
|
|
||||||
* <p>Tooltips do not inherit display characteristics, such as color and styles, from the message component on which they are applied.</p>
|
|
||||||
*
|
|
||||||
* @param which The statistic to display.
|
|
||||||
* @param item The sole material parameter to the statistic.
|
|
||||||
* @return This builder instance.
|
|
||||||
* @throws IllegalArgumentException If the statistic requires a parameter which was not supplied, or was supplied a parameter that was not required.
|
|
||||||
*/
|
|
||||||
public FancyMessage statisticTooltip(final Statistic which, Material item) {
|
|
||||||
Type type = which.getType();
|
|
||||||
if (type == Type.UNTYPED) {
|
|
||||||
throw new IllegalArgumentException("That statistic needs no additional parameter!");
|
|
||||||
}
|
|
||||||
if ((type == Type.BLOCK && item.isBlock()) || type == Type.ENTITY) {
|
|
||||||
throw new IllegalArgumentException("Wrong parameter type for that statistic - needs " + type + "!");
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
Object statistic = Reflection.getMethod(Reflection.getOBCClass("CraftStatistic"), "getMaterialStatistic", Statistic.class, Material.class).invoke(null, which, item);
|
|
||||||
return achievementTooltip((String) Reflection.getField(Reflection.getNMSClass("Statistic"), "name").get(statistic));
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
Bukkit.getLogger().log(Level.WARNING, "Could not access method.", e);
|
|
||||||
return this;
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
Bukkit.getLogger().log(Level.WARNING, "Argument could not be passed.", e);
|
|
||||||
return this;
|
|
||||||
} catch (InvocationTargetException e) {
|
|
||||||
Bukkit.getLogger().log(Level.WARNING, "A error has occurred during invoking of method.", e);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the behavior of the current editing component to display information about a statistic parameter with an entity type when the client hovers over the text.
|
|
||||||
* <p>Tooltips do not inherit display characteristics, such as color and styles, from the message component on which they are applied.</p>
|
|
||||||
*
|
|
||||||
* @param which The statistic to display.
|
|
||||||
* @param entity The sole entity type parameter to the statistic.
|
|
||||||
* @return This builder instance.
|
|
||||||
* @throws IllegalArgumentException If the statistic requires a parameter which was not supplied, or was supplied a parameter that was not required.
|
|
||||||
*/
|
|
||||||
public FancyMessage statisticTooltip(final Statistic which, EntityType entity) {
|
|
||||||
Type type = which.getType();
|
|
||||||
if (type == Type.UNTYPED) {
|
|
||||||
throw new IllegalArgumentException("That statistic needs no additional parameter!");
|
|
||||||
}
|
|
||||||
if (type != Type.ENTITY) {
|
|
||||||
throw new IllegalArgumentException("Wrong parameter type for that statistic - needs " + type + "!");
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
Object statistic = Reflection.getMethod(Reflection.getOBCClass("CraftStatistic"), "getEntityStatistic", Statistic.class, EntityType.class).invoke(null, which, entity);
|
|
||||||
return achievementTooltip((String) Reflection.getField(Reflection.getNMSClass("Statistic"), "name").get(statistic));
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
Bukkit.getLogger().log(Level.WARNING, "Could not access method.", e);
|
|
||||||
return this;
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
Bukkit.getLogger().log(Level.WARNING, "Argument could not be passed.", e);
|
|
||||||
return this;
|
|
||||||
} catch (InvocationTargetException e) {
|
|
||||||
Bukkit.getLogger().log(Level.WARNING, "A error has occurred during invoking of method.", e);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the behavior of the current editing component to display information about an item when the client hovers over the text.
|
|
||||||
* <p>Tooltips do not inherit display characteristics, such as color and styles, from the message component on which they are applied.</p>
|
|
||||||
*
|
|
||||||
* @param itemJSON A string representing the JSON-serialized NBT data tag of an {@link ItemStack}.
|
|
||||||
* @return This builder instance.
|
|
||||||
*/
|
|
||||||
public FancyMessage itemTooltip(final String itemJSON) {
|
|
||||||
onHover("show_item", new JsonString(itemJSON)); // Seems a bit hacky, considering we have a JSON object as a parameter
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the behavior of the current editing component to display information about an item when the client hovers over the text.
|
|
||||||
* <p>Tooltips do not inherit display characteristics, such as color and styles, from the message component on which they are applied.</p>
|
|
||||||
*
|
|
||||||
* @param itemStack The stack for which to display information.
|
|
||||||
* @return This builder instance.
|
|
||||||
*/
|
|
||||||
public FancyMessage itemTooltip(final ItemStack itemStack) {
|
|
||||||
try {
|
|
||||||
Object nmsItem = Reflection.getMethod(Reflection.getOBCClass("inventory.CraftItemStack"), "asNMSCopy", ItemStack.class).invoke(null, itemStack);
|
|
||||||
return itemTooltip(Reflection.getMethod(Reflection.getNMSClass("ItemStack"), "save", Reflection.getNMSClass("NBTTagCompound")).invoke(nmsItem, Reflection.getNMSClass("NBTTagCompound").newInstance()).toString());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the behavior of the current editing component to display raw text when the client hovers over the text.
|
|
||||||
* <p>Tooltips do not inherit display characteristics, such as color and styles, from the message component on which they are applied.</p>
|
|
||||||
*
|
|
||||||
* @param text The text, which supports newlines, which will be displayed to the client upon hovering.
|
|
||||||
* @return This builder instance.
|
|
||||||
*/
|
|
||||||
public FancyMessage tooltip(final String text) {
|
|
||||||
onHover("show_text", new JsonString(text));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the behavior of the current editing component to display raw text when the client hovers over the text.
|
|
||||||
* <p>Tooltips do not inherit display characteristics, such as color and styles, from the message component on which they are applied.</p>
|
|
||||||
*
|
|
||||||
* @param lines The lines of text which will be displayed to the client upon hovering. The iteration order of this object will be the order in which the lines of the tooltip are created.
|
|
||||||
* @return This builder instance.
|
|
||||||
*/
|
|
||||||
public FancyMessage tooltip(final Iterable<String> lines) {
|
|
||||||
tooltip(com.plotsquared.bukkit.chat.ArrayWrapper.toArray(lines, String.class));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the behavior of the current editing component to display raw text when the client hovers over the text.
|
|
||||||
* <p>Tooltips do not inherit display characteristics, such as color and styles, from the message component on which they are applied.</p>
|
|
||||||
*
|
|
||||||
* @param lines The lines of text which will be displayed to the client upon hovering.
|
|
||||||
* @return This builder instance.
|
|
||||||
*/
|
|
||||||
public FancyMessage tooltip(final String... lines) {
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
for (int i = 0; i < lines.length; i++) {
|
|
||||||
builder.append(lines[i]);
|
|
||||||
if (i != lines.length - 1) {
|
|
||||||
builder.append('\n');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tooltip(builder.toString());
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the behavior of the current editing component to display formatted text when the client hovers over the text.
|
|
||||||
* <p>Tooltips do not inherit display characteristics, such as color and styles, from the message component on which they are applied.</p>
|
|
||||||
*
|
|
||||||
* @param text The formatted text which will be displayed to the client upon hovering.
|
|
||||||
* @return This builder instance.
|
|
||||||
*/
|
|
||||||
public FancyMessage formattedTooltip(FancyMessage text) {
|
|
||||||
for (MessagePart component : text.messageParts) {
|
|
||||||
if (component.clickActionData != null && component.clickActionName != null) {
|
|
||||||
throw new IllegalArgumentException("The tooltip text cannot have click data.");
|
|
||||||
} else if (component.hoverActionData != null && component.hoverActionName != null) {
|
|
||||||
throw new IllegalArgumentException("The tooltip text cannot have a tooltip.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onHover("show_text", text);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the behavior of the current editing component to display the specified lines of formatted text when the client hovers over the text.
|
|
||||||
* <p>Tooltips do not inherit display characteristics, such as color and styles, from the message component on which they are applied.</p>
|
|
||||||
*
|
|
||||||
* @param lines The lines of formatted text which will be displayed to the client upon hovering.
|
|
||||||
* @return This builder instance.
|
|
||||||
*/
|
|
||||||
public FancyMessage formattedTooltip(FancyMessage... lines) {
|
|
||||||
if (lines.length < 1) {
|
|
||||||
onHover(null, null); // Clear tooltip
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
FancyMessage result = new FancyMessage();
|
|
||||||
result.messageParts.clear(); // Remove the one existing text component that exists by default, which destabilizes the object
|
|
||||||
|
|
||||||
for (int i = 0; i < lines.length; i++) {
|
|
||||||
try {
|
|
||||||
for (MessagePart component : lines[i]) {
|
|
||||||
if (component.clickActionData != null && component.clickActionName != null) {
|
|
||||||
throw new IllegalArgumentException("The tooltip text cannot have click data.");
|
|
||||||
} else if (component.hoverActionData != null && component.hoverActionName != null) {
|
|
||||||
throw new IllegalArgumentException("The tooltip text cannot have a tooltip.");
|
|
||||||
}
|
|
||||||
if (component.hasText()) {
|
|
||||||
result.messageParts.add(component.clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (i != lines.length - 1) {
|
|
||||||
result.messageParts.add(new MessagePart(rawText("\n")));
|
|
||||||
}
|
|
||||||
} catch (CloneNotSupportedException e) {
|
|
||||||
Bukkit.getLogger().log(Level.WARNING, "Failed to clone object", e);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return formattedTooltip(result.messageParts.isEmpty() ? null : result); // Throws NPE if size is 0, intended
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the behavior of the current editing component to display the specified lines of formatted text when the client hovers over the text.
|
|
||||||
* <p>Tooltips do not inherit display characteristics, such as color and styles, from the message component on which they are applied.</p>
|
|
||||||
*
|
|
||||||
* @param lines The lines of text which will be displayed to the client upon hovering. The iteration order of this object will be the order in which the lines of the tooltip are created.
|
|
||||||
* @return This builder instance.
|
|
||||||
*/
|
|
||||||
public FancyMessage formattedTooltip(final Iterable<FancyMessage> lines) {
|
|
||||||
return formattedTooltip(com.plotsquared.bukkit.chat.ArrayWrapper.toArray(lines, FancyMessage.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If the text is a translatable key, and it has replaceable values, this function can be used to set the replacements that will be used in the message.
|
|
||||||
*
|
|
||||||
* @param replacements The replacements, in order, that will be used in the language-specific message.
|
|
||||||
* @return This builder instance.
|
|
||||||
*/
|
|
||||||
public FancyMessage translationReplacements(final String... replacements) {
|
|
||||||
for (String str : replacements) {
|
|
||||||
latest().translationReplacements.add(new JsonString(str));
|
|
||||||
}
|
|
||||||
dirty = true;
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If the text is a translatable key, and it has replaceable values, this function can be used to set the replacements that will be used in the message.
|
|
||||||
* @param replacements The replacements, in order, that will be used in the language-specific message.
|
|
||||||
* @return This builder instance.
|
|
||||||
*/ /* ------------
|
|
||||||
public FancyMessage translationReplacements(final Iterable<? extends CharSequence> replacements){
|
|
||||||
for(CharSequence str : replacements){
|
|
||||||
latest().translationReplacements.add(new JsonString(str));
|
|
||||||
}
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If the text is a translatable key, and it has replaceable values, this function can be used to set the replacements that will be used in the message.
|
|
||||||
*
|
|
||||||
* @param replacements The replacements, in order, that will be used in the language-specific message.
|
|
||||||
* @return This builder instance.
|
|
||||||
*/
|
|
||||||
public FancyMessage translationReplacements(final FancyMessage... replacements) {
|
|
||||||
for (FancyMessage str : replacements) {
|
|
||||||
latest().translationReplacements.add(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
dirty = true;
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If the text is a translatable key, and it has replaceable values, this function can be used to set the replacements that will be used in the message.
|
|
||||||
*
|
|
||||||
* @param replacements The replacements, in order, that will be used in the language-specific message.
|
|
||||||
* @return This builder instance.
|
|
||||||
*/
|
|
||||||
public FancyMessage translationReplacements(final Iterable<FancyMessage> replacements) {
|
|
||||||
return translationReplacements(com.plotsquared.bukkit.chat.ArrayWrapper.toArray(replacements, FancyMessage.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Terminate construction of the current editing component, and begin construction of a new message component.
|
|
||||||
* After a successful call to this method, all setter methods will refer to a new message component, created as a result of the call to this method.
|
|
||||||
*
|
|
||||||
* @param text The text which will populate the new message component.
|
|
||||||
* @return This builder instance.
|
|
||||||
*/
|
|
||||||
public FancyMessage then(final String text) {
|
|
||||||
return then(rawText(text));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Terminate construction of the current editing component, and begin construction of a new message component.
|
|
||||||
* After a successful call to this method, all setter methods will refer to a new message component, created as a result of the call to this method.
|
|
||||||
*
|
|
||||||
* @param text The text which will populate the new message component.
|
|
||||||
* @return This builder instance.
|
|
||||||
*/
|
|
||||||
public FancyMessage then(final TextualComponent text) {
|
|
||||||
if (!latest().hasText()) {
|
|
||||||
throw new IllegalStateException("previous message part has no text");
|
|
||||||
}
|
|
||||||
messageParts.add(new MessagePart(text));
|
|
||||||
dirty = true;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Terminate construction of the current editing component, and begin construction of a new message component.
|
|
||||||
* After a successful call to this method, all setter methods will refer to a new message component, created as a result of the call to this method.
|
|
||||||
*
|
|
||||||
* @return This builder instance.
|
|
||||||
*/
|
|
||||||
public FancyMessage then() {
|
|
||||||
if (!latest().hasText()) {
|
|
||||||
throw new IllegalStateException("previous message part has no text");
|
|
||||||
}
|
|
||||||
messageParts.add(new MessagePart());
|
|
||||||
dirty = true;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeJson(JsonWriter writer) throws IOException {
|
|
||||||
if (messageParts.size() == 1) {
|
|
||||||
latest().writeJson(writer);
|
|
||||||
} else {
|
|
||||||
writer.beginObject().name("text").value("").name("extra").beginArray();
|
|
||||||
for (final MessagePart part : this) {
|
|
||||||
part.writeJson(writer);
|
|
||||||
}
|
|
||||||
writer.endArray().endObject();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Serialize this fancy message, converting it into syntactically-valid JSON using a {@link JsonWriter}.
|
|
||||||
* This JSON should be compatible with vanilla formatter commands such as {@code /tellraw}.
|
|
||||||
*
|
|
||||||
* @return The JSON string representing this object.
|
|
||||||
*/
|
|
||||||
public String toJSONString() {
|
|
||||||
if (!dirty && jsonString != null) {
|
|
||||||
return jsonString;
|
|
||||||
}
|
|
||||||
StringWriter string = new StringWriter();
|
|
||||||
JsonWriter json = new JsonWriter(string);
|
|
||||||
try {
|
|
||||||
writeJson(json);
|
|
||||||
json.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException("invalid message");
|
|
||||||
}
|
|
||||||
jsonString = string.toString();
|
|
||||||
dirty = false;
|
|
||||||
return jsonString;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sends this message to a player. The player will receive the fully-fledged formatted display of this message.
|
|
||||||
*
|
|
||||||
* @param player The player who will receive the message.
|
|
||||||
*/
|
|
||||||
public void send(Player player) {
|
|
||||||
send(player, toJSONString());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void send(CommandSender sender, String jsonString) {
|
|
||||||
if (!(sender instanceof Player)) {
|
|
||||||
sender.sendMessage(toOldMessageFormat());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Player player = (Player) sender;
|
|
||||||
try {
|
|
||||||
Object handle = Reflection.getHandle(player);
|
|
||||||
Object connection = Reflection.getField(handle.getClass(), "playerConnection").get(handle);
|
|
||||||
Reflection.getMethod(connection.getClass(), "sendPacket", Reflection.getNMSClass("Packet")).invoke(connection, createChatPacket(jsonString));
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
Bukkit.getLogger().log(Level.WARNING, "Argument could not be passed.", e);
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
Bukkit.getLogger().log(Level.WARNING, "Could not access method.", e);
|
|
||||||
} catch (InstantiationException e) {
|
|
||||||
Bukkit.getLogger().log(Level.WARNING, "Underlying class is abstract.", e);
|
|
||||||
} catch (InvocationTargetException e) {
|
|
||||||
Bukkit.getLogger().log(Level.WARNING, "A error has occurred during invoking of method.", e);
|
|
||||||
} catch (NoSuchMethodException e) {
|
|
||||||
Bukkit.getLogger().log(Level.WARNING, "Could not find method.", e);
|
|
||||||
} catch (ClassNotFoundException e) {
|
|
||||||
Bukkit.getLogger().log(Level.WARNING, "Could not find class.", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// The ChatSerializer's instance of Gson
|
|
||||||
private static Object nmsChatSerializerGsonInstance;
|
|
||||||
private static Method fromJsonMethod;
|
|
||||||
|
|
||||||
private Object createChatPacket(String json) throws IllegalArgumentException, IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException {
|
|
||||||
if (nmsChatSerializerGsonInstance == null) {
|
|
||||||
// Find the field and its value, completely bypassing obfuscation
|
|
||||||
Class<?> chatSerializerClazz;
|
|
||||||
|
|
||||||
// Get the three parts of the version string (major version is currently unused)
|
|
||||||
// vX_Y_RZ
|
|
||||||
// X = major
|
|
||||||
// Y = minor
|
|
||||||
// Z = revision
|
|
||||||
final String version = Reflection.getVersion();
|
|
||||||
String[] split = version.substring(1, version.length() - 1).split("_"); // Remove trailing dot
|
|
||||||
//int majorVersion = Integer.parseInt(split[0]);
|
|
||||||
int minorVersion = Integer.parseInt(split[1]);
|
|
||||||
int revisionVersion = Integer.parseInt(split[2].substring(1)); // Substring to ignore R
|
|
||||||
|
|
||||||
if (minorVersion < 8 || (minorVersion == 8 && revisionVersion == 1)) {
|
|
||||||
chatSerializerClazz = Reflection.getNMSClass("ChatSerializer");
|
|
||||||
} else {
|
|
||||||
chatSerializerClazz = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (chatSerializerClazz == null) {
|
|
||||||
throw new ClassNotFoundException("Can't find the ChatSerializer class");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Field declaredField : chatSerializerClazz.getDeclaredFields()) {
|
|
||||||
if (Modifier.isFinal(declaredField.getModifiers()) && Modifier.isStatic(declaredField.getModifiers()) && declaredField.getType().getName().endsWith("Gson")) {
|
|
||||||
// We've found our field
|
|
||||||
declaredField.setAccessible(true);
|
|
||||||
nmsChatSerializerGsonInstance = declaredField.get(null);
|
|
||||||
fromJsonMethod = nmsChatSerializerGsonInstance.getClass().getMethod("fromJson", String.class, Class.class);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Since the method is so simple, and all the obfuscated methods have the same name, it's easier to reimplement 'IChatBaseComponent a(String)' than to reflectively call it
|
|
||||||
// Of course, the implementation may change, but fuzzy matches might break with signature changes
|
|
||||||
Object serializedChatComponent = fromJsonMethod.invoke(nmsChatSerializerGsonInstance, json, Reflection.getNMSClass("IChatBaseComponent"));
|
|
||||||
|
|
||||||
return nmsPacketPlayOutChatConstructor.newInstance(serializedChatComponent);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sends this message to a command sender.
|
|
||||||
* If the sender is a player, they will receive the fully-fledged formatted display of this message.
|
|
||||||
* Otherwise, they will receive a version of this message with less formatting.
|
|
||||||
*
|
|
||||||
* @param sender The command sender who will receive the message.
|
|
||||||
* @see #toOldMessageFormat()
|
|
||||||
*/
|
|
||||||
public void send(CommandSender sender) {
|
|
||||||
send(sender, toJSONString());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sends this message to multiple command senders.
|
|
||||||
*
|
|
||||||
* @param senders The command senders who will receive the message.
|
|
||||||
* @see #send(CommandSender)
|
|
||||||
*/
|
|
||||||
public void send(final Iterable<? extends CommandSender> senders) {
|
|
||||||
String string = toJSONString();
|
|
||||||
for (final CommandSender sender : senders) {
|
|
||||||
send(sender, string);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert this message to a human-readable string with limited formatting.
|
|
||||||
* This method is used to send this message to clients without JSON formatting support.
|
|
||||||
* <p>
|
|
||||||
* Serialization of this message by using this message will include (in this order for each message part):
|
|
||||||
* <ol>
|
|
||||||
* <li>The color of each message part.</li>
|
|
||||||
* <li>The applicable stylizations for each message part.</li>
|
|
||||||
* <li>The core text of the message part.</li>
|
|
||||||
* </ol>
|
|
||||||
* The primary omissions are tooltips and clickable actions. Consequently, this method should be used only as a last resort.
|
|
||||||
* </p>
|
|
||||||
* <p>
|
|
||||||
* Color and formatting can be removed from the returned string by using {@link ChatColor#stripColor(String)}.</p>
|
|
||||||
*
|
|
||||||
* @return A human-readable string representing limited formatting in addition to the core text of this message.
|
|
||||||
*/
|
|
||||||
public String toOldMessageFormat() {
|
|
||||||
StringBuilder result = new StringBuilder();
|
|
||||||
for (MessagePart part : this) {
|
|
||||||
result.append(part.color == null ? "" : part.color);
|
|
||||||
for (ChatColor formatSpecifier : part.styles) {
|
|
||||||
result.append(formatSpecifier);
|
|
||||||
}
|
|
||||||
result.append(part.text);
|
|
||||||
}
|
|
||||||
return result.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private MessagePart latest() {
|
|
||||||
return messageParts.get(messageParts.size() - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onClick(final String name, final String data) {
|
|
||||||
final MessagePart latest = latest();
|
|
||||||
latest.clickActionName = name;
|
|
||||||
latest.clickActionData = data;
|
|
||||||
dirty = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onHover(final String name, final JsonRepresentedObject data) {
|
|
||||||
final MessagePart latest = latest();
|
|
||||||
latest.hoverActionName = name;
|
|
||||||
latest.hoverActionData = data;
|
|
||||||
dirty = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Doc copied from interface
|
|
||||||
public Map<String, Object> serialize() {
|
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
|
||||||
map.put("messageParts", messageParts);
|
|
||||||
// map.put("JSON", toJSONString());
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deserializes a JSON-represented message from a mapping of key-value pairs.
|
|
||||||
* This is called by the Bukkit serialization API.
|
|
||||||
* It is not intended for direct public API consumption.
|
|
||||||
*
|
|
||||||
* @param serialized The key-value mapping which represents a fancy message.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static FancyMessage deserialize(Map<String, Object> serialized) {
|
|
||||||
FancyMessage msg = new FancyMessage();
|
|
||||||
msg.messageParts = (List<MessagePart>) serialized.get("messageParts");
|
|
||||||
msg.jsonString = serialized.containsKey("JSON") ? serialized.get("JSON").toString() : null;
|
|
||||||
msg.dirty = !serialized.containsKey("JSON");
|
|
||||||
return msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <b>Internally called method. Not for API consumption.</b>
|
|
||||||
*/
|
|
||||||
public Iterator<MessagePart> iterator() {
|
|
||||||
return messageParts.iterator();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static JsonParser _stringParser = new JsonParser();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deserializes a fancy message from its JSON representation. This JSON representation is of the format of
|
|
||||||
* that returned by {@link #toJSONString()}, and is compatible with vanilla inputs.
|
|
||||||
*
|
|
||||||
* @param json The JSON string which represents a fancy message.
|
|
||||||
* @return A {@code FancyMessage} representing the parameterized JSON message.
|
|
||||||
*/
|
|
||||||
public static FancyMessage deserialize(String json) {
|
|
||||||
JsonObject serialized = _stringParser.parse(json).getAsJsonObject();
|
|
||||||
JsonArray extra = serialized.getAsJsonArray("extra"); // Get the extra component
|
|
||||||
FancyMessage returnVal = new FancyMessage();
|
|
||||||
returnVal.messageParts.clear();
|
|
||||||
for (JsonElement mPrt : extra) {
|
|
||||||
MessagePart component = new MessagePart();
|
|
||||||
JsonObject messagePart = mPrt.getAsJsonObject();
|
|
||||||
for (Map.Entry<String, JsonElement> entry : messagePart.entrySet()) {
|
|
||||||
// Deserialize text
|
|
||||||
if (TextualComponent.isTextKey(entry.getKey())) {
|
|
||||||
// The map mimics the YAML serialization, which has a "key" field and one or more "value" fields
|
|
||||||
Map<String, Object> serializedMapForm = new HashMap<>(); // Must be object due to Bukkit serializer API compliance
|
|
||||||
serializedMapForm.put("key", entry.getKey());
|
|
||||||
if (entry.getValue().isJsonPrimitive()) {
|
|
||||||
// Assume string
|
|
||||||
serializedMapForm.put("value", entry.getValue().getAsString());
|
|
||||||
} else {
|
|
||||||
// Composite object, but we assume each element is a string
|
|
||||||
for (Map.Entry<String, JsonElement> compositeNestedElement : entry.getValue().getAsJsonObject().entrySet()) {
|
|
||||||
serializedMapForm.put("value." + compositeNestedElement.getKey(), compositeNestedElement.getValue().getAsString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
component.text = TextualComponent.deserialize(serializedMapForm);
|
|
||||||
} else if (MessagePart.stylesToNames.inverse().containsKey(entry.getKey())) {
|
|
||||||
if (entry.getValue().getAsBoolean()) {
|
|
||||||
component.styles.add(MessagePart.stylesToNames.inverse().get(entry.getKey()));
|
|
||||||
}
|
|
||||||
} else if (entry.getKey().equals("color")) {
|
|
||||||
component.color = ChatColor.valueOf(entry.getValue().getAsString().toUpperCase());
|
|
||||||
} else if (entry.getKey().equals("clickEvent")) {
|
|
||||||
JsonObject object = entry.getValue().getAsJsonObject();
|
|
||||||
component.clickActionName = object.get("action").getAsString();
|
|
||||||
component.clickActionData = object.get("value").getAsString();
|
|
||||||
} else if (entry.getKey().equals("hoverEvent")) {
|
|
||||||
JsonObject object = entry.getValue().getAsJsonObject();
|
|
||||||
component.hoverActionName = object.get("action").getAsString();
|
|
||||||
if (object.get("value").isJsonPrimitive()) {
|
|
||||||
// Assume string
|
|
||||||
component.hoverActionData = new JsonString(object.get("value").getAsString());
|
|
||||||
} else {
|
|
||||||
// Assume composite type
|
|
||||||
// The only composite type we currently store is another FancyMessage
|
|
||||||
// Therefore, recursion time!
|
|
||||||
component.hoverActionData = deserialize(object.get("value").toString() /* This should properly serialize the JSON object as a JSON string */);
|
|
||||||
}
|
|
||||||
} else if (entry.getKey().equals("insertion")) {
|
|
||||||
component.insertionData = entry.getValue().getAsString();
|
|
||||||
} else if (entry.getKey().equals("with")) {
|
|
||||||
for (JsonElement object : entry.getValue().getAsJsonArray()) {
|
|
||||||
if (object.isJsonPrimitive()) {
|
|
||||||
component.translationReplacements.add(new JsonString(object.getAsString()));
|
|
||||||
} else {
|
|
||||||
// Only composite type stored in this array is - again - FancyMessages
|
|
||||||
// Recurse within this function to parse this as a translation replacement
|
|
||||||
component.translationReplacements.add(deserialize(object.toString()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
returnVal.messageParts.add(component);
|
|
||||||
}
|
|
||||||
return returnVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.chat;
|
|
||||||
|
|
||||||
import com.google.gson.stream.JsonWriter;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents an object that can be serialized to a JSON writer instance.
|
|
||||||
*/
|
|
||||||
interface JsonRepresentedObject {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Writes the JSON representation of this object to the specified writer.
|
|
||||||
* @param writer The JSON writer which will receive the object.
|
|
||||||
* @throws IOException If an error occurs writing to the stream.
|
|
||||||
*/
|
|
||||||
public void writeJson(JsonWriter writer) throws IOException;
|
|
||||||
|
|
||||||
}
|
|
@ -1,47 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.chat;
|
|
||||||
|
|
||||||
import com.google.gson.stream.JsonWriter;
|
|
||||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a JSON string value.
|
|
||||||
* Writes by this object will not write name values nor begin/end objects in the JSON stream.
|
|
||||||
* All writes merely write the represented string value.
|
|
||||||
*/
|
|
||||||
final class JsonString implements JsonRepresentedObject, ConfigurationSerializable {
|
|
||||||
|
|
||||||
private String _value;
|
|
||||||
|
|
||||||
public JsonString(CharSequence value) {
|
|
||||||
_value = value == null ? null : value.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeJson(JsonWriter writer) throws IOException {
|
|
||||||
writer.value(getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getValue() {
|
|
||||||
return _value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, Object> serialize() {
|
|
||||||
HashMap<String, Object> theSingleValue = new HashMap<String, Object>();
|
|
||||||
theSingleValue.put("stringValue", _value);
|
|
||||||
return theSingleValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static JsonString deserialize(Map<String, Object> map) {
|
|
||||||
return new JsonString(map.get("stringValue").toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return _value;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,157 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.chat;
|
|
||||||
|
|
||||||
import com.google.common.collect.BiMap;
|
|
||||||
import com.google.common.collect.ImmutableBiMap;
|
|
||||||
import com.google.gson.stream.JsonWriter;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
|
||||||
import org.bukkit.configuration.serialization.ConfigurationSerialization;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Internal class: Represents a component of a JSON-serializable {@link FancyMessage}.
|
|
||||||
*/
|
|
||||||
final class MessagePart implements JsonRepresentedObject, ConfigurationSerializable, Cloneable {
|
|
||||||
|
|
||||||
ChatColor color = ChatColor.WHITE;
|
|
||||||
ArrayList<ChatColor> styles = new ArrayList<>();
|
|
||||||
String clickActionName = null;
|
|
||||||
String clickActionData = null;
|
|
||||||
String hoverActionName = null;
|
|
||||||
JsonRepresentedObject hoverActionData = null;
|
|
||||||
TextualComponent text = null;
|
|
||||||
String insertionData = null;
|
|
||||||
ArrayList<JsonRepresentedObject> translationReplacements = new ArrayList<>();
|
|
||||||
|
|
||||||
MessagePart(final TextualComponent text) {
|
|
||||||
this.text = text;
|
|
||||||
}
|
|
||||||
|
|
||||||
MessagePart() {
|
|
||||||
this.text = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean hasText() {
|
|
||||||
return text != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public MessagePart clone() throws CloneNotSupportedException {
|
|
||||||
MessagePart obj = (MessagePart) super.clone();
|
|
||||||
obj.styles = (ArrayList<ChatColor>) styles.clone();
|
|
||||||
if (hoverActionData instanceof JsonString) {
|
|
||||||
obj.hoverActionData = new JsonString(((JsonString) hoverActionData).getValue());
|
|
||||||
} else if (hoverActionData instanceof FancyMessage) {
|
|
||||||
obj.hoverActionData = ((FancyMessage) hoverActionData).clone();
|
|
||||||
}
|
|
||||||
obj.translationReplacements = (ArrayList<JsonRepresentedObject>) translationReplacements.clone();
|
|
||||||
return obj;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static final BiMap<ChatColor, String> stylesToNames;
|
|
||||||
|
|
||||||
static {
|
|
||||||
ImmutableBiMap.Builder<ChatColor, String> builder = ImmutableBiMap.builder();
|
|
||||||
for (final ChatColor style : ChatColor.values()) {
|
|
||||||
if (!style.isFormat()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
String styleName;
|
|
||||||
switch (style) {
|
|
||||||
case MAGIC:
|
|
||||||
styleName = "obfuscated";
|
|
||||||
break;
|
|
||||||
case UNDERLINE:
|
|
||||||
styleName = "underlined";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
styleName = style.name().toLowerCase();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.put(style, styleName);
|
|
||||||
}
|
|
||||||
stylesToNames = builder.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void writeJson(JsonWriter json) {
|
|
||||||
try {
|
|
||||||
json.beginObject();
|
|
||||||
text.writeJson(json);
|
|
||||||
json.name("color").value(color.name().toLowerCase());
|
|
||||||
for (final ChatColor style : styles) {
|
|
||||||
json.name(stylesToNames.get(style)).value(true);
|
|
||||||
}
|
|
||||||
if (clickActionName != null && clickActionData != null) {
|
|
||||||
json.name("clickEvent")
|
|
||||||
.beginObject()
|
|
||||||
.name("action").value(clickActionName)
|
|
||||||
.name("value").value(clickActionData)
|
|
||||||
.endObject();
|
|
||||||
}
|
|
||||||
if (hoverActionName != null && hoverActionData != null) {
|
|
||||||
json.name("hoverEvent")
|
|
||||||
.beginObject()
|
|
||||||
.name("action").value(hoverActionName)
|
|
||||||
.name("value");
|
|
||||||
hoverActionData.writeJson(json);
|
|
||||||
json.endObject();
|
|
||||||
}
|
|
||||||
if (insertionData != null) {
|
|
||||||
json.name("insertion").value(insertionData);
|
|
||||||
}
|
|
||||||
if (translationReplacements.size() > 0 && text != null && TextualComponent.isTranslatableText(text)) {
|
|
||||||
json.name("with").beginArray();
|
|
||||||
for (JsonRepresentedObject obj : translationReplacements) {
|
|
||||||
obj.writeJson(json);
|
|
||||||
}
|
|
||||||
json.endArray();
|
|
||||||
}
|
|
||||||
json.endObject();
|
|
||||||
} catch (IOException e) {
|
|
||||||
Bukkit.getLogger().log(Level.WARNING, "A problem occured during writing of JSON string", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, Object> serialize() {
|
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
|
||||||
map.put("text", text);
|
|
||||||
map.put("styles", styles);
|
|
||||||
map.put("color", color.getChar());
|
|
||||||
map.put("hoverActionName", hoverActionName);
|
|
||||||
map.put("hoverActionData", hoverActionData);
|
|
||||||
map.put("clickActionName", clickActionName);
|
|
||||||
map.put("clickActionData", clickActionData);
|
|
||||||
map.put("insertion", insertionData);
|
|
||||||
map.put("translationReplacements", translationReplacements);
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static MessagePart deserialize(Map<String, Object> serialized) {
|
|
||||||
MessagePart part = new MessagePart((TextualComponent) serialized.get("text"));
|
|
||||||
part.styles = (ArrayList<ChatColor>) serialized.get("styles");
|
|
||||||
part.color = ChatColor.getByChar(serialized.get("color").toString());
|
|
||||||
part.hoverActionName = (String) serialized.get("hoverActionName");
|
|
||||||
part.hoverActionData = (JsonRepresentedObject) serialized.get("hoverActionData");
|
|
||||||
part.clickActionName = (String) serialized.get("clickActionName");
|
|
||||||
part.clickActionData = (String) serialized.get("clickActionData");
|
|
||||||
part.insertionData = (String) serialized.get("insertion");
|
|
||||||
part.translationReplacements = (ArrayList<JsonRepresentedObject>) serialized.get("translationReplacements");
|
|
||||||
return part;
|
|
||||||
}
|
|
||||||
|
|
||||||
static {
|
|
||||||
ConfigurationSerialization.registerClass(MessagePart.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,206 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.chat;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A class containing static utility methods and caches which are intended as reflective conveniences.
|
|
||||||
* Unless otherwise noted, upon failure methods will return {@code null}.
|
|
||||||
*/
|
|
||||||
public final class Reflection {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stores loaded classes from the {@code net.minecraft.server} package.
|
|
||||||
*/
|
|
||||||
private static final Map<String, Class<?>> _loadedNMSClasses = new HashMap<>();
|
|
||||||
/**
|
|
||||||
* Stores loaded classes from the {@code org.bukkit.craftbukkit} package (and subpackages).
|
|
||||||
*/
|
|
||||||
private static final Map<String, Class<?>> _loadedOBCClasses = new HashMap<>();
|
|
||||||
private static final Map<Class<?>, Map<String, Field>> _loadedFields = new HashMap<>();
|
|
||||||
/**
|
|
||||||
* Contains loaded methods in a cache.
|
|
||||||
* The map maps [types to maps of [method names to maps of [parameter types to method instances]]].
|
|
||||||
*/
|
|
||||||
private static final Map<Class<?>, Map<String, Map<ArrayWrapper<Class<?>>, Method>>> _loadedMethods = new HashMap<>();
|
|
||||||
private static String _versionString;
|
|
||||||
|
|
||||||
private Reflection() { }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the version string from the package name of the CraftBukkit server implementation.
|
|
||||||
* This is needed to bypass the JAR package name changing on each update.
|
|
||||||
*
|
|
||||||
* @return The version string of the OBC and NMS packages, <em>including the trailing dot</em>.
|
|
||||||
*/
|
|
||||||
public synchronized static String getVersion() {
|
|
||||||
if (_versionString == null) {
|
|
||||||
if (Bukkit.getServer() == null) {
|
|
||||||
// The server hasn't started, static initializer call?
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
String name = Bukkit.getServer().getClass().getPackage().getName();
|
|
||||||
_versionString = name.substring(name.lastIndexOf('.') + 1) + ".";
|
|
||||||
}
|
|
||||||
|
|
||||||
return _versionString;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a {@link Class} object representing a type contained within the {@code net.minecraft.server} versioned package.
|
|
||||||
* The class instances returned by this method are cached, such that no lookup will be done twice (unless multiple threads are accessing this method simultaneously).
|
|
||||||
*
|
|
||||||
* @param className The name of the class, excluding the package, within NMS.
|
|
||||||
* @return The class instance representing the specified NMS class, or {@code null} if it could not be loaded.
|
|
||||||
*/
|
|
||||||
public synchronized static Class<?> getNMSClass(String className) {
|
|
||||||
if (_loadedNMSClasses.containsKey(className)) {
|
|
||||||
return _loadedNMSClasses.get(className);
|
|
||||||
}
|
|
||||||
|
|
||||||
String fullName = "net.minecraft.server." + getVersion() + className;
|
|
||||||
Class<?> clazz;
|
|
||||||
try {
|
|
||||||
clazz = Class.forName(fullName);
|
|
||||||
} catch (ClassNotFoundException e) {
|
|
||||||
_loadedNMSClasses.put(className, null);
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
_loadedNMSClasses.put(className, clazz);
|
|
||||||
return clazz;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a {@link Class} object representing a type contained within the {@code org.bukkit.craftbukkit} versioned package.
|
|
||||||
* The class instances returned by this method are cached, such that no lookup will be done twice (unless multiple threads are accessing this method simultaneously).
|
|
||||||
*
|
|
||||||
* @param className The name of the class, excluding the package, within OBC. This name may contain a subpackage name, such as {@code inventory.CraftItemStack}.
|
|
||||||
* @return The class instance representing the specified OBC class, or {@code null} if it could not be loaded.
|
|
||||||
*/
|
|
||||||
public synchronized static Class<?> getOBCClass(String className) {
|
|
||||||
if (_loadedOBCClasses.containsKey(className)) {
|
|
||||||
return _loadedOBCClasses.get(className);
|
|
||||||
}
|
|
||||||
|
|
||||||
String fullName = "org.bukkit.craftbukkit." + getVersion() + className;
|
|
||||||
Class<?> clazz;
|
|
||||||
try {
|
|
||||||
clazz = Class.forName(fullName);
|
|
||||||
} catch (ClassNotFoundException e) {
|
|
||||||
_loadedOBCClasses.put(className, null);
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
_loadedOBCClasses.put(className, clazz);
|
|
||||||
return clazz;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Attempts to get the NMS handle of a CraftBukkit object.
|
|
||||||
* <p>
|
|
||||||
* The only match currently attempted by this method is a retrieval by using a parameterless {@code getHandle()} method implemented by the runtime type of the specified object.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param obj The object for which to retrieve an NMS handle.
|
|
||||||
* @return The NMS handle of the specified object, or {@code null} if it could not be retrieved using {@code getHandle()}.
|
|
||||||
*/
|
|
||||||
public synchronized static Object getHandle(Object obj) throws InvocationTargetException, IllegalAccessException, IllegalArgumentException {
|
|
||||||
return getMethod(obj.getClass(), "getHandle").invoke(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves a {@link Field} instance declared by the specified class with the specified name.
|
|
||||||
* Java access modifiers are ignored during this retrieval. No guarantee is made as to whether the field
|
|
||||||
* returned will be an instance or static field.
|
|
||||||
* <p>
|
|
||||||
* A global caching mechanism within this class is used to store fields. Combined with synchronization, this guarantees that
|
|
||||||
* no field will be reflectively looked up twice.
|
|
||||||
* </p>
|
|
||||||
* <p>
|
|
||||||
* If a field is deemed suitable for return, {@link Field#setAccessible(boolean) setAccessible} will be invoked with an argument of {@code true} before it is returned.
|
|
||||||
* This ensures that callers do not have to check or worry about Java access modifiers when dealing with the returned instance.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param clazz The class which contains the field to retrieve.
|
|
||||||
* @param name The declared name of the field in the class.
|
|
||||||
* @return A field object with the specified name declared by the specified class.
|
|
||||||
* @see Class#getDeclaredField(String)
|
|
||||||
*/
|
|
||||||
public synchronized static Field getField(Class<?> clazz, String name) {
|
|
||||||
Map<String, Field> loaded;
|
|
||||||
if (!_loadedFields.containsKey(clazz)) {
|
|
||||||
loaded = new HashMap<>();
|
|
||||||
_loadedFields.put(clazz, loaded);
|
|
||||||
} else {
|
|
||||||
loaded = _loadedFields.get(clazz);
|
|
||||||
}
|
|
||||||
if (loaded.containsKey(name)) {
|
|
||||||
// If the field is loaded (or cached as not existing), return the relevant value, which might be null
|
|
||||||
return loaded.get(name);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
Field field = clazz.getDeclaredField(name);
|
|
||||||
field.setAccessible(true);
|
|
||||||
loaded.put(name, field);
|
|
||||||
return field;
|
|
||||||
} catch (NoSuchFieldException | SecurityException e) {
|
|
||||||
// Error loading
|
|
||||||
e.printStackTrace();
|
|
||||||
// Cache field as not existing
|
|
||||||
loaded.put(name, null);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves a {@link Method} instance declared by the specified class with the specified name and argument types.
|
|
||||||
* Java access modifiers are ignored during this retrieval. No guarantee is made as to whether the field
|
|
||||||
* returned will be an instance or static field.
|
|
||||||
* <p>
|
|
||||||
* A global caching mechanism within this class is used to store method. Combined with synchronization, this guarantees that
|
|
||||||
* no method will be reflectively looked up twice.
|
|
||||||
* <p>
|
|
||||||
* If a method is deemed suitable for return, {@link Method#setAccessible(boolean) setAccessible} will be invoked with an argument of {@code true} before it is returned.
|
|
||||||
* This ensures that callers do not have to check or worry about Java access modifiers when dealing with the returned instance.
|
|
||||||
* <p>
|
|
||||||
* This method does <em>not</em> search superclasses of the specified type for methods with the specified signature.
|
|
||||||
* Callers wishing this behavior should use {@link Class#getDeclaredMethod(String, Class...)}.
|
|
||||||
*
|
|
||||||
* @param clazz The class which contains the method to retrieve.
|
|
||||||
* @param name The declared name of the method in the class.
|
|
||||||
* @param args The formal argument types of the method.
|
|
||||||
* @return A method object with the specified name declared by the specified class.
|
|
||||||
*/
|
|
||||||
public synchronized static Method getMethod(Class<?> clazz, String name, Class<?>... args) {
|
|
||||||
if (!_loadedMethods.containsKey(clazz)) {
|
|
||||||
_loadedMethods.put(clazz, new HashMap<String, Map<ArrayWrapper<Class<?>>, Method>>());
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, Map<ArrayWrapper<Class<?>>, Method>> loadedMethodNames = _loadedMethods.get(clazz);
|
|
||||||
if (!loadedMethodNames.containsKey(name)) {
|
|
||||||
loadedMethodNames.put(name, new HashMap<ArrayWrapper<Class<?>>, Method>());
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<ArrayWrapper<Class<?>>, Method> loadedSignatures = loadedMethodNames.get(name);
|
|
||||||
ArrayWrapper<Class<?>> wrappedArg = new ArrayWrapper<>(args);
|
|
||||||
if (loadedSignatures.containsKey(wrappedArg)) {
|
|
||||||
return loadedSignatures.get(wrappedArg);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Method m : clazz.getMethods()) {
|
|
||||||
if (m.getName().equals(name) && Arrays.equals(args, m.getParameterTypes())) {
|
|
||||||
m.setAccessible(true);
|
|
||||||
loadedSignatures.put(wrappedArg, m);
|
|
||||||
return m;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
loadedSignatures.put(wrappedArg, null);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,317 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.chat;
|
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
import com.google.gson.stream.JsonWriter;
|
|
||||||
import org.bukkit.configuration.serialization.ConfigurationSerializable;
|
|
||||||
import org.bukkit.configuration.serialization.ConfigurationSerialization;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a textual component of a message part.
|
|
||||||
* This can be used to not only represent string literals in a JSON message,
|
|
||||||
* but also to represent localized strings and other text values.
|
|
||||||
* <p>Different instances of this class can be created with static constructor methods.</p>
|
|
||||||
*/
|
|
||||||
public abstract class TextualComponent implements Cloneable {
|
|
||||||
|
|
||||||
static {
|
|
||||||
ConfigurationSerialization.registerClass(TextualComponent.ArbitraryTextTypeComponent.class);
|
|
||||||
ConfigurationSerialization.registerClass(TextualComponent.ComplexTextTypeComponent.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
static TextualComponent deserialize(Map<String, Object> map) {
|
|
||||||
if (map.containsKey("key") && map.size() == 2 && map.containsKey("value")) {
|
|
||||||
// Arbitrary text component
|
|
||||||
return ArbitraryTextTypeComponent.deserialize(map);
|
|
||||||
} else if (map.size() >= 2 && map.containsKey("key") && !map.containsKey("value") /* It contains keys that START WITH value */) {
|
|
||||||
// Complex JSON object
|
|
||||||
return ComplexTextTypeComponent.deserialize(map);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
static boolean isTextKey(String key) {
|
|
||||||
return key.equals("translate") || key.equals("text") || key.equals("score") || key.equals("selector");
|
|
||||||
}
|
|
||||||
|
|
||||||
static boolean isTranslatableText(TextualComponent component) {
|
|
||||||
return component instanceof ComplexTextTypeComponent && component.getKey().equals("translate");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a textual component representing a string literal.
|
|
||||||
*
|
|
||||||
* <p>This is the default type of textual component when a single string
|
|
||||||
* literal is given to a method.
|
|
||||||
*
|
|
||||||
* @param textValue The text which will be represented.
|
|
||||||
* @return The text component representing the specified literal text.
|
|
||||||
*/
|
|
||||||
public static TextualComponent rawText(String textValue) {
|
|
||||||
return new ArbitraryTextTypeComponent("text", textValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a textual component representing a localized string.
|
|
||||||
* The client will see this text component as their localized version of the specified string <em>key</em>, which can be overridden by a
|
|
||||||
* resource pack.
|
|
||||||
* <p>
|
|
||||||
* If the specified translation key is not present on the client resource pack, the translation key will be displayed as a string literal to
|
|
||||||
* the client.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param translateKey The string key which maps to localized text.
|
|
||||||
* @return The text component representing the specified localized text.
|
|
||||||
*/
|
|
||||||
public static TextualComponent localizedText(String translateKey) {
|
|
||||||
return new ArbitraryTextTypeComponent("translate", translateKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void throwUnsupportedSnapshot() {
|
|
||||||
throw new UnsupportedOperationException("This feature is only supported in snapshot releases.");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a textual component representing a scoreboard value.
|
|
||||||
* The client will see their own score for the specified objective as the text represented by this component.
|
|
||||||
* <p>
|
|
||||||
* <b>This method is currently guaranteed to throw an {@code UnsupportedOperationException} as it is only supported on snapshot clients.</b>
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param scoreboardObjective The name of the objective for which to display the score.
|
|
||||||
* @return The text component representing the specified scoreboard score (for the viewing player), or {@code null} if an error occurs during
|
|
||||||
* JSON serialization.
|
|
||||||
*/
|
|
||||||
public static TextualComponent objectiveScore(String scoreboardObjective) {
|
|
||||||
return objectiveScore("*", scoreboardObjective);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a textual component representing a scoreboard value.
|
|
||||||
* The client will see the score of the specified player for the specified objective as the text represented by this component.
|
|
||||||
*
|
|
||||||
* <p><b>This method is currently guaranteed to throw an {@code UnsupportedOperationException}
|
|
||||||
* as it is only supported on snapshot clients.</b>
|
|
||||||
*
|
|
||||||
* @param playerName The name of the player whos score will be shown. If
|
|
||||||
* this string represents the single-character sequence
|
|
||||||
* "*", the viewing player's score will be displayed.
|
|
||||||
* Standard minecraft selectors (@a, @p, etc)
|
|
||||||
* are <em>not</em> supported.
|
|
||||||
* @param scoreboardObjective The name of the objective for
|
|
||||||
* which to display the score.
|
|
||||||
* @return The text component representing the specified scoreboard score
|
|
||||||
* for the specified player, or {@code null} if an error occurs during JSON serialization.
|
|
||||||
*/
|
|
||||||
public static TextualComponent objectiveScore(String playerName, String scoreboardObjective) {
|
|
||||||
throwUnsupportedSnapshot(); // Remove this line when the feature is released to non-snapshot versions, in addition to updating ALL THE
|
|
||||||
// OVERLOADS documentation accordingly
|
|
||||||
|
|
||||||
return new ComplexTextTypeComponent("score", ImmutableMap.<String, String>builder()
|
|
||||||
.put("name", playerName)
|
|
||||||
.put("objective", scoreboardObjective)
|
|
||||||
.build());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a textual component representing a player name, retrievable by using a standard minecraft selector.
|
|
||||||
* The client will see the players or entities captured by the specified selector as the text represented by this component.
|
|
||||||
* <p>
|
|
||||||
* <b>This method is currently guaranteed to throw an {@code UnsupportedOperationException} as it is only supported on snapshot clients.</b>
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param selector The minecraft player or entity selector which will capture the entities whose string representations will be displayed in
|
|
||||||
* the place of this text component.
|
|
||||||
* @return The text component representing the name of the entities captured by the selector.
|
|
||||||
*/
|
|
||||||
public static TextualComponent selector(String selector) {
|
|
||||||
throwUnsupportedSnapshot(); // Remove this line when the feature is released to non-snapshot versions, in addition to updating ALL THE
|
|
||||||
// OVERLOADS documentation accordingly
|
|
||||||
|
|
||||||
return new ArbitraryTextTypeComponent("selector", selector);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return getReadableString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return The JSON key used to represent text components of this type.
|
|
||||||
*/
|
|
||||||
public abstract String getKey();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return A readable String
|
|
||||||
*/
|
|
||||||
public abstract String getReadableString();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clones a textual component instance.
|
|
||||||
* The returned object should not reference this textual component instance, but should maintain the same key and value.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public abstract TextualComponent clone() throws CloneNotSupportedException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Writes the text data represented by this textual component to the specified JSON writer object.
|
|
||||||
* A new object within the writer is not started.
|
|
||||||
*
|
|
||||||
* @param writer The object to which to write the JSON data.
|
|
||||||
* @throws IOException If an error occurs while writing to the stream.
|
|
||||||
*/
|
|
||||||
public abstract void writeJson(JsonWriter writer) throws IOException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Internal class used to represent all types of text components.
|
|
||||||
* Exception validating done is on keys and values.
|
|
||||||
*/
|
|
||||||
private static final class ArbitraryTextTypeComponent extends TextualComponent implements ConfigurationSerializable {
|
|
||||||
|
|
||||||
private String key;
|
|
||||||
private String value;
|
|
||||||
|
|
||||||
public ArbitraryTextTypeComponent(String key, String value) {
|
|
||||||
setKey(key);
|
|
||||||
setValue(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ArbitraryTextTypeComponent deserialize(Map<String, Object> map) {
|
|
||||||
return new ArbitraryTextTypeComponent(map.get("key").toString(), map.get("value").toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getKey() {
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setKey(String key) {
|
|
||||||
Preconditions.checkArgument(key != null && !key.isEmpty(), "The key must be specified.");
|
|
||||||
this.key = key;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValue(String value) {
|
|
||||||
Preconditions.checkArgument(value != null, "The value must be specified.");
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TextualComponent clone() throws CloneNotSupportedException {
|
|
||||||
// Since this is a private and final class, we can just reinstantiate this class instead of casting super.clone
|
|
||||||
return new ArbitraryTextTypeComponent(getKey(), getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeJson(JsonWriter writer) throws IOException {
|
|
||||||
writer.name(getKey()).value(getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SuppressWarnings("serial")
|
|
||||||
public Map<String, Object> serialize() {
|
|
||||||
return new HashMap<String, Object>() {
|
|
||||||
{
|
|
||||||
put("key", getKey());
|
|
||||||
put("value", getValue());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getReadableString() {
|
|
||||||
return getValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Internal class used to represent a text component with a nested JSON
|
|
||||||
* value.
|
|
||||||
*
|
|
||||||
* <p>Exception validating done is on keys and values.
|
|
||||||
*/
|
|
||||||
private static final class ComplexTextTypeComponent extends TextualComponent implements ConfigurationSerializable {
|
|
||||||
|
|
||||||
private String key;
|
|
||||||
private Map<String, String> value;
|
|
||||||
|
|
||||||
public ComplexTextTypeComponent(String key, Map<String, String> values) {
|
|
||||||
setKey(key);
|
|
||||||
setValue(values);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ComplexTextTypeComponent deserialize(Map<String, Object> map) {
|
|
||||||
String key = null;
|
|
||||||
Map<String, String> value = new HashMap<>();
|
|
||||||
for (Map.Entry<String, Object> valEntry : map.entrySet()) {
|
|
||||||
if (valEntry.getKey().equals("key")) {
|
|
||||||
key = (String) valEntry.getValue();
|
|
||||||
} else if (valEntry.getKey().startsWith("value.")) {
|
|
||||||
value.put(valEntry.getKey().substring(6) /* Strips out the value prefix */, valEntry.getValue().toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new ComplexTextTypeComponent(key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getKey() {
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setKey(String key) {
|
|
||||||
Preconditions.checkArgument(key != null && !key.isEmpty(), "The key must be specified.");
|
|
||||||
this.key = key;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, String> getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValue(Map<String, String> value) {
|
|
||||||
Preconditions.checkArgument(value != null, "The value must be specified.");
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TextualComponent clone() {
|
|
||||||
// Since this is a private and final class, we can just reinstantiate this class instead of casting super.clone
|
|
||||||
return new ComplexTextTypeComponent(getKey(), getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeJson(JsonWriter writer) throws IOException {
|
|
||||||
writer.name(getKey());
|
|
||||||
writer.beginObject();
|
|
||||||
for (Map.Entry<String, String> jsonPair : value.entrySet()) {
|
|
||||||
writer.name(jsonPair.getKey()).value(jsonPair.getValue());
|
|
||||||
}
|
|
||||||
writer.endObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SuppressWarnings("serial")
|
|
||||||
public Map<String, Object> serialize() {
|
|
||||||
return new java.util.HashMap<String, Object>() {
|
|
||||||
{
|
|
||||||
put("key", getKey());
|
|
||||||
for (Map.Entry<String, String> valEntry : getValue().entrySet()) {
|
|
||||||
put("value." + valEntry.getKey(), valEntry.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getReadableString() {
|
|
||||||
return getKey();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,299 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.commands;
|
|
||||||
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
|
||||||
import com.intellectualcrafters.plot.commands.CommandCategory;
|
|
||||||
import com.intellectualcrafters.plot.commands.RequiredType;
|
|
||||||
import com.intellectualcrafters.plot.commands.SubCommand;
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
|
||||||
import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
|
||||||
import com.intellectualcrafters.plot.object.StringWrapper;
|
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
|
||||||
import com.intellectualcrafters.plot.util.StringMan;
|
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
|
||||||
import com.intellectualcrafters.plot.util.WorldUtil;
|
|
||||||
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
|
|
||||||
import com.plotsquared.bukkit.uuid.DatFileFilter;
|
|
||||||
import com.plotsquared.bukkit.uuid.DefaultUUIDWrapper;
|
|
||||||
import com.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper;
|
|
||||||
import com.plotsquared.bukkit.uuid.OfflineUUIDWrapper;
|
|
||||||
import com.plotsquared.general.commands.Argument;
|
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
@CommandDeclaration(
|
|
||||||
command = "uuidconvert",
|
|
||||||
permission = "plots.admin",
|
|
||||||
description = "Debug UUID conversion",
|
|
||||||
usage = "/plot uuidconvert <lower|offline|online>",
|
|
||||||
requiredType = RequiredType.CONSOLE,
|
|
||||||
category = CommandCategory.DEBUG)
|
|
||||||
public class DebugUUID extends SubCommand {
|
|
||||||
|
|
||||||
public DebugUUID() {
|
|
||||||
super(Argument.String);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCommand(final PlotPlayer player, String[] args) {
|
|
||||||
final UUIDWrapper currentUUIDWrapper = UUIDHandler.getUUIDWrapper();
|
|
||||||
final UUIDWrapper newWrapper;
|
|
||||||
|
|
||||||
switch (args[0].toLowerCase()) {
|
|
||||||
case "lower":
|
|
||||||
newWrapper = new LowerOfflineUUIDWrapper();
|
|
||||||
break;
|
|
||||||
case "offline":
|
|
||||||
newWrapper = new OfflineUUIDWrapper();
|
|
||||||
break;
|
|
||||||
case "online":
|
|
||||||
newWrapper = new DefaultUUIDWrapper();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
try {
|
|
||||||
Class<?> clazz = Class.forName(args[0]);
|
|
||||||
newWrapper = (UUIDWrapper) clazz.newInstance();
|
|
||||||
} catch (ClassNotFoundException | IllegalAccessException | InstantiationException ignored) {
|
|
||||||
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot uuidconvert <lower|offline|online>");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.length != 2 || !"-o".equals(args[1])) {
|
|
||||||
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot uuidconvert " + args[0] + " - o");
|
|
||||||
MainUtil.sendMessage(player, "&cBe aware of the following!");
|
|
||||||
MainUtil.sendMessage(player, "&8 - &cUse the database command or another method to backup your plots beforehand");
|
|
||||||
MainUtil.sendMessage(player, "&8 - &cIf the process is interrupted, all plots could be deleted");
|
|
||||||
MainUtil.sendMessage(player, "&8 - &cIf an error occurs, all plots could be deleted");
|
|
||||||
MainUtil.sendMessage(player, "&8 - &cPlot settings WILL be lost upon conversion");
|
|
||||||
MainUtil.sendMessage(player, "&cTO REITERATE: BACK UP YOUR DATABASE BEFORE USING THIS!!!");
|
|
||||||
MainUtil.sendMessage(player, "&7Retype the command with the override parameter when ready :)");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentUUIDWrapper.getClass().getCanonicalName().equals(newWrapper.getClass().getCanonicalName())) {
|
|
||||||
MainUtil.sendMessage(player, "&cUUID mode already in use!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
MainUtil.sendMessage(player, "&6Beginning UUID mode conversion");
|
|
||||||
MainUtil.sendMessage(player, "&7 - Disconnecting players");
|
|
||||||
for (Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
|
|
||||||
entry.getValue().kick("UUID conversion has been initiated. You may reconnect when finished.");
|
|
||||||
}
|
|
||||||
|
|
||||||
MainUtil.sendMessage(player, "&7 - Initializing map");
|
|
||||||
|
|
||||||
final HashMap<UUID, UUID> uCMap = new HashMap<>();
|
|
||||||
final HashMap<UUID, UUID> uCReverse = new HashMap<>();
|
|
||||||
|
|
||||||
MainUtil.sendMessage(player, "&7 - Collecting playerdata");
|
|
||||||
|
|
||||||
HashSet<String> worlds = Sets.newHashSet(WorldUtil.IMP.getMainWorld(), "world");
|
|
||||||
HashSet<UUID> uuids = new HashSet<>();
|
|
||||||
HashSet<String> names = new HashSet<>();
|
|
||||||
for (String worldName : worlds) {
|
|
||||||
File playerDataFolder = new File(worldName + File.separator + "playerdata");
|
|
||||||
String[] dat = playerDataFolder.list(new DatFileFilter());
|
|
||||||
if (dat != null) {
|
|
||||||
for (String current : dat) {
|
|
||||||
String s = current.replaceAll(".dat$", "");
|
|
||||||
try {
|
|
||||||
UUID uuid = UUID.fromString(s);
|
|
||||||
uuids.add(uuid);
|
|
||||||
} catch (Exception ignored) {
|
|
||||||
MainUtil.sendMessage(player, C.PREFIX + "Invalid playerdata: " + current);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File playersFolder = new File(worldName + File.separator + "players");
|
|
||||||
dat = playersFolder.list(new DatFileFilter());
|
|
||||||
if (dat != null) {
|
|
||||||
for (String current : dat) {
|
|
||||||
names.add(current.replaceAll(".dat$", ""));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MainUtil.sendMessage(player, "&7 - Populating map");
|
|
||||||
UUID uuid2;
|
|
||||||
UUIDWrapper wrapper = new DefaultUUIDWrapper();
|
|
||||||
for (UUID uuid : uuids) {
|
|
||||||
try {
|
|
||||||
OfflinePlotPlayer op = wrapper.getOfflinePlayer(uuid);
|
|
||||||
uuid = currentUUIDWrapper.getUUID(op);
|
|
||||||
uuid2 = newWrapper.getUUID(op);
|
|
||||||
if (!uuid.equals(uuid2) && !uCMap.containsKey(uuid) && !uCReverse.containsKey(uuid2)) {
|
|
||||||
uCMap.put(uuid, uuid2);
|
|
||||||
uCReverse.put(uuid2, uuid);
|
|
||||||
}
|
|
||||||
} catch (Throwable ignored) {
|
|
||||||
MainUtil.sendMessage(player, C.PREFIX + "&6Invalid playerdata: " + uuid.toString() + ".dat");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (String name : names) {
|
|
||||||
UUID uuid = currentUUIDWrapper.getUUID(name);
|
|
||||||
uuid2 = newWrapper.getUUID(name);
|
|
||||||
if (!uuid.equals(uuid2)) {
|
|
||||||
uCMap.put(uuid, uuid2);
|
|
||||||
uCReverse.put(uuid2, uuid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (uCMap.isEmpty()) {
|
|
||||||
MainUtil.sendMessage(player, "&c - Error! Attempting to repopulate");
|
|
||||||
for (OfflinePlotPlayer op : currentUUIDWrapper.getOfflinePlayers()) {
|
|
||||||
if (op.getLastPlayed() != 0) {
|
|
||||||
// String name = op.getPluginName();
|
|
||||||
// StringWrapper wrap = new StringWrapper(name);
|
|
||||||
UUID uuid = currentUUIDWrapper.getUUID(op);
|
|
||||||
uuid2 = newWrapper.getUUID(op);
|
|
||||||
if (!uuid.equals(uuid2)) {
|
|
||||||
uCMap.put(uuid, uuid2);
|
|
||||||
uCReverse.put(uuid2, uuid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (uCMap.isEmpty()) {
|
|
||||||
MainUtil.sendMessage(player, "&cError. Failed to collect UUIDs!");
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
MainUtil.sendMessage(player, "&a - Successfully repopulated");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MainUtil.sendMessage(player, "&7 - Replacing cache");
|
|
||||||
TaskManager.runTaskAsync(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
for (Entry<UUID, UUID> entry : uCMap.entrySet()) {
|
|
||||||
String name = UUIDHandler.getName(entry.getKey());
|
|
||||||
if (name != null) {
|
|
||||||
UUIDHandler.add(new StringWrapper(name), entry.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MainUtil.sendMessage(player, "&7 - Scanning for applicable files (uuids.txt)");
|
|
||||||
|
|
||||||
File file = new File(PS.get().IMP.getDirectory(), "uuids.txt");
|
|
||||||
if (file.exists()) {
|
|
||||||
try {
|
|
||||||
List<String> lines = Files.readAllLines(file.toPath(), StandardCharsets.UTF_8);
|
|
||||||
for (String line : lines) {
|
|
||||||
try {
|
|
||||||
line = line.trim();
|
|
||||||
if (line.isEmpty()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
line = line.replaceAll("[\\|][0-9]+[\\|][0-9]+[\\|]", "");
|
|
||||||
String[] split = line.split("\\|");
|
|
||||||
String name = split[0];
|
|
||||||
if (name.isEmpty() || name.length() > 16 || !StringMan.isAlphanumericUnd(name)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
UUID old = currentUUIDWrapper.getUUID(name);
|
|
||||||
if (old == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
UUID now = newWrapper.getUUID(name);
|
|
||||||
UUIDHandler.add(new StringWrapper(name), now);
|
|
||||||
uCMap.put(old, now);
|
|
||||||
uCReverse.put(now, old);
|
|
||||||
} catch (Exception e2) {
|
|
||||||
e2.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MainUtil.sendMessage(player, "&7 - Replacing wrapper");
|
|
||||||
UUIDHandler.setUUIDWrapper(newWrapper);
|
|
||||||
|
|
||||||
MainUtil.sendMessage(player, "&7 - Updating plot objects");
|
|
||||||
|
|
||||||
for (Plot plot : PS.get().getPlots()) {
|
|
||||||
UUID value = uCMap.get(plot.owner);
|
|
||||||
if (value != null) {
|
|
||||||
plot.owner = value;
|
|
||||||
}
|
|
||||||
plot.getTrusted().clear();
|
|
||||||
plot.getMembers().clear();
|
|
||||||
plot.getDenied().clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
MainUtil.sendMessage(player, "&7 - Deleting database");
|
|
||||||
boolean result = DBFunc.deleteTables();
|
|
||||||
|
|
||||||
MainUtil.sendMessage(player, "&7 - Creating tables");
|
|
||||||
|
|
||||||
try {
|
|
||||||
DBFunc.createTables();
|
|
||||||
if (!result) {
|
|
||||||
MainUtil.sendMessage(player, "&cConversion failed! Attempting recovery");
|
|
||||||
for (Plot plot : PS.get().getPlots()) {
|
|
||||||
UUID value = uCReverse.get(plot.owner);
|
|
||||||
if (value != null) {
|
|
||||||
plot.owner = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DBFunc.createPlotsAndData(new ArrayList<>(PS.get().getPlots()), new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
MainUtil.sendMessage(player, "&6Recovery was successful!");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newWrapper instanceof OfflineUUIDWrapper) {
|
|
||||||
PS.get().worlds.set("UUID.force-lowercase", false);
|
|
||||||
PS.get().worlds.set("UUID.offline", true);
|
|
||||||
} else if (newWrapper instanceof DefaultUUIDWrapper) {
|
|
||||||
PS.get().worlds.set("UUID.force-lowercase", false);
|
|
||||||
PS.get().worlds.set("UUID.offline", false);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
PS.get().worlds.save(PS.get().worldsFile);
|
|
||||||
} catch (IOException ignored) {
|
|
||||||
MainUtil.sendMessage(player, "Could not save configuration. It will need to be manual set!");
|
|
||||||
}
|
|
||||||
|
|
||||||
MainUtil.sendMessage(player, "&7 - Populating tables");
|
|
||||||
|
|
||||||
TaskManager.runTaskAsync(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
ArrayList<Plot> plots = new ArrayList<>(PS.get().getPlots());
|
|
||||||
DBFunc.createPlotsAndData(plots, new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
MainUtil.sendMessage(player, "&aConversion complete!");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
MainUtil.sendMessage(player, "&aIt is now safe for players to join");
|
|
||||||
MainUtil.sendMessage(player, "&cConversion is still in progress, you will be notified when it is complete");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,82 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.database.plotme;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.configuration.file.FileConfiguration;
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
public abstract class APlotMeConnector {
|
|
||||||
|
|
||||||
public abstract Connection getPlotMeConnection(String plugin, FileConfiguration plotConfig, String dataFolder);
|
|
||||||
|
|
||||||
public abstract HashMap<String, HashMap<PlotId, Plot>> getPlotMePlots(Connection connection) throws SQLException;
|
|
||||||
|
|
||||||
public abstract boolean accepts(String version);
|
|
||||||
|
|
||||||
public boolean isValidConnection(Connection connection) {
|
|
||||||
return connection != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void copyConfig(FileConfiguration plotConfig, String world, String actualWorldName) {
|
|
||||||
int pathWidth = plotConfig.getInt("worlds." + world + ".PathWidth"); //
|
|
||||||
PS.get().worlds.set("worlds." + actualWorldName + ".road.width", pathWidth);
|
|
||||||
int plotSize = plotConfig.getInt("worlds." + world + ".PlotSize"); //
|
|
||||||
PS.get().worlds.set("worlds." + actualWorldName + ".plot.size", plotSize);
|
|
||||||
String wallBlock = plotConfig.getString("worlds." + world + ".WallBlockId"); //
|
|
||||||
PS.get().worlds.set("worlds." + actualWorldName + ".wall.block", wallBlock);
|
|
||||||
String floor = plotConfig.getString("worlds." + world + ".PlotFloorBlockId"); //
|
|
||||||
PS.get().worlds.set("worlds." + actualWorldName + ".plot.floor", Collections.singletonList(floor));
|
|
||||||
String filling = plotConfig.getString("worlds." + world + ".PlotFillingBlockId"); //
|
|
||||||
PS.get().worlds.set("worlds." + actualWorldName + ".plot.filling", Collections.singletonList(filling));
|
|
||||||
String road = plotConfig.getString("worlds." + world + ".RoadMainBlockId");
|
|
||||||
PS.get().worlds.set("worlds." + actualWorldName + ".road.block", road);
|
|
||||||
int height = plotConfig.getInt("worlds." + world + ".RoadHeight"); //
|
|
||||||
PS.get().worlds.set("worlds." + actualWorldName + ".road.height", height);
|
|
||||||
PS.get().worlds.set("worlds." + actualWorldName + ".plot.height", height);
|
|
||||||
PS.get().worlds.set("worlds." + actualWorldName + ".wall.height", height);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Location getPlotTopLocAbs(int path, int plot, PlotId plotId) {
|
|
||||||
int px = plotId.x;
|
|
||||||
int pz = plotId.y;
|
|
||||||
int x = px * (path + plot) - (int) Math.floor(path / 2) - 1;
|
|
||||||
int z = pz * (path + plot) - (int) Math.floor(path / 2) - 1;
|
|
||||||
return new Location(null, x, 256, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Location getPlotBottomLocAbs(int path, int plot, PlotId plotId) {
|
|
||||||
int px = plotId.x;
|
|
||||||
int pz = plotId.y;
|
|
||||||
int x = px * (path + plot) - plot - (int) Math.floor(path / 2) - 1;
|
|
||||||
int z = pz * (path + plot) - plot - (int) Math.floor(path / 2) - 1;
|
|
||||||
return new Location(null, x, 1, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMerged(HashMap<String, HashMap<PlotId, boolean[]>> merges, String world, PlotId id, int direction) {
|
|
||||||
HashMap<PlotId, boolean[]> plots = merges.get(world);
|
|
||||||
PlotId id2 = new PlotId(id.x, id.y);
|
|
||||||
boolean[] merge1;
|
|
||||||
if (plots.containsKey(id)) {
|
|
||||||
merge1 = plots.get(id);
|
|
||||||
} else {
|
|
||||||
merge1 = new boolean[] { false, false, false, false };
|
|
||||||
}
|
|
||||||
boolean[] merge2;
|
|
||||||
if (plots.containsKey(id2)) {
|
|
||||||
merge2 = plots.get(id2);
|
|
||||||
} else {
|
|
||||||
merge2 = new boolean[] { false, false, false, false };
|
|
||||||
}
|
|
||||||
merge1[direction] = true;
|
|
||||||
merge2[(direction + 2) % 4] = true;
|
|
||||||
plots.put(id, merge1);
|
|
||||||
plots.put(id2, merge1);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,239 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.database.plotme;
|
|
||||||
|
|
||||||
import com.google.common.base.Charsets;
|
|
||||||
import com.intellectualcrafters.configuration.file.FileConfiguration;
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
|
||||||
import com.intellectualcrafters.plot.database.SQLite;
|
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotArea;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
|
||||||
import com.intellectualcrafters.plot.object.StringWrapper;
|
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.DriverManager;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class ClassicPlotMeConnector extends APlotMeConnector {
|
|
||||||
|
|
||||||
private String plugin = "PlotMe";
|
|
||||||
private String prefix;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Connection getPlotMeConnection(String plugin, FileConfiguration plotConfig, String dataFolder) {
|
|
||||||
this.plugin = plugin.toLowerCase();
|
|
||||||
this.prefix = plotConfig.getString("mySQLprefix", this.plugin.toLowerCase());
|
|
||||||
try {
|
|
||||||
if (plotConfig.getBoolean("usemySQL")) {
|
|
||||||
String user = plotConfig.getString("mySQLuname");
|
|
||||||
String password = plotConfig.getString("mySQLpass");
|
|
||||||
String con = plotConfig.getString("mySQLconn");
|
|
||||||
return DriverManager.getConnection(con, user, password);
|
|
||||||
} else {
|
|
||||||
return new SQLite(new File(dataFolder + File.separator + "plots.db")).openConnection();
|
|
||||||
}
|
|
||||||
} catch (SQLException | ClassNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HashMap<String, HashMap<PlotId, Plot>> getPlotMePlots(Connection connection) throws SQLException {
|
|
||||||
HashMap<String, Integer> plotWidth = new HashMap<>();
|
|
||||||
HashMap<String, Integer> roadWidth = new HashMap<>();
|
|
||||||
HashMap<String, HashMap<PlotId, Plot>> plots = new HashMap<>();
|
|
||||||
HashMap<String, HashMap<PlotId, boolean[]>> merges = new HashMap<>();
|
|
||||||
PreparedStatement statement = connection.prepareStatement("SELECT * FROM `" + this.prefix + "Plots`");
|
|
||||||
ResultSet resultSet = statement.executeQuery();
|
|
||||||
String column = null;
|
|
||||||
boolean checkUUID = DBFunc.hasColumn(resultSet, "ownerid");
|
|
||||||
boolean checkUUID2 = DBFunc.hasColumn(resultSet, "ownerId");
|
|
||||||
if (checkUUID) {
|
|
||||||
column = "ownerid";
|
|
||||||
} else if (checkUUID2) {
|
|
||||||
column = "ownerId";
|
|
||||||
}
|
|
||||||
boolean merge = !"plotme".equalsIgnoreCase(this.plugin) && Settings.Enabled_Components.PLOTME_CONVERTER;
|
|
||||||
int missing = 0;
|
|
||||||
while (resultSet.next()) {
|
|
||||||
PlotId id = new PlotId(resultSet.getInt("idX"), resultSet.getInt("idZ"));
|
|
||||||
String name = resultSet.getString("owner");
|
|
||||||
String world = LikePlotMeConverter.getWorld(resultSet.getString("world"));
|
|
||||||
if (!plots.containsKey(world)) {
|
|
||||||
plots.put(world, new HashMap<PlotId, Plot>());
|
|
||||||
if (merge) {
|
|
||||||
int plot = PS.get().worlds.getInt("worlds." + world + ".plot.size");
|
|
||||||
int path = PS.get().worlds.getInt("worlds." + world + ".road.width");
|
|
||||||
plotWidth.put(world, plot);
|
|
||||||
roadWidth.put(world, path);
|
|
||||||
merges.put(world, new HashMap<PlotId, boolean[]>());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (merge) {
|
|
||||||
int tx = resultSet.getInt("topX");
|
|
||||||
int tz = resultSet.getInt("topZ");
|
|
||||||
int bx = resultSet.getInt("bottomX") - 1;
|
|
||||||
int bz = resultSet.getInt("bottomZ") - 1;
|
|
||||||
int path = roadWidth.get(world);
|
|
||||||
int plot = plotWidth.get(world);
|
|
||||||
Location top = getPlotTopLocAbs(path, plot, id);
|
|
||||||
Location bot = getPlotBottomLocAbs(path, plot, id);
|
|
||||||
if (tx > top.getX()) {
|
|
||||||
setMerged(merges, world, id, 1);
|
|
||||||
}
|
|
||||||
if (tz > top.getZ()) {
|
|
||||||
setMerged(merges, world, id, 2);
|
|
||||||
}
|
|
||||||
if (bx < bot.getX()) {
|
|
||||||
setMerged(merges, world, id, 3);
|
|
||||||
}
|
|
||||||
if (bz > bot.getZ()) {
|
|
||||||
setMerged(merges, world, id, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
UUID owner = UUIDHandler.getUUID(name, null);
|
|
||||||
if (owner == null) {
|
|
||||||
if ("*".equals(name)) {
|
|
||||||
owner = DBFunc.everyone;
|
|
||||||
} else {
|
|
||||||
if (checkUUID || checkUUID2) {
|
|
||||||
byte[] bytes = resultSet.getBytes(column);
|
|
||||||
if (bytes != null) {
|
|
||||||
ByteBuffer bb = ByteBuffer.wrap(bytes);
|
|
||||||
long high = bb.getLong();
|
|
||||||
long low = bb.getLong();
|
|
||||||
owner = new UUID(high, low);
|
|
||||||
UUIDHandler.add(new StringWrapper(name), owner);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (name.isEmpty()) {
|
|
||||||
PS.log("&cCould not identify owner for plot: " + id + " -> '" + name + "'");
|
|
||||||
missing++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
owner = UUID.nameUUIDFromBytes(("OfflinePlayer:" + name.toLowerCase()).getBytes(Charsets.UTF_8));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
UUIDHandler.add(new StringWrapper(name), owner);
|
|
||||||
}
|
|
||||||
Plot plot = new Plot(PlotArea.createGeneric(world), id, owner);
|
|
||||||
plots.get(world).put(id, plot);
|
|
||||||
}
|
|
||||||
if (missing > 0) {
|
|
||||||
PS.log("&cSome names could not be identified:");
|
|
||||||
PS.log("&7 - Empty quotes mean PlotMe just stored an unowned plot in the database");
|
|
||||||
PS.log("&7 - Names you have never seen before could be from people mistyping commands");
|
|
||||||
PS.log("&7 - Converting from a non-uuid version of PlotMe can't identify owners if the playerdata files are deleted (these plots will "
|
|
||||||
+ "remain unknown until the player connects)");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Entry<String, HashMap<PlotId, boolean[]>> entry : merges.entrySet()) {
|
|
||||||
String world = entry.getKey();
|
|
||||||
for (Entry<PlotId, boolean[]> entry2 : entry.getValue().entrySet()) {
|
|
||||||
HashMap<PlotId, Plot> newPlots = plots.get(world);
|
|
||||||
Plot plot = newPlots.get(entry2.getKey());
|
|
||||||
if (plot != null) {
|
|
||||||
plot.setMerged(entry2.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
resultSet.close();
|
|
||||||
statement.close();
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
PS.log(" - " + this.prefix + "Denied");
|
|
||||||
statement = connection.prepareStatement("SELECT * FROM `" + this.prefix + "Denied`");
|
|
||||||
resultSet = statement.executeQuery();
|
|
||||||
|
|
||||||
while (resultSet.next()) {
|
|
||||||
PlotId id = new PlotId(resultSet.getInt("idX"), resultSet.getInt("idZ"));
|
|
||||||
String name = resultSet.getString("player");
|
|
||||||
String world = LikePlotMeConverter.getWorld(resultSet.getString("world"));
|
|
||||||
UUID denied = UUIDHandler.getUUID(name, null);
|
|
||||||
if (denied == null) {
|
|
||||||
if ("*".equals(name)) {
|
|
||||||
denied = DBFunc.everyone;
|
|
||||||
} else if (DBFunc.hasColumn(resultSet, "playerid")) {
|
|
||||||
byte[] bytes = resultSet.getBytes("playerid");
|
|
||||||
if (bytes != null) {
|
|
||||||
ByteBuffer bb = ByteBuffer.wrap(bytes);
|
|
||||||
long mostSigBits = bb.getLong();
|
|
||||||
long leastSigBits = bb.getLong();
|
|
||||||
denied = new UUID(mostSigBits, leastSigBits);
|
|
||||||
UUIDHandler.add(new StringWrapper(name), denied);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (denied == null) {
|
|
||||||
PS.log("&6Could not identify denied for plot: " + id);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
HashMap<PlotId, Plot> worldMap = plots.get(world);
|
|
||||||
if (worldMap != null) {
|
|
||||||
Plot plot = worldMap.get(id);
|
|
||||||
if (plot != null) {
|
|
||||||
plot.getDenied().add(denied);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
statement = connection.prepareStatement("SELECT * FROM `" + this.plugin + "Allowed`");
|
|
||||||
resultSet = statement.executeQuery();
|
|
||||||
|
|
||||||
while (resultSet.next()) {
|
|
||||||
PlotId id = new PlotId(resultSet.getInt("idX"), resultSet.getInt("idZ"));
|
|
||||||
String name = resultSet.getString("player");
|
|
||||||
String world = LikePlotMeConverter.getWorld(resultSet.getString("world"));
|
|
||||||
UUID helper = UUIDHandler.getUUID(name, null);
|
|
||||||
if (helper == null) {
|
|
||||||
if ("*".equals(name)) {
|
|
||||||
helper = DBFunc.everyone;
|
|
||||||
} else if (DBFunc.hasColumn(resultSet, "playerid")) {
|
|
||||||
byte[] bytes = resultSet.getBytes("playerid");
|
|
||||||
if (bytes != null) {
|
|
||||||
ByteBuffer bb = ByteBuffer.wrap(bytes);
|
|
||||||
long mostSigBits = bb.getLong();
|
|
||||||
long leastSigBits = bb.getLong();
|
|
||||||
helper = new UUID(mostSigBits, leastSigBits);
|
|
||||||
UUIDHandler.add(new StringWrapper(name), helper);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (helper == null) {
|
|
||||||
PS.log("&6Could not identify helper for plot: " + id);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
HashMap<PlotId, Plot> worldMap = plots.get(world);
|
|
||||||
if (worldMap != null) {
|
|
||||||
Plot plot = worldMap.get(id);
|
|
||||||
if (plot != null) {
|
|
||||||
plot.getTrusted().add(helper);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
resultSet.close();
|
|
||||||
statement.close();
|
|
||||||
|
|
||||||
} catch (SQLException ignored) {}
|
|
||||||
return plots;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean accepts(String version) {
|
|
||||||
return version == null || PS.get().canUpdate(version, "0.17.0") || PS.get().canUpdate("0.999.999", version);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,362 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.database.plotme;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.configuration.ConfigurationSection;
|
|
||||||
import com.intellectualcrafters.configuration.MemorySection;
|
|
||||||
import com.intellectualcrafters.configuration.file.FileConfiguration;
|
|
||||||
import com.intellectualcrafters.configuration.file.YamlConfiguration;
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotArea;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
|
||||||
import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.WorldCreator;
|
|
||||||
import org.bukkit.command.CommandException;
|
|
||||||
|
|
||||||
public class LikePlotMeConverter {
|
|
||||||
|
|
||||||
private final String plugin;
|
|
||||||
|
|
||||||
public LikePlotMeConverter(String plugin) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getWorld(String world) {
|
|
||||||
for (World newWorld : Bukkit.getWorlds()) {
|
|
||||||
if (newWorld.getName().equalsIgnoreCase(world)) {
|
|
||||||
return newWorld.getName();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return world;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void sendMessage(String message) {
|
|
||||||
PS.debug("&3PlotMe&8->&3" + PS.imp().getPluginName() + "&8: &7" + message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPlotMePath() {
|
|
||||||
return new File(".").getAbsolutePath() + File.separator + "plugins" + File.separator + plugin + File.separator;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FileConfiguration getPlotMeConfig(String dataFolder) {
|
|
||||||
File plotMeFile = new File(dataFolder + "config.yml");
|
|
||||||
if (!plotMeFile.exists()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return YamlConfiguration.loadConfiguration(plotMeFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<String> getPlotMeWorlds(FileConfiguration plotConfig) {
|
|
||||||
return plotConfig.getConfigurationSection("worlds").getKeys(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void mergeWorldYml(FileConfiguration plotConfig) {
|
|
||||||
try {
|
|
||||||
File genConfig =
|
|
||||||
new File("plugins" + File.separator + plugin + File.separator + "PlotMe-DefaultGenerator" + File.separator + "config.yml");
|
|
||||||
if (genConfig.exists()) {
|
|
||||||
YamlConfiguration yml = YamlConfiguration.loadConfiguration(genConfig);
|
|
||||||
for (String key : yml.getKeys(true)) {
|
|
||||||
if (!plotConfig.contains(key)) {
|
|
||||||
Object value = yml.get(key);
|
|
||||||
if (!(value instanceof MemorySection)) {
|
|
||||||
plotConfig.set(key, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateWorldYml(String location) {
|
|
||||||
try {
|
|
||||||
Path path = Paths.get(location);
|
|
||||||
File file = new File(location);
|
|
||||||
if (!file.exists()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String content = new String(Files.readAllBytes(path), StandardCharsets.UTF_8);
|
|
||||||
String pluginName = PS.imp().getPluginName();
|
|
||||||
content = content.replace("PlotMe-DefaultGenerator", pluginName);
|
|
||||||
content = content.replace("PlotMe", pluginName);
|
|
||||||
content = content.replace("AthionPlots", pluginName);
|
|
||||||
content = content.replace("PlotZWorld", pluginName);
|
|
||||||
Files.write(path, content.getBytes(StandardCharsets.UTF_8));
|
|
||||||
} catch (IOException ignored) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void copyConfig(ConfigurationSection plotmeDgYml, String world) throws IOException {
|
|
||||||
String actualWorldName = getWorld(world);
|
|
||||||
String plotMeWorldName = world.toLowerCase();
|
|
||||||
Integer pathWidth = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".PathWidth"); //
|
|
||||||
PS.get().worlds.set("worlds." + world + ".road.width", pathWidth);
|
|
||||||
int height = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".RoadHeight", plotmeDgYml.getInt("worlds." + plotMeWorldName + ".GroundHeight", 64)); //
|
|
||||||
PS.get().worlds.set("worlds." + world + ".road.height", height);
|
|
||||||
PS.get().worlds.set("worlds." + world + ".wall.height", height);
|
|
||||||
PS.get().worlds.set("worlds." + world + ".plot.height", height);
|
|
||||||
int plotSize = plotmeDgYml.getInt("worlds." + plotMeWorldName + ".PlotSize", 32); //
|
|
||||||
PS.get().worlds.set("worlds." + world + ".plot.size", plotSize);
|
|
||||||
String wallblock = plotmeDgYml.getString("worlds." + plotMeWorldName + ".UnclaimedBorder", plotmeDgYml.getString("worlds." + plotMeWorldName + ".WallBlock", "44")); //
|
|
||||||
PS.get().worlds.set("worlds." + world + ".wall.block", wallblock);
|
|
||||||
String claimed = plotmeDgYml.getString("worlds." + plotMeWorldName + ".ProtectedWallBlock", "44:1"); //
|
|
||||||
PS.get().worlds.set("worlds." + world + ".wall.block_claimed", claimed);
|
|
||||||
String floor = plotmeDgYml.getString("worlds." + plotMeWorldName + ".PlotFloorBlock", "2"); //
|
|
||||||
PS.get().worlds.set("worlds." + world + ".plot.floor", Collections.singletonList(floor));
|
|
||||||
String filling = plotmeDgYml.getString("worlds." + plotMeWorldName + ".FillBlock", "3"); //
|
|
||||||
PS.get().worlds.set("worlds." + world + ".plot.filling", Collections.singletonList(filling));
|
|
||||||
String road = plotmeDgYml.getString("worlds." + plotMeWorldName + ".RoadMainBlock", "5");
|
|
||||||
PS.get().worlds.set("worlds." + world + ".road.block", road);
|
|
||||||
PS.get().worlds.set("worlds." + actualWorldName + ".road.height", height);
|
|
||||||
PS.get().worlds.set("worlds." + actualWorldName + ".plot.height", height);
|
|
||||||
PS.get().worlds.set("worlds." + actualWorldName + ".wall.height", height);
|
|
||||||
PS.get().worlds.save(PS.get().worldsFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean run(APlotMeConnector connector) {
|
|
||||||
try {
|
|
||||||
String dataFolder = getPlotMePath();
|
|
||||||
FileConfiguration plotConfig = getPlotMeConfig(dataFolder);
|
|
||||||
if (plotConfig == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
String version = plotConfig.getString("Version");
|
|
||||||
if (version == null) {
|
|
||||||
version = plotConfig.getString("version");
|
|
||||||
}
|
|
||||||
if (!connector.accepts(version)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
PS.debug("&3Using connector: " + connector.getClass().getCanonicalName());
|
|
||||||
|
|
||||||
Connection connection = connector.getPlotMeConnection(plugin,plotConfig, dataFolder);
|
|
||||||
|
|
||||||
if (!connector.isValidConnection(connection)) {
|
|
||||||
sendMessage("Cannot connect to PlotMe DB. Conversion process will not continue");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
sendMessage("PlotMe conversion has started. To disable this, please set 'enabled-components -> plotme-converter' to false in the 'settings.yml'");
|
|
||||||
|
|
||||||
mergeWorldYml(plotConfig);
|
|
||||||
|
|
||||||
sendMessage("Connecting to PlotMe DB");
|
|
||||||
|
|
||||||
ArrayList<Plot> createdPlots = new ArrayList<>();
|
|
||||||
|
|
||||||
sendMessage("Collecting plot data");
|
|
||||||
|
|
||||||
String dbPrefix = "PlotMe".toLowerCase();
|
|
||||||
sendMessage(" - " + dbPrefix + "Plots");
|
|
||||||
final Set<String> worlds = getPlotMeWorlds(plotConfig);
|
|
||||||
|
|
||||||
if (Settings.Enabled_Components.PLOTME_CONVERTER) {
|
|
||||||
sendMessage("Updating bukkit.yml");
|
|
||||||
updateWorldYml("bukkit.yml");
|
|
||||||
updateWorldYml("plugins/Multiverse-Core/worlds.yml");
|
|
||||||
for (String world : plotConfig.getConfigurationSection("worlds").getKeys(false)) {
|
|
||||||
sendMessage("Copying config for: " + world);
|
|
||||||
try {
|
|
||||||
String actualWorldName = getWorld(world);
|
|
||||||
connector.copyConfig(plotConfig, world, actualWorldName);
|
|
||||||
PS.get().worlds.save(PS.get().worldsFile);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
sendMessage("&c-- &lFailed to save configuration for world '" + world
|
|
||||||
+ "'\nThis will need to be done using the setup command, or manually");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
HashMap<String, HashMap<PlotId, Plot>> plots = connector.getPlotMePlots(connection);
|
|
||||||
int plotCount = 0;
|
|
||||||
for (Entry<String, HashMap<PlotId, Plot>> entry : plots.entrySet()) {
|
|
||||||
plotCount += entry.getValue().size();
|
|
||||||
}
|
|
||||||
if (!Settings.Enabled_Components.PLOTME_CONVERTER) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
sendMessage(" - " + dbPrefix + "Allowed");
|
|
||||||
|
|
||||||
sendMessage("Collected " + plotCount + " plots from PlotMe");
|
|
||||||
File plotmeDgFile = new File(dataFolder + File.separator + "PlotMe-DefaultGenerator" + File.separator + "config.yml");
|
|
||||||
if (plotmeDgFile.exists()) {
|
|
||||||
YamlConfiguration plotmeDgYml = YamlConfiguration.loadConfiguration(plotmeDgFile);
|
|
||||||
try {
|
|
||||||
HashSet<String> allWorlds = new HashSet<>(plots.keySet());
|
|
||||||
allWorlds.addAll(worlds);
|
|
||||||
for (String world : allWorlds) {
|
|
||||||
copyConfig(plotmeDgYml, world);
|
|
||||||
}
|
|
||||||
} catch (IOException ignored) {
|
|
||||||
ignored.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (Entry<String, HashMap<PlotId, Plot>> entry : plots.entrySet()) {
|
|
||||||
String world = entry.getKey();
|
|
||||||
PlotArea area = PS.get().getPlotArea(world, null);
|
|
||||||
int duplicate = 0;
|
|
||||||
if (area != null) {
|
|
||||||
for (Entry<PlotId, Plot> entry2 : entry.getValue().entrySet()) {
|
|
||||||
if (area.getOwnedPlotAbs(entry2.getKey()) != null) {
|
|
||||||
duplicate++;
|
|
||||||
} else {
|
|
||||||
createdPlots.add(entry2.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (duplicate > 0) {
|
|
||||||
PS.debug("&c[WARNING] Found " + duplicate + " duplicate plots already in DB for world: '" + world
|
|
||||||
+ "'. Have you run the converter already?");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (PS.get().plots_tmp != null) {
|
|
||||||
HashMap<PlotId, Plot> map = PS.get().plots_tmp.get(world);
|
|
||||||
if (map != null) {
|
|
||||||
for (Entry<PlotId, Plot> entry2 : entry.getValue().entrySet()) {
|
|
||||||
if (map.containsKey(entry2.getKey())) {
|
|
||||||
duplicate++;
|
|
||||||
} else {
|
|
||||||
createdPlots.add(entry2.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (duplicate > 0) {
|
|
||||||
PS.debug("&c[WARNING] Found " + duplicate + " duplicate plots already in DB for world: '" + world
|
|
||||||
+ "'. Have you run the converter already?");
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
createdPlots.addAll(entry.getValue().values());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sendMessage("Creating plot DB");
|
|
||||||
Thread.sleep(1000);
|
|
||||||
final AtomicBoolean done = new AtomicBoolean(false);
|
|
||||||
DBFunc.createPlotsAndData(createdPlots, new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (done.get()) {
|
|
||||||
done();
|
|
||||||
sendMessage("&aDatabase conversion is now complete!");
|
|
||||||
PS.debug("&c - Stop the server");
|
|
||||||
PS.debug("&c - Disable 'plotme-converter' and 'plotme-convert.cache-uuids' in the settings.yml");
|
|
||||||
PS.debug("&c - Correct any generator settings that haven't copied to 'settings.yml' properly");
|
|
||||||
PS.debug("&c - Start the server");
|
|
||||||
PS.get().setPlots(DBFunc.getPlots());
|
|
||||||
} else {
|
|
||||||
sendMessage("&cPlease wait until database conversion is complete. You will be notified with instructions when this happens!");
|
|
||||||
done.set(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
sendMessage("Saving configuration...");
|
|
||||||
try {
|
|
||||||
PS.get().worlds.save(PS.get().worldsFile);
|
|
||||||
} catch (IOException ignored) {
|
|
||||||
sendMessage(" - &cFailed to save configuration.");
|
|
||||||
}
|
|
||||||
TaskManager.runTask(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
boolean mv = false;
|
|
||||||
boolean mw = false;
|
|
||||||
if ((Bukkit.getPluginManager().getPlugin("Multiverse-Core") != null) && Bukkit.getPluginManager().getPlugin("Multiverse-Core")
|
|
||||||
.isEnabled()) {
|
|
||||||
mv = true;
|
|
||||||
} else if ((Bukkit.getPluginManager().getPlugin("MultiWorld") != null) && Bukkit.getPluginManager().getPlugin("MultiWorld")
|
|
||||||
.isEnabled()) {
|
|
||||||
mw = true;
|
|
||||||
}
|
|
||||||
for (String worldName : worlds) {
|
|
||||||
World world = Bukkit.getWorld(getWorld(worldName));
|
|
||||||
if (world == null) {
|
|
||||||
sendMessage("&cInvalid world in PlotMe configuration: " + worldName);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
String actualWorldName = world.getName();
|
|
||||||
sendMessage("Reloading generator for world: '" + actualWorldName + "'...");
|
|
||||||
if (!Bukkit.getWorlds().isEmpty() && Bukkit.getWorlds().get(0).getName().equals(worldName)) {
|
|
||||||
sendMessage("&cYou need to stop the server to reload this world properly");
|
|
||||||
} else {
|
|
||||||
PS.get().removePlotAreas(actualWorldName);
|
|
||||||
if (mv) {
|
|
||||||
// unload world with MV
|
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mv unload " + actualWorldName);
|
|
||||||
try {
|
|
||||||
Thread.sleep(1000);
|
|
||||||
} catch (InterruptedException ignored) {
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
}
|
|
||||||
// load world with MV
|
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(),
|
|
||||||
"mv import " + actualWorldName + " normal -g " + PS.imp().getPluginName());
|
|
||||||
} else if (mw) {
|
|
||||||
// unload world with MW
|
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "mw unload " + actualWorldName);
|
|
||||||
try {
|
|
||||||
Thread.sleep(1000);
|
|
||||||
} catch (InterruptedException ignored) {
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
}
|
|
||||||
// load world with MW
|
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(),
|
|
||||||
"mw create " + actualWorldName + " plugin:" + PS.imp().getPluginName());
|
|
||||||
} else {
|
|
||||||
// Load using Bukkit API
|
|
||||||
// - User must set generator manually
|
|
||||||
Bukkit.getServer().unloadWorld(world, true);
|
|
||||||
World myWorld = WorldCreator.name(actualWorldName).generator(new BukkitPlotGenerator(PS.get().IMP.getDefaultGenerator())).createWorld();
|
|
||||||
myWorld.save();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (CommandException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
if (done.get()) {
|
|
||||||
done();
|
|
||||||
sendMessage("&aDatabase conversion is now complete!");
|
|
||||||
PS.debug("&c - Stop the server");
|
|
||||||
PS.debug("&c - Disable 'plotme-converter' and 'plotme-convert.cache-uuids' in the settings.yml");
|
|
||||||
PS.debug("&c - Correct any generator settings that haven't copied to 'settings.yml' properly");
|
|
||||||
PS.debug("&c - Start the server");
|
|
||||||
} else {
|
|
||||||
sendMessage("&cPlease wait until database conversion is complete. You will be notified with instructions when this happens!");
|
|
||||||
done.set(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (InterruptedException | SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
PS.debug("&/end/");
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void done() {
|
|
||||||
PS.get().setPlots(DBFunc.getPlots());
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,194 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.database.plotme;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.configuration.file.FileConfiguration;
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
|
||||||
import com.intellectualcrafters.plot.database.SQLite;
|
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotArea;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
|
||||||
import com.intellectualcrafters.plot.object.StringWrapper;
|
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.DriverManager;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class PlotMeConnector_017 extends APlotMeConnector {
|
|
||||||
|
|
||||||
private String plugin;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Connection getPlotMeConnection(String plugin, FileConfiguration plotConfig, String dataFolder) {
|
|
||||||
this.plugin = plugin.toLowerCase();
|
|
||||||
try {
|
|
||||||
if (plotConfig.getBoolean("usemySQL")) {
|
|
||||||
String user = plotConfig.getString("mySQLuname");
|
|
||||||
String password = plotConfig.getString("mySQLpass");
|
|
||||||
String con = plotConfig.getString("mySQLconn");
|
|
||||||
return DriverManager.getConnection(con, user, password);
|
|
||||||
} else {
|
|
||||||
File file = new File(dataFolder + File.separator + "plotmecore.db");
|
|
||||||
if (file.exists()) {
|
|
||||||
return new SQLite(file).openConnection();
|
|
||||||
}
|
|
||||||
return new SQLite(new File(dataFolder + File.separator + "plots.db")).openConnection();
|
|
||||||
}
|
|
||||||
} catch (SQLException | ClassNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HashMap<String, HashMap<PlotId, Plot>> getPlotMePlots(Connection connection) throws SQLException {
|
|
||||||
ResultSet resultSet;
|
|
||||||
PreparedStatement statement;
|
|
||||||
HashMap<String, Integer> plotWidth = new HashMap<>();
|
|
||||||
HashMap<String, Integer> roadWidth = new HashMap<>();
|
|
||||||
HashMap<Integer, Plot> plots = new HashMap<>();
|
|
||||||
HashMap<String, HashMap<PlotId, boolean[]>> merges = new HashMap<>();
|
|
||||||
try {
|
|
||||||
statement = connection.prepareStatement("SELECT * FROM `" + this.plugin + "core_plots`");
|
|
||||||
resultSet = statement.executeQuery();
|
|
||||||
} catch (SQLException e) {
|
|
||||||
PS.debug("========= Table does not exist =========");
|
|
||||||
e.printStackTrace();
|
|
||||||
PS.debug("=======================================");
|
|
||||||
PS.debug("&8 - &7The database does not match the version specified in the PlotMe config");
|
|
||||||
PS.debug("&8 - &7Please correct this, or if you are unsure, the most common is 0.16.3");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
boolean checkUUID = DBFunc.hasColumn(resultSet, "ownerID");
|
|
||||||
boolean merge = !"plotme".equals(this.plugin) && Settings.Enabled_Components.PLOTME_CONVERTER;
|
|
||||||
while (resultSet.next()) {
|
|
||||||
int key = resultSet.getInt("plot_id");
|
|
||||||
PlotId id = new PlotId(resultSet.getInt("plotX"), resultSet.getInt("plotZ"));
|
|
||||||
String name = resultSet.getString("owner");
|
|
||||||
String world = LikePlotMeConverter.getWorld(resultSet.getString("world"));
|
|
||||||
if (!plots.containsKey(world) && merge) {
|
|
||||||
int plot = PS.get().worlds.getInt("worlds." + world + ".plot.size");
|
|
||||||
int path = PS.get().worlds.getInt("worlds." + world + ".road.width");
|
|
||||||
plotWidth.put(world, plot);
|
|
||||||
roadWidth.put(world, path);
|
|
||||||
merges.put(world, new HashMap<PlotId, boolean[]>());
|
|
||||||
}
|
|
||||||
if (merge) {
|
|
||||||
int tx = resultSet.getInt("topX");
|
|
||||||
int tz = resultSet.getInt("topZ");
|
|
||||||
int bx = resultSet.getInt("bottomX") - 1;
|
|
||||||
int bz = resultSet.getInt("bottomZ") - 1;
|
|
||||||
int path = roadWidth.get(world);
|
|
||||||
int plot = plotWidth.get(world);
|
|
||||||
Location top = getPlotTopLocAbs(path, plot, id);
|
|
||||||
Location bot = getPlotBottomLocAbs(path, plot, id);
|
|
||||||
if (tx > top.getX()) {
|
|
||||||
setMerged(merges, world, id, 1);
|
|
||||||
}
|
|
||||||
if (tz > top.getZ()) {
|
|
||||||
setMerged(merges, world, id, 2);
|
|
||||||
}
|
|
||||||
if (bx < bot.getX()) {
|
|
||||||
setMerged(merges, world, id, 3);
|
|
||||||
}
|
|
||||||
if (bz > bot.getZ()) {
|
|
||||||
setMerged(merges, world, id, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
UUID owner = UUIDHandler.getUUID(name, null);
|
|
||||||
if (owner == null) {
|
|
||||||
if (name.equals("*")) {
|
|
||||||
owner = DBFunc.everyone;
|
|
||||||
} else {
|
|
||||||
if (checkUUID) {
|
|
||||||
byte[] bytes = resultSet.getBytes("ownerid");
|
|
||||||
if (bytes != null) {
|
|
||||||
owner = UUID.nameUUIDFromBytes(bytes);
|
|
||||||
UUIDHandler.add(new StringWrapper(name), owner);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (owner == null) {
|
|
||||||
PS.log("&cCould not identify owner for plot: " + id + " -> '" + name + '\'');
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
UUIDHandler.add(new StringWrapper(name), owner);
|
|
||||||
}
|
|
||||||
Plot plot = new Plot(PlotArea.createGeneric(world), id, owner);
|
|
||||||
plots.put(key, plot);
|
|
||||||
}
|
|
||||||
for (Plot plot : plots.values()) {
|
|
||||||
HashMap<PlotId, boolean[]> mergeMap = merges.get(plot.getArea().worldname);
|
|
||||||
if (mergeMap != null) {
|
|
||||||
if (mergeMap.containsKey(plot.getId())) {
|
|
||||||
plot.setMerged(mergeMap.get(plot.getId()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
resultSet.close();
|
|
||||||
statement.close();
|
|
||||||
try {
|
|
||||||
PS.log(" - " + this.plugin + "core_denied");
|
|
||||||
statement = connection.prepareStatement("SELECT * FROM `" + this.plugin + "core_denied`");
|
|
||||||
resultSet = statement.executeQuery();
|
|
||||||
|
|
||||||
while (resultSet.next()) {
|
|
||||||
int key = resultSet.getInt("plot_id");
|
|
||||||
Plot plot = plots.get(key);
|
|
||||||
if (plot == null) {
|
|
||||||
PS.log("&6Denied (" + key + ") references deleted plot; ignoring entry.");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
UUID denied = UUID.fromString(resultSet.getString("player"));
|
|
||||||
plot.getDenied().add(denied);
|
|
||||||
}
|
|
||||||
|
|
||||||
PS.log(" - " + this.plugin + "core_allowed");
|
|
||||||
statement = connection.prepareStatement("SELECT * FROM `" + this.plugin + "core_allowed`");
|
|
||||||
resultSet = statement.executeQuery();
|
|
||||||
|
|
||||||
while (resultSet.next()) {
|
|
||||||
int key = resultSet.getInt("plot_id");
|
|
||||||
Plot plot = plots.get(key);
|
|
||||||
if (plot == null) {
|
|
||||||
PS.log("&6Allowed (" + key + ") references deleted plot; ignoring entry.");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
UUID allowed = UUID.fromString(resultSet.getString("player"));
|
|
||||||
plot.getTrusted().add(allowed);
|
|
||||||
}
|
|
||||||
resultSet.close();
|
|
||||||
statement.close();
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
HashMap<String, HashMap<PlotId, Plot>> processed = new HashMap<>();
|
|
||||||
|
|
||||||
for (Plot plot : plots.values()) {
|
|
||||||
HashMap<PlotId, Plot> map = processed.get(plot.getArea().worldname);
|
|
||||||
if (map == null) {
|
|
||||||
map = new HashMap<>();
|
|
||||||
processed.put(plot.getArea().worldname, map);
|
|
||||||
}
|
|
||||||
map.put(plot.getId(), plot);
|
|
||||||
}
|
|
||||||
return processed;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean accepts(String version) {
|
|
||||||
if (version == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return !PS.get().canUpdate(version, "0.17");
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.entity;
|
||||||
|
|
||||||
|
class AgeableStats {
|
||||||
|
|
||||||
|
int age;
|
||||||
|
boolean locked;
|
||||||
|
boolean adult;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.entity;
|
||||||
|
|
||||||
|
class ArmorStandStats {
|
||||||
|
|
||||||
|
final float[] head = new float[3];
|
||||||
|
final float[] body = new float[3];
|
||||||
|
final float[] leftLeg = new float[3];
|
||||||
|
final float[] rightLeg = new float[3];
|
||||||
|
final float[] leftArm = new float[3];
|
||||||
|
final float[] rightArm = new float[3];
|
||||||
|
boolean arms;
|
||||||
|
boolean noPlate;
|
||||||
|
boolean invisible;
|
||||||
|
boolean small;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.entity;
|
||||||
|
|
||||||
|
class EntityBaseStats {
|
||||||
|
|
||||||
|
EntityWrapper passenger;
|
||||||
|
float fall;
|
||||||
|
short fire;
|
||||||
|
int age;
|
||||||
|
double vZ;
|
||||||
|
double vY;
|
||||||
|
double vX;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.entity;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
|
public abstract class EntityWrapper {
|
||||||
|
|
||||||
|
protected final float yaw;
|
||||||
|
protected final float pitch;
|
||||||
|
private final Entity entity;
|
||||||
|
private final EntityType type;
|
||||||
|
public double x;
|
||||||
|
public double y;
|
||||||
|
public double z;
|
||||||
|
|
||||||
|
EntityWrapper(final @NonNull Entity entity) {
|
||||||
|
this.entity = entity;
|
||||||
|
this.type = entity.getType();
|
||||||
|
|
||||||
|
final Location location = entity.getLocation();
|
||||||
|
this.x = location.getX();
|
||||||
|
this.y = location.getY();
|
||||||
|
this.z = location.getZ();
|
||||||
|
this.yaw = location.getYaw();
|
||||||
|
this.pitch = location.getPitch();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.format("[%s, x=%s, y=%s, z=%s]", type.getName(), x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract Entity spawn(World world, int xOffset, int zOffset);
|
||||||
|
|
||||||
|
public abstract void saveEntity();
|
||||||
|
|
||||||
|
public float getYaw() {
|
||||||
|
return this.yaw;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getPitch() {
|
||||||
|
return this.pitch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Entity getEntity() {
|
||||||
|
return this.entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityType getType() {
|
||||||
|
return this.type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getX() {
|
||||||
|
return this.x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getY() {
|
||||||
|
return this.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getZ() {
|
||||||
|
return this.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.entity;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Horse;
|
||||||
|
|
||||||
|
class HorseStats {
|
||||||
|
|
||||||
|
double jump;
|
||||||
|
boolean chest;
|
||||||
|
Horse.Variant variant;
|
||||||
|
Horse.Color color;
|
||||||
|
Horse.Style style;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.entity;
|
||||||
|
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
class LivingEntityStats {
|
||||||
|
|
||||||
|
boolean loot;
|
||||||
|
String name;
|
||||||
|
boolean visible;
|
||||||
|
float health;
|
||||||
|
short air;
|
||||||
|
boolean persistent;
|
||||||
|
boolean leashed;
|
||||||
|
short leashX;
|
||||||
|
short leashY;
|
||||||
|
short leashZ;
|
||||||
|
boolean equipped;
|
||||||
|
ItemStack mainHand;
|
||||||
|
ItemStack helmet;
|
||||||
|
ItemStack boots;
|
||||||
|
ItemStack leggings;
|
||||||
|
ItemStack chestplate;
|
||||||
|
Collection<PotionEffect> potions;
|
||||||
|
ItemStack offHand;
|
||||||
|
|
||||||
|
}
|
@ -1,7 +1,26 @@
|
|||||||
package com.plotsquared.bukkit.object.entity;
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.entity;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.plotsquared.core.configuration.Settings;
|
||||||
import com.plotsquared.bukkit.util.BukkitVersion;
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.bukkit.Art;
|
import org.bukkit.Art;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -9,25 +28,21 @@ import org.bukkit.Rotation;
|
|||||||
import org.bukkit.TreeSpecies;
|
import org.bukkit.TreeSpecies;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.entity.AbstractHorse;
|
||||||
import org.bukkit.entity.Ageable;
|
import org.bukkit.entity.Ageable;
|
||||||
import org.bukkit.entity.ArmorStand;
|
import org.bukkit.entity.ArmorStand;
|
||||||
import org.bukkit.entity.Bat;
|
import org.bukkit.entity.Bat;
|
||||||
import org.bukkit.entity.Boat;
|
import org.bukkit.entity.Boat;
|
||||||
|
import org.bukkit.entity.ChestedHorse;
|
||||||
import org.bukkit.entity.EnderDragon;
|
import org.bukkit.entity.EnderDragon;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
import org.bukkit.entity.Guardian;
|
|
||||||
import org.bukkit.entity.Horse;
|
|
||||||
import org.bukkit.entity.IronGolem;
|
import org.bukkit.entity.IronGolem;
|
||||||
import org.bukkit.entity.Item;
|
import org.bukkit.entity.Item;
|
||||||
import org.bukkit.entity.ItemFrame;
|
import org.bukkit.entity.ItemFrame;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Painting;
|
import org.bukkit.entity.Painting;
|
||||||
import org.bukkit.entity.Rabbit;
|
import org.bukkit.entity.Rabbit;
|
||||||
import org.bukkit.entity.Rabbit.Type;
|
|
||||||
import org.bukkit.entity.Sheep;
|
import org.bukkit.entity.Sheep;
|
||||||
import org.bukkit.entity.Skeleton;
|
|
||||||
import org.bukkit.entity.Skeleton.SkeletonType;
|
|
||||||
import org.bukkit.entity.Slime;
|
import org.bukkit.entity.Slime;
|
||||||
import org.bukkit.entity.Tameable;
|
import org.bukkit.entity.Tameable;
|
||||||
import org.bukkit.inventory.EntityEquipment;
|
import org.bukkit.inventory.EntityEquipment;
|
||||||
@ -36,18 +51,17 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.util.EulerAngle;
|
import org.bukkit.util.EulerAngle;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
public class EntityWrapper {
|
import java.util.List;
|
||||||
|
|
||||||
|
public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + ReplicatingEntityWrapper.class.getSimpleName());
|
||||||
|
|
||||||
private final EntityType type;
|
|
||||||
private final float yaw;
|
|
||||||
private final float pitch;
|
|
||||||
private final short depth;
|
private final short depth;
|
||||||
private final int hash;
|
private final int hash;
|
||||||
private final EntityBaseStats base = new EntityBaseStats();
|
private final EntityBaseStats base = new EntityBaseStats();
|
||||||
public double x;
|
|
||||||
public double y;
|
private ItemStack[] inventory;
|
||||||
public double z;
|
|
||||||
public ItemStack[] inventory;
|
|
||||||
// Extended
|
// Extended
|
||||||
private ItemStack stack;
|
private ItemStack stack;
|
||||||
private byte dataByte;
|
private byte dataByte;
|
||||||
@ -60,22 +74,18 @@ public class EntityWrapper {
|
|||||||
private HorseStats horse;
|
private HorseStats horse;
|
||||||
private boolean noGravity;
|
private boolean noGravity;
|
||||||
|
|
||||||
public EntityWrapper(Entity entity, short depth) {
|
public ReplicatingEntityWrapper(Entity entity, short depth) {
|
||||||
|
super(entity);
|
||||||
|
|
||||||
this.hash = entity.getEntityId();
|
this.hash = entity.getEntityId();
|
||||||
this.depth = depth;
|
this.depth = depth;
|
||||||
Location location = entity.getLocation();
|
|
||||||
this.yaw = location.getYaw();
|
|
||||||
this.pitch = location.getPitch();
|
|
||||||
this.x = location.getX();
|
|
||||||
this.y = location.getY();
|
|
||||||
this.z = location.getZ();
|
|
||||||
this.type = entity.getType();
|
|
||||||
if (depth == 0) {
|
if (depth == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Entity passenger = entity.getPassenger();
|
List<Entity> passengers = entity.getPassengers();
|
||||||
if (passenger != null) {
|
if (passengers.size() > 0) {
|
||||||
this.base.passenger = new EntityWrapper(passenger, depth);
|
this.base.passenger = new ReplicatingEntityWrapper(passengers.get(0), depth);
|
||||||
}
|
}
|
||||||
this.base.fall = entity.getFallDistance();
|
this.base.fall = entity.getFallDistance();
|
||||||
this.base.fire = (short) entity.getFireTicks();
|
this.base.fire = (short) entity.getFireTicks();
|
||||||
@ -87,73 +97,65 @@ public class EntityWrapper {
|
|||||||
if (depth == 1) {
|
if (depth == 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_10_0) || entity instanceof ArmorStand) {
|
if (!entity.hasGravity()) {
|
||||||
if (!entity.hasGravity()) {
|
this.noGravity = true;
|
||||||
this.noGravity = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
switch (entity.getType()) {
|
switch (entity.getType().toString()) {
|
||||||
case ARROW:
|
case "BOAT":
|
||||||
case BOAT:
|
Boat boat = (Boat) entity;
|
||||||
if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) {
|
this.dataByte = getOrdinal(TreeSpecies.values(), boat.getWoodType());
|
||||||
Boat boat = (Boat) entity;
|
return;
|
||||||
this.dataByte = getOrdinal(TreeSpecies.values(), boat.getWoodType());
|
case "ARROW":
|
||||||
}
|
case "EGG":
|
||||||
case COMPLEX_PART:
|
case "ENDER_CRYSTAL":
|
||||||
case EGG:
|
case "ENDER_PEARL":
|
||||||
case ENDER_CRYSTAL:
|
case "ENDER_SIGNAL":
|
||||||
case ENDER_PEARL:
|
case "EXPERIENCE_ORB":
|
||||||
case ENDER_SIGNAL:
|
case "FALLING_BLOCK":
|
||||||
case EXPERIENCE_ORB:
|
case "FIREBALL":
|
||||||
case FALLING_BLOCK:
|
case "FIREWORK":
|
||||||
case FIREBALL:
|
case "FISHING_HOOK":
|
||||||
case FIREWORK:
|
case "LEASH_HITCH":
|
||||||
case FISHING_HOOK:
|
case "LIGHTNING":
|
||||||
case LEASH_HITCH:
|
case "MINECART":
|
||||||
case LIGHTNING:
|
case "MINECART_COMMAND":
|
||||||
case MINECART:
|
case "MINECART_MOB_SPAWNER":
|
||||||
case MINECART_COMMAND:
|
case "MINECART_TNT":
|
||||||
case MINECART_MOB_SPAWNER:
|
case "PLAYER":
|
||||||
case MINECART_TNT:
|
case "PRIMED_TNT":
|
||||||
case PLAYER:
|
case "SLIME":
|
||||||
case PRIMED_TNT:
|
case "SMALL_FIREBALL":
|
||||||
case SLIME:
|
case "SNOWBALL":
|
||||||
case SMALL_FIREBALL:
|
case "MINECART_FURNACE":
|
||||||
case SNOWBALL:
|
case "SPLASH_POTION":
|
||||||
case MINECART_FURNACE:
|
case "THROWN_EXP_BOTTLE":
|
||||||
case SPLASH_POTION:
|
case "WITHER_SKULL":
|
||||||
case THROWN_EXP_BOTTLE:
|
case "UNKNOWN":
|
||||||
case WEATHER:
|
case "SPECTRAL_ARROW":
|
||||||
case WITHER_SKULL:
|
case "SHULKER_BULLET":
|
||||||
case UNKNOWN:
|
case "DRAGON_FIREBALL":
|
||||||
case TIPPED_ARROW:
|
case "AREA_EFFECT_CLOUD":
|
||||||
case SPECTRAL_ARROW:
|
case "TRIDENT":
|
||||||
case SHULKER_BULLET:
|
case "LLAMA_SPIT":
|
||||||
case DRAGON_FIREBALL:
|
|
||||||
case LINGERING_POTION:
|
|
||||||
case AREA_EFFECT_CLOUD:
|
|
||||||
// Do this stuff later
|
// Do this stuff later
|
||||||
return;
|
return;
|
||||||
default:
|
|
||||||
PS.debug("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType());
|
|
||||||
return;
|
|
||||||
// MISC //
|
// MISC //
|
||||||
case DROPPED_ITEM:
|
case "DROPPED_ITEM":
|
||||||
Item item = (Item) entity;
|
Item item = (Item) entity;
|
||||||
this.stack = item.getItemStack();
|
this.stack = item.getItemStack();
|
||||||
return;
|
return;
|
||||||
case ITEM_FRAME:
|
case "ITEM_FRAME":
|
||||||
this.x = Math.floor(this.x);
|
this.x = Math.floor(this.getX());
|
||||||
this.y = Math.floor(this.y);
|
this.y = Math.floor(this.getY());
|
||||||
this.z = Math.floor(this.z);
|
this.z = Math.floor(this.getZ());
|
||||||
ItemFrame itemFrame = (ItemFrame) entity;
|
ItemFrame itemFrame = (ItemFrame) entity;
|
||||||
this.dataByte = getOrdinal(Rotation.values(), itemFrame.getRotation());
|
this.dataByte = getOrdinal(Rotation.values(), itemFrame.getRotation());
|
||||||
this.stack = itemFrame.getItem().clone();
|
this.stack = itemFrame.getItem().clone();
|
||||||
return;
|
return;
|
||||||
case PAINTING:
|
case "PAINTING":
|
||||||
this.x = Math.floor(this.x);
|
this.x = Math.floor(this.getX());
|
||||||
this.y = Math.floor(this.y);
|
this.y = Math.floor(this.getY());
|
||||||
this.z = Math.floor(this.z);
|
this.z = Math.floor(this.getZ());
|
||||||
Painting painting = (Painting) entity;
|
Painting painting = (Painting) entity;
|
||||||
Art art = painting.getArt();
|
Art art = painting.getArt();
|
||||||
this.dataByte = getOrdinal(BlockFace.values(), painting.getFacing());
|
this.dataByte = getOrdinal(BlockFace.values(), painting.getFacing());
|
||||||
@ -165,68 +167,75 @@ public class EntityWrapper {
|
|||||||
return;
|
return;
|
||||||
// END MISC //
|
// END MISC //
|
||||||
// INVENTORY HOLDER //
|
// INVENTORY HOLDER //
|
||||||
case MINECART_CHEST:
|
case "MINECART_CHEST":
|
||||||
case MINECART_HOPPER:
|
case "MINECART_HOPPER":
|
||||||
storeInventory((InventoryHolder) entity);
|
storeInventory((InventoryHolder) entity);
|
||||||
return;
|
return;
|
||||||
// START LIVING ENTITY //
|
// START LIVING ENTITY //
|
||||||
// START AGEABLE //
|
// START AGEABLE //
|
||||||
// START TAMEABLE //
|
// START TAMEABLE //
|
||||||
case HORSE:
|
case "HORSE":
|
||||||
Horse horse = (Horse) entity;
|
case "DONKEY":
|
||||||
|
case "LLAMA":
|
||||||
|
case "MULE":
|
||||||
|
case "SKELETON_HORSE":
|
||||||
|
AbstractHorse horse = (AbstractHorse) entity;
|
||||||
this.horse = new HorseStats();
|
this.horse = new HorseStats();
|
||||||
this.horse.jump = horse.getJumpStrength();
|
this.horse.jump = horse.getJumpStrength();
|
||||||
this.horse.chest = horse.isCarryingChest();
|
if (horse instanceof ChestedHorse horse1) {
|
||||||
this.horse.variant = horse.getVariant();
|
this.horse.chest = horse1.isCarryingChest();
|
||||||
this.horse.style = horse.getStyle();
|
}
|
||||||
this.horse.color = horse.getColor();
|
//todo these horse features need fixing
|
||||||
|
//this.horse.variant = horse.getVariant();
|
||||||
|
//this.horse.style = horse.getStyle();
|
||||||
|
//this.horse.color = horse.getColor();
|
||||||
storeTameable(horse);
|
storeTameable(horse);
|
||||||
storeAgeable(horse);
|
storeAgeable(horse);
|
||||||
storeLiving(horse);
|
storeLiving(horse);
|
||||||
storeInventory(horse);
|
storeInventory(horse);
|
||||||
return;
|
return;
|
||||||
// END INVENTORY HOLDER //
|
// END INVENTORY HOLDER //
|
||||||
case WOLF:
|
case "WOLF":
|
||||||
case OCELOT:
|
case "OCELOT":
|
||||||
storeTameable((Tameable) entity);
|
storeTameable((Tameable) entity);
|
||||||
storeAgeable((Ageable) entity);
|
storeAgeable((Ageable) entity);
|
||||||
storeLiving((LivingEntity) entity);
|
storeLiving((LivingEntity) entity);
|
||||||
return;
|
return;
|
||||||
// END TAMEABLE //
|
// END TAMEABLE //
|
||||||
case SHEEP:
|
//todo fix sheep
|
||||||
|
case "SHEEP":
|
||||||
Sheep sheep = (Sheep) entity;
|
Sheep sheep = (Sheep) entity;
|
||||||
this.dataByte = (byte) (sheep.isSheared() ? 1 : 0);
|
if (sheep.isSheared()) {
|
||||||
|
this.dataByte = (byte) 1;
|
||||||
|
} else {
|
||||||
|
this.dataByte = (byte) 0;
|
||||||
|
}
|
||||||
this.dataByte2 = sheep.getColor().getDyeData();
|
this.dataByte2 = sheep.getColor().getDyeData();
|
||||||
storeAgeable(sheep);
|
storeAgeable(sheep);
|
||||||
storeLiving(sheep);
|
storeLiving(sheep);
|
||||||
return;
|
return;
|
||||||
case VILLAGER:
|
case "VILLAGER":
|
||||||
case CHICKEN:
|
case "CHICKEN":
|
||||||
case COW:
|
case "COW":
|
||||||
case MUSHROOM_COW:
|
case "MUSHROOM_COW":
|
||||||
case PIG:
|
case "PIG":
|
||||||
case POLAR_BEAR:
|
case "TURTLE":
|
||||||
|
case "POLAR_BEAR":
|
||||||
storeAgeable((Ageable) entity);
|
storeAgeable((Ageable) entity);
|
||||||
storeLiving((LivingEntity) entity);
|
storeLiving((LivingEntity) entity);
|
||||||
return;
|
return;
|
||||||
case RABBIT:
|
case "RABBIT":
|
||||||
this.dataByte = getOrdinal(Type.values(), ((Rabbit) entity).getRabbitType());
|
this.dataByte = getOrdinal(Rabbit.Type.values(), ((Rabbit) entity).getRabbitType());
|
||||||
storeAgeable((Ageable) entity);
|
storeAgeable((Ageable) entity);
|
||||||
storeLiving((LivingEntity) entity);
|
storeLiving((LivingEntity) entity);
|
||||||
return;
|
return;
|
||||||
// END AGEABLE //
|
// END AGEABLE //
|
||||||
case GUARDIAN:
|
case "ARMOR_STAND":
|
||||||
this.dataByte = (byte) (((Guardian) entity).isElder() ? 1 : 0);
|
|
||||||
storeLiving((LivingEntity) entity);
|
|
||||||
return;
|
|
||||||
case SKELETON:
|
|
||||||
this.dataByte = getOrdinal(SkeletonType.values(),((Skeleton)entity).getSkeletonType());
|
|
||||||
storeLiving((LivingEntity) entity);
|
|
||||||
return;
|
|
||||||
case ARMOR_STAND:
|
|
||||||
ArmorStand stand = (ArmorStand) entity;
|
ArmorStand stand = (ArmorStand) entity;
|
||||||
this.inventory = new ItemStack[]{stand.getItemInHand().clone(), stand.getHelmet().clone(), stand.getChestplate().clone(),
|
this.inventory =
|
||||||
stand.getLeggings().clone(), stand.getBoots().clone()};
|
new ItemStack[]{stand.getItemInHand().clone(), stand.getHelmet().clone(),
|
||||||
|
stand.getChestplate().clone(), stand.getLeggings().clone(),
|
||||||
|
stand.getBoots().clone()};
|
||||||
storeLiving(stand);
|
storeLiving(stand);
|
||||||
this.stand = new ArmorStandStats();
|
this.stand = new ArmorStandStats();
|
||||||
|
|
||||||
@ -273,38 +282,46 @@ public class EntityWrapper {
|
|||||||
this.stand.small = true;
|
this.stand.small = true;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case ENDERMITE:
|
case "ENDERMITE":
|
||||||
return;
|
return;
|
||||||
case BAT:
|
case "BAT":
|
||||||
if (((Bat) entity).isAwake()) {
|
if (((Bat) entity).isAwake()) {
|
||||||
this.dataByte = (byte) 1;
|
this.dataByte = (byte) 1;
|
||||||
} else {
|
} else {
|
||||||
this.dataByte = (byte) 0;
|
this.dataByte = (byte) 0;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case ENDER_DRAGON:
|
case "ENDER_DRAGON":
|
||||||
EnderDragon entity1 = (EnderDragon) entity;
|
EnderDragon entity1 = (EnderDragon) entity;
|
||||||
this.dataByte = (byte) entity1.getPhase().ordinal();
|
this.dataByte = (byte) entity1.getPhase().ordinal();
|
||||||
return;
|
return;
|
||||||
case GHAST:
|
case "SKELETON":
|
||||||
case MAGMA_CUBE:
|
case "WITHER_SKELETON":
|
||||||
case SQUID:
|
case "GUARDIAN":
|
||||||
case PIG_ZOMBIE:
|
case "ELDER_GUARDIAN":
|
||||||
case ZOMBIE:
|
case "GHAST":
|
||||||
case WITHER:
|
case "MAGMA_CUBE":
|
||||||
case WITCH:
|
case "SQUID":
|
||||||
case SPIDER:
|
case "PIG_ZOMBIE":
|
||||||
case CAVE_SPIDER:
|
case "HOGLIN":
|
||||||
case SILVERFISH:
|
case "ZOMBIFIED_PIGLIN":
|
||||||
case GIANT:
|
case "PIGLIN":
|
||||||
case ENDERMAN:
|
case "PIGLIN_BRUTE":
|
||||||
case CREEPER:
|
case "ZOMBIE":
|
||||||
case BLAZE:
|
case "WITHER":
|
||||||
case SHULKER:
|
case "WITCH":
|
||||||
case SNOWMAN:
|
case "SPIDER":
|
||||||
|
case "CAVE_SPIDER":
|
||||||
|
case "SILVERFISH":
|
||||||
|
case "GIANT":
|
||||||
|
case "ENDERMAN":
|
||||||
|
case "CREEPER":
|
||||||
|
case "BLAZE":
|
||||||
|
case "SHULKER":
|
||||||
|
case "SNOWMAN":
|
||||||
storeLiving((LivingEntity) entity);
|
storeLiving((LivingEntity) entity);
|
||||||
return;
|
return;
|
||||||
case IRON_GOLEM:
|
case "IRON_GOLEM":
|
||||||
if (((IronGolem) entity).isPlayerCreated()) {
|
if (((IronGolem) entity).isPlayerCreated()) {
|
||||||
this.dataByte = (byte) 1;
|
this.dataByte = (byte) 1;
|
||||||
} else {
|
} else {
|
||||||
@ -346,35 +363,34 @@ public class EntityWrapper {
|
|||||||
if (this.lived.leashed) {
|
if (this.lived.leashed) {
|
||||||
// TODO leashes
|
// TODO leashes
|
||||||
// World world = entity.getWorld();
|
// World world = entity.getWorld();
|
||||||
// Entity leash = world.spawnEntity(new Location(world, Math.floor(x) + lived.leashX, Math.floor(y) + lived.leashY, Math
|
// Entity leash = world.spawnEntity(new Location(world, Math.floor(x) +
|
||||||
// .floor(z) + lived.leashZ), EntityType.LEASH_HITCH);
|
// lived.leashX, Math.floor(y) + lived.leashY, Math.floor(z) + lived.leashZ),
|
||||||
|
// EntityType.LEASH_HITCH);
|
||||||
// entity.setLeashHolder(leash);
|
// entity.setLeashHolder(leash);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void restoreEquipment(LivingEntity entity) {
|
void restoreEquipment(LivingEntity entity) {
|
||||||
EntityEquipment equipment = entity.getEquipment();
|
EntityEquipment equipment = entity.getEquipment();
|
||||||
if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) {
|
if (equipment != null) {
|
||||||
equipment.setItemInMainHand(this.lived.mainHand);
|
equipment.setItemInMainHand(this.lived.mainHand);
|
||||||
equipment.setItemInOffHand(this.lived.offHand);
|
equipment.setItemInOffHand(this.lived.offHand);
|
||||||
} else {
|
equipment.setHelmet(this.lived.helmet);
|
||||||
equipment.setItemInHand(this.lived.mainHand);
|
equipment.setChestplate(this.lived.chestplate);
|
||||||
|
equipment.setLeggings(this.lived.leggings);
|
||||||
|
equipment.setBoots(this.lived.boots);
|
||||||
}
|
}
|
||||||
equipment.setHelmet(this.lived.helmet);
|
|
||||||
equipment.setChestplate(this.lived.chestplate);
|
|
||||||
equipment.setLeggings(this.lived.leggings);
|
|
||||||
equipment.setBoots(this.lived.boots);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void restoreInventory(InventoryHolder entity) {
|
private void restoreInventory(InventoryHolder entity) {
|
||||||
try {
|
try {
|
||||||
entity.getInventory().setContents(this.inventory);
|
entity.getInventory().setContents(this.inventory);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
PS.debug("&c[WARN] Failed to restore inventory.\n Reason: " + e.getMessage());
|
LOGGER.error("Failed to restore inventory", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void storeLiving(LivingEntity lived) {
|
private void storeLiving(LivingEntity lived) {
|
||||||
this.lived = new LivingEntityStats();
|
this.lived = new LivingEntityStats();
|
||||||
this.lived.potions = lived.getActivePotionEffects();
|
this.lived.potions = lived.getActivePotionEffects();
|
||||||
this.lived.loot = lived.getCanPickupItems();
|
this.lived.loot = lived.getCanPickupItems();
|
||||||
@ -386,9 +402,9 @@ public class EntityWrapper {
|
|||||||
this.lived.leashed = lived.isLeashed();
|
this.lived.leashed = lived.isLeashed();
|
||||||
if (this.lived.leashed) {
|
if (this.lived.leashed) {
|
||||||
Location location = lived.getLeashHolder().getLocation();
|
Location location = lived.getLeashHolder().getLocation();
|
||||||
this.lived.leashX = (short) (this.x - location.getBlockX());
|
this.lived.leashX = (short) (this.getX() - location.getBlockX());
|
||||||
this.lived.leashY = (short) (this.y - location.getBlockY());
|
this.lived.leashY = (short) (this.getY() - location.getBlockY());
|
||||||
this.lived.leashZ = (short) (this.z - location.getBlockZ());
|
this.lived.leashZ = (short) (this.getZ() - location.getBlockZ());
|
||||||
}
|
}
|
||||||
EntityEquipment equipment = lived.getEquipment();
|
EntityEquipment equipment = lived.getEquipment();
|
||||||
this.lived.equipped = equipment != null;
|
this.lived.equipped = equipment != null;
|
||||||
@ -398,13 +414,8 @@ public class EntityWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void storeEquipment(EntityEquipment equipment) {
|
void storeEquipment(EntityEquipment equipment) {
|
||||||
if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) {
|
this.lived.mainHand = equipment.getItemInMainHand().clone();
|
||||||
this.lived.mainHand = equipment.getItemInMainHand().clone();
|
this.lived.offHand = equipment.getItemInOffHand().clone();
|
||||||
this.lived.offHand = equipment.getItemInOffHand().clone();
|
|
||||||
} else {
|
|
||||||
this.lived.mainHand = equipment.getItemInHand().clone();
|
|
||||||
this.lived.offHand = null;
|
|
||||||
}
|
|
||||||
this.lived.boots = equipment.getBoots().clone();
|
this.lived.boots = equipment.getBoots().clone();
|
||||||
this.lived.leggings = equipment.getLeggings().clone();
|
this.lived.leggings = equipment.getLeggings().clone();
|
||||||
this.lived.chestplate = equipment.getChestplate().clone();
|
this.lived.chestplate = equipment.getChestplate().clone();
|
||||||
@ -443,28 +454,30 @@ public class EntityWrapper {
|
|||||||
this.tamed.tamed = tamed.isTamed();
|
this.tamed.tamed = tamed.isTamed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation") // Paper deprecation
|
||||||
|
@Override
|
||||||
public Entity spawn(World world, int xOffset, int zOffset) {
|
public Entity spawn(World world, int xOffset, int zOffset) {
|
||||||
Location location = new Location(world, this.x + xOffset, this.y, this.z + zOffset);
|
Location location = new Location(world, this.getX() + xOffset, this.getY(), this.z + zOffset);
|
||||||
location.setYaw(this.yaw);
|
location.setYaw(this.yaw);
|
||||||
location.setPitch(this.pitch);
|
location.setPitch(this.pitch);
|
||||||
if (!this.type.isSpawnable()) {
|
if (!this.getType().isSpawnable()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Entity entity;
|
Entity entity;
|
||||||
switch (this.type) {
|
switch (this.getType().toString()) {
|
||||||
case DROPPED_ITEM:
|
case "DROPPED_ITEM":
|
||||||
return world.dropItem(location, this.stack);
|
return world.dropItem(location, this.stack);
|
||||||
case PLAYER:
|
case "PLAYER":
|
||||||
case LEASH_HITCH:
|
case "LEASH_HITCH":
|
||||||
return null;
|
return null;
|
||||||
case ITEM_FRAME:
|
case "ITEM_FRAME":
|
||||||
entity = world.spawn(location, ItemFrame.class);
|
entity = world.spawn(location, ItemFrame.class);
|
||||||
break;
|
break;
|
||||||
case PAINTING:
|
case "PAINTING":
|
||||||
entity = world.spawn(location, Painting.class);
|
entity = world.spawn(location, Painting.class);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
entity = world.spawnEntity(location, this.type);
|
entity = world.spawnEntity(location, this.getType());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (this.depth == 0) {
|
if (this.depth == 0) {
|
||||||
@ -472,8 +485,9 @@ public class EntityWrapper {
|
|||||||
}
|
}
|
||||||
if (this.base.passenger != null) {
|
if (this.base.passenger != null) {
|
||||||
try {
|
try {
|
||||||
entity.setPassenger(this.base.passenger.spawn(world, xOffset, zOffset));
|
entity.addPassenger(this.base.passenger.spawn(world, xOffset, zOffset));
|
||||||
} catch (Exception ignored) { }
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (this.base.fall != 0) {
|
if (this.base.fall != 0) {
|
||||||
entity.setFallDistance(this.base.fall);
|
entity.setFallDistance(this.base.fall);
|
||||||
@ -488,102 +502,99 @@ public class EntityWrapper {
|
|||||||
if (this.depth == 1) {
|
if (this.depth == 1) {
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_10_0) || entity instanceof ArmorStand) {
|
if (this.noGravity) {
|
||||||
if (this.noGravity) {
|
entity.setGravity(false);
|
||||||
entity.setGravity(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
switch (entity.getType()) {
|
switch (entity.getType().toString()) {
|
||||||
case ARROW:
|
case "BOAT":
|
||||||
case BOAT:
|
Boat boat = (Boat) entity;
|
||||||
if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_9_0)) {
|
boat.setWoodType(TreeSpecies.values()[dataByte]);
|
||||||
Boat boat = (Boat) entity;
|
|
||||||
boat.setWoodType(TreeSpecies.values()[dataByte]);
|
|
||||||
}
|
|
||||||
|
|
||||||
case COMPLEX_PART:
|
|
||||||
case EGG:
|
|
||||||
case ENDER_CRYSTAL:
|
|
||||||
case ENDER_PEARL:
|
|
||||||
case ENDER_SIGNAL:
|
|
||||||
case DROPPED_ITEM:
|
|
||||||
case EXPERIENCE_ORB:
|
|
||||||
case FALLING_BLOCK:
|
|
||||||
case FIREBALL:
|
|
||||||
case FIREWORK:
|
|
||||||
case FISHING_HOOK:
|
|
||||||
case LEASH_HITCH:
|
|
||||||
case LIGHTNING:
|
|
||||||
case MINECART:
|
|
||||||
case MINECART_COMMAND:
|
|
||||||
case MINECART_MOB_SPAWNER:
|
|
||||||
case MINECART_TNT:
|
|
||||||
case PLAYER:
|
|
||||||
case PRIMED_TNT:
|
|
||||||
return entity;
|
return entity;
|
||||||
case SLIME:
|
case "SLIME":
|
||||||
((Slime) entity).setSize(this.dataByte);
|
((Slime) entity).setSize(this.dataByte);
|
||||||
return entity;
|
return entity;
|
||||||
case SMALL_FIREBALL:
|
case "ARROW":
|
||||||
case SNOWBALL:
|
case "EGG":
|
||||||
case SPLASH_POTION:
|
case "ENDER_CRYSTAL":
|
||||||
case THROWN_EXP_BOTTLE:
|
case "ENDER_PEARL":
|
||||||
case WEATHER:
|
case "ENDER_SIGNAL":
|
||||||
case TIPPED_ARROW:
|
case "DROPPED_ITEM":
|
||||||
case SPECTRAL_ARROW:
|
case "EXPERIENCE_ORB":
|
||||||
case SHULKER_BULLET:
|
case "FALLING_BLOCK":
|
||||||
case LINGERING_POTION:
|
case "FIREBALL":
|
||||||
case AREA_EFFECT_CLOUD:
|
case "FIREWORK":
|
||||||
case DRAGON_FIREBALL:
|
case "FISHING_HOOK":
|
||||||
case WITHER_SKULL:
|
case "LEASH_HITCH":
|
||||||
case MINECART_FURNACE:
|
case "LIGHTNING":
|
||||||
case UNKNOWN:
|
case "MINECART":
|
||||||
|
case "MINECART_COMMAND":
|
||||||
|
case "MINECART_MOB_SPAWNER":
|
||||||
|
case "MINECART_TNT":
|
||||||
|
case "PLAYER":
|
||||||
|
case "PRIMED_TNT":
|
||||||
|
case "SMALL_FIREBALL":
|
||||||
|
case "SNOWBALL":
|
||||||
|
case "SPLASH_POTION":
|
||||||
|
case "THROWN_EXP_BOTTLE":
|
||||||
|
case "SPECTRAL_ARROW":
|
||||||
|
case "SHULKER_BULLET":
|
||||||
|
case "AREA_EFFECT_CLOUD":
|
||||||
|
case "DRAGON_FIREBALL":
|
||||||
|
case "WITHER_SKULL":
|
||||||
|
case "MINECART_FURNACE":
|
||||||
|
case "LLAMA_SPIT":
|
||||||
|
case "TRIDENT":
|
||||||
|
case "UNKNOWN":
|
||||||
// Do this stuff later
|
// Do this stuff later
|
||||||
return entity;
|
return entity;
|
||||||
default:
|
|
||||||
PS.debug("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType());
|
|
||||||
return entity;
|
|
||||||
// MISC //
|
// MISC //
|
||||||
case ITEM_FRAME:
|
case "ITEM_FRAME":
|
||||||
ItemFrame itemframe = (ItemFrame) entity;
|
ItemFrame itemframe = (ItemFrame) entity;
|
||||||
itemframe.setRotation(Rotation.values()[this.dataByte]);
|
itemframe.setRotation(Rotation.values()[this.dataByte]);
|
||||||
itemframe.setItem(this.stack);
|
itemframe.setItem(this.stack);
|
||||||
return entity;
|
return entity;
|
||||||
case PAINTING:
|
case "PAINTING":
|
||||||
Painting painting = (Painting) entity;
|
Painting painting = (Painting) entity;
|
||||||
painting.setFacingDirection(BlockFace.values()[this.dataByte], true);
|
painting.setFacingDirection(BlockFace.values()[this.dataByte], true);
|
||||||
painting.setArt(Art.getByName(this.dataString), true);
|
painting.setArt(Art.getByName(this.dataString), true);
|
||||||
return entity;
|
return entity;
|
||||||
// END MISC //
|
// END MISC //
|
||||||
// INVENTORY HOLDER //
|
// INVENTORY HOLDER //
|
||||||
case MINECART_CHEST:
|
case "MINECART_CHEST":
|
||||||
case MINECART_HOPPER:
|
case "MINECART_HOPPER":
|
||||||
restoreInventory((InventoryHolder) entity);
|
restoreInventory((InventoryHolder) entity);
|
||||||
return entity;
|
return entity;
|
||||||
// START LIVING ENTITY //
|
// START LIVING ENTITY //
|
||||||
// START AGEABLE //
|
// START AGEABLE //
|
||||||
// START TAMEABLE //
|
// START TAMEABLE //
|
||||||
case HORSE:
|
case "HORSE":
|
||||||
Horse horse = (Horse) entity;
|
case "LLAMA":
|
||||||
|
case "SKELETON_HORSE":
|
||||||
|
case "DONKEY":
|
||||||
|
case "MULE":
|
||||||
|
AbstractHorse horse = (AbstractHorse) entity;
|
||||||
horse.setJumpStrength(this.horse.jump);
|
horse.setJumpStrength(this.horse.jump);
|
||||||
horse.setCarryingChest(this.horse.chest);
|
if (horse instanceof ChestedHorse) {
|
||||||
horse.setVariant(this.horse.variant);
|
((ChestedHorse) horse).setCarryingChest(this.horse.chest);
|
||||||
horse.setStyle(this.horse.style);
|
}
|
||||||
horse.setColor(this.horse.color);
|
//todo broken as of 1.13
|
||||||
|
//horse.setVariant(this.horse.variant);
|
||||||
|
//horse.setStyle(this.horse.style);
|
||||||
|
//horse.setColor(this.horse.color);
|
||||||
restoreTameable(horse);
|
restoreTameable(horse);
|
||||||
restoreAgeable(horse);
|
restoreAgeable(horse);
|
||||||
restoreLiving(horse);
|
restoreLiving(horse);
|
||||||
restoreInventory(horse);
|
restoreInventory(horse);
|
||||||
return entity;
|
return entity;
|
||||||
// END INVENTORY HOLDER //
|
// END INVENTORY HOLDER //
|
||||||
case WOLF:
|
case "WOLF":
|
||||||
case OCELOT:
|
case "OCELOT":
|
||||||
restoreTameable((Tameable) entity);
|
restoreTameable((Tameable) entity);
|
||||||
restoreAgeable((Ageable) entity);
|
restoreAgeable((Ageable) entity);
|
||||||
restoreLiving((LivingEntity) entity);
|
restoreLiving((LivingEntity) entity);
|
||||||
return entity;
|
return entity;
|
||||||
// END AGEABLE //
|
// END AGEABLE //
|
||||||
case SHEEP:
|
case "SHEEP":
|
||||||
Sheep sheep = (Sheep) entity;
|
Sheep sheep = (Sheep) entity;
|
||||||
if (this.dataByte == 1) {
|
if (this.dataByte == 1) {
|
||||||
sheep.setSheared(true);
|
sheep.setSheared(true);
|
||||||
@ -594,36 +605,25 @@ public class EntityWrapper {
|
|||||||
restoreAgeable(sheep);
|
restoreAgeable(sheep);
|
||||||
restoreLiving(sheep);
|
restoreLiving(sheep);
|
||||||
return sheep;
|
return sheep;
|
||||||
case VILLAGER:
|
case "VILLAGER":
|
||||||
case CHICKEN:
|
case "CHICKEN":
|
||||||
case COW:
|
case "COW":
|
||||||
case POLAR_BEAR:
|
case "TURTLE":
|
||||||
case MUSHROOM_COW:
|
case "POLAR_BEAR":
|
||||||
case PIG:
|
case "MUSHROOM_COW":
|
||||||
|
case "PIG":
|
||||||
restoreAgeable((Ageable) entity);
|
restoreAgeable((Ageable) entity);
|
||||||
restoreLiving((LivingEntity) entity);
|
restoreLiving((LivingEntity) entity);
|
||||||
return entity;
|
return entity;
|
||||||
// END AGEABLE //
|
// END AGEABLE //
|
||||||
case RABBIT:
|
case "RABBIT":
|
||||||
if (this.dataByte != 0) {
|
if (this.dataByte != 0) {
|
||||||
((Rabbit) entity).setRabbitType(Type.values()[this.dataByte]);
|
((Rabbit) entity).setRabbitType(Rabbit.Type.values()[this.dataByte]);
|
||||||
}
|
}
|
||||||
restoreAgeable((Ageable) entity);
|
restoreAgeable((Ageable) entity);
|
||||||
restoreLiving((LivingEntity) entity);
|
restoreLiving((LivingEntity) entity);
|
||||||
return entity;
|
return entity;
|
||||||
case GUARDIAN:
|
case "ARMOR_STAND":
|
||||||
if (this.dataByte != 0) {
|
|
||||||
((Guardian) entity).setElder(true);
|
|
||||||
}
|
|
||||||
restoreLiving((LivingEntity) entity);
|
|
||||||
return entity;
|
|
||||||
case SKELETON:
|
|
||||||
if (this.dataByte != 0) {
|
|
||||||
((Skeleton) entity).setSkeletonType(SkeletonType.values()[this.dataByte]);
|
|
||||||
}
|
|
||||||
storeLiving((LivingEntity) entity);
|
|
||||||
return entity;
|
|
||||||
case ARMOR_STAND:
|
|
||||||
// CHECK positions
|
// CHECK positions
|
||||||
ArmorStand stand = (ArmorStand) entity;
|
ArmorStand stand = (ArmorStand) entity;
|
||||||
if (this.inventory[0] != null) {
|
if (this.inventory[0] != null) {
|
||||||
@ -642,27 +642,41 @@ public class EntityWrapper {
|
|||||||
stand.setBoots(this.inventory[4]);
|
stand.setBoots(this.inventory[4]);
|
||||||
}
|
}
|
||||||
if (this.stand.head[0] != 0 || this.stand.head[1] != 0 || this.stand.head[2] != 0) {
|
if (this.stand.head[0] != 0 || this.stand.head[1] != 0 || this.stand.head[2] != 0) {
|
||||||
EulerAngle pose = new EulerAngle(this.stand.head[0], this.stand.head[1], this.stand.head[2]);
|
EulerAngle pose =
|
||||||
|
new EulerAngle(this.stand.head[0], this.stand.head[1], this.stand.head[2]);
|
||||||
stand.setHeadPose(pose);
|
stand.setHeadPose(pose);
|
||||||
}
|
}
|
||||||
if (this.stand.body[0] != 0 || this.stand.body[1] != 0 || this.stand.body[2] != 0) {
|
if (this.stand.body[0] != 0 || this.stand.body[1] != 0 || this.stand.body[2] != 0) {
|
||||||
EulerAngle pose = new EulerAngle(this.stand.body[0], this.stand.body[1], this.stand.body[2]);
|
EulerAngle pose =
|
||||||
|
new EulerAngle(this.stand.body[0], this.stand.body[1], this.stand.body[2]);
|
||||||
stand.setBodyPose(pose);
|
stand.setBodyPose(pose);
|
||||||
}
|
}
|
||||||
if (this.stand.leftLeg[0] != 0 || this.stand.leftLeg[1] != 0 || this.stand.leftLeg[2] != 0) {
|
if (this.stand.leftLeg[0] != 0 || this.stand.leftLeg[1] != 0
|
||||||
EulerAngle pose = new EulerAngle(this.stand.leftLeg[0], this.stand.leftLeg[1], this.stand.leftLeg[2]);
|
|| this.stand.leftLeg[2] != 0) {
|
||||||
|
EulerAngle pose = new EulerAngle(this.stand.leftLeg[0], this.stand.leftLeg[1],
|
||||||
|
this.stand.leftLeg[2]
|
||||||
|
);
|
||||||
stand.setLeftLegPose(pose);
|
stand.setLeftLegPose(pose);
|
||||||
}
|
}
|
||||||
if (this.stand.rightLeg[0] != 0 || this.stand.rightLeg[1] != 0 || this.stand.rightLeg[2] != 0) {
|
if (this.stand.rightLeg[0] != 0 || this.stand.rightLeg[1] != 0
|
||||||
EulerAngle pose = new EulerAngle(this.stand.rightLeg[0], this.stand.rightLeg[1], this.stand.rightLeg[2]);
|
|| this.stand.rightLeg[2] != 0) {
|
||||||
|
EulerAngle pose = new EulerAngle(this.stand.rightLeg[0], this.stand.rightLeg[1],
|
||||||
|
this.stand.rightLeg[2]
|
||||||
|
);
|
||||||
stand.setRightLegPose(pose);
|
stand.setRightLegPose(pose);
|
||||||
}
|
}
|
||||||
if (this.stand.leftArm[0] != 0 || this.stand.leftArm[1] != 0 || this.stand.leftArm[2] != 0) {
|
if (this.stand.leftArm[0] != 0 || this.stand.leftArm[1] != 0
|
||||||
EulerAngle pose = new EulerAngle(this.stand.leftArm[0], this.stand.leftArm[1], this.stand.leftArm[2]);
|
|| this.stand.leftArm[2] != 0) {
|
||||||
|
EulerAngle pose = new EulerAngle(this.stand.leftArm[0], this.stand.leftArm[1],
|
||||||
|
this.stand.leftArm[2]
|
||||||
|
);
|
||||||
stand.setLeftArmPose(pose);
|
stand.setLeftArmPose(pose);
|
||||||
}
|
}
|
||||||
if (this.stand.rightArm[0] != 0 || this.stand.rightArm[1] != 0 || this.stand.rightArm[2] != 0) {
|
if (this.stand.rightArm[0] != 0 || this.stand.rightArm[1] != 0
|
||||||
EulerAngle pose = new EulerAngle(this.stand.rightArm[0], this.stand.rightArm[1], this.stand.rightArm[2]);
|
|| this.stand.rightArm[2] != 0) {
|
||||||
|
EulerAngle pose = new EulerAngle(this.stand.rightArm[0], this.stand.rightArm[1],
|
||||||
|
this.stand.rightArm[2]
|
||||||
|
);
|
||||||
stand.setRightArmPose(pose);
|
stand.setRightArmPose(pose);
|
||||||
}
|
}
|
||||||
if (this.stand.invisible) {
|
if (this.stand.invisible) {
|
||||||
@ -679,47 +693,63 @@ public class EntityWrapper {
|
|||||||
}
|
}
|
||||||
restoreLiving(stand);
|
restoreLiving(stand);
|
||||||
return stand;
|
return stand;
|
||||||
case BAT:
|
case "BAT":
|
||||||
if (this.dataByte != 0) {
|
if (this.dataByte != 0) {
|
||||||
((Bat) entity).setAwake(true);
|
((Bat) entity).setAwake(true);
|
||||||
}
|
}
|
||||||
restoreLiving((LivingEntity) entity);
|
restoreLiving((LivingEntity) entity);
|
||||||
return entity;
|
return entity;
|
||||||
case ENDER_DRAGON:
|
case "ENDER_DRAGON":
|
||||||
if (this.dataByte != 0) {
|
if (this.dataByte != 0) {
|
||||||
((EnderDragon) entity).setPhase(EnderDragon.Phase.values()[this.dataByte]);
|
((EnderDragon) entity).setPhase(EnderDragon.Phase.values()[this.dataByte]);
|
||||||
}
|
}
|
||||||
restoreLiving((LivingEntity) entity);
|
restoreLiving((LivingEntity) entity);
|
||||||
return entity;
|
return entity;
|
||||||
case ENDERMITE:
|
case "ENDERMITE":
|
||||||
case GHAST:
|
case "GHAST":
|
||||||
case MAGMA_CUBE:
|
case "MAGMA_CUBE":
|
||||||
case SQUID:
|
case "SQUID":
|
||||||
case PIG_ZOMBIE:
|
case "PIG_ZOMBIE":
|
||||||
case ZOMBIE:
|
case "HOGLIN":
|
||||||
case WITHER:
|
case "PIGLIN":
|
||||||
case WITCH:
|
case "ZOMBIFIED_PIGLIN":
|
||||||
case SPIDER:
|
case "PIGLIN_BRUTE":
|
||||||
case CAVE_SPIDER:
|
case "ZOMBIE":
|
||||||
case SILVERFISH:
|
case "WITHER":
|
||||||
case GIANT:
|
case "WITCH":
|
||||||
case ENDERMAN:
|
case "SPIDER":
|
||||||
case CREEPER:
|
case "CAVE_SPIDER":
|
||||||
case BLAZE:
|
case "SILVERFISH":
|
||||||
case SNOWMAN:
|
case "GIANT":
|
||||||
case SHULKER:
|
case "ENDERMAN":
|
||||||
|
case "CREEPER":
|
||||||
|
case "BLAZE":
|
||||||
|
case "SNOWMAN":
|
||||||
|
case "SHULKER":
|
||||||
|
case "GUARDIAN":
|
||||||
|
case "ELDER_GUARDIAN":
|
||||||
|
case "SKELETON":
|
||||||
|
case "WITHER_SKELETON":
|
||||||
restoreLiving((LivingEntity) entity);
|
restoreLiving((LivingEntity) entity);
|
||||||
return entity;
|
return entity;
|
||||||
case IRON_GOLEM:
|
case "IRON_GOLEM":
|
||||||
if (this.dataByte != 0) {
|
if (this.dataByte != 0) {
|
||||||
((IronGolem) entity).setPlayerCreated(true);
|
((IronGolem) entity).setPlayerCreated(true);
|
||||||
}
|
}
|
||||||
restoreLiving((LivingEntity) entity);
|
restoreLiving((LivingEntity) entity);
|
||||||
return entity;
|
return entity;
|
||||||
// END LIVING
|
default:
|
||||||
|
if (Settings.DEBUG) {
|
||||||
|
LOGGER.info("Could not identify entity: {}", entity.getType());
|
||||||
|
}
|
||||||
|
return entity;
|
||||||
|
// END LIVING
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void saveEntity() {
|
||||||
|
}
|
||||||
|
|
||||||
private byte getOrdinal(Object[] list, Object value) {
|
private byte getOrdinal(Object[] list, Object value) {
|
||||||
for (byte i = 0; i < list.length; i++) {
|
for (byte i = 0; i < list.length; i++) {
|
||||||
if (list[i].equals(value)) {
|
if (list[i].equals(value)) {
|
||||||
@ -729,9 +759,5 @@ public class EntityWrapper {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return String.format("[%s, x=%s, y=%s, z=%s]", type.getName(), x, y, z);
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.entity;
|
||||||
|
|
||||||
|
import org.bukkit.entity.AnimalTamer;
|
||||||
|
|
||||||
|
class TameableStats {
|
||||||
|
|
||||||
|
AnimalTamer owner;
|
||||||
|
boolean tamed;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,116 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.entity;
|
||||||
|
|
||||||
|
import com.plotsquared.bukkit.BukkitPlatform;
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
|
|
||||||
|
public class TeleportEntityWrapper extends EntityWrapper {
|
||||||
|
|
||||||
|
private Location oldLocation;
|
||||||
|
private boolean gravityOld;
|
||||||
|
private boolean invulnerableOld;
|
||||||
|
private int fireTicksOld;
|
||||||
|
private int livingTicksOld;
|
||||||
|
|
||||||
|
public TeleportEntityWrapper(final Entity entity) {
|
||||||
|
super(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Entity spawn(final World world, final int xOffset, final int zOffset) {
|
||||||
|
if (!getEntity().getLocation().getChunk().equals(oldLocation.getChunk())) {
|
||||||
|
final Location oldLocation = this.oldLocation.clone();
|
||||||
|
oldLocation.add(xOffset, 0, xOffset);
|
||||||
|
getEntity().teleport(oldLocation);
|
||||||
|
getEntity().setGravity(gravityOld);
|
||||||
|
getEntity().setInvulnerable(invulnerableOld);
|
||||||
|
getEntity().setFireTicks(fireTicksOld);
|
||||||
|
getEntity().setTicksLived(livingTicksOld);
|
||||||
|
getEntity().removeMetadata("ps-tmp-teleport", BukkitPlatform.getPlugin(BukkitPlatform.class));
|
||||||
|
}
|
||||||
|
return getEntity();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveEntity() {
|
||||||
|
if (getEntity().hasMetadata("ps-tmp-teleport")) {
|
||||||
|
this.oldLocation = (Location) this.getEntity().getMetadata("ps-tmp-teleport").get(0);
|
||||||
|
} else {
|
||||||
|
this.oldLocation = this.getEntity().getLocation();
|
||||||
|
}
|
||||||
|
|
||||||
|
// To account for offsets in the chunk manager
|
||||||
|
this.oldLocation = oldLocation.clone();
|
||||||
|
this.oldLocation.setX(this.getX());
|
||||||
|
this.oldLocation.setY(this.getY());
|
||||||
|
this.oldLocation.setZ(this.getZ());
|
||||||
|
|
||||||
|
this.gravityOld = this.getEntity().hasGravity();
|
||||||
|
this.getEntity().setGravity(false);
|
||||||
|
this.invulnerableOld = this.getEntity().isInvulnerable();
|
||||||
|
this.getEntity().setInvulnerable(true);
|
||||||
|
this.fireTicksOld = this.getEntity().getFireTicks();
|
||||||
|
this.livingTicksOld = this.getEntity().getTicksLived();
|
||||||
|
this.getEntity().setMetadata(
|
||||||
|
"ps-tmp-teleport",
|
||||||
|
new FixedMetadataValue(BukkitPlatform.getPlugin(BukkitPlatform.class), oldLocation)
|
||||||
|
);
|
||||||
|
final Chunk newChunk = getNewChunk();
|
||||||
|
this.getEntity().teleport(
|
||||||
|
new Location(newChunk.getWorld(), newChunk.getX() << 4, 5000, newChunk.getZ() << 4));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Chunk getNewChunk() {
|
||||||
|
final Chunk oldChunk = oldLocation.getChunk();
|
||||||
|
Chunk chunk = null;
|
||||||
|
|
||||||
|
for (Chunk lChunk : oldChunk.getWorld().getLoadedChunks()) {
|
||||||
|
if (!lChunk.equals(oldChunk) && lChunk.isLoaded()) {
|
||||||
|
chunk = lChunk;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (chunk == null) {
|
||||||
|
for (int dx = 1; dx < Integer.MAX_VALUE; dx++) {
|
||||||
|
for (int dz = 0; dz < Integer.MAX_VALUE; dz++) {
|
||||||
|
if ((chunk = getChunkRelative(oldChunk, dx, dz)).isLoaded()) {
|
||||||
|
break;
|
||||||
|
} else if ((chunk = getChunkRelative(oldChunk, -dx, dz)).isLoaded()) {
|
||||||
|
break;
|
||||||
|
} else if ((chunk = getChunkRelative(oldChunk, dx, -dz)).isLoaded()) {
|
||||||
|
break;
|
||||||
|
} else if ((chunk = getChunkRelative(oldChunk, -dx, -dz)).isLoaded()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return chunk;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Chunk getChunkRelative(final Chunk chunk, final int dx, final int dz) {
|
||||||
|
return chunk.getWorld().getChunkAt(chunk.getX() + dx, chunk.getZ() + dz);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,66 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.events;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.flag.Flag;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotCluster;
|
|
||||||
import org.bukkit.event.Cancellable;
|
|
||||||
import org.bukkit.event.Event;
|
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when a flag is removed from a plot.
|
|
||||||
*/
|
|
||||||
public class ClusterFlagRemoveEvent extends Event implements Cancellable {
|
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
|
||||||
private final PlotCluster cluster;
|
|
||||||
private final Flag flag;
|
|
||||||
private boolean cancelled;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PlotFlagRemoveEvent: Called when a flag is removed from a plot.
|
|
||||||
*
|
|
||||||
* @param flag Flag that was removed
|
|
||||||
* @param cluster PlotCluster from which the flag was removed
|
|
||||||
*/
|
|
||||||
public ClusterFlagRemoveEvent(Flag flag, PlotCluster cluster) {
|
|
||||||
this.cluster = cluster;
|
|
||||||
this.flag = flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HandlerList getHandlerList() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the cluster involved.
|
|
||||||
*
|
|
||||||
* @return PlotCluster
|
|
||||||
*/
|
|
||||||
public PlotCluster getCluster() {
|
|
||||||
return this.cluster;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the flag involved.
|
|
||||||
*
|
|
||||||
* @return Flag
|
|
||||||
*/
|
|
||||||
public Flag getFlag() {
|
|
||||||
return this.flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HandlerList getHandlers() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isCancelled() {
|
|
||||||
return this.cancelled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setCancelled(boolean b) {
|
|
||||||
this.cancelled = b;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,62 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.events;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.Cancellable;
|
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
import org.bukkit.event.player.PlayerEvent;
|
|
||||||
|
|
||||||
public class PlayerClaimPlotEvent extends PlayerEvent implements Cancellable {
|
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
|
||||||
private final Plot plot;
|
|
||||||
private final boolean auto;
|
|
||||||
private boolean cancelled;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PlayerClaimPlotEvent: Called when a plot is claimed.
|
|
||||||
*
|
|
||||||
* @param player Player that claimed the plot
|
|
||||||
* @param plot Plot that was claimed
|
|
||||||
*/
|
|
||||||
public PlayerClaimPlotEvent(Player player, Plot plot, boolean auto) {
|
|
||||||
super(player);
|
|
||||||
this.plot = plot;
|
|
||||||
this.auto = auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HandlerList getHandlerList() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the plot involved
|
|
||||||
*
|
|
||||||
* @return Plot
|
|
||||||
*/
|
|
||||||
public Plot getPlot() {
|
|
||||||
return this.plot;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return true if it was an automated claim, else false
|
|
||||||
*/
|
|
||||||
public boolean wasAuto() {
|
|
||||||
return this.auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HandlerList getHandlers() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isCancelled() {
|
|
||||||
return this.cancelled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setCancelled(boolean b) {
|
|
||||||
this.cancelled = b;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.events;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
import org.bukkit.event.player.PlayerEvent;
|
|
||||||
|
|
||||||
public class PlayerEnterPlotEvent extends PlayerEvent {
|
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
|
||||||
private final Plot plot;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when a player leaves a plot.
|
|
||||||
*
|
|
||||||
* @param player Player that entered the plot
|
|
||||||
* @param plot Plot that was entered
|
|
||||||
*/
|
|
||||||
public PlayerEnterPlotEvent(Player player, Plot plot) {
|
|
||||||
super(player);
|
|
||||||
this.plot = plot;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HandlerList getHandlerList() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the plot involved.
|
|
||||||
*
|
|
||||||
* @return Plot
|
|
||||||
*/
|
|
||||||
public Plot getPlot() {
|
|
||||||
return this.plot;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HandlerList getHandlers() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.events;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
import org.bukkit.event.player.PlayerEvent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
public class PlayerLeavePlotEvent extends PlayerEvent {
|
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
|
||||||
private final Plot plot;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PlayerLeavePlotEvent: Called when a player leaves a plot
|
|
||||||
*
|
|
||||||
* @param player Player that left the plot
|
|
||||||
* @param plot Plot that was left
|
|
||||||
*/
|
|
||||||
public PlayerLeavePlotEvent(Player player, Plot plot) {
|
|
||||||
super(player);
|
|
||||||
this.plot = plot;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HandlerList getHandlerList() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the plot involved
|
|
||||||
*
|
|
||||||
* @return Plot
|
|
||||||
*/
|
|
||||||
public Plot getPlot() {
|
|
||||||
return this.plot;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HandlerList getHandlers() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,66 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.events;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class PlayerPlotDeniedEvent extends PlotEvent {
|
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
|
||||||
private final Player initiator;
|
|
||||||
private final boolean added;
|
|
||||||
private final UUID player;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PlayerPlotDeniedEvent: Called when the denied UUID list is modified for a plot.
|
|
||||||
*
|
|
||||||
* @param initiator Player that initiated the event
|
|
||||||
* @param plot Plot in which the event occurred
|
|
||||||
* @param player Player that was denied/un-denied
|
|
||||||
* @param added true of add to deny list, false if removed
|
|
||||||
*/
|
|
||||||
public PlayerPlotDeniedEvent(Player initiator, Plot plot, UUID player, boolean added) {
|
|
||||||
super(plot);
|
|
||||||
this.initiator = initiator;
|
|
||||||
this.added = added;
|
|
||||||
this.player = player;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HandlerList getHandlerList() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If a user was added.
|
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public boolean wasAdded() {
|
|
||||||
return this.added;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The player added/removed.
|
|
||||||
*
|
|
||||||
* @return UUID
|
|
||||||
*/
|
|
||||||
public UUID getPlayer() {
|
|
||||||
return this.player;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The player initiating the action.
|
|
||||||
*
|
|
||||||
* @return Player
|
|
||||||
*/
|
|
||||||
public Player getInitiator() {
|
|
||||||
return this.initiator;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HandlerList getHandlers() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,70 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.events;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
public class PlayerPlotHelperEvent extends PlotEvent {
|
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
|
||||||
private final Player initiator;
|
|
||||||
private final boolean added;
|
|
||||||
private final UUID player;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PlayerPlotHelperEvent: Called when a plot helper is added/removed
|
|
||||||
*
|
|
||||||
* @param initiator Player that initiated the event
|
|
||||||
* @param plot Plot in which the event occurred
|
|
||||||
* @param player Player that was added/removed from the helper list
|
|
||||||
* @param added true of the player was added, false if the player was removed
|
|
||||||
*/
|
|
||||||
public PlayerPlotHelperEvent(Player initiator, Plot plot, UUID player, boolean added) {
|
|
||||||
super(plot);
|
|
||||||
this.initiator = initiator;
|
|
||||||
this.added = added;
|
|
||||||
this.player = player;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HandlerList getHandlerList() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If a player was added
|
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public boolean wasAdded() {
|
|
||||||
return this.added;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The UUID added/removed
|
|
||||||
*
|
|
||||||
* @return UUID
|
|
||||||
*/
|
|
||||||
public UUID getPlayer() {
|
|
||||||
return this.player;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The player initiating the action
|
|
||||||
*
|
|
||||||
* @return Player
|
|
||||||
*/
|
|
||||||
public Player getInitiator() {
|
|
||||||
return this.initiator;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HandlerList getHandlers() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,70 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.events;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
public class PlayerPlotTrustedEvent extends PlotEvent {
|
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
|
||||||
private final Player initiator;
|
|
||||||
private final boolean added;
|
|
||||||
private final UUID player;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PlayerPlotTrustedEvent: Called when a plot trusted user is added/removed
|
|
||||||
*
|
|
||||||
* @param initiator Player that initiated the event
|
|
||||||
* @param plot Plot in which the event occurred
|
|
||||||
* @param player Player that was added/removed from the trusted list
|
|
||||||
* @param added true of the player was added, false if the player was removed
|
|
||||||
*/
|
|
||||||
public PlayerPlotTrustedEvent(Player initiator, Plot plot, UUID player, boolean added) {
|
|
||||||
super(plot);
|
|
||||||
this.initiator = initiator;
|
|
||||||
this.added = added;
|
|
||||||
this.player = player;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HandlerList getHandlerList() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If a player was added
|
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public boolean wasAdded() {
|
|
||||||
return this.added;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The UUID added/removed
|
|
||||||
*
|
|
||||||
* @return UUID
|
|
||||||
*/
|
|
||||||
public UUID getPlayer() {
|
|
||||||
return this.player;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The player initiating the action
|
|
||||||
*
|
|
||||||
* @return Player
|
|
||||||
*/
|
|
||||||
public Player getInitiator() {
|
|
||||||
return this.initiator;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HandlerList getHandlers() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,72 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.events;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.Cancellable;
|
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
import org.bukkit.event.player.PlayerEvent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when a player teleports to a plot
|
|
||||||
*
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
public class PlayerTeleportToPlotEvent extends PlayerEvent implements Cancellable {
|
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
|
||||||
private final Location from;
|
|
||||||
private final Plot plot;
|
|
||||||
private boolean cancelled;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PlayerTeleportToPlotEvent: Called when a player teleports to a plot
|
|
||||||
*
|
|
||||||
* @param player That was teleported
|
|
||||||
* @param from Start location
|
|
||||||
* @param plot Plot to which the player was teleported
|
|
||||||
*/
|
|
||||||
public PlayerTeleportToPlotEvent(Player player, Location from, Plot plot) {
|
|
||||||
super(player);
|
|
||||||
this.from = from;
|
|
||||||
this.plot = plot;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HandlerList getHandlerList() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HandlerList getHandlers() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the from location
|
|
||||||
*
|
|
||||||
* @return Location
|
|
||||||
*/
|
|
||||||
public Location getFrom() {
|
|
||||||
return this.from;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the plot involved
|
|
||||||
*
|
|
||||||
* @return Plot
|
|
||||||
*/
|
|
||||||
public Plot getPlot() {
|
|
||||||
return this.plot;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isCancelled() {
|
|
||||||
return this.cancelled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setCancelled(boolean cancelled) {
|
|
||||||
this.cancelled = cancelled;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,56 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.events;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
|
||||||
import org.bukkit.event.Cancellable;
|
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when a plot is cleared
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class PlotClearEvent extends PlotEvent implements Cancellable {
|
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
|
||||||
private boolean cancelled;
|
|
||||||
public PlotClearEvent(Plot plot) {
|
|
||||||
super(plot);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HandlerList getHandlerList() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the PlotId.
|
|
||||||
*
|
|
||||||
* @return PlotId
|
|
||||||
*/
|
|
||||||
public PlotId getPlotId() {
|
|
||||||
return getPlot().getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the world name.
|
|
||||||
*
|
|
||||||
* @return String
|
|
||||||
*/
|
|
||||||
public String getWorld() {
|
|
||||||
return getPlot().getArea().worldname;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HandlerList getHandlers() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isCancelled() {
|
|
||||||
return this.cancelled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setCancelled(boolean b) {
|
|
||||||
this.cancelled = b;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,56 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.events;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when a plot component is set
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class PlotComponentSetEvent extends PlotEvent {
|
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
|
||||||
private final String component;
|
|
||||||
|
|
||||||
public PlotComponentSetEvent(Plot plot, String component) {
|
|
||||||
super(plot);
|
|
||||||
this.component = component;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HandlerList getHandlerList() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the PlotId
|
|
||||||
*
|
|
||||||
* @return PlotId
|
|
||||||
*/
|
|
||||||
public PlotId getPlotId() {
|
|
||||||
return getPlot().getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the world name
|
|
||||||
*
|
|
||||||
* @return String
|
|
||||||
*/
|
|
||||||
public String getWorld() {
|
|
||||||
return getPlot().getArea().worldname;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the component which was set
|
|
||||||
*
|
|
||||||
* @return Component name
|
|
||||||
*/
|
|
||||||
public String getComponent() {
|
|
||||||
return this.component;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HandlerList getHandlers() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.events;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when a plot is deleted
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class PlotDeleteEvent extends PlotEvent {
|
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
|
||||||
|
|
||||||
public PlotDeleteEvent(Plot plot) {
|
|
||||||
super(plot);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HandlerList getHandlerList() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the PlotId
|
|
||||||
*
|
|
||||||
* @return PlotId
|
|
||||||
*/
|
|
||||||
public PlotId getPlotId() {
|
|
||||||
return getPlot().getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the world name
|
|
||||||
*
|
|
||||||
* @return String
|
|
||||||
*/
|
|
||||||
public String getWorld() {
|
|
||||||
return getPlot().getArea().worldname;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HandlerList getHandlers() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.events;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import org.bukkit.event.Event;
|
|
||||||
|
|
||||||
public abstract class PlotEvent extends Event {
|
|
||||||
|
|
||||||
private final Plot plot;
|
|
||||||
|
|
||||||
public PlotEvent(Plot plot) {
|
|
||||||
this.plot = plot;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final Plot getPlot() {
|
|
||||||
return this.plot;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,56 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.events;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.flag.Flag;
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import org.bukkit.event.Cancellable;
|
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when a Flag is added to a plot.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class PlotFlagAddEvent extends PlotEvent implements Cancellable {
|
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
|
||||||
private final Flag flag;
|
|
||||||
private boolean cancelled;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PlotFlagAddEvent: Called when a Flag is added to a plot.
|
|
||||||
*
|
|
||||||
* @param flag Flag that was added
|
|
||||||
* @param plot Plot to which the flag was added
|
|
||||||
*/
|
|
||||||
public PlotFlagAddEvent(Flag flag, Plot plot) {
|
|
||||||
super(plot);
|
|
||||||
this.flag = flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HandlerList getHandlerList() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the flag involved.
|
|
||||||
*
|
|
||||||
* @return Flag
|
|
||||||
*/
|
|
||||||
public Flag getFlag() {
|
|
||||||
return this.flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HandlerList getHandlers() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final boolean isCancelled() {
|
|
||||||
return this.cancelled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final void setCancelled(boolean cancelled) {
|
|
||||||
this.cancelled = cancelled;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,56 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.events;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.flag.Flag;
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import org.bukkit.event.Cancellable;
|
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when a flag is removed from a plot
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class PlotFlagRemoveEvent extends PlotEvent implements Cancellable {
|
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
|
||||||
private final Flag flag;
|
|
||||||
private boolean cancelled;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PlotFlagRemoveEvent: Called when a flag is removed from a plot
|
|
||||||
*
|
|
||||||
* @param flag Flag that was removed
|
|
||||||
* @param plot Plot from which the flag was removed
|
|
||||||
*/
|
|
||||||
public PlotFlagRemoveEvent(Flag flag, Plot plot) {
|
|
||||||
super(plot);
|
|
||||||
this.flag = flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HandlerList getHandlerList() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the flag involved
|
|
||||||
*
|
|
||||||
* @return Flag
|
|
||||||
*/
|
|
||||||
public Flag getFlag() {
|
|
||||||
return this.flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HandlerList getHandlers() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final boolean isCancelled() {
|
|
||||||
return this.cancelled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final void setCancelled(boolean cancelled) {
|
|
||||||
this.cancelled = cancelled;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,62 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.events;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.event.Cancellable;
|
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class PlotMergeEvent extends PlotEvent implements Cancellable {
|
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
|
||||||
private final ArrayList<PlotId> plots;
|
|
||||||
private final World world;
|
|
||||||
private boolean cancelled;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PlotMergeEvent: Called when plots are merged
|
|
||||||
*
|
|
||||||
* @param world World in which the event occurred
|
|
||||||
* @param plot Plot that was merged
|
|
||||||
* @param plots A list of plots involved in the event
|
|
||||||
*/
|
|
||||||
public PlotMergeEvent(World world, Plot plot, ArrayList<PlotId> plots) {
|
|
||||||
super(plot);
|
|
||||||
this.world = world;
|
|
||||||
this.plots = plots;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HandlerList getHandlerList() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the plots being added.
|
|
||||||
*
|
|
||||||
* @return Plot
|
|
||||||
*/
|
|
||||||
public ArrayList<PlotId> getPlots() {
|
|
||||||
return this.plots;
|
|
||||||
}
|
|
||||||
|
|
||||||
public World getWorld() {
|
|
||||||
return this.world;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HandlerList getHandlers() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isCancelled() {
|
|
||||||
return this.cancelled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setCancelled(boolean b) {
|
|
||||||
this.cancelled = b;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.events;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
|
||||||
import com.intellectualcrafters.plot.object.Rating;
|
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
|
|
||||||
public class PlotRateEvent extends PlotEvent {
|
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
|
||||||
private final PlotPlayer rater;
|
|
||||||
private Rating rating;
|
|
||||||
|
|
||||||
public PlotRateEvent(PlotPlayer rater, Rating rating, Plot plot) {
|
|
||||||
super(plot);
|
|
||||||
this.rater = rater;
|
|
||||||
this.rating = rating;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HandlerList getHandlerList() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PlotPlayer getRater() {
|
|
||||||
return this.rater;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Rating getRating() {
|
|
||||||
return this.rating;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRating(Rating rating) {
|
|
||||||
this.rating = rating;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HandlerList getHandlers() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,67 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.events;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.object.PlotArea;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.event.Cancellable;
|
|
||||||
import org.bukkit.event.Event;
|
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class PlotUnlinkEvent extends Event implements Cancellable {
|
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
|
||||||
private final ArrayList<PlotId> plots;
|
|
||||||
private final World world;
|
|
||||||
private final PlotArea area;
|
|
||||||
private boolean cancelled;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when a mega-plot is unlinked.
|
|
||||||
*
|
|
||||||
* @param world World in which the event occurred
|
|
||||||
* @param plots Plots that are involved in the event
|
|
||||||
*/
|
|
||||||
public PlotUnlinkEvent(World world, PlotArea area, ArrayList<PlotId> plots) {
|
|
||||||
this.plots = plots;
|
|
||||||
this.world = world;
|
|
||||||
this.area = area;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HandlerList getHandlerList() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the plots involved.
|
|
||||||
*
|
|
||||||
* @return The {@link PlotId}'s of the plots involved
|
|
||||||
*/
|
|
||||||
public ArrayList<PlotId> getPlots() {
|
|
||||||
return this.plots;
|
|
||||||
}
|
|
||||||
|
|
||||||
public World getWorld() {
|
|
||||||
return this.world;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PlotArea getArea() {
|
|
||||||
return this.area;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HandlerList getHandlers() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isCancelled() {
|
|
||||||
return this.cancelled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setCancelled(boolean b) {
|
|
||||||
this.cancelled = b;
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.generator;
|
||||||
|
|
||||||
|
import com.plotsquared.bukkit.queue.LimitedRegionWrapperQueue;
|
||||||
|
import com.plotsquared.core.generator.HybridPlotWorld;
|
||||||
|
import com.plotsquared.core.generator.IndependentPlotGenerator;
|
||||||
|
import com.plotsquared.core.location.Location;
|
||||||
|
import com.plotsquared.core.location.UncheckedWorldLocation;
|
||||||
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
|
import com.plotsquared.core.plot.world.SinglePlotArea;
|
||||||
|
import com.plotsquared.core.queue.ScopedQueueCoordinator;
|
||||||
|
import org.bukkit.generator.BlockPopulator;
|
||||||
|
import org.bukkit.generator.LimitedRegion;
|
||||||
|
import org.bukkit.generator.WorldInfo;
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
final class BlockStatePopulator extends BlockPopulator {
|
||||||
|
|
||||||
|
private final IndependentPlotGenerator plotGenerator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 6.9.0
|
||||||
|
*/
|
||||||
|
public BlockStatePopulator(
|
||||||
|
final @NonNull IndependentPlotGenerator plotGenerator
|
||||||
|
) {
|
||||||
|
this.plotGenerator = plotGenerator;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Use {@link BlockStatePopulator#BlockStatePopulator(IndependentPlotGenerator)} as plotAreManager is unused
|
||||||
|
*/
|
||||||
|
@Deprecated(forRemoval = true, since = "6.9.0")
|
||||||
|
public BlockStatePopulator(
|
||||||
|
final @NonNull IndependentPlotGenerator plotGenerator,
|
||||||
|
final @NonNull PlotAreaManager plotAreaManager
|
||||||
|
) {
|
||||||
|
this.plotGenerator = plotGenerator;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void populate(
|
||||||
|
@NonNull final WorldInfo worldInfo,
|
||||||
|
@NonNull final Random random,
|
||||||
|
final int chunkX,
|
||||||
|
final int chunkZ,
|
||||||
|
@NonNull final LimitedRegion limitedRegion
|
||||||
|
) {
|
||||||
|
PlotArea area = UncheckedWorldLocation.at(worldInfo.getName(), chunkX << 4, 0, chunkZ << 4).getPlotArea();
|
||||||
|
if (area == null || (area instanceof HybridPlotWorld hpw && !hpw.populationNeeded()) || area instanceof SinglePlotArea) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
LimitedRegionWrapperQueue wrapped = new LimitedRegionWrapperQueue(limitedRegion);
|
||||||
|
// It is possible for the region to be larger than the chunk, but there is no reason for P2 to need to populate
|
||||||
|
// outside of the actual chunk area.
|
||||||
|
Location min = UncheckedWorldLocation.at(worldInfo.getName(), chunkX << 4, worldInfo.getMinHeight(), chunkZ << 4);
|
||||||
|
Location max = UncheckedWorldLocation.at(
|
||||||
|
worldInfo.getName(),
|
||||||
|
(chunkX << 4) + 15,
|
||||||
|
worldInfo.getMaxHeight(),
|
||||||
|
(chunkZ << 4) + 15
|
||||||
|
);
|
||||||
|
ScopedQueueCoordinator offsetChunkQueue = new ScopedQueueCoordinator(wrapped, min, max);
|
||||||
|
this.plotGenerator.populateChunk(offsetChunkQueue, area);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,14 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
package com.plotsquared.bukkit.generator;
|
package com.plotsquared.bukkit.generator;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.generator.AugmentedUtils;
|
import com.plotsquared.core.PlotSquared;
|
||||||
|
import com.plotsquared.core.generator.AugmentedUtils;
|
||||||
|
import com.plotsquared.core.queue.QueueCoordinator;
|
||||||
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
|
import com.sk89q.worldedit.util.SideEffectSet;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.generator.BlockPopulator;
|
import org.bukkit.generator.BlockPopulator;
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class BukkitAugmentedGenerator extends BlockPopulator {
|
public class BukkitAugmentedGenerator extends BlockPopulator {
|
||||||
|
|
||||||
private static BukkitAugmentedGenerator generator;
|
private static BukkitAugmentedGenerator generator;
|
||||||
|
|
||||||
public static BukkitAugmentedGenerator get(World world) {
|
public static BukkitAugmentedGenerator get(World world) {
|
||||||
@ -25,7 +48,15 @@ public class BukkitAugmentedGenerator extends BlockPopulator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void populate(World world, Random r, Chunk chunk) {
|
public void populate(@NonNull World world, @NonNull Random random, @NonNull Chunk source) {
|
||||||
AugmentedUtils.generate(world.getName(), chunk.getX(), chunk.getZ(), null);
|
QueueCoordinator queue = PlotSquared.platform().globalBlockQueue().getNewQueue(BukkitAdapter.adapt(world));
|
||||||
|
// The chunk is already loaded and we do not want to load the chunk in "fully" by using any PaperLib methods.
|
||||||
|
queue.setForceSync(true);
|
||||||
|
queue.setSideEffectSet(SideEffectSet.none());
|
||||||
|
queue.setBiomesEnabled(false);
|
||||||
|
queue.setChunkObject(source);
|
||||||
|
AugmentedUtils.generateChunk(world.getName(), source.getX(), source.getZ(), queue);
|
||||||
|
queue.enqueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,243 +1,115 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
package com.plotsquared.bukkit.generator;
|
package com.plotsquared.bukkit.generator;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.plotsquared.bukkit.queue.GenChunk;
|
||||||
import com.intellectualcrafters.plot.generator.GeneratorWrapper;
|
|
||||||
import com.intellectualcrafters.plot.generator.IndependentPlotGenerator;
|
|
||||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
|
||||||
import com.intellectualcrafters.plot.object.ChunkWrapper;
|
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotArea;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotManager;
|
|
||||||
import com.intellectualcrafters.plot.object.PseudoRandom;
|
|
||||||
import com.intellectualcrafters.plot.object.SetupObject;
|
|
||||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
|
||||||
import com.intellectualcrafters.plot.util.MathMan;
|
|
||||||
import com.intellectualcrafters.plot.util.block.GlobalBlockQueue;
|
|
||||||
import com.intellectualcrafters.plot.util.block.LocalBlockQueue;
|
|
||||||
import com.intellectualcrafters.plot.util.block.ScopedLocalBlockQueue;
|
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
import com.plotsquared.bukkit.util.block.GenChunk;
|
import com.plotsquared.bukkit.util.BukkitWorld;
|
||||||
import org.bukkit.Chunk;
|
import com.plotsquared.core.PlotSquared;
|
||||||
|
import com.plotsquared.core.generator.GeneratorWrapper;
|
||||||
|
import com.plotsquared.core.generator.IndependentPlotGenerator;
|
||||||
|
import com.plotsquared.core.generator.SingleWorldGenerator;
|
||||||
|
import com.plotsquared.core.location.ChunkWrapper;
|
||||||
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
|
import com.plotsquared.core.queue.ScopedQueueCoordinator;
|
||||||
|
import com.plotsquared.core.util.ChunkManager;
|
||||||
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.generator.BlockPopulator;
|
import org.bukkit.generator.BlockPopulator;
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrapper<ChunkGenerator> {
|
public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrapper<ChunkGenerator> {
|
||||||
|
|
||||||
private final GenChunk chunkSetter;
|
@SuppressWarnings("unused")
|
||||||
private final PseudoRandom random = new PseudoRandom();
|
public final boolean PAPER_ASYNC_SAFE = true;
|
||||||
|
|
||||||
|
private final PlotAreaManager plotAreaManager;
|
||||||
private final IndependentPlotGenerator plotGenerator;
|
private final IndependentPlotGenerator plotGenerator;
|
||||||
private List<BlockPopulator> populators;
|
|
||||||
private final ChunkGenerator platformGenerator;
|
private final ChunkGenerator platformGenerator;
|
||||||
private final boolean full;
|
private final boolean full;
|
||||||
private final HashMap<ChunkLoc, byte[][]> dataMap = new HashMap<>();
|
private final String levelName;
|
||||||
|
private List<BlockPopulator> populators;
|
||||||
private boolean loaded = false;
|
private boolean loaded = false;
|
||||||
|
|
||||||
public BukkitPlotGenerator(IndependentPlotGenerator generator) {
|
public BukkitPlotGenerator(
|
||||||
if (generator == null) {
|
final @NonNull String name,
|
||||||
throw new IllegalArgumentException("Generator may not be null!");
|
final @NonNull IndependentPlotGenerator generator,
|
||||||
}
|
final @NonNull PlotAreaManager plotAreaManager
|
||||||
|
) {
|
||||||
|
this.plotAreaManager = plotAreaManager;
|
||||||
|
this.levelName = name;
|
||||||
this.plotGenerator = generator;
|
this.plotGenerator = generator;
|
||||||
this.platformGenerator = this;
|
this.platformGenerator = this;
|
||||||
populators = new ArrayList<>();
|
this.populators = new ArrayList<>();
|
||||||
this.populators.add(new BlockPopulator() {
|
int minecraftMinorVersion = PlotSquared.platform().serverVersion()[1];
|
||||||
|
if (minecraftMinorVersion >= 17) {
|
||||||
private LocalBlockQueue queue;
|
this.populators.add(new BlockStatePopulator(this.plotGenerator));
|
||||||
|
} else {
|
||||||
@Override
|
this.populators.add(new LegacyBlockStatePopulator(this.plotGenerator));
|
||||||
public void populate(World world, Random r, Chunk c) {
|
|
||||||
if (queue == null) {
|
|
||||||
queue = GlobalBlockQueue.IMP.getNewQueue(world.getName(), false);
|
|
||||||
}
|
|
||||||
ChunkLoc loc = new ChunkLoc(c.getX(), c.getZ());
|
|
||||||
byte[][] resultData;
|
|
||||||
if (!BukkitPlotGenerator.this.dataMap.containsKey(loc)) {
|
|
||||||
GenChunk result = BukkitPlotGenerator.this.chunkSetter;
|
|
||||||
// Set the chunk location
|
|
||||||
result.setChunk(c);
|
|
||||||
// Set the result data
|
|
||||||
result.result = new short[16][];
|
|
||||||
result.result_data = new byte[16][];
|
|
||||||
result.grid = null;
|
|
||||||
result.cd = null;
|
|
||||||
// Catch any exceptions (as exceptions usually thrown)
|
|
||||||
generate(world, loc.x, loc.z, result);
|
|
||||||
resultData = result.result_data;
|
|
||||||
} else {
|
|
||||||
resultData = BukkitPlotGenerator.this.dataMap.remove(loc);
|
|
||||||
}
|
|
||||||
if (resultData != null) {
|
|
||||||
for (int i = 0; i < resultData.length; i++) {
|
|
||||||
byte[] section = resultData[i];
|
|
||||||
if (section == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
for (int j = 0; j < section.length; j++) {
|
|
||||||
int x = MainUtil.x_loc[i][j];
|
|
||||||
int y = MainUtil.y_loc[i][j];
|
|
||||||
int z = MainUtil.z_loc[i][j];
|
|
||||||
c.getBlock(x, y, z).setData(section[j]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
BukkitPlotGenerator.this.random.state = c.getX() << 16 | c.getZ() & 0xFFFF;
|
|
||||||
PlotArea area = PS.get().getPlotArea(world.getName(), null);
|
|
||||||
ChunkWrapper wrap = new ChunkWrapper(area.worldname, c.getX(), c.getZ());
|
|
||||||
ScopedLocalBlockQueue chunk = queue.getForChunk(wrap.x, wrap.z);
|
|
||||||
if (BukkitPlotGenerator.this.plotGenerator.populateChunk(chunk, area, BukkitPlotGenerator.this.random)) {
|
|
||||||
queue.flush();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.chunkSetter = new GenChunk(null, null);
|
|
||||||
this.full = true;
|
|
||||||
MainUtil.initCache();
|
|
||||||
}
|
|
||||||
|
|
||||||
public BukkitPlotGenerator(final String world, final ChunkGenerator cg) {
|
|
||||||
if (cg instanceof BukkitPlotGenerator) {
|
|
||||||
throw new IllegalArgumentException("ChunkGenerator: " + cg.getClass().getName() + " is already a BukkitPlotGenerator!");
|
|
||||||
}
|
}
|
||||||
this.full = false;
|
this.full = true;
|
||||||
PS.debug("BukkitPlotGenerator does not fully support: " + cg);
|
|
||||||
this.platformGenerator = cg;
|
|
||||||
this.plotGenerator = new IndependentPlotGenerator() {
|
|
||||||
@Override
|
|
||||||
public void processSetup(SetupObject setup) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initialize(PlotArea area) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PlotManager getNewPlotManager() {
|
|
||||||
return PS.get().IMP.getDefaultGenerator().getNewPlotManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return cg.getClass().getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PlotArea getNewPlotArea(String world, String id, PlotId min, PlotId max) {
|
|
||||||
return PS.get().IMP.getDefaultGenerator().getNewPlotArea(world, id, min, max);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void generateChunk(final ScopedLocalBlockQueue result, PlotArea settings, PseudoRandom random) {
|
|
||||||
World w = BukkitUtil.getWorld(world);
|
|
||||||
Location min = result.getMin();
|
|
||||||
int cx = min.getX() >> 4;
|
|
||||||
int cz = min.getZ() >> 4;
|
|
||||||
Random r = new Random(MathMan.pair((short) cx, (short) cz));
|
|
||||||
BiomeGrid grid = new BiomeGrid() {
|
|
||||||
@Override
|
|
||||||
public void setBiome(int x, int z, Biome biome) {
|
|
||||||
result.setBiome(x, z, biome.name());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Biome getBiome(int arg0, int arg1) {
|
|
||||||
return Biome.FOREST;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
try {
|
|
||||||
// ChunkData will spill a bit
|
|
||||||
ChunkData data = cg.generateChunkData(w, r, cx, cz, grid);
|
|
||||||
if (data != null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} catch (Throwable ignored) {}
|
|
||||||
// Populator spillage
|
|
||||||
short[][] tmp = cg.generateExtBlockSections(w, r, cx, cz, grid);
|
|
||||||
if (tmp != null) {
|
|
||||||
for (int i = 0; i < tmp.length; i++) {
|
|
||||||
short[] section = tmp[i];
|
|
||||||
if (section == null) {
|
|
||||||
if (i < 7) {
|
|
||||||
for (int x = 0; x < 16; x++) {
|
|
||||||
for (int z = 0; z < 16; z++) {
|
|
||||||
for (int y = i << 4; y < (i << 4) + 16; y++) {
|
|
||||||
result.setBlock(x, y, z, (short) 0, (byte) 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
for (int j = 0; j < section.length; j++) {
|
|
||||||
int x = MainUtil.x_loc[i][j];
|
|
||||||
int y = MainUtil.y_loc[i][j];
|
|
||||||
int z = MainUtil.z_loc[i][j];
|
|
||||||
result.setBlock(x, y, z, section[j], (byte) 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (BlockPopulator populator : cg.getDefaultPopulators(w)) {
|
|
||||||
populator.populate(w, r, w.getChunkAt(cx, cz));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
this.chunkSetter = new GenChunk(null, new ChunkWrapper(world, 0, 0));
|
|
||||||
MainUtil.initCache();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BukkitPlotGenerator(final String world, final ChunkGenerator cg, final @NonNull PlotAreaManager plotAreaManager) {
|
||||||
|
if (cg instanceof BukkitPlotGenerator) {
|
||||||
|
throw new IllegalArgumentException("ChunkGenerator: " + cg.getClass().getName()
|
||||||
|
+ " is already a BukkitPlotGenerator!");
|
||||||
|
}
|
||||||
|
this.plotAreaManager = plotAreaManager;
|
||||||
|
this.levelName = world;
|
||||||
|
this.full = false;
|
||||||
|
this.platformGenerator = cg;
|
||||||
|
this.plotGenerator = new DelegatePlotGenerator(cg, world);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void augment(PlotArea area) {
|
public void augment(PlotArea area) {
|
||||||
BukkitAugmentedGenerator.get(BukkitUtil.getWorld(area.worldname));
|
BukkitAugmentedGenerator.get(BukkitUtil.getWorld(area.getWorldName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFull() {
|
public boolean isFull() {
|
||||||
return this.full;
|
return this.full;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IndependentPlotGenerator getPlotGenerator() {
|
public IndependentPlotGenerator getPlotGenerator() {
|
||||||
return this.plotGenerator;
|
return this.plotGenerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChunkGenerator getPlatformGenerator() {
|
public ChunkGenerator getPlatformGenerator() {
|
||||||
return this.platformGenerator;
|
return this.platformGenerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BlockPopulator> getDefaultPopulators(World world) {
|
public @NonNull List<BlockPopulator> getDefaultPopulators(@NonNull World world) {
|
||||||
try {
|
try {
|
||||||
if (!this.loaded) {
|
checkLoaded(world);
|
||||||
String name = world.getName();
|
|
||||||
PS.get().loadWorld(name, this);
|
|
||||||
Set<PlotArea> areas = PS.get().getPlotAreas(name);
|
|
||||||
if (!areas.isEmpty()) {
|
|
||||||
PlotArea area = areas.iterator().next();
|
|
||||||
if (!area.MOB_SPAWNING) {
|
|
||||||
if (!area.SPAWN_EGGS) {
|
|
||||||
world.setSpawnFlags(false, false);
|
|
||||||
}
|
|
||||||
world.setAmbientSpawnLimit(0);
|
|
||||||
world.setAnimalSpawnLimit(0);
|
|
||||||
world.setMonsterSpawnLimit(0);
|
|
||||||
world.setWaterAnimalSpawnLimit(0);
|
|
||||||
} else {
|
|
||||||
world.setSpawnFlags(true, true);
|
|
||||||
world.setAmbientSpawnLimit(-1);
|
|
||||||
world.setAnimalSpawnLimit(-1);
|
|
||||||
world.setMonsterSpawnLimit(-1);
|
|
||||||
world.setWaterAnimalSpawnLimit(-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.loaded = true;
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -246,101 +118,147 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
|
|||||||
if (populators == null && platformGenerator != null) {
|
if (populators == null && platformGenerator != null) {
|
||||||
populators = new ArrayList<>(platformGenerator.getDefaultPopulators(world));
|
populators = new ArrayList<>(platformGenerator.getDefaultPopulators(world));
|
||||||
}
|
}
|
||||||
for (BlockPopulator populator : this.populators) {
|
if (populators != null) {
|
||||||
if (!existing.contains(populator)) {
|
for (BlockPopulator populator : this.populators) {
|
||||||
toAdd.add(populator);
|
if (!existing.contains(populator)) {
|
||||||
|
toAdd.add(populator);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return toAdd;
|
return toAdd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private synchronized void checkLoaded(@NonNull World world) {
|
||||||
|
// Do not attempt to load configurations until WorldEdit has a platform ready.
|
||||||
|
if (!PlotSquared.get().isWeInitialised()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!this.loaded) {
|
||||||
|
String name = world.getName();
|
||||||
|
PlotSquared.get().loadWorld(name, this);
|
||||||
|
final Set<PlotArea> areas = this.plotAreaManager.getPlotAreasSet(name);
|
||||||
|
if (!areas.isEmpty()) {
|
||||||
|
PlotArea area = areas.iterator().next();
|
||||||
|
if (!area.isMobSpawning()) {
|
||||||
|
if (!area.isSpawnEggs()) {
|
||||||
|
world.setSpawnFlags(false, false);
|
||||||
|
}
|
||||||
|
setSpawnLimits(world, 0);
|
||||||
|
} else {
|
||||||
|
world.setSpawnFlags(true, true);
|
||||||
|
setSpawnLimits(world, -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.loaded = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
private void setSpawnLimits(@NonNull World world, int limit) {
|
||||||
|
world.setAmbientSpawnLimit(limit);
|
||||||
|
world.setAnimalSpawnLimit(limit);
|
||||||
|
world.setMonsterSpawnLimit(limit);
|
||||||
|
world.setWaterAnimalSpawnLimit(limit);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The entire method is deprecated, but kept for compatibility with versions lower than or equal to 1.16.2.
|
||||||
|
* The method will be removed in future versions, because WorldEdit and FastAsyncWorldEdit only support the latest point
|
||||||
|
* release.
|
||||||
|
*/
|
||||||
|
@Deprecated(forRemoval = true, since = "6.11.0")
|
||||||
@Override
|
@Override
|
||||||
public ChunkData generateChunkData(World world, Random random, int cx, int cz, BiomeGrid grid) {
|
public @NonNull ChunkData generateChunkData(
|
||||||
GenChunk result = this.chunkSetter;
|
@NonNull World world, @NonNull Random random, int x, int z,
|
||||||
|
@NonNull BiomeGrid biome
|
||||||
|
) {
|
||||||
|
int minY = BukkitWorld.getMinWorldHeight(world);
|
||||||
|
int maxY = BukkitWorld.getMaxWorldHeight(world);
|
||||||
|
GenChunk result = new GenChunk(minY, maxY);
|
||||||
|
if (this.getPlotGenerator() instanceof SingleWorldGenerator) {
|
||||||
|
if (result.getChunkData() != null) {
|
||||||
|
for (int chunkX = 0; chunkX < 16; chunkX++) {
|
||||||
|
for (int chunkZ = 0; chunkZ < 16; chunkZ++) {
|
||||||
|
for (int y = minY; y < maxY; y++) {
|
||||||
|
biome.setBiome(chunkX, y, chunkZ, Biome.PLAINS);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result.getChunkData();
|
||||||
|
}
|
||||||
|
}
|
||||||
// Set the chunk location
|
// Set the chunk location
|
||||||
result.setChunk(new ChunkWrapper(world.getName(), cx, cz));
|
result.setChunk(new ChunkWrapper(world.getName(), x, z));
|
||||||
// Set the result data
|
// Set the result data
|
||||||
result.cd = createChunkData(world);
|
result.setChunkData(createChunkData(world));
|
||||||
result.grid = grid;
|
result.biomeGrid = biome;
|
||||||
result.result = null;
|
result.result = null;
|
||||||
result.result_data = null;
|
|
||||||
// Catch any exceptions (as exceptions usually thrown)
|
// Catch any exceptions (as exceptions usually thrown)
|
||||||
try {
|
try {
|
||||||
// Fill the result data if necessary
|
// Fill the result data if necessary
|
||||||
if (this.platformGenerator != this) {
|
if (this.platformGenerator != this) {
|
||||||
return this.platformGenerator.generateChunkData(world, random, cx, cz, grid);
|
return this.platformGenerator.generateChunkData(world, random, x, z, biome);
|
||||||
} else {
|
} else {
|
||||||
generate(world, cx, cz, result);
|
generate(BlockVector2.at(x, z), world, result);
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
// Return the result data
|
// Return the result data
|
||||||
return result.cd;
|
return result.getChunkData();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void generate(World world, int cx, int cz, ScopedLocalBlockQueue result) {
|
private void generate(BlockVector2 loc, World world, ScopedQueueCoordinator result) {
|
||||||
// Load if improperly loaded
|
// Load if improperly loaded
|
||||||
if (!this.loaded) {
|
if (!this.loaded) {
|
||||||
String name = world.getName();
|
checkLoaded(world);
|
||||||
PS.get().loadWorld(name, this);
|
|
||||||
this.loaded = true;
|
|
||||||
}
|
}
|
||||||
// Set random seed
|
|
||||||
this.random.state = cx << 16 | cz & 0xFFFF;
|
|
||||||
// Process the chunk
|
// Process the chunk
|
||||||
if (ChunkManager.preProcessChunk(result)) {
|
if (ChunkManager.preProcessChunk(loc, result)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PlotArea area = PS.get().getPlotArea(world.getName(), null);
|
PlotArea area = this.plotAreaManager.getPlotArea(world.getName(), null);
|
||||||
|
if (area == null && (area = this.plotAreaManager.getPlotArea(this.levelName, null)) == null) {
|
||||||
|
throw new IllegalStateException(
|
||||||
|
"Cannot regenerate chunk that does not belong to a plot area." + " Location: " + loc
|
||||||
|
+ ", world: " + world);
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
this.plotGenerator.generateChunk(this.chunkSetter, area, this.random);
|
this.plotGenerator.generateChunk(result, area);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
// Recover from generator error
|
// Recover from generator error
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
ChunkManager.postProcessChunk(result);
|
ChunkManager.postProcessChunk(loc, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public short[][] generateExtBlockSections(World world, Random r, int cx, int cz, BiomeGrid grid) {
|
|
||||||
GenChunk result = this.chunkSetter;
|
|
||||||
// Set the chunk location
|
|
||||||
result.setChunk(new ChunkWrapper(world.getName(), cx, cz));
|
|
||||||
// Set the result data
|
|
||||||
result.result = new short[16][];
|
|
||||||
result.result_data = new byte[16][];
|
|
||||||
result.grid = grid;
|
|
||||||
result.cd = null;
|
|
||||||
// Catch any exceptions (as exceptions usually thrown)
|
|
||||||
try {
|
|
||||||
// Fill the result data
|
|
||||||
if (this.platformGenerator != this) {
|
|
||||||
return this.platformGenerator.generateExtBlockSections(world, r, cx, cz, grid);
|
|
||||||
} else {
|
|
||||||
generate(world, cx, cz, result);
|
|
||||||
this.dataMap.put(new ChunkLoc(cx, cz), result.result_data);
|
|
||||||
|
|
||||||
}
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
// Return the result data
|
|
||||||
return result.result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allow spawning everywhere.
|
|
||||||
* @param world Ignored
|
|
||||||
* @param x Ignored
|
|
||||||
* @param z Ignored
|
|
||||||
* @return always true
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canSpawn(World world, int x, int z) {
|
public boolean canSpawn(final @NonNull World world, final int x, final int z) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean shouldGenerateCaves() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean shouldGenerateDecorations() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isParallelCapable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean shouldGenerateMobs() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean shouldGenerateStructures() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
if (this.platformGenerator == this) {
|
if (this.platformGenerator == this) {
|
||||||
@ -352,12 +270,17 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
|
|||||||
return this.platformGenerator.getClass().getName();
|
return this.platformGenerator.getClass().getName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(final Object obj) {
|
||||||
if (obj == null) {
|
if (obj == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return toString().equals(obj.toString()) || toString().equals(obj.getClass().getName());
|
return toString().equals(obj.toString()) || toString().equals(obj.getClass().getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getLevelName() {
|
||||||
|
return this.levelName;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,102 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.generator;
|
||||||
|
|
||||||
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
|
import com.plotsquared.core.PlotSquared;
|
||||||
|
import com.plotsquared.core.generator.IndependentPlotGenerator;
|
||||||
|
import com.plotsquared.core.location.Location;
|
||||||
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
|
import com.plotsquared.core.plot.PlotId;
|
||||||
|
import com.plotsquared.core.queue.ScopedQueueCoordinator;
|
||||||
|
import com.plotsquared.core.util.MathMan;
|
||||||
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.block.Biome;
|
||||||
|
import org.bukkit.generator.BlockPopulator;
|
||||||
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
final class DelegatePlotGenerator extends IndependentPlotGenerator {
|
||||||
|
|
||||||
|
private final ChunkGenerator chunkGenerator;
|
||||||
|
private final String world;
|
||||||
|
|
||||||
|
public DelegatePlotGenerator(ChunkGenerator chunkGenerator, String world) {
|
||||||
|
this.chunkGenerator = chunkGenerator;
|
||||||
|
this.world = world;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initialize(PlotArea area) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return this.chunkGenerator.getClass().getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PlotArea getNewPlotArea(String world, String id, PlotId min, PlotId max) {
|
||||||
|
return PlotSquared.platform().defaultGenerator().getNewPlotArea(world, id, min, max);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void generateChunk(final ScopedQueueCoordinator result, PlotArea settings) {
|
||||||
|
World world = BukkitUtil.getWorld(this.world);
|
||||||
|
Location min = result.getMin();
|
||||||
|
int chunkX = min.getX() >> 4;
|
||||||
|
int chunkZ = min.getZ() >> 4;
|
||||||
|
Random random = new Random(MathMan.pair((short) chunkX, (short) chunkZ));
|
||||||
|
try {
|
||||||
|
ChunkGenerator.BiomeGrid grid = new ChunkGenerator.BiomeGrid() {
|
||||||
|
@Override
|
||||||
|
public void setBiome(int x, int z, @NonNull Biome biome) {
|
||||||
|
result.setBiome(x, z, BukkitAdapter.adapt(biome));
|
||||||
|
}
|
||||||
|
|
||||||
|
//do not annotate with Override until we discontinue support for 1.4.4 (we no longer support 1.4.4)
|
||||||
|
@Override
|
||||||
|
public void setBiome(int x, int y, int z, @NonNull Biome biome) {
|
||||||
|
result.setBiome(x, z, BukkitAdapter.adapt(biome));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull Biome getBiome(int x, int z) {
|
||||||
|
return Biome.FOREST;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull Biome getBiome(int x, int y, int z) {
|
||||||
|
return Biome.FOREST;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
chunkGenerator.generateChunkData(world, random, chunkX, chunkZ, grid);
|
||||||
|
return;
|
||||||
|
} catch (Throwable ignored) {
|
||||||
|
}
|
||||||
|
for (BlockPopulator populator : chunkGenerator.getDefaultPopulators(world)) {
|
||||||
|
populator.populate(world, random, world.getChunkAt(chunkX, chunkZ));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.generator;
|
||||||
|
|
||||||
|
import com.plotsquared.core.PlotSquared;
|
||||||
|
import com.plotsquared.core.generator.HybridPlotWorld;
|
||||||
|
import com.plotsquared.core.generator.IndependentPlotGenerator;
|
||||||
|
import com.plotsquared.core.location.Location;
|
||||||
|
import com.plotsquared.core.location.UncheckedWorldLocation;
|
||||||
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
|
import com.plotsquared.core.plot.world.SinglePlotArea;
|
||||||
|
import com.plotsquared.core.queue.QueueCoordinator;
|
||||||
|
import com.plotsquared.core.queue.ScopedQueueCoordinator;
|
||||||
|
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
||||||
|
import com.sk89q.worldedit.util.SideEffectSet;
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.generator.BlockPopulator;
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
final class LegacyBlockStatePopulator extends BlockPopulator {
|
||||||
|
|
||||||
|
private final IndependentPlotGenerator plotGenerator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 6.9.0
|
||||||
|
*/
|
||||||
|
public LegacyBlockStatePopulator(
|
||||||
|
final @NonNull IndependentPlotGenerator plotGenerator
|
||||||
|
) {
|
||||||
|
this.plotGenerator = plotGenerator;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void populate(@NonNull final World world, @NonNull final Random random, @NonNull final Chunk source) {
|
||||||
|
int chunkMinX = source.getX() << 4;
|
||||||
|
int chunkMinZ = source.getZ() << 4;
|
||||||
|
PlotArea area = Location.at(world.getName(), chunkMinX, 0, chunkMinZ).getPlotArea();
|
||||||
|
if (area == null || (area instanceof HybridPlotWorld hpw && !hpw.populationNeeded()) || area instanceof SinglePlotArea) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QueueCoordinator queue = PlotSquared.platform().globalBlockQueue().getNewQueue(new BukkitWorld(world));
|
||||||
|
queue.setForceSync(true);
|
||||||
|
queue.setSideEffectSet(SideEffectSet.none());
|
||||||
|
queue.setBiomesEnabled(false);
|
||||||
|
queue.setChunkObject(source);
|
||||||
|
Location min = UncheckedWorldLocation.at(world.getName(), chunkMinX, world.getMinHeight(), chunkMinZ);
|
||||||
|
Location max = UncheckedWorldLocation.at(world.getName(), chunkMinX + 15, world.getMaxHeight(), chunkMinZ + 15);
|
||||||
|
ScopedQueueCoordinator offsetChunkQueue = new ScopedQueueCoordinator(queue, min, max);
|
||||||
|
this.plotGenerator.populateChunk(offsetChunkQueue, area);
|
||||||
|
queue.enqueue();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.inject;
|
||||||
|
|
||||||
|
import com.google.inject.AbstractModule;
|
||||||
|
import com.google.inject.assistedinject.FactoryModuleBuilder;
|
||||||
|
import com.plotsquared.core.backup.BackupManager;
|
||||||
|
import com.plotsquared.core.backup.BackupProfile;
|
||||||
|
import com.plotsquared.core.backup.NullBackupManager;
|
||||||
|
import com.plotsquared.core.backup.PlayerBackupProfile;
|
||||||
|
import com.plotsquared.core.backup.SimpleBackupManager;
|
||||||
|
import com.plotsquared.core.inject.factory.PlayerBackupProfileFactory;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
public class BackupModule extends AbstractModule {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + BackupModule.class.getSimpleName());
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configure() {
|
||||||
|
try {
|
||||||
|
install(new FactoryModuleBuilder()
|
||||||
|
.implement(BackupProfile.class, PlayerBackupProfile.class).build(PlayerBackupProfileFactory.class));
|
||||||
|
bind(BackupManager.class).to(SimpleBackupManager.class);
|
||||||
|
} catch (final Exception e) {
|
||||||
|
LOGGER.error("Failed to initialize backup manager", e);
|
||||||
|
LOGGER.error("Backup features will be disabled");
|
||||||
|
bind(BackupManager.class).to(NullBackupManager.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,148 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.inject;
|
||||||
|
|
||||||
|
import com.google.inject.AbstractModule;
|
||||||
|
import com.google.inject.Provides;
|
||||||
|
import com.google.inject.Singleton;
|
||||||
|
import com.google.inject.assistedinject.FactoryModuleBuilder;
|
||||||
|
import com.plotsquared.bukkit.BukkitPlatform;
|
||||||
|
import com.plotsquared.bukkit.listener.SingleWorldListener;
|
||||||
|
import com.plotsquared.bukkit.player.BukkitPlayerManager;
|
||||||
|
import com.plotsquared.bukkit.queue.BukkitChunkCoordinator;
|
||||||
|
import com.plotsquared.bukkit.queue.BukkitQueueCoordinator;
|
||||||
|
import com.plotsquared.bukkit.schematic.BukkitSchematicHandler;
|
||||||
|
import com.plotsquared.bukkit.util.BukkitChunkManager;
|
||||||
|
import com.plotsquared.bukkit.util.BukkitEconHandler;
|
||||||
|
import com.plotsquared.bukkit.util.BukkitInventoryUtil;
|
||||||
|
import com.plotsquared.bukkit.util.BukkitRegionManager;
|
||||||
|
import com.plotsquared.bukkit.util.BukkitSetupUtils;
|
||||||
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
|
import com.plotsquared.bukkit.util.fawe.FaweRegionManager;
|
||||||
|
import com.plotsquared.bukkit.util.fawe.FaweSchematicHandler;
|
||||||
|
import com.plotsquared.core.PlotPlatform;
|
||||||
|
import com.plotsquared.core.PlotSquared;
|
||||||
|
import com.plotsquared.core.configuration.Settings;
|
||||||
|
import com.plotsquared.core.generator.HybridGen;
|
||||||
|
import com.plotsquared.core.generator.IndependentPlotGenerator;
|
||||||
|
import com.plotsquared.core.inject.annotations.ConsoleActor;
|
||||||
|
import com.plotsquared.core.inject.annotations.DefaultGenerator;
|
||||||
|
import com.plotsquared.core.inject.factory.ChunkCoordinatorBuilderFactory;
|
||||||
|
import com.plotsquared.core.inject.factory.ChunkCoordinatorFactory;
|
||||||
|
import com.plotsquared.core.inject.factory.HybridPlotWorldFactory;
|
||||||
|
import com.plotsquared.core.inject.factory.ProgressSubscriberFactory;
|
||||||
|
import com.plotsquared.core.plot.world.DefaultPlotAreaManager;
|
||||||
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
|
import com.plotsquared.core.plot.world.SinglePlotAreaManager;
|
||||||
|
import com.plotsquared.core.queue.ChunkCoordinator;
|
||||||
|
import com.plotsquared.core.queue.GlobalBlockQueue;
|
||||||
|
import com.plotsquared.core.queue.QueueProvider;
|
||||||
|
import com.plotsquared.core.queue.subscriber.DefaultProgressSubscriber;
|
||||||
|
import com.plotsquared.core.queue.subscriber.ProgressSubscriber;
|
||||||
|
import com.plotsquared.core.util.ChunkManager;
|
||||||
|
import com.plotsquared.core.util.EconHandler;
|
||||||
|
import com.plotsquared.core.util.InventoryUtil;
|
||||||
|
import com.plotsquared.core.util.PlayerManager;
|
||||||
|
import com.plotsquared.core.util.RegionManager;
|
||||||
|
import com.plotsquared.core.util.SchematicHandler;
|
||||||
|
import com.plotsquared.core.util.SetupUtils;
|
||||||
|
import com.plotsquared.core.util.WorldUtil;
|
||||||
|
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||||
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
|
public class BukkitModule extends AbstractModule {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LogManager.getLogger("PlotSquared/" + BukkitModule.class.getSimpleName());
|
||||||
|
|
||||||
|
private final BukkitPlatform bukkitPlatform;
|
||||||
|
|
||||||
|
public BukkitModule(final @NonNull BukkitPlatform bukkitPlatform) {
|
||||||
|
this.bukkitPlatform = bukkitPlatform;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configure() {
|
||||||
|
bind(PlayerManager.class).to(BukkitPlayerManager.class);
|
||||||
|
bind(JavaPlugin.class).toInstance(bukkitPlatform);
|
||||||
|
bind(PlotPlatform.class).toInstance(bukkitPlatform);
|
||||||
|
bind(BukkitPlatform.class).toInstance(bukkitPlatform);
|
||||||
|
bind(IndependentPlotGenerator.class).annotatedWith(DefaultGenerator.class).to(HybridGen.class);
|
||||||
|
// Console actor
|
||||||
|
@NonNull ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
|
||||||
|
WorldEditPlugin wePlugin = ((WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit"));
|
||||||
|
bind(Actor.class).annotatedWith(ConsoleActor.class).toInstance(wePlugin.wrapCommandSender(console));
|
||||||
|
bind(InventoryUtil.class).to(BukkitInventoryUtil.class);
|
||||||
|
bind(SetupUtils.class).to(BukkitSetupUtils.class);
|
||||||
|
bind(WorldUtil.class).to(BukkitUtil.class);
|
||||||
|
install(new FactoryModuleBuilder()
|
||||||
|
.implement(ProgressSubscriber.class, DefaultProgressSubscriber.class)
|
||||||
|
.build(ProgressSubscriberFactory.class));
|
||||||
|
bind(ChunkManager.class).to(BukkitChunkManager.class);
|
||||||
|
if (PlotSquared.platform().isFaweHooking()) {
|
||||||
|
bind(SchematicHandler.class).to(FaweSchematicHandler.class);
|
||||||
|
bind(RegionManager.class).to(FaweRegionManager.class);
|
||||||
|
} else {
|
||||||
|
bind(SchematicHandler.class).to(BukkitSchematicHandler.class);
|
||||||
|
bind(RegionManager.class).to(BukkitRegionManager.class);
|
||||||
|
}
|
||||||
|
bind(GlobalBlockQueue.class).toInstance(new GlobalBlockQueue(QueueProvider.of(BukkitQueueCoordinator.class)));
|
||||||
|
if (Settings.Enabled_Components.WORLDS) {
|
||||||
|
bind(PlotAreaManager.class).to(SinglePlotAreaManager.class);
|
||||||
|
try {
|
||||||
|
bind(SingleWorldListener.class).toInstance(new SingleWorldListener());
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
bind(PlotAreaManager.class).to(DefaultPlotAreaManager.class);
|
||||||
|
}
|
||||||
|
install(new FactoryModuleBuilder().build(HybridPlotWorldFactory.class));
|
||||||
|
install(new FactoryModuleBuilder()
|
||||||
|
.implement(ChunkCoordinator.class, BukkitChunkCoordinator.class)
|
||||||
|
.build(ChunkCoordinatorFactory.class));
|
||||||
|
install(new FactoryModuleBuilder().build(ChunkCoordinatorBuilderFactory.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
@NonNull EconHandler provideEconHandler() {
|
||||||
|
if (!Settings.Enabled_Components.ECONOMY) {
|
||||||
|
return EconHandler.nullEconHandler();
|
||||||
|
}
|
||||||
|
if (Bukkit.getPluginManager().isPluginEnabled("Vault")) {
|
||||||
|
try {
|
||||||
|
BukkitEconHandler econHandler = new BukkitEconHandler();
|
||||||
|
if (!econHandler.init()) {
|
||||||
|
LOGGER.warn("Economy is enabled but no plugin is providing an economy service. Falling back...");
|
||||||
|
return EconHandler.nullEconHandler();
|
||||||
|
}
|
||||||
|
return econHandler;
|
||||||
|
} catch (final Exception ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return EconHandler.nullEconHandler();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.inject;
|
||||||
|
|
||||||
|
import com.google.inject.AbstractModule;
|
||||||
|
import com.google.inject.Provides;
|
||||||
|
import com.google.inject.Singleton;
|
||||||
|
import com.plotsquared.bukkit.permissions.BukkitPermissionHandler;
|
||||||
|
import com.plotsquared.bukkit.permissions.VaultPermissionHandler;
|
||||||
|
import com.plotsquared.core.permissions.PermissionHandler;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
|
public class PermissionModule extends AbstractModule {
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
PermissionHandler providePermissionHandler() {
|
||||||
|
try {
|
||||||
|
if (Bukkit.getPluginManager().isPluginEnabled("Vault")) {
|
||||||
|
return new VaultPermissionHandler();
|
||||||
|
}
|
||||||
|
} catch (final Exception ignored) {
|
||||||
|
}
|
||||||
|
return new BukkitPermissionHandler();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.inject;
|
||||||
|
|
||||||
|
import com.google.inject.AbstractModule;
|
||||||
|
import com.google.inject.Provides;
|
||||||
|
import com.google.inject.Singleton;
|
||||||
|
import com.plotsquared.bukkit.managers.BukkitWorldManager;
|
||||||
|
import com.plotsquared.bukkit.managers.MultiverseWorldManager;
|
||||||
|
import com.plotsquared.core.util.PlatformWorldManager;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.World;
|
||||||
|
|
||||||
|
public class WorldManagerModule extends AbstractModule {
|
||||||
|
|
||||||
|
@SuppressWarnings("removal") // Internal use only
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
PlatformWorldManager<World> provideWorldManager() {
|
||||||
|
if (Bukkit.getPluginManager().getPlugin("Multiverse-Core") != null) {
|
||||||
|
return new MultiverseWorldManager();
|
||||||
|
} else {
|
||||||
|
return new BukkitWorldManager();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,189 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.listener;
|
||||||
|
|
||||||
|
import com.google.inject.Inject;
|
||||||
|
import com.plotsquared.bukkit.player.BukkitPlayer;
|
||||||
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
|
import com.plotsquared.core.location.Location;
|
||||||
|
import com.plotsquared.core.plot.Plot;
|
||||||
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
|
import com.plotsquared.core.plot.flag.implementations.CopperOxideFlag;
|
||||||
|
import com.plotsquared.core.plot.flag.implementations.MiscInteractFlag;
|
||||||
|
import com.plotsquared.core.util.PlotFlagUtil;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Item;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.block.BlockFertilizeEvent;
|
||||||
|
import org.bukkit.event.block.BlockFormEvent;
|
||||||
|
import org.bukkit.event.block.BlockReceiveGameEvent;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public class BlockEventListener117 implements Listener {
|
||||||
|
|
||||||
|
private static final Set<Material> COPPER_OXIDIZING = Set.of(
|
||||||
|
Material.COPPER_BLOCK,
|
||||||
|
Material.EXPOSED_COPPER,
|
||||||
|
Material.WEATHERED_COPPER,
|
||||||
|
Material.OXIDIZED_COPPER,
|
||||||
|
Material.CUT_COPPER,
|
||||||
|
Material.EXPOSED_CUT_COPPER,
|
||||||
|
Material.WEATHERED_CUT_COPPER,
|
||||||
|
Material.OXIDIZED_CUT_COPPER,
|
||||||
|
Material.CUT_COPPER_STAIRS,
|
||||||
|
Material.EXPOSED_CUT_COPPER_STAIRS,
|
||||||
|
Material.WEATHERED_CUT_COPPER_STAIRS,
|
||||||
|
Material.OXIDIZED_CUT_COPPER_STAIRS,
|
||||||
|
Material.CUT_COPPER_SLAB,
|
||||||
|
Material.EXPOSED_CUT_COPPER_SLAB,
|
||||||
|
Material.WEATHERED_CUT_COPPER_SLAB,
|
||||||
|
Material.OXIDIZED_CUT_COPPER_SLAB
|
||||||
|
);
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public BlockEventListener117() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
public void onBlockReceiveGame(BlockReceiveGameEvent event) {
|
||||||
|
Block block = event.getBlock();
|
||||||
|
Location location = BukkitUtil.adapt(block.getLocation());
|
||||||
|
Entity entity = event.getEntity();
|
||||||
|
|
||||||
|
PlotArea area = location.getPlotArea();
|
||||||
|
if (area == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BukkitPlayer plotPlayer = null;
|
||||||
|
|
||||||
|
if (entity instanceof Player player) {
|
||||||
|
plotPlayer = BukkitUtil.adapt(player);
|
||||||
|
if (area.notifyIfOutsideBuildArea(plotPlayer, location.getY())) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Plot plot = location.getOwnedPlot();
|
||||||
|
if (plot == null && !PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, MiscInteractFlag.class, true) || plot != null && !plot.getFlag(
|
||||||
|
MiscInteractFlag.class)) {
|
||||||
|
if (plotPlayer != null) {
|
||||||
|
if (plot != null) {
|
||||||
|
if (!plot.isAdded(plotPlayer.getUUID())) {
|
||||||
|
plot.debug(plotPlayer.getName() + " couldn't trigger sculk sensors because misc-interact = false");
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (entity instanceof Item item) {
|
||||||
|
UUID itemThrower = item.getThrower();
|
||||||
|
if (plot != null) {
|
||||||
|
if (itemThrower == null && (itemThrower = item.getOwner()) == null) {
|
||||||
|
plot.debug(
|
||||||
|
"A thrown item couldn't trigger sculk sensors because misc-interact = false and the item's owner could not be resolved.");
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!plot.isAdded(itemThrower)) {
|
||||||
|
if (!plot.isAdded(itemThrower)) {
|
||||||
|
plot.debug("A thrown item couldn't trigger sculk sensors because misc-interact = false");
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
public void onBlockFertilize(BlockFertilizeEvent event) {
|
||||||
|
Block block = event.getBlock();
|
||||||
|
List<org.bukkit.block.BlockState> blocks = event.getBlocks();
|
||||||
|
Location location = BukkitUtil.adapt(blocks.get(0).getLocation());
|
||||||
|
|
||||||
|
PlotArea area = location.getPlotArea();
|
||||||
|
if (area == null) {
|
||||||
|
for (int i = blocks.size() - 1; i >= 0; i--) {
|
||||||
|
Location blockLocation = BukkitUtil.adapt(blocks.get(i).getLocation());
|
||||||
|
blockLocation = BukkitUtil.adapt(blocks.get(i).getLocation());
|
||||||
|
if (blockLocation.isPlotArea()) {
|
||||||
|
blocks.remove(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Plot origin = area.getOwnedPlot(location);
|
||||||
|
if (origin == null) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (int i = blocks.size() - 1; i >= 0; i--) {
|
||||||
|
Location blockLocation = BukkitUtil.adapt(blocks.get(i).getLocation());
|
||||||
|
if (!area.contains(blockLocation.getX(), blockLocation.getZ())) {
|
||||||
|
blocks.remove(i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Plot plot = area.getOwnedPlot(blockLocation);
|
||||||
|
if (!Objects.equals(plot, origin)) {
|
||||||
|
event.getBlocks().remove(i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!area.buildRangeContainsY(location.getY())) {
|
||||||
|
event.getBlocks().remove(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
public void onBlockForm(BlockFormEvent event) {
|
||||||
|
Block block = event.getBlock();
|
||||||
|
Location location = BukkitUtil.adapt(block.getLocation());
|
||||||
|
if (location.isPlotRoad()) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PlotArea area = location.getPlotArea();
|
||||||
|
if (area == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Plot plot = area.getOwnedPlot(location);
|
||||||
|
if (plot == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (COPPER_OXIDIZING.contains(event.getNewState().getType())) {
|
||||||
|
if (!plot.getFlag(CopperOxideFlag.class)) {
|
||||||
|
plot.debug("Copper could not oxide because copper-oxide = false");
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,365 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.listener;
|
||||||
|
|
||||||
|
import com.google.inject.Inject;
|
||||||
|
import com.plotsquared.core.PlotSquared;
|
||||||
|
import com.plotsquared.core.configuration.Settings;
|
||||||
|
import com.plotsquared.core.location.Location;
|
||||||
|
import com.plotsquared.core.plot.Plot;
|
||||||
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
|
import com.plotsquared.core.plot.world.SinglePlotArea;
|
||||||
|
import com.plotsquared.core.util.ReflectionUtils.RefClass;
|
||||||
|
import com.plotsquared.core.util.ReflectionUtils.RefField;
|
||||||
|
import com.plotsquared.core.util.ReflectionUtils.RefMethod;
|
||||||
|
import com.plotsquared.core.util.task.PlotSquaredTask;
|
||||||
|
import com.plotsquared.core.util.task.TaskManager;
|
||||||
|
import com.plotsquared.core.util.task.TaskTime;
|
||||||
|
import io.papermc.lib.PaperLib;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.block.BlockState;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Item;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||||
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
|
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||||
|
import org.bukkit.event.world.ChunkLoadEvent;
|
||||||
|
import org.bukkit.event.world.ChunkUnloadEvent;
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public class ChunkListener implements Listener {
|
||||||
|
|
||||||
|
private final PlotAreaManager plotAreaManager;
|
||||||
|
private final int version;
|
||||||
|
|
||||||
|
private RefMethod methodGetHandleChunk;
|
||||||
|
private RefMethod methodGetHandleWorld;
|
||||||
|
private RefField mustSave;
|
||||||
|
/*
|
||||||
|
private RefMethod methodGetFullChunk;
|
||||||
|
private RefMethod methodGetBukkitChunk;
|
||||||
|
private RefMethod methodGetChunkProvider;
|
||||||
|
private RefMethod methodGetVisibleMap;
|
||||||
|
private RefField worldServer;
|
||||||
|
private RefField playerChunkMap;
|
||||||
|
private RefField updatingChunks;
|
||||||
|
private RefField visibleChunks;
|
||||||
|
*/
|
||||||
|
private Chunk lastChunk;
|
||||||
|
private boolean ignoreUnload = false;
|
||||||
|
private boolean isTrueForNotSave = true;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public ChunkListener(final @NonNull PlotAreaManager plotAreaManager) {
|
||||||
|
this.plotAreaManager = plotAreaManager;
|
||||||
|
version = PlotSquared.platform().serverVersion()[1];
|
||||||
|
if (!Settings.Chunk_Processor.AUTO_TRIM) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
RefClass classCraftWorld = getRefClass("{cb}.CraftWorld");
|
||||||
|
this.methodGetHandleWorld = classCraftWorld.getMethod("getHandle");
|
||||||
|
RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
||||||
|
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle");
|
||||||
|
try {
|
||||||
|
if (version < 17) {
|
||||||
|
RefClass classChunk = getRefClass("{nms}.Chunk");
|
||||||
|
if (version == 13) {
|
||||||
|
this.mustSave = classChunk.getField("mustSave");
|
||||||
|
this.isTrueForNotSave = false;
|
||||||
|
} else {
|
||||||
|
this.mustSave = classChunk.getField("mustNotSave");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
RefClass classChunk = getRefClass("net.minecraft.world.level.chunk.Chunk");
|
||||||
|
this.mustSave = classChunk.getField("mustNotSave");
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (NoSuchFieldException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} catch (Throwable ignored) {
|
||||||
|
Settings.Chunk_Processor.AUTO_TRIM = false;
|
||||||
|
}
|
||||||
|
for (World world : Bukkit.getWorlds()) {
|
||||||
|
world.setAutoSave(false);
|
||||||
|
}
|
||||||
|
if (version > 13) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
TaskManager.runTaskRepeat(() -> {
|
||||||
|
try {
|
||||||
|
HashSet<Chunk> toUnload = new HashSet<>();
|
||||||
|
for (World world : Bukkit.getWorlds()) {
|
||||||
|
String worldName = world.getName();
|
||||||
|
if (!this.plotAreaManager.hasPlotArea(worldName)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Object craftWorld = methodGetHandleWorld.of(world).call();
|
||||||
|
if (version == 13) {
|
||||||
|
Object chunkMap = craftWorld.getClass().getDeclaredMethod("getPlayerChunkMap").invoke(craftWorld);
|
||||||
|
Method methodIsChunkInUse =
|
||||||
|
chunkMap.getClass().getDeclaredMethod("isChunkInUse", int.class, int.class);
|
||||||
|
Chunk[] chunks = world.getLoadedChunks();
|
||||||
|
for (Chunk chunk : chunks) {
|
||||||
|
if ((boolean) methodIsChunkInUse.invoke(chunkMap, chunk.getX(), chunk.getZ())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int x = chunk.getX();
|
||||||
|
int z = chunk.getZ();
|
||||||
|
if (!shouldSave(worldName, x, z)) {
|
||||||
|
unloadChunk(worldName, chunk, false);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
toUnload.add(chunk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (toUnload.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
for (Chunk chunk : toUnload) {
|
||||||
|
if (System.currentTimeMillis() - start > 5) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
chunk.unload(true);
|
||||||
|
}
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}, TaskTime.ticks(1L));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean unloadChunk(String world, Chunk chunk, boolean safe) {
|
||||||
|
if (safe && shouldSave(world, chunk.getX(), chunk.getZ())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Object c = this.methodGetHandleChunk.of(chunk).call();
|
||||||
|
RefField.RefExecutor field = this.mustSave.of(c);
|
||||||
|
if ((Boolean) field.get() != isTrueForNotSave) {
|
||||||
|
field.set(isTrueForNotSave);
|
||||||
|
if (chunk.isLoaded()) {
|
||||||
|
ignoreUnload = true;
|
||||||
|
chunk.unload(false);
|
||||||
|
ignoreUnload = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean shouldSave(String world, int chunkX, int chunkZ) {
|
||||||
|
int x = chunkX << 4;
|
||||||
|
int z = chunkZ << 4;
|
||||||
|
int x2 = x + 15;
|
||||||
|
int z2 = z + 15;
|
||||||
|
Location loc = Location.at(world, x, 1, z);
|
||||||
|
PlotArea plotArea = plotAreaManager.getPlotArea(loc);
|
||||||
|
if (plotArea != null) {
|
||||||
|
Plot plot = plotArea.getPlot(loc);
|
||||||
|
if (plot != null && plot.hasOwner()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
loc = Location.at(world, x2, 1, z2);
|
||||||
|
plotArea = plotAreaManager.getPlotArea(loc);
|
||||||
|
if (plotArea != null) {
|
||||||
|
Plot plot = plotArea.getPlot(loc);
|
||||||
|
if (plot != null && plot.hasOwner()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
loc = Location.at(world, x2, 1, z);
|
||||||
|
plotArea = plotAreaManager.getPlotArea(loc);
|
||||||
|
if (plotArea != null) {
|
||||||
|
Plot plot = plotArea.getPlot(loc);
|
||||||
|
if (plot != null && plot.hasOwner()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
loc = Location.at(world, x, 1, z2);
|
||||||
|
plotArea = plotAreaManager.getPlotArea(loc);
|
||||||
|
if (plotArea != null) {
|
||||||
|
Plot plot = plotArea.getPlot(loc);
|
||||||
|
if (plot != null && plot.hasOwner()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
loc = Location.at(world, x + 7, 1, z + 7);
|
||||||
|
plotArea = plotAreaManager.getPlotArea(loc);
|
||||||
|
if (plotArea == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Plot plot = plotArea.getPlot(loc);
|
||||||
|
return plot != null && plot.hasOwner();
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onChunkUnload(ChunkUnloadEvent event) {
|
||||||
|
if (ignoreUnload) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Chunk chunk = event.getChunk();
|
||||||
|
if (Settings.Chunk_Processor.AUTO_TRIM) {
|
||||||
|
String world = chunk.getWorld().getName();
|
||||||
|
if ((!Settings.Enabled_Components.WORLDS || !SinglePlotArea.isSinglePlotWorld(world)) && this.plotAreaManager.hasPlotArea(world)) {
|
||||||
|
if (unloadChunk(world, chunk, true)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (processChunk(event.getChunk(), true)) {
|
||||||
|
chunk.setForceLoaded(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onChunkLoad(ChunkLoadEvent event) {
|
||||||
|
processChunk(event.getChunk(), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
|
public void onItemSpawn(ItemSpawnEvent event) {
|
||||||
|
Item entity = event.getEntity();
|
||||||
|
PaperLib.getChunkAtAsync(event.getLocation()).thenAccept(chunk -> {
|
||||||
|
if (chunk == this.lastChunk) {
|
||||||
|
event.getEntity().remove();
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!this.plotAreaManager.hasPlotArea(chunk.getWorld().getName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Entity[] entities = chunk.getEntities();
|
||||||
|
if (entities.length > Settings.Chunk_Processor.MAX_ENTITIES) {
|
||||||
|
event.getEntity().remove();
|
||||||
|
event.setCancelled(true);
|
||||||
|
this.lastChunk = chunk;
|
||||||
|
} else {
|
||||||
|
this.lastChunk = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
public void onBlockPhysics(BlockPhysicsEvent event) {
|
||||||
|
if (Settings.Chunk_Processor.DISABLE_PHYSICS) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
|
public void onEntitySpawn(CreatureSpawnEvent event) {
|
||||||
|
LivingEntity entity = event.getEntity();
|
||||||
|
PaperLib.getChunkAtAsync(event.getLocation()).thenAccept(chunk -> {
|
||||||
|
if (chunk == this.lastChunk) {
|
||||||
|
event.getEntity().remove();
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!this.plotAreaManager.hasPlotArea(chunk.getWorld().getName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Entity[] entities = chunk.getEntities();
|
||||||
|
if (entities.length > Settings.Chunk_Processor.MAX_ENTITIES) {
|
||||||
|
event.getEntity().remove();
|
||||||
|
event.setCancelled(true);
|
||||||
|
this.lastChunk = chunk;
|
||||||
|
} else {
|
||||||
|
this.lastChunk = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void cleanChunk(final Chunk chunk) {
|
||||||
|
final int currentIndex = TaskManager.index.incrementAndGet();
|
||||||
|
PlotSquaredTask task = TaskManager.runTaskRepeat(() -> {
|
||||||
|
if (!chunk.isLoaded()) {
|
||||||
|
Objects.requireNonNull(TaskManager.removeTask(currentIndex)).cancel();
|
||||||
|
chunk.unload(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
BlockState[] tiles = chunk.getTileEntities();
|
||||||
|
if (tiles.length == 0) {
|
||||||
|
Objects.requireNonNull(TaskManager.removeTask(currentIndex)).cancel();
|
||||||
|
chunk.unload(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
int i = 0;
|
||||||
|
while (System.currentTimeMillis() - start < 250) {
|
||||||
|
if (i >= tiles.length - Settings.Chunk_Processor.MAX_TILES) {
|
||||||
|
Objects.requireNonNull(TaskManager.removeTask(currentIndex)).cancel();
|
||||||
|
chunk.unload(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
tiles[i].getBlock().setType(Material.AIR, false);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}, TaskTime.ticks(5L));
|
||||||
|
TaskManager.addTask(task, currentIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean processChunk(Chunk chunk, boolean unload) {
|
||||||
|
if (!this.plotAreaManager.hasPlotArea(chunk.getWorld().getName())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Entity[] entities = chunk.getEntities();
|
||||||
|
BlockState[] tiles = chunk.getTileEntities();
|
||||||
|
if (entities.length > Settings.Chunk_Processor.MAX_ENTITIES) {
|
||||||
|
int toRemove = entities.length - Settings.Chunk_Processor.MAX_ENTITIES;
|
||||||
|
int index = 0;
|
||||||
|
while (toRemove > 0 && index < entities.length) {
|
||||||
|
final Entity entity = entities[index++];
|
||||||
|
if (!(entity instanceof Player)) {
|
||||||
|
entity.remove();
|
||||||
|
toRemove--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (tiles.length > Settings.Chunk_Processor.MAX_TILES) {
|
||||||
|
if (unload) {
|
||||||
|
cleanChunk(chunk);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < (tiles.length - Settings.Chunk_Processor.MAX_TILES); i++) {
|
||||||
|
tiles[i].getBlock().setType(Material.AIR, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,439 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.listener;
|
||||||
|
|
||||||
|
import com.google.inject.Inject;
|
||||||
|
import com.plotsquared.bukkit.player.BukkitPlayer;
|
||||||
|
import com.plotsquared.bukkit.util.BukkitEntityUtil;
|
||||||
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
|
import com.plotsquared.core.PlotSquared;
|
||||||
|
import com.plotsquared.core.configuration.Settings;
|
||||||
|
import com.plotsquared.core.listener.PlayerBlockEventType;
|
||||||
|
import com.plotsquared.core.location.Location;
|
||||||
|
import com.plotsquared.core.permissions.Permission;
|
||||||
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
|
import com.plotsquared.core.plot.Plot;
|
||||||
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
|
import com.plotsquared.core.plot.PlotHandler;
|
||||||
|
import com.plotsquared.core.plot.flag.implementations.DisablePhysicsFlag;
|
||||||
|
import com.plotsquared.core.plot.flag.implementations.EntityChangeBlockFlag;
|
||||||
|
import com.plotsquared.core.plot.flag.implementations.ExplosionFlag;
|
||||||
|
import com.plotsquared.core.plot.flag.implementations.InvincibleFlag;
|
||||||
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
|
import com.plotsquared.core.util.EventDispatcher;
|
||||||
|
import com.plotsquared.core.util.PlotFlagUtil;
|
||||||
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Particle;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.Ageable;
|
||||||
|
import org.bukkit.entity.Boat;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.FallingBlock;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Projectile;
|
||||||
|
import org.bukkit.entity.TNTPrimed;
|
||||||
|
import org.bukkit.entity.Vehicle;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
|
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||||
|
import org.bukkit.event.entity.EntityCombustByEntityEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
|
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||||
|
import org.bukkit.event.vehicle.VehicleCreateEvent;
|
||||||
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
|
import org.bukkit.metadata.MetadataValue;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
import org.bukkit.projectiles.BlockProjectileSource;
|
||||||
|
import org.bukkit.projectiles.ProjectileSource;
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public class EntityEventListener implements Listener {
|
||||||
|
|
||||||
|
private final PlotAreaManager plotAreaManager;
|
||||||
|
private final EventDispatcher eventDispatcher;
|
||||||
|
private float lastRadius;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public EntityEventListener(
|
||||||
|
final @NonNull PlotAreaManager plotAreaManager,
|
||||||
|
final @NonNull EventDispatcher eventDispatcher
|
||||||
|
) {
|
||||||
|
this.plotAreaManager = plotAreaManager;
|
||||||
|
this.eventDispatcher = eventDispatcher;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
|
public void onEntityCombustByEntity(EntityCombustByEntityEvent event) {
|
||||||
|
EntityDamageByEntityEvent eventChange =
|
||||||
|
new EntityDamageByEntityEvent(
|
||||||
|
event.getCombuster(),
|
||||||
|
event.getEntity(),
|
||||||
|
EntityDamageEvent.DamageCause.FIRE_TICK,
|
||||||
|
event.getDuration()
|
||||||
|
);
|
||||||
|
onEntityDamageByEntityEvent(eventChange);
|
||||||
|
if (eventChange.isCancelled()) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
|
public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent event) {
|
||||||
|
Entity damager = event.getDamager();
|
||||||
|
Location location = BukkitUtil.adapt(damager.getLocation());
|
||||||
|
if (!this.plotAreaManager.hasPlotArea(location.getWorldName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Entity victim = event.getEntity();
|
||||||
|
/*
|
||||||
|
if (victim.getType().equals(EntityType.ITEM_FRAME)) {
|
||||||
|
Plot plot = BukkitUtil.getLocation(victim).getPlot();
|
||||||
|
if (plot != null && !plot.isAdded(damager.getUniqueId())) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
if (!BukkitEntityUtil.entityDamage(damager, victim, event.getCause())) {
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
if (victim instanceof Ageable ageable) {
|
||||||
|
if (ageable.getAge() == -24000) {
|
||||||
|
ageable.setAge(0);
|
||||||
|
ageable.setAdult();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
public void creatureSpawnEvent(CreatureSpawnEvent event) {
|
||||||
|
Entity entity = event.getEntity();
|
||||||
|
Location location = BukkitUtil.adapt(entity.getLocation());
|
||||||
|
PlotArea area = location.getPlotArea();
|
||||||
|
if (area == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CreatureSpawnEvent.SpawnReason reason = event.getSpawnReason();
|
||||||
|
switch (reason.toString()) {
|
||||||
|
case "DISPENSE_EGG":
|
||||||
|
case "EGG":
|
||||||
|
case "OCELOT_BABY":
|
||||||
|
case "SPAWNER_EGG":
|
||||||
|
if (!area.isSpawnEggs()) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "REINFORCEMENTS":
|
||||||
|
case "NATURAL":
|
||||||
|
case "MOUNT":
|
||||||
|
case "PATROL":
|
||||||
|
case "RAID":
|
||||||
|
case "SHEARED":
|
||||||
|
case "SILVERFISH_BLOCK":
|
||||||
|
case "ENDER_PEARL":
|
||||||
|
case "TRAP":
|
||||||
|
case "VILLAGE_DEFENSE":
|
||||||
|
case "VILLAGE_INVASION":
|
||||||
|
case "BEEHIVE":
|
||||||
|
case "CHUNK_GEN":
|
||||||
|
if (!area.isMobSpawning()) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "BREEDING":
|
||||||
|
if (!area.isSpawnBreeding()) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "BUILD_IRONGOLEM":
|
||||||
|
case "BUILD_SNOWMAN":
|
||||||
|
case "BUILD_WITHER":
|
||||||
|
case "CUSTOM":
|
||||||
|
if (!area.isSpawnCustom() && entity.getType() != EntityType.ARMOR_STAND) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "SPAWNER":
|
||||||
|
if (!area.isMobSpawnerSpawning()) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Plot plot = area.getOwnedPlotAbs(location);
|
||||||
|
if (plot == null) {
|
||||||
|
if (!area.isMobSpawning()) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (BukkitEntityUtil.checkEntity(entity, plot.getBasePlot(false))) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||||
|
public void onEntityFall(EntityChangeBlockEvent event) {
|
||||||
|
if (event.getEntityType() != EntityType.FALLING_BLOCK) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Block block = event.getBlock();
|
||||||
|
World world = block.getWorld();
|
||||||
|
String worldName = world.getName();
|
||||||
|
if (!this.plotAreaManager.hasPlotArea(worldName)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Location location = BukkitUtil.adapt(block.getLocation());
|
||||||
|
PlotArea area = location.getPlotArea();
|
||||||
|
if (area == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Plot plot = area.getOwnedPlotAbs(location);
|
||||||
|
if (plot == null || plot.getFlag(DisablePhysicsFlag.class)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
if (plot != null) {
|
||||||
|
if (block.getType().hasGravity()) {
|
||||||
|
BlockEventListener.sendBlockChange(block.getLocation(), block.getBlockData());
|
||||||
|
}
|
||||||
|
plot.debug("Falling block event was cancelled because disable-physics = true");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (event.getTo().hasGravity()) {
|
||||||
|
Entity entity = event.getEntity();
|
||||||
|
List<MetadataValue> meta = entity.getMetadata("plot");
|
||||||
|
if (meta.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Plot origin = (Plot) meta.get(0).value();
|
||||||
|
if (origin != null && !origin.equals(plot)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
entity.remove();
|
||||||
|
}
|
||||||
|
} else if (event.getTo() == Material.AIR) {
|
||||||
|
event.getEntity().setMetadata("plot", new FixedMetadataValue((Plugin) PlotSquared.platform(), plot));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
|
public void onDamage(EntityDamageEvent event) {
|
||||||
|
if (event.getEntityType() != EntityType.PLAYER) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Location location = BukkitUtil.adapt(event.getEntity().getLocation());
|
||||||
|
PlotArea area = location.getPlotArea();
|
||||||
|
if (area == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Plot plot = location.getOwnedPlot();
|
||||||
|
if (plot == null) {
|
||||||
|
if (PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, InvincibleFlag.class, true)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (plot.getFlag(InvincibleFlag.class)) {
|
||||||
|
plot.debug(event.getEntity().getName() + " could not take damage because invincible = true");
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
public void onBigBoom(EntityExplodeEvent event) {
|
||||||
|
Location location = BukkitUtil.adapt(event.getLocation());
|
||||||
|
PlotArea area = location.getPlotArea();
|
||||||
|
boolean plotArea = location.isPlotArea();
|
||||||
|
if (!plotArea) {
|
||||||
|
if (!this.plotAreaManager.hasPlotArea(location.getWorldName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Plot plot = area.getOwnedPlot(location);
|
||||||
|
if (plot != null) {
|
||||||
|
if (plot.getFlag(ExplosionFlag.class)) {
|
||||||
|
List<MetadataValue> meta = event.getEntity().getMetadata("plot");
|
||||||
|
Plot origin;
|
||||||
|
if (meta.isEmpty()) {
|
||||||
|
origin = plot;
|
||||||
|
} else {
|
||||||
|
origin = (Plot) meta.get(0).value();
|
||||||
|
}
|
||||||
|
if (this.lastRadius != 0) {
|
||||||
|
List<Entity> nearby = event.getEntity().getNearbyEntities(this.lastRadius, this.lastRadius, this.lastRadius);
|
||||||
|
for (Entity near : nearby) {
|
||||||
|
if (near instanceof TNTPrimed || near.getType().equals(EntityType.MINECART_TNT)) {
|
||||||
|
if (!near.hasMetadata("plot")) {
|
||||||
|
near.setMetadata("plot", new FixedMetadataValue((Plugin) PlotSquared.platform(), plot));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.lastRadius = 0;
|
||||||
|
}
|
||||||
|
Iterator<Block> iterator = event.blockList().iterator();
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
Block block = iterator.next();
|
||||||
|
location = BukkitUtil.adapt(block.getLocation());
|
||||||
|
if (!area.contains(location.getX(), location.getZ()) || !origin.equals(area.getOwnedPlot(location))) {
|
||||||
|
iterator.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
plot.debug("Explosion was cancelled because explosion = false");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
event.setCancelled(true);
|
||||||
|
//Spawn Explosion Particles when enabled in settings
|
||||||
|
if (Settings.General.ALWAYS_SHOW_EXPLOSIONS) {
|
||||||
|
event.getLocation().getWorld().spawnParticle(Particle.EXPLOSION_HUGE, event.getLocation(), 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
public void onPeskyMobsChangeTheWorldLikeWTFEvent(EntityChangeBlockEvent event) {
|
||||||
|
Entity e = event.getEntity();
|
||||||
|
Material type = event.getBlock().getType();
|
||||||
|
Location location = BukkitUtil.adapt(event.getBlock().getLocation());
|
||||||
|
PlotArea area = location.getPlotArea();
|
||||||
|
if (area == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (e instanceof FallingBlock) {
|
||||||
|
// allow falling blocks converting to blocks and vice versa
|
||||||
|
return;
|
||||||
|
} else if (e instanceof Boat) {
|
||||||
|
// allow boats destroying lily pads
|
||||||
|
if (type == Material.LILY_PAD) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (e instanceof Player player) {
|
||||||
|
BukkitPlayer pp = BukkitUtil.adapt(player);
|
||||||
|
if (type.toString().equals("POWDER_SNOW")) {
|
||||||
|
// Burning player evaporating powder snow. Use same checks as
|
||||||
|
// trampling farmland
|
||||||
|
BlockType blockType = BukkitAdapter.asBlockType(type);
|
||||||
|
if (!this.eventDispatcher.checkPlayerBlockEvent(pp,
|
||||||
|
PlayerBlockEventType.TRIGGER_PHYSICAL, location, blockType, true
|
||||||
|
)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
// already handled by other flags (mainly the 'use' flag):
|
||||||
|
// - player tilting big dripleaf by standing on it
|
||||||
|
// - player picking glow berries from cave vine
|
||||||
|
// - player trampling farmland
|
||||||
|
// - player standing on or clicking redstone ore
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (e instanceof Projectile entity) {
|
||||||
|
// Exact same as the ProjectileHitEvent listener, except that we let
|
||||||
|
// the entity-change-block determine what to do with shooters that
|
||||||
|
// aren't players and aren't blocks
|
||||||
|
Plot plot = area.getPlot(location);
|
||||||
|
ProjectileSource shooter = entity.getShooter();
|
||||||
|
if (shooter instanceof Player) {
|
||||||
|
PlotPlayer<?> pp = BukkitUtil.adapt((Player) shooter);
|
||||||
|
if (plot == null) {
|
||||||
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
|
||||||
|
entity.remove();
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (plot.isAdded(pp.getUUID()) || pp.hasPermission(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
entity.remove();
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!(shooter instanceof Entity) && shooter != null) {
|
||||||
|
if (plot == null) {
|
||||||
|
entity.remove();
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Location sLoc =
|
||||||
|
BukkitUtil.adapt(((BlockProjectileSource) shooter).getBlock().getLocation());
|
||||||
|
if (!area.contains(sLoc.getX(), sLoc.getZ())) {
|
||||||
|
entity.remove();
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Plot sPlot = area.getOwnedPlotAbs(sLoc);
|
||||||
|
if (sPlot == null || !PlotHandler.sameOwners(plot, sPlot)) {
|
||||||
|
entity.remove();
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// fall back to entity-change-block flag
|
||||||
|
}
|
||||||
|
|
||||||
|
Plot plot = area.getOwnedPlot(location);
|
||||||
|
if (plot != null && !plot.getFlag(EntityChangeBlockFlag.class)) {
|
||||||
|
plot.debug(e.getType() + " could not change block because entity-change-block = false");
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPrime(ExplosionPrimeEvent event) {
|
||||||
|
this.lastRadius = event.getRadius() + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
public void onVehicleCreate(VehicleCreateEvent event) {
|
||||||
|
Vehicle entity = event.getVehicle();
|
||||||
|
Location location = BukkitUtil.adapt(entity.getLocation());
|
||||||
|
PlotArea area = location.getPlotArea();
|
||||||
|
if (area == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Plot plot = area.getOwnedPlotAbs(location);
|
||||||
|
if (plot == null || BukkitEntityUtil.checkEntity(entity, plot)) {
|
||||||
|
entity.remove();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) {
|
||||||
|
entity.setMetadata("plot", new FixedMetadataValue((Plugin) PlotSquared.platform(), plot));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,231 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.listener;
|
||||||
|
|
||||||
|
import com.plotsquared.bukkit.util.BukkitEntityUtil;
|
||||||
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
|
import com.plotsquared.core.PlotSquared;
|
||||||
|
import com.plotsquared.core.configuration.Settings;
|
||||||
|
import com.plotsquared.core.location.Location;
|
||||||
|
import com.plotsquared.core.plot.Plot;
|
||||||
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
|
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
||||||
|
import io.papermc.lib.PaperLib;
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.ArmorStand;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.Vehicle;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
|
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||||
|
import org.bukkit.event.entity.EntityTeleportEvent;
|
||||||
|
import org.bukkit.event.vehicle.VehicleBlockCollisionEvent;
|
||||||
|
import org.bukkit.event.vehicle.VehicleCreateEvent;
|
||||||
|
import org.bukkit.event.vehicle.VehicleMoveEvent;
|
||||||
|
import org.bukkit.event.vehicle.VehicleUpdateEvent;
|
||||||
|
import org.bukkit.event.world.ChunkLoadEvent;
|
||||||
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
|
import org.bukkit.metadata.MetadataValue;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class EntitySpawnListener implements Listener {
|
||||||
|
|
||||||
|
private static final String KEY = "P2";
|
||||||
|
private static boolean ignoreTP = false;
|
||||||
|
private static boolean hasPlotArea = false;
|
||||||
|
private static String areaName = null;
|
||||||
|
|
||||||
|
public static void testNether(final Entity entity) {
|
||||||
|
@NonNull World world = entity.getWorld();
|
||||||
|
if (world.getEnvironment() != World.Environment.NETHER && world.getEnvironment() != World.Environment.THE_END) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
test(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void testCreate(final Entity entity) {
|
||||||
|
@NonNull World world = entity.getWorld();
|
||||||
|
if (!world.getName().equals(areaName)) {
|
||||||
|
areaName = world.getName();
|
||||||
|
hasPlotArea = PlotSquared.get().getPlotAreaManager().hasPlotArea(areaName);
|
||||||
|
}
|
||||||
|
if (!hasPlotArea) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
test(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void test(Entity entity) {
|
||||||
|
@NonNull World world = entity.getWorld();
|
||||||
|
List<MetadataValue> meta = entity.getMetadata(KEY);
|
||||||
|
if (meta.isEmpty()) {
|
||||||
|
if (PlotSquared.get().getPlotAreaManager().hasPlotArea(world.getName())) {
|
||||||
|
entity.setMetadata(KEY, new FixedMetadataValue((Plugin) PlotSquared.platform(), entity.getLocation()));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
org.bukkit.Location origin = (org.bukkit.Location) meta.get(0).value();
|
||||||
|
World originWorld = origin.getWorld();
|
||||||
|
if (!originWorld.equals(world)) {
|
||||||
|
if (!ignoreTP) {
|
||||||
|
if (!world.getName().equalsIgnoreCase(originWorld + "_the_end")) {
|
||||||
|
if (entity.getType() == EntityType.PLAYER) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
ignoreTP = true;
|
||||||
|
PaperLib.teleportAsync(entity, origin);
|
||||||
|
} finally {
|
||||||
|
ignoreTP = false;
|
||||||
|
}
|
||||||
|
if (entity.getLocation().getWorld().equals(world)) {
|
||||||
|
entity.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (entity.getType() == EntityType.PLAYER) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
entity.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
public void creatureSpawnEvent(EntitySpawnEvent event) {
|
||||||
|
Entity entity = event.getEntity();
|
||||||
|
Location location = BukkitUtil.adapt(entity.getLocation());
|
||||||
|
PlotArea area = location.getPlotArea();
|
||||||
|
if (!location.isPlotArea()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Plot plot = location.getOwnedPlotAbs();
|
||||||
|
EntityType type = entity.getType();
|
||||||
|
if (plot == null) {
|
||||||
|
if (type == EntityType.DROPPED_ITEM) {
|
||||||
|
if (Settings.Enabled_Components.KILL_ROAD_ITEMS) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!area.isMobSpawning()) {
|
||||||
|
if (type == EntityType.PLAYER) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (type.isAlive()) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!area.isMiscSpawnUnowned() && !type.isAlive()) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
if (type == EntityType.ENDER_CRYSTAL) {
|
||||||
|
if (BukkitEntityUtil.checkEntity(entity, plot)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (type == EntityType.SHULKER) {
|
||||||
|
if (!entity.hasMetadata("shulkerPlot")) {
|
||||||
|
entity.setMetadata("shulkerPlot", new FixedMetadataValue((Plugin) PlotSquared.platform(), plot.getId()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onChunkLoad(ChunkLoadEvent event) {
|
||||||
|
@NonNull Chunk chunk = event.getChunk();
|
||||||
|
for (final Entity entity : chunk.getEntities()) {
|
||||||
|
testCreate(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onVehicle(VehicleUpdateEvent event) {
|
||||||
|
testNether(event.getVehicle());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onVehicle(VehicleCreateEvent event) {
|
||||||
|
testCreate(event.getVehicle());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onVehicle(VehicleBlockCollisionEvent event) {
|
||||||
|
testNether(event.getVehicle());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onTeleport(EntityTeleportEvent event) {
|
||||||
|
Entity entity = event.getEntity();
|
||||||
|
Entity fromLocation = event.getEntity();
|
||||||
|
Block toLocation = event.getTo().getBlock();
|
||||||
|
final Location fromLocLocation = BukkitUtil.adapt(fromLocation.getLocation());
|
||||||
|
final PlotArea fromArea = fromLocLocation.getPlotArea();
|
||||||
|
Location toLocLocation = BukkitUtil.adapt(toLocation.getLocation());
|
||||||
|
PlotArea toArea = toLocLocation.getPlotArea();
|
||||||
|
|
||||||
|
if (toArea == null) {
|
||||||
|
if (fromLocation.getType() == EntityType.SHULKER && fromArea != null) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Plot toPlot = toArea.getOwnedPlot(toLocLocation);
|
||||||
|
if (fromLocation.getType() == EntityType.SHULKER && fromArea != null) {
|
||||||
|
final Plot fromPlot = fromArea.getOwnedPlot(fromLocLocation);
|
||||||
|
|
||||||
|
if (fromPlot != null || toPlot != null) {
|
||||||
|
if ((fromPlot == null || !fromPlot.equals(toPlot)) && (toPlot == null || !toPlot.equals(fromPlot))) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (entity instanceof Vehicle || entity instanceof ArmorStand) {
|
||||||
|
testNether(event.getEntity());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
public void vehicleMove(VehicleMoveEvent event) {
|
||||||
|
testNether(event.getVehicle());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void spawn(CreatureSpawnEvent event) {
|
||||||
|
if (event.getEntityType() == EntityType.ARMOR_STAND) {
|
||||||
|
testCreate(event.getEntity());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,128 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.listener;
|
||||||
|
|
||||||
|
import com.plotsquared.bukkit.player.BukkitPlayer;
|
||||||
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
|
import com.plotsquared.core.location.Location;
|
||||||
|
import com.plotsquared.core.permissions.Permission;
|
||||||
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
|
import com.plotsquared.core.plot.Plot;
|
||||||
|
import com.plotsquared.core.plot.flag.implementations.ForcefieldFlag;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public class ForceFieldListener {
|
||||||
|
|
||||||
|
private static Set<PlotPlayer<?>> getNearbyPlayers(Player player, Plot plot) {
|
||||||
|
Set<PlotPlayer<?>> players = new HashSet<>();
|
||||||
|
for (Player nearPlayer : player.getNearbyEntities(5d, 5d, 5d).stream()
|
||||||
|
.filter(entity -> entity instanceof Player)
|
||||||
|
.map(entity -> (Player) entity)
|
||||||
|
.toList()
|
||||||
|
) {
|
||||||
|
PlotPlayer<?> plotPlayer;
|
||||||
|
if ((plotPlayer = BukkitUtil.adapt(nearPlayer)) == null || !plot
|
||||||
|
.equals(plotPlayer.getCurrentPlot())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!plot.isAdded(plotPlayer.getUUID())) {
|
||||||
|
players.add(plotPlayer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return players;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static PlotPlayer<?> hasNearbyPermitted(Player player, Plot plot) {
|
||||||
|
for (Player nearPlayer : player.getNearbyEntities(5d, 5d, 5d).stream()
|
||||||
|
.filter(entity -> entity instanceof Player)
|
||||||
|
.map(entity -> (Player) entity)
|
||||||
|
.toList()
|
||||||
|
) {
|
||||||
|
PlotPlayer<?> plotPlayer;
|
||||||
|
if ((plotPlayer = BukkitUtil.adapt(nearPlayer)) == null || !plot
|
||||||
|
.equals(plotPlayer.getCurrentPlot())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (plot.isAdded(plotPlayer.getUUID())) {
|
||||||
|
return plotPlayer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Vector calculateVelocity(PlotPlayer<?> player, PlotPlayer<?> e) {
|
||||||
|
Location playerLocation = player.getLocationFull();
|
||||||
|
Location oPlayerLocation = e.getLocation();
|
||||||
|
double playerX = playerLocation.getX();
|
||||||
|
double playerY = playerLocation.getY();
|
||||||
|
double playerZ = playerLocation.getZ();
|
||||||
|
double oPlayerX = oPlayerLocation.getX();
|
||||||
|
double oPlayerY = oPlayerLocation.getY();
|
||||||
|
double oPlayerZ = oPlayerLocation.getZ();
|
||||||
|
double x = 0d;
|
||||||
|
if (playerX < oPlayerX) {
|
||||||
|
x = 1.0d;
|
||||||
|
} else if (playerX > oPlayerX) {
|
||||||
|
x = -1.0d;
|
||||||
|
}
|
||||||
|
double y = 0d;
|
||||||
|
if (playerY < oPlayerY) {
|
||||||
|
y = 0.5d;
|
||||||
|
} else if (playerY > oPlayerY) {
|
||||||
|
y = -0.5d;
|
||||||
|
}
|
||||||
|
double z = 0d;
|
||||||
|
if (playerZ < oPlayerZ) {
|
||||||
|
z = 1.0d;
|
||||||
|
} else if (playerZ > oPlayerZ) {
|
||||||
|
z = -1.0d;
|
||||||
|
}
|
||||||
|
return new Vector(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleForcefield(Player player, PlotPlayer<?> plotPlayer, Plot plot) {
|
||||||
|
if (plot.getFlag(ForcefieldFlag.class)) {
|
||||||
|
UUID uuid = plotPlayer.getUUID();
|
||||||
|
if (plot.isAdded(uuid)) {
|
||||||
|
Set<PlotPlayer<?>> players = getNearbyPlayers(player, plot);
|
||||||
|
for (PlotPlayer<?> oPlayer : players) {
|
||||||
|
if (!oPlayer.hasPermission(Permission.PERMISSION_ADMIN_ENTRY_FORCEFIELD)) {
|
||||||
|
((BukkitPlayer) oPlayer).player
|
||||||
|
.setVelocity(calculateVelocity(plotPlayer, oPlayer));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
PlotPlayer<?> oPlayer = hasNearbyPermitted(player, plot);
|
||||||
|
if (oPlayer == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!plotPlayer.hasPermission(Permission.PERMISSION_ADMIN_ENTRY_FORCEFIELD)) {
|
||||||
|
player.setVelocity(calculateVelocity(oPlayer, plotPlayer));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,456 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.listener;
|
||||||
|
|
||||||
|
import com.destroystokyo.paper.event.block.BeaconEffectEvent;
|
||||||
|
import com.destroystokyo.paper.event.entity.EntityPathfindEvent;
|
||||||
|
import com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent;
|
||||||
|
import com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent;
|
||||||
|
import com.destroystokyo.paper.event.entity.PreSpawnerSpawnEvent;
|
||||||
|
import com.destroystokyo.paper.event.entity.SlimePathfindEvent;
|
||||||
|
import com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent;
|
||||||
|
import com.destroystokyo.paper.event.server.AsyncTabCompleteEvent;
|
||||||
|
import com.google.inject.Inject;
|
||||||
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
|
import com.plotsquared.core.command.Command;
|
||||||
|
import com.plotsquared.core.command.MainCommand;
|
||||||
|
import com.plotsquared.core.configuration.Settings;
|
||||||
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
|
import com.plotsquared.core.location.Location;
|
||||||
|
import com.plotsquared.core.permissions.Permission;
|
||||||
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
|
import com.plotsquared.core.plot.Plot;
|
||||||
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
|
import com.plotsquared.core.plot.flag.FlagContainer;
|
||||||
|
import com.plotsquared.core.plot.flag.implementations.BeaconEffectsFlag;
|
||||||
|
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
||||||
|
import com.plotsquared.core.plot.flag.implementations.ProjectilesFlag;
|
||||||
|
import com.plotsquared.core.plot.flag.types.BooleanFlag;
|
||||||
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
|
import com.plotsquared.core.util.PlotFlagUtil;
|
||||||
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.TileState;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Projectile;
|
||||||
|
import org.bukkit.entity.Slime;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
|
import org.bukkit.projectiles.ProjectileSource;
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Events specific to Paper. Some toit nups here
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public class PaperListener implements Listener {
|
||||||
|
|
||||||
|
private final PlotAreaManager plotAreaManager;
|
||||||
|
private Chunk lastChunk;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public PaperListener(final @NonNull PlotAreaManager plotAreaManager) {
|
||||||
|
this.plotAreaManager = plotAreaManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onEntityPathfind(EntityPathfindEvent event) {
|
||||||
|
if (!Settings.Paper_Components.ENTITY_PATHING) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Location toLoc = BukkitUtil.adapt(event.getLoc());
|
||||||
|
Location fromLoc = BukkitUtil.adapt(event.getEntity().getLocation());
|
||||||
|
PlotArea tarea = toLoc.getPlotArea();
|
||||||
|
if (tarea == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PlotArea farea = fromLoc.getPlotArea();
|
||||||
|
if (farea == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (tarea != farea) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Plot tplot = toLoc.getPlot();
|
||||||
|
Plot fplot = fromLoc.getPlot();
|
||||||
|
if (tplot == null ^ fplot == null) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (tplot == null || tplot.getId().hashCode() == fplot.getId().hashCode()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (fplot.isMerged() && fplot.getConnectedPlots().contains(fplot)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onEntityPathfind(SlimePathfindEvent event) {
|
||||||
|
if (!Settings.Paper_Components.ENTITY_PATHING) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Slime slime = event.getEntity();
|
||||||
|
|
||||||
|
Block b = slime.getTargetBlock(4);
|
||||||
|
if (b == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Location toLoc = BukkitUtil.adapt(b.getLocation());
|
||||||
|
Location fromLoc = BukkitUtil.adapt(event.getEntity().getLocation());
|
||||||
|
PlotArea tarea = toLoc.getPlotArea();
|
||||||
|
if (tarea == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PlotArea farea = fromLoc.getPlotArea();
|
||||||
|
if (farea == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tarea != farea) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Plot tplot = toLoc.getPlot();
|
||||||
|
Plot fplot = fromLoc.getPlot();
|
||||||
|
if (tplot == null ^ fplot == null) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (tplot == null || tplot.getId().hashCode() == fplot.getId().hashCode()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (fplot.isMerged() && fplot.getConnectedPlots().contains(fplot)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPreCreatureSpawnEvent(PreCreatureSpawnEvent event) {
|
||||||
|
if (!Settings.Paper_Components.CREATURE_SPAWN) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Location location = BukkitUtil.adapt(event.getSpawnLocation());
|
||||||
|
PlotArea area = location.getPlotArea();
|
||||||
|
if (!location.isPlotArea()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//If entities are spawning... the chunk should be loaded?
|
||||||
|
Entity[] entities = event.getSpawnLocation().getChunk().getEntities();
|
||||||
|
if (entities.length > Settings.Chunk_Processor.MAX_ENTITIES) {
|
||||||
|
event.setShouldAbortSpawn(true);
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CreatureSpawnEvent.SpawnReason reason = event.getReason();
|
||||||
|
switch (reason.toString()) {
|
||||||
|
case "DISPENSE_EGG":
|
||||||
|
case "EGG":
|
||||||
|
case "OCELOT_BABY":
|
||||||
|
case "SPAWNER_EGG":
|
||||||
|
if (!area.isSpawnEggs()) {
|
||||||
|
event.setShouldAbortSpawn(true);
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "REINFORCEMENTS":
|
||||||
|
case "NATURAL":
|
||||||
|
case "MOUNT":
|
||||||
|
case "PATROL":
|
||||||
|
case "RAID":
|
||||||
|
case "SHEARED":
|
||||||
|
case "SILVERFISH_BLOCK":
|
||||||
|
case "ENDER_PEARL":
|
||||||
|
case "TRAP":
|
||||||
|
case "VILLAGE_DEFENSE":
|
||||||
|
case "VILLAGE_INVASION":
|
||||||
|
case "BEEHIVE":
|
||||||
|
case "CHUNK_GEN":
|
||||||
|
if (!area.isMobSpawning()) {
|
||||||
|
event.setShouldAbortSpawn(true);
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "BREEDING":
|
||||||
|
if (!area.isSpawnBreeding()) {
|
||||||
|
event.setShouldAbortSpawn(true);
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "BUILD_IRONGOLEM":
|
||||||
|
case "BUILD_SNOWMAN":
|
||||||
|
case "BUILD_WITHER":
|
||||||
|
case "CUSTOM":
|
||||||
|
if (!area.isSpawnCustom() && event.getType() != EntityType.ARMOR_STAND) {
|
||||||
|
event.setShouldAbortSpawn(true);
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "SPAWNER":
|
||||||
|
if (!area.isMobSpawnerSpawning()) {
|
||||||
|
event.setShouldAbortSpawn(true);
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Plot plot = location.getOwnedPlotAbs();
|
||||||
|
if (plot == null) {
|
||||||
|
EntityType type = event.getType();
|
||||||
|
// PreCreatureSpawnEvent **should** not be called for DROPPED_ITEM, just for the sake of consistency
|
||||||
|
if (type == EntityType.DROPPED_ITEM) {
|
||||||
|
if (Settings.Enabled_Components.KILL_ROAD_ITEMS) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!area.isMobSpawning()) {
|
||||||
|
if (type == EntityType.PLAYER) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (type.isAlive()) {
|
||||||
|
event.setShouldAbortSpawn(true);
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!area.isMiscSpawnUnowned() && !type.isAlive()) {
|
||||||
|
event.setShouldAbortSpawn(true);
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) {
|
||||||
|
event.setShouldAbortSpawn(true);
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPlayerNaturallySpawnCreaturesEvent(PlayerNaturallySpawnCreaturesEvent event) {
|
||||||
|
if (Settings.Paper_Components.CANCEL_CHUNK_SPAWN) {
|
||||||
|
Location location = BukkitUtil.adapt(event.getPlayer().getLocation());
|
||||||
|
PlotArea area = location.getPlotArea();
|
||||||
|
if (area != null && !area.isMobSpawning()) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onPreSpawnerSpawnEvent(PreSpawnerSpawnEvent event) {
|
||||||
|
if (Settings.Paper_Components.SPAWNER_SPAWN) {
|
||||||
|
Location location = BukkitUtil.adapt(event.getSpawnerLocation());
|
||||||
|
PlotArea area = location.getPlotArea();
|
||||||
|
if (area != null && !area.isMobSpawnerSpawning()) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
event.setShouldAbortSpawn(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
|
public void onBlockPlace(BlockPlaceEvent event) {
|
||||||
|
if (!Settings.Paper_Components.TILE_ENTITY_CHECK || !Settings.Enabled_Components.CHUNK_PROCESSOR) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!(event.getBlock().getState(false) instanceof TileState)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final Location location = BukkitUtil.adapt(event.getBlock().getLocation());
|
||||||
|
final PlotArea plotArea = location.getPlotArea();
|
||||||
|
if (plotArea == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final int tileEntityCount = event.getBlock().getChunk().getTileEntities(false).length;
|
||||||
|
if (tileEntityCount >= Settings.Chunk_Processor.MAX_TILES) {
|
||||||
|
final PlotPlayer<?> plotPlayer = BukkitUtil.adapt(event.getPlayer());
|
||||||
|
plotPlayer.sendMessage(
|
||||||
|
TranslatableCaption.of("errors.tile_entity_cap_reached"),
|
||||||
|
Template.of("amount", String.valueOf(Settings.Chunk_Processor.MAX_TILES))
|
||||||
|
);
|
||||||
|
event.setCancelled(true);
|
||||||
|
event.setBuild(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unsure if this will be any performance improvement over the spigot version,
|
||||||
|
* but here it is anyway :)
|
||||||
|
*
|
||||||
|
* @param event Paper's PlayerLaunchProjectileEvent
|
||||||
|
*/
|
||||||
|
@EventHandler
|
||||||
|
public void onProjectileLaunch(PlayerLaunchProjectileEvent event) {
|
||||||
|
if (!Settings.Paper_Components.PLAYER_PROJECTILE) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Projectile entity = event.getProjectile();
|
||||||
|
ProjectileSource shooter = entity.getShooter();
|
||||||
|
if (!(shooter instanceof Player)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Location location = BukkitUtil.adapt(entity.getLocation());
|
||||||
|
PlotArea area = location.getPlotArea();
|
||||||
|
if (area == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PlotPlayer<Player> pp = BukkitUtil.adapt((Player) shooter);
|
||||||
|
Plot plot = location.getOwnedPlot();
|
||||||
|
|
||||||
|
if (plot == null) {
|
||||||
|
if (!PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, ProjectilesFlag.class, true) && !pp.hasPermission(
|
||||||
|
Permission.PERMISSION_ADMIN_PROJECTILE_ROAD
|
||||||
|
)) {
|
||||||
|
pp.sendMessage(
|
||||||
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
|
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD))
|
||||||
|
);
|
||||||
|
entity.remove();
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
} else if (!plot.hasOwner()) {
|
||||||
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
|
||||||
|
pp.sendMessage(
|
||||||
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
|
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED))
|
||||||
|
);
|
||||||
|
entity.remove();
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
} else if (!plot.isAdded(pp.getUUID())) {
|
||||||
|
if (!plot.getFlag(ProjectilesFlag.class)) {
|
||||||
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
|
||||||
|
pp.sendMessage(
|
||||||
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
|
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER))
|
||||||
|
);
|
||||||
|
entity.remove();
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onAsyncTabCompletion(final AsyncTabCompleteEvent event) {
|
||||||
|
if (!Settings.Paper_Components.ASYNC_TAB_COMPLETION) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String buffer = event.getBuffer();
|
||||||
|
if (!(event.getSender() instanceof Player)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ((!event.isCommand() && !buffer.startsWith("/")) || buffer.indexOf(' ') == -1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (buffer.startsWith("/")) {
|
||||||
|
buffer = buffer.substring(1);
|
||||||
|
}
|
||||||
|
final String[] unprocessedArgs = buffer.split(Pattern.quote(" "));
|
||||||
|
if (unprocessedArgs.length == 1) {
|
||||||
|
return; // We don't do anything in this case
|
||||||
|
} else if (!Settings.Enabled_Components.TAB_COMPLETED_ALIASES
|
||||||
|
.contains(unprocessedArgs[0].toLowerCase(Locale.ENGLISH))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final String[] args = new String[unprocessedArgs.length - 1];
|
||||||
|
System.arraycopy(unprocessedArgs, 1, args, 0, args.length);
|
||||||
|
try {
|
||||||
|
final PlotPlayer<?> player = BukkitUtil.adapt((Player) event.getSender());
|
||||||
|
final Collection<Command> objects = MainCommand.getInstance().tab(player, args, buffer.endsWith(" "));
|
||||||
|
if (objects == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final List<String> result = new ArrayList<>();
|
||||||
|
for (final com.plotsquared.core.command.Command o : objects) {
|
||||||
|
result.add(o.toString());
|
||||||
|
}
|
||||||
|
event.setCompletions(result);
|
||||||
|
event.setHandled(true);
|
||||||
|
} catch (final Exception ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true)
|
||||||
|
public void onBeaconEffect(final BeaconEffectEvent event) {
|
||||||
|
Block block = event.getBlock();
|
||||||
|
Location beaconLocation = BukkitUtil.adapt(block.getLocation());
|
||||||
|
Plot beaconPlot = beaconLocation.getPlot();
|
||||||
|
|
||||||
|
PlotArea area = beaconLocation.getPlotArea();
|
||||||
|
if (area == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
Location playerLocation = BukkitUtil.adapt(player.getLocation());
|
||||||
|
|
||||||
|
PlotPlayer<Player> plotPlayer = BukkitUtil.adapt(player);
|
||||||
|
Plot playerStandingPlot = playerLocation.getPlot();
|
||||||
|
if (playerStandingPlot == null) {
|
||||||
|
FlagContainer container = area.getRoadFlagContainer();
|
||||||
|
if (!getBooleanFlagValue(container, BeaconEffectsFlag.class, true) ||
|
||||||
|
(beaconPlot != null && Settings.Enabled_Components.DISABLE_BEACON_EFFECT_OVERFLOW)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
FlagContainer container = playerStandingPlot.getFlagContainer();
|
||||||
|
boolean plotBeaconEffects = getBooleanFlagValue(container, BeaconEffectsFlag.class, true);
|
||||||
|
if (playerStandingPlot.equals(beaconPlot)) {
|
||||||
|
if (!plotBeaconEffects) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!plotBeaconEffects || Settings.Enabled_Components.DISABLE_BEACON_EFFECT_OVERFLOW) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean getBooleanFlagValue(@NonNull FlagContainer container,
|
||||||
|
@NonNull Class<? extends BooleanFlag<?>> flagClass,
|
||||||
|
boolean defaultValue) {
|
||||||
|
BooleanFlag<?> flag = container.getFlag(flagClass);
|
||||||
|
return flag == null ? defaultValue : flag.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,91 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.listener;
|
||||||
|
|
||||||
|
import com.google.inject.Inject;
|
||||||
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
|
import com.plotsquared.core.configuration.Settings;
|
||||||
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
|
import com.plotsquared.core.location.Location;
|
||||||
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
|
import org.bukkit.block.Banner;
|
||||||
|
import org.bukkit.block.Beacon;
|
||||||
|
import org.bukkit.block.BlockState;
|
||||||
|
import org.bukkit.block.CommandBlock;
|
||||||
|
import org.bukkit.block.Comparator;
|
||||||
|
import org.bukkit.block.Conduit;
|
||||||
|
import org.bukkit.block.Container;
|
||||||
|
import org.bukkit.block.CreatureSpawner;
|
||||||
|
import org.bukkit.block.DaylightDetector;
|
||||||
|
import org.bukkit.block.EnchantingTable;
|
||||||
|
import org.bukkit.block.EndGateway;
|
||||||
|
import org.bukkit.block.EnderChest;
|
||||||
|
import org.bukkit.block.Jukebox;
|
||||||
|
import org.bukkit.block.Sign;
|
||||||
|
import org.bukkit.block.Skull;
|
||||||
|
import org.bukkit.block.Structure;
|
||||||
|
import org.bukkit.block.data.type.Bed;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated P2 effectively no longer supports 1.13
|
||||||
|
*/
|
||||||
|
@Deprecated(forRemoval = true, since = "6.10.4")
|
||||||
|
public class PaperListener113 extends PaperListener {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public PaperListener113(@NonNull PlotAreaManager plotAreaManager) {
|
||||||
|
super(plotAreaManager);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onBlockPlace(BlockPlaceEvent event) {
|
||||||
|
if (!Settings.Paper_Components.TILE_ENTITY_CHECK || !Settings.Enabled_Components.CHUNK_PROCESSOR) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
BlockState state = event.getBlock().getState(false);
|
||||||
|
if (!(state instanceof Banner || state instanceof Beacon || state instanceof Bed || state instanceof CommandBlock
|
||||||
|
|| state instanceof Comparator || state instanceof Conduit || state instanceof Container || state instanceof CreatureSpawner
|
||||||
|
|| state instanceof DaylightDetector || state instanceof EnchantingTable || state instanceof EnderChest || state instanceof EndGateway
|
||||||
|
|| state instanceof Jukebox || state instanceof Sign || state instanceof Skull || state instanceof Structure)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final Location location = BukkitUtil.adapt(event.getBlock().getLocation());
|
||||||
|
final PlotArea plotArea = location.getPlotArea();
|
||||||
|
if (plotArea == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final int tileEntityCount = event.getBlock().getChunk().getTileEntities(false).length;
|
||||||
|
if (tileEntityCount >= Settings.Chunk_Processor.MAX_TILES) {
|
||||||
|
final PlotPlayer<?> plotPlayer = BukkitUtil.adapt(event.getPlayer());
|
||||||
|
plotPlayer.sendMessage(
|
||||||
|
TranslatableCaption.of("errors.tile_entity_cap_reached"),
|
||||||
|
Template.of("amount", String.valueOf(Settings.Chunk_Processor.MAX_TILES))
|
||||||
|
);
|
||||||
|
event.setCancelled(true);
|
||||||
|
event.setBuild(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,208 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.listener;
|
||||||
|
|
||||||
|
import com.google.inject.Inject;
|
||||||
|
import com.plotsquared.bukkit.util.BukkitEntityUtil;
|
||||||
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
|
import com.plotsquared.core.location.Location;
|
||||||
|
import com.plotsquared.core.permissions.Permission;
|
||||||
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
|
import com.plotsquared.core.plot.Plot;
|
||||||
|
import com.plotsquared.core.plot.PlotArea;
|
||||||
|
import com.plotsquared.core.plot.PlotHandler;
|
||||||
|
import com.plotsquared.core.plot.flag.implementations.ProjectilesFlag;
|
||||||
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
|
import com.plotsquared.core.util.PlotFlagUtil;
|
||||||
|
import net.kyori.adventure.text.minimessage.Template;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Projectile;
|
||||||
|
import org.bukkit.entity.ThrownPotion;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.entity.LingeringPotionSplashEvent;
|
||||||
|
import org.bukkit.event.entity.PotionSplashEvent;
|
||||||
|
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||||
|
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||||
|
import org.bukkit.projectiles.BlockProjectileSource;
|
||||||
|
import org.bukkit.projectiles.ProjectileSource;
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public class ProjectileEventListener implements Listener {
|
||||||
|
|
||||||
|
private final PlotAreaManager plotAreaManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public ProjectileEventListener(final @NonNull PlotAreaManager plotAreaManager) {
|
||||||
|
this.plotAreaManager = plotAreaManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
public void onLingeringPotionSplash(LingeringPotionSplashEvent event) {
|
||||||
|
// Cancelling projectile hit events still results in area effect clouds.
|
||||||
|
// We need to cancel the splash events to get rid of those.
|
||||||
|
onProjectileHit(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
public void onPotionSplash(PotionSplashEvent event) {
|
||||||
|
ThrownPotion damager = event.getPotion();
|
||||||
|
Location location = BukkitUtil.adapt(damager.getLocation());
|
||||||
|
if (!this.plotAreaManager.hasPlotArea(location.getWorldName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int count = 0;
|
||||||
|
for (LivingEntity victim : event.getAffectedEntities()) {
|
||||||
|
if (!BukkitEntityUtil.entityDamage(damager, victim)) {
|
||||||
|
event.setIntensity(victim, 0);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (count > 0 && count == event.getAffectedEntities().size()) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
} else {
|
||||||
|
// Cancelling projectile hit events still results in potions
|
||||||
|
// splashing in the world. We need to cancel the splash events to
|
||||||
|
// avoid that.
|
||||||
|
onProjectileHit(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true)
|
||||||
|
public void onProjectileLaunch(ProjectileLaunchEvent event) {
|
||||||
|
Projectile entity = event.getEntity();
|
||||||
|
ProjectileSource shooter = entity.getShooter();
|
||||||
|
if (!(shooter instanceof Player)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Location location = BukkitUtil.adapt(entity.getLocation());
|
||||||
|
PlotArea area = location.getPlotArea();
|
||||||
|
if (area == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PlotPlayer<Player> pp = BukkitUtil.adapt((Player) shooter);
|
||||||
|
Plot plot = location.getOwnedPlot();
|
||||||
|
|
||||||
|
if (plot == null) {
|
||||||
|
if (!PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, ProjectilesFlag.class, true) && !pp.hasPermission(
|
||||||
|
Permission.PERMISSION_ADMIN_PROJECTILE_ROAD
|
||||||
|
)) {
|
||||||
|
pp.sendMessage(
|
||||||
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
|
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_ROAD))
|
||||||
|
);
|
||||||
|
entity.remove();
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
} else if (!plot.hasOwner()) {
|
||||||
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED)) {
|
||||||
|
pp.sendMessage(
|
||||||
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
|
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED))
|
||||||
|
);
|
||||||
|
entity.remove();
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
} else if (!plot.isAdded(pp.getUUID())) {
|
||||||
|
if (!plot.getFlag(ProjectilesFlag.class)) {
|
||||||
|
if (!pp.hasPermission(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER)) {
|
||||||
|
pp.sendMessage(
|
||||||
|
TranslatableCaption.of("permission.no_permission_event"),
|
||||||
|
Template.of("node", String.valueOf(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER))
|
||||||
|
);
|
||||||
|
entity.remove();
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onProjectileHit(ProjectileHitEvent event) {
|
||||||
|
Projectile entity = event.getEntity();
|
||||||
|
Location location = BukkitUtil.adapt(entity.getLocation());
|
||||||
|
if (!this.plotAreaManager.hasPlotArea(location.getWorldName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PlotArea area = location.getPlotArea();
|
||||||
|
if (area == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Plot plot = area.getPlot(location);
|
||||||
|
ProjectileSource shooter = entity.getShooter();
|
||||||
|
if (shooter instanceof Player) {
|
||||||
|
if (!((Player) shooter).isOnline()) {
|
||||||
|
if (plot != null) {
|
||||||
|
if (plot.isAdded(((Player) shooter).getUniqueId()) || plot.getFlag(ProjectilesFlag.class)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, ProjectilesFlag.class, true)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
entity.remove();
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PlotPlayer<?> pp = BukkitUtil.adapt((Player) shooter);
|
||||||
|
if (plot == null) {
|
||||||
|
if (!PlotFlagUtil.isAreaRoadFlagsAndFlagEquals(area, ProjectilesFlag.class, true) && !pp.hasPermission(
|
||||||
|
Permission.PERMISSION_ADMIN_PROJECTILE_UNOWNED
|
||||||
|
)) {
|
||||||
|
entity.remove();
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (plot.isAdded(pp.getUUID()) || pp.hasPermission(Permission.PERMISSION_ADMIN_PROJECTILE_OTHER) || plot.getFlag(
|
||||||
|
ProjectilesFlag.class)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
entity.remove();
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!(shooter instanceof Entity) && shooter != null) {
|
||||||
|
if (plot == null) {
|
||||||
|
entity.remove();
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Location sLoc =
|
||||||
|
BukkitUtil.adapt(((BlockProjectileSource) shooter).getBlock().getLocation());
|
||||||
|
if (!area.contains(sLoc.getX(), sLoc.getZ())) {
|
||||||
|
entity.remove();
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Plot sPlot = area.getOwnedPlotAbs(sLoc);
|
||||||
|
if (sPlot == null || !PlotHandler.sameOwners(plot, sPlot)) {
|
||||||
|
entity.remove();
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.listener;
|
||||||
|
|
||||||
|
import com.google.inject.Inject;
|
||||||
|
import com.plotsquared.bukkit.BukkitPlatform;
|
||||||
|
import com.plotsquared.bukkit.placeholder.MVdWPlaceholders;
|
||||||
|
import com.plotsquared.core.configuration.Settings;
|
||||||
|
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||||
|
import com.plotsquared.core.player.ConsolePlayer;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.server.ServerLoadEvent;
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
|
public class ServerListener implements Listener {
|
||||||
|
|
||||||
|
private final BukkitPlatform plugin;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public ServerListener(final @NonNull BukkitPlatform plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onServerLoad(ServerLoadEvent event) {
|
||||||
|
if (Bukkit.getPluginManager().getPlugin("MVdWPlaceholderAPI") != null && Settings.Enabled_Components.USE_MVDWAPI) {
|
||||||
|
new MVdWPlaceholders(this.plugin, this.plugin.placeholderRegistry());
|
||||||
|
ConsolePlayer.getConsole().sendMessage(TranslatableCaption.of("placeholder.hooked"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,102 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.listener;
|
||||||
|
|
||||||
|
import com.plotsquared.core.PlotSquared;
|
||||||
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
|
import com.plotsquared.core.plot.world.SinglePlotArea;
|
||||||
|
import com.plotsquared.core.plot.world.SinglePlotAreaManager;
|
||||||
|
import com.plotsquared.core.util.ReflectionUtils;
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.world.ChunkEvent;
|
||||||
|
import org.bukkit.event.world.ChunkLoadEvent;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
||||||
|
|
||||||
|
public class SingleWorldListener implements Listener {
|
||||||
|
|
||||||
|
private final Method methodGetHandleChunk;
|
||||||
|
private Field shouldSave = null;
|
||||||
|
|
||||||
|
public SingleWorldListener() throws Exception {
|
||||||
|
ReflectionUtils.RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
||||||
|
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle").getRealMethod();
|
||||||
|
try {
|
||||||
|
if (PlotSquared.platform().serverVersion()[1] < 17) {
|
||||||
|
ReflectionUtils.RefClass classChunk = getRefClass("{nms}.Chunk");
|
||||||
|
if (PlotSquared.platform().serverVersion()[1] == 13) {
|
||||||
|
this.shouldSave = classChunk.getField("mustSave").getRealField();
|
||||||
|
} else {
|
||||||
|
this.shouldSave = classChunk.getField("s").getRealField();
|
||||||
|
}
|
||||||
|
} else if (PlotSquared.platform().serverVersion()[1] == 17) {
|
||||||
|
ReflectionUtils.RefClass classChunk = getRefClass("net.minecraft.world.level.chunk.Chunk");
|
||||||
|
this.shouldSave = classChunk.getField("r").getRealField();
|
||||||
|
} else if (PlotSquared.platform().serverVersion()[1] == 18) {
|
||||||
|
ReflectionUtils.RefClass classChunk = getRefClass("net.minecraft.world.level.chunk.IChunkAccess");
|
||||||
|
this.shouldSave = classChunk.getField("b").getRealField();
|
||||||
|
}
|
||||||
|
} catch (NoSuchFieldException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void markChunkAsClean(Chunk chunk) {
|
||||||
|
try {
|
||||||
|
Object nmsChunk = methodGetHandleChunk.invoke(chunk);
|
||||||
|
if (shouldSave != null) {
|
||||||
|
this.shouldSave.set(nmsChunk, false);
|
||||||
|
}
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handle(ChunkEvent event) {
|
||||||
|
World world = event.getWorld();
|
||||||
|
String name = world.getName();
|
||||||
|
PlotAreaManager man = PlotSquared.get().getPlotAreaManager();
|
||||||
|
if (!(man instanceof SinglePlotAreaManager)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!SinglePlotArea.isSinglePlotWorld(name)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
markChunkAsClean(event.getChunk());
|
||||||
|
}
|
||||||
|
|
||||||
|
// @EventHandler
|
||||||
|
// public void onPopulate(ChunkPopulateEvent event) {
|
||||||
|
// handle(event);
|
||||||
|
// }
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
|
public void onChunkLoad(ChunkLoadEvent event) {
|
||||||
|
handle(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.listener;
|
||||||
|
|
||||||
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
|
import com.plotsquared.core.location.Location;
|
||||||
|
import com.plotsquared.core.plot.Plot;
|
||||||
|
import com.plotsquared.core.plot.flag.FlagContainer;
|
||||||
|
import com.plotsquared.core.plot.flag.implementations.BeaconEffectsFlag;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.entity.EntityPotionEffectEvent;
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fallback listener for paper events on spigot
|
||||||
|
*/
|
||||||
|
public class SpigotListener implements Listener {
|
||||||
|
|
||||||
|
@EventHandler(ignoreCancelled = true)
|
||||||
|
public void onEffect(@NonNull EntityPotionEffectEvent event) {
|
||||||
|
if (event.getCause() != EntityPotionEffectEvent.Cause.BEACON) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Entity entity = event.getEntity();
|
||||||
|
Location location = BukkitUtil.adapt(entity.getLocation());
|
||||||
|
Plot plot = location.getPlot();
|
||||||
|
if (plot == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
FlagContainer container = plot.getFlagContainer();
|
||||||
|
BeaconEffectsFlag effectsEnabled = container.getFlag(BeaconEffectsFlag.class);
|
||||||
|
if (effectsEnabled != null && !effectsEnabled.getValue()) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.listener;
|
||||||
|
|
||||||
|
import com.google.inject.Inject;
|
||||||
|
import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
|
||||||
|
import com.plotsquared.core.PlotSquared;
|
||||||
|
import com.plotsquared.core.generator.GeneratorWrapper;
|
||||||
|
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||||
|
import com.plotsquared.core.plot.world.SinglePlotAreaManager;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.world.WorldInitEvent;
|
||||||
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public class WorldEvents implements Listener {
|
||||||
|
|
||||||
|
private final PlotAreaManager plotAreaManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public WorldEvents(final @NonNull PlotAreaManager plotAreaManager) {
|
||||||
|
this.plotAreaManager = plotAreaManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
|
public void onWorldInit(WorldInitEvent event) {
|
||||||
|
World world = event.getWorld();
|
||||||
|
String name = world.getName();
|
||||||
|
if (this.plotAreaManager instanceof final SinglePlotAreaManager single) {
|
||||||
|
if (single.isWorld(name)) {
|
||||||
|
world.setKeepSpawnInMemory(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ChunkGenerator gen = world.getGenerator();
|
||||||
|
if (gen instanceof GeneratorWrapper) {
|
||||||
|
PlotSquared.get().loadWorld(name, (GeneratorWrapper<?>) gen);
|
||||||
|
} else {
|
||||||
|
PlotSquared.get().loadWorld(name, new BukkitPlotGenerator(name, gen, this.plotAreaManager));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,288 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.listeners;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import com.intellectualcrafters.plot.util.ReflectionUtils.RefClass;
|
|
||||||
import com.intellectualcrafters.plot.util.ReflectionUtils.RefField;
|
|
||||||
import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod;
|
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Chunk;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.entity.Item;
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
|
||||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
|
||||||
import org.bukkit.event.world.ChunkLoadEvent;
|
|
||||||
import org.bukkit.event.world.ChunkUnloadEvent;
|
|
||||||
|
|
||||||
|
|
||||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
|
||||||
|
|
||||||
public class ChunkListener implements Listener {
|
|
||||||
|
|
||||||
private RefMethod methodGetHandleChunk;
|
|
||||||
private RefField mustSave;
|
|
||||||
private Chunk lastChunk;
|
|
||||||
|
|
||||||
|
|
||||||
public ChunkListener() {
|
|
||||||
if (Settings.Chunk_Processor.AUTO_TRIM) {
|
|
||||||
try {
|
|
||||||
RefClass classChunk = getRefClass("{nms}.Chunk");
|
|
||||||
RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
|
||||||
this.mustSave = classChunk.getField("mustSave");
|
|
||||||
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle");
|
|
||||||
} catch (Throwable ignored) {
|
|
||||||
PS.debug(PS.imp().getPluginName() + "/Server not compatible for chunk processor trim/gc");
|
|
||||||
Settings.Chunk_Processor.AUTO_TRIM = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!Settings.Chunk_Processor.AUTO_TRIM) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (World world : Bukkit.getWorlds()) {
|
|
||||||
world.setAutoSave(false);
|
|
||||||
}
|
|
||||||
TaskManager.runTaskRepeat(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
HashSet<Chunk> toUnload = new HashSet<>();
|
|
||||||
for (World world : Bukkit.getWorlds()) {
|
|
||||||
String worldName = world.getName();
|
|
||||||
if (!PS.get().hasPlotArea(worldName)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
Object w = world.getClass().getDeclaredMethod("getHandle").invoke(world);
|
|
||||||
Object chunkMap = w.getClass().getDeclaredMethod("getPlayerChunkMap").invoke(w);
|
|
||||||
Method methodIsChunkInUse = chunkMap.getClass().getDeclaredMethod("isChunkInUse", int.class, int.class);
|
|
||||||
Chunk[] chunks = world.getLoadedChunks();
|
|
||||||
for (Chunk chunk : chunks) {
|
|
||||||
if ((boolean) methodIsChunkInUse.invoke(chunkMap, chunk.getX(), chunk.getZ())) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
int x = chunk.getX();
|
|
||||||
int z = chunk.getZ();
|
|
||||||
if (!shouldSave(worldName, x, z)) {
|
|
||||||
unloadChunk(worldName, chunk, false);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
toUnload.add(chunk);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (toUnload.isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
long start = System.currentTimeMillis();
|
|
||||||
for (Chunk chunk : toUnload) {
|
|
||||||
if (System.currentTimeMillis() - start > 5) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
chunk.unload(true, false);
|
|
||||||
}
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean ignoreUnload = false;
|
|
||||||
|
|
||||||
public boolean unloadChunk(String world, Chunk chunk, boolean safe) {
|
|
||||||
if (safe && shouldSave(world, chunk.getX(), chunk.getZ())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Object c = this.methodGetHandleChunk.of(chunk).call();
|
|
||||||
RefField.RefExecutor field = this.mustSave.of(c);
|
|
||||||
if ((Boolean) field.get() == true) {
|
|
||||||
field.set(false);
|
|
||||||
if (chunk.isLoaded()) {
|
|
||||||
ignoreUnload = true;
|
|
||||||
chunk.unload(false, false);
|
|
||||||
ignoreUnload = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean shouldSave(String world, int X, int Z) {
|
|
||||||
int x = X << 4;
|
|
||||||
int z = Z << 4;
|
|
||||||
int x2 = x + 15;
|
|
||||||
int z2 = z + 15;
|
|
||||||
Plot plot = new Location(world, x, 1, z).getOwnedPlotAbs();
|
|
||||||
if (plot != null && plot.hasOwner()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
plot = new Location(world, x2, 1, z2).getOwnedPlotAbs();
|
|
||||||
if (plot != null && plot.hasOwner()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
plot = new Location(world, x2, 1, z).getOwnedPlotAbs();
|
|
||||||
if (plot != null && plot.hasOwner()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
plot = new Location(world, x, 1, z2).getOwnedPlotAbs();
|
|
||||||
if (plot != null && plot.hasOwner()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
plot = new Location(world, x + 7, 1, z + 7).getOwnedPlotAbs();
|
|
||||||
return plot != null && plot.hasOwner();
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onChunkUnload(ChunkUnloadEvent event) {
|
|
||||||
if (ignoreUnload) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Settings.Chunk_Processor.AUTO_TRIM) {
|
|
||||||
Chunk chunk = event.getChunk();
|
|
||||||
String world = chunk.getWorld().getName();
|
|
||||||
if (PS.get().hasPlotArea(world)) {
|
|
||||||
if (unloadChunk(world, chunk, true)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (processChunk(event.getChunk(), true)) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onChunkLoad(ChunkLoadEvent event) {
|
|
||||||
processChunk(event.getChunk(), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
|
||||||
public void onItemSpawn(ItemSpawnEvent event) {
|
|
||||||
Item entity = event.getEntity();
|
|
||||||
Chunk chunk = entity.getLocation().getChunk();
|
|
||||||
if (chunk == this.lastChunk) {
|
|
||||||
event.getEntity().remove();
|
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!PS.get().hasPlotArea(chunk.getWorld().getName())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Entity[] entities = chunk.getEntities();
|
|
||||||
if (entities.length > Settings.Chunk_Processor.MAX_ENTITIES) {
|
|
||||||
event.getEntity().remove();
|
|
||||||
event.setCancelled(true);
|
|
||||||
this.lastChunk = chunk;
|
|
||||||
} else {
|
|
||||||
this.lastChunk = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
|
||||||
public void onBlockPhysics(BlockPhysicsEvent event) {
|
|
||||||
if (Settings.Chunk_Processor.DISABLE_PHYSICS) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
|
||||||
public void onEntitySpawn(CreatureSpawnEvent event) {
|
|
||||||
LivingEntity entity = event.getEntity();
|
|
||||||
Chunk chunk = entity.getLocation().getChunk();
|
|
||||||
if (chunk == this.lastChunk) {
|
|
||||||
event.getEntity().remove();
|
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!PS.get().hasPlotArea(chunk.getWorld().getName())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Entity[] entities = chunk.getEntities();
|
|
||||||
if (entities.length > Settings.Chunk_Processor.MAX_ENTITIES) {
|
|
||||||
event.getEntity().remove();
|
|
||||||
event.setCancelled(true);
|
|
||||||
this.lastChunk = chunk;
|
|
||||||
} else {
|
|
||||||
this.lastChunk = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void cleanChunk(final Chunk chunk) {
|
|
||||||
TaskManager.index.incrementAndGet();
|
|
||||||
final Integer currentIndex = TaskManager.index.get();
|
|
||||||
Integer task = TaskManager.runTaskRepeat(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (!chunk.isLoaded()) {
|
|
||||||
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
|
|
||||||
TaskManager.tasks.remove(currentIndex);
|
|
||||||
PS.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!");
|
|
||||||
chunk.unload(true, true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
BlockState[] tiles = chunk.getTileEntities();
|
|
||||||
if (tiles.length == 0) {
|
|
||||||
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
|
|
||||||
TaskManager.tasks.remove(currentIndex);
|
|
||||||
PS.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!");
|
|
||||||
chunk.unload(true, true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
long start = System.currentTimeMillis();
|
|
||||||
int i = 0;
|
|
||||||
while (System.currentTimeMillis() - start < 250) {
|
|
||||||
if (i >= tiles.length) {
|
|
||||||
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
|
|
||||||
TaskManager.tasks.remove(currentIndex);
|
|
||||||
PS.debug(C.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!");
|
|
||||||
chunk.unload(true, true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
tiles[i].getBlock().setType(Material.AIR, false);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 5);
|
|
||||||
TaskManager.tasks.put(currentIndex, task);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean processChunk(Chunk chunk, boolean unload) {
|
|
||||||
if (!PS.get().hasPlotArea(chunk.getWorld().getName())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Entity[] entities = chunk.getEntities();
|
|
||||||
BlockState[] tiles = chunk.getTileEntities();
|
|
||||||
if (entities.length > Settings.Chunk_Processor.MAX_ENTITIES) {
|
|
||||||
for (Entity ent : entities) {
|
|
||||||
if (!(ent instanceof Player)) {
|
|
||||||
ent.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PS.debug(C.PREFIX.s() + "&a detected unsafe chunk and processed: " + (chunk.getX() << 4) + "," + (chunk.getX() << 4));
|
|
||||||
}
|
|
||||||
if (tiles.length > Settings.Chunk_Processor.MAX_TILES) {
|
|
||||||
if (unload) {
|
|
||||||
PS.debug(C.PREFIX.s() + "&c detected unsafe chunk: " + (chunk.getX() << 4) + "," + (chunk.getX() << 4));
|
|
||||||
cleanChunk(chunk);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
for (BlockState tile : tiles) {
|
|
||||||
tile.getBlock().setType(Material.AIR, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.listeners;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
|
||||||
import com.intellectualcrafters.plot.flag.Flags;
|
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotArea;
|
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.entity.EntitySpawnEvent;
|
|
||||||
|
|
||||||
public class EntitySpawnListener implements Listener {
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
|
||||||
public void creatureSpawnEvent(EntitySpawnEvent event) {
|
|
||||||
Entity entity = event.getEntity();
|
|
||||||
Location location = BukkitUtil.getLocation(entity.getLocation());
|
|
||||||
PlotArea area = location.getPlotArea();
|
|
||||||
if (area == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Plot plot = area.getOwnedPlotAbs(location);
|
|
||||||
if (plot == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Settings.Done.RESTRICT_BUILDING && plot.hasFlag(Flags.DONE)) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
switch (entity.getType()) {
|
|
||||||
case ENDER_CRYSTAL:
|
|
||||||
if (plot == null) {
|
|
||||||
if (!area.MOB_SPAWNING) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (PlayerEvents.checkEntity(entity, plot)) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,93 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.listeners;
|
|
||||||
|
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
import com.intellectualcrafters.plot.flag.Flags;
|
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
|
||||||
import com.plotsquared.bukkit.object.BukkitPlayer;
|
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class ForceFieldListener {
|
|
||||||
|
|
||||||
private static Set<PlotPlayer> getNearbyPlayers(Player player, Plot plot) {
|
|
||||||
Set<PlotPlayer> players = new HashSet<>();
|
|
||||||
for (Player nearPlayer : Iterables.filter(player.getNearbyEntities(5d, 5d, 5d),Player.class)) {
|
|
||||||
PlotPlayer plotPlayer;
|
|
||||||
if ((plotPlayer = BukkitUtil.getPlayer(nearPlayer)) == null || !plot.equals(plotPlayer.getCurrentPlot())) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!plot.isAdded(plotPlayer.getUUID())) {
|
|
||||||
players.add(plotPlayer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return players;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static PlotPlayer hasNearbyPermitted(Player player, Plot plot) {
|
|
||||||
for (Player nearPlayer : Iterables.filter(player.getNearbyEntities(5d, 5d, 5d),Player.class)) {
|
|
||||||
PlotPlayer plotPlayer;
|
|
||||||
if ((plotPlayer = BukkitUtil.getPlayer(nearPlayer)) == null || !plot.equals(plotPlayer.getCurrentPlot())) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (plot.isAdded(plotPlayer.getUUID())) {
|
|
||||||
return plotPlayer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Vector calculateVelocity(PlotPlayer player, PlotPlayer e) {
|
|
||||||
Location playerLocation = player.getLocationFull();
|
|
||||||
Location oPlayerLocation = e.getLocation();
|
|
||||||
double playerX = playerLocation.getX();
|
|
||||||
double playerY = playerLocation.getY();
|
|
||||||
double playerZ = playerLocation.getZ();
|
|
||||||
double oPlayerX = oPlayerLocation.getX();
|
|
||||||
double oPlayerY = oPlayerLocation.getY();
|
|
||||||
double oPlayerZ = oPlayerLocation.getZ();
|
|
||||||
double x = 0d;
|
|
||||||
if (playerX < oPlayerX) {
|
|
||||||
x = 1.0d;
|
|
||||||
} else if (playerX > oPlayerX) {
|
|
||||||
x = -1.0d;
|
|
||||||
}
|
|
||||||
double y = 0d;
|
|
||||||
if (playerY < oPlayerY) {
|
|
||||||
y = 0.5d;
|
|
||||||
} else if (playerY > oPlayerY) {
|
|
||||||
y = -0.5d;
|
|
||||||
}
|
|
||||||
double z = 0d;
|
|
||||||
if (playerZ < oPlayerZ) {
|
|
||||||
z = 1.0d;
|
|
||||||
} else if (playerZ > oPlayerZ) {
|
|
||||||
z = -1.0d;
|
|
||||||
}
|
|
||||||
return new Vector(x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void handleForcefield(Player player, PlotPlayer plotPlayer, Plot plot) {
|
|
||||||
if (Flags.FORCEFIELD.isTrue(plot)) {
|
|
||||||
UUID uuid = plotPlayer.getUUID();
|
|
||||||
if (plot.isAdded(uuid)) {
|
|
||||||
Set<PlotPlayer> players = getNearbyPlayers(player, plot);
|
|
||||||
for (PlotPlayer oPlayer : players) {
|
|
||||||
((BukkitPlayer) oPlayer).player.setVelocity(calculateVelocity(plotPlayer, oPlayer));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
PlotPlayer oPlayer = hasNearbyPermitted(player, plot);
|
|
||||||
if (oPlayer == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
player.setVelocity(calculateVelocity(oPlayer, plotPlayer));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
@ -1,49 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.listeners;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
|
||||||
import com.intellectualcrafters.plot.flag.Flags;
|
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotArea;
|
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.block.BlockExplodeEvent;
|
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
public class PlayerEvents183 implements Listener {
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
|
||||||
public void onBigBoom(BlockExplodeEvent event) {
|
|
||||||
Block block = event.getBlock();
|
|
||||||
Location location = BukkitUtil.getLocation(block.getLocation());
|
|
||||||
String world = location.getWorld();
|
|
||||||
if (!PS.get().hasPlotArea(world)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
PlotArea area = location.getPlotArea();
|
|
||||||
if (area == null) {
|
|
||||||
Iterator<Block> iterator = event.blockList().iterator();
|
|
||||||
while (iterator.hasNext()) {
|
|
||||||
location = BukkitUtil.getLocation(iterator.next().getLocation());
|
|
||||||
if (location.getPlotArea() != null) {
|
|
||||||
iterator.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Plot plot = area.getOwnedPlot(location);
|
|
||||||
if (plot == null || !plot.getFlag(Flags.EXPLOSION).or(false)) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
Iterator<Block> iterator = event.blockList().iterator();
|
|
||||||
while (iterator.hasNext()) {
|
|
||||||
Block b = iterator.next();
|
|
||||||
if (!plot.equals(area.getOwnedPlot(BukkitUtil.getLocation(b.getLocation())))) {
|
|
||||||
iterator.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,155 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.listeners;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
|
||||||
import com.intellectualcrafters.plot.config.C;
|
|
||||||
import com.intellectualcrafters.plot.flag.Flags;
|
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotArea;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
|
||||||
import com.plotsquared.listener.PlotListener;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.block.BlockState;
|
|
||||||
import org.bukkit.entity.ArmorStand;
|
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.entity.HumanEntity;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.inventory.InventoryAction;
|
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
|
||||||
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class PlayerEvents_1_8 extends PlotListener implements Listener {
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
|
||||||
public void onInventoryClick(InventoryClickEvent event) {
|
|
||||||
if (!event.isLeftClick() || (event.getAction() != InventoryAction.PLACE_ALL) || event.isShiftClick()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
HumanEntity entity = event.getWhoClicked();
|
|
||||||
if (!(entity instanceof Player) || !PS.get().hasPlotArea(entity.getWorld().getName())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Player player = (Player) entity;
|
|
||||||
PlayerInventory inv = player.getInventory();
|
|
||||||
int slot = inv.getHeldItemSlot();
|
|
||||||
if ((slot != event.getSlot()) || (slot > 8) || !event.getEventName().equals("InventoryCreativeEvent")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ItemStack current = inv.getItemInHand();
|
|
||||||
ItemStack newItem = event.getCursor();
|
|
||||||
ItemMeta newMeta = newItem.getItemMeta();
|
|
||||||
ItemMeta oldMeta = newItem.getItemMeta();
|
|
||||||
String newLore = "";
|
|
||||||
if (newMeta != null) {
|
|
||||||
List<String> lore = newMeta.getLore();
|
|
||||||
if (lore != null) {
|
|
||||||
newLore = lore.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String oldLore = "";
|
|
||||||
if (oldMeta != null) {
|
|
||||||
List<String> lore = oldMeta.getLore();
|
|
||||||
if (lore != null) {
|
|
||||||
oldLore = lore.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!"[(+NBT)]".equals(newLore) || (current.equals(newItem) && newLore.equals(oldLore))) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
HashSet<Byte> blocks = null;
|
|
||||||
Block block = player.getTargetBlock(blocks, 7);
|
|
||||||
BlockState state = block.getState();
|
|
||||||
if (state == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (state.getType() != newItem.getType()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Location l = BukkitUtil.getLocation(state.getLocation());
|
|
||||||
PlotArea area = l.getPlotArea();
|
|
||||||
if (area == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Plot plot = area.getPlotAbs(l);
|
|
||||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
|
||||||
boolean cancelled = false;
|
|
||||||
if (plot == null) {
|
|
||||||
if (!Permissions.hasPermission(pp, "plots.admin.interact.road")) {
|
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.road");
|
|
||||||
cancelled = true;
|
|
||||||
}
|
|
||||||
} else if (!plot.hasOwner()) {
|
|
||||||
if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) {
|
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.unowned");
|
|
||||||
cancelled = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
UUID uuid = pp.getUUID();
|
|
||||||
if (!plot.isAdded(uuid)) {
|
|
||||||
if (!Permissions.hasPermission(pp, "plots.admin.interact.other")) {
|
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.other");
|
|
||||||
cancelled = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (cancelled) {
|
|
||||||
if ((current.getType() == newItem.getType()) && (current.getDurability() == newItem.getDurability())) {
|
|
||||||
event.setCursor(new ItemStack(newItem.getType(), newItem.getAmount(), newItem.getDurability()));
|
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
event.setCursor(new ItemStack(newItem.getType(), newItem.getAmount(), newItem.getDurability()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
|
||||||
public void onInteract(PlayerInteractAtEntityEvent e) {
|
|
||||||
Entity entity = e.getRightClicked();
|
|
||||||
if (!(entity instanceof ArmorStand)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Location l = BukkitUtil.getLocation(e.getRightClicked().getLocation());
|
|
||||||
PlotArea area = l.getPlotArea();
|
|
||||||
if (area == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Plot plot = area.getPlotAbs(l);
|
|
||||||
PlotPlayer pp = BukkitUtil.getPlayer(e.getPlayer());
|
|
||||||
if (plot == null) {
|
|
||||||
if (!Permissions.hasPermission(pp, "plots.admin.interact.road")) {
|
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.road");
|
|
||||||
e.setCancelled(true);
|
|
||||||
}
|
|
||||||
} else if (!plot.hasOwner()) {
|
|
||||||
if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) {
|
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.unowned");
|
|
||||||
e.setCancelled(true);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
UUID uuid = pp.getUUID();
|
|
||||||
if (!plot.isAdded(uuid)) {
|
|
||||||
if (Flags.MISC_INTERACT.isTrue(plot)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!Permissions.hasPermission(pp, "plots.admin.interact.other")) {
|
|
||||||
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.other");
|
|
||||||
e.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.listeners;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
|
||||||
import org.bukkit.entity.LingeringPotion;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.entity.LingeringPotionSplashEvent;
|
|
||||||
|
|
||||||
public class PlayerEvents_1_9 implements Listener {
|
|
||||||
|
|
||||||
private final PlayerEvents parent;
|
|
||||||
|
|
||||||
public PlayerEvents_1_9(PlayerEvents parent) {
|
|
||||||
this.parent = parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
|
||||||
public void onPotionSplash(LingeringPotionSplashEvent event) {
|
|
||||||
LingeringPotion entity = event.getEntity();
|
|
||||||
Location l = BukkitUtil.getLocation(entity);
|
|
||||||
if (!PS.get().hasPlotArea(l.getWorld())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!parent.onProjectileHit(event)) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,198 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.listeners;
|
|
||||||
|
|
||||||
import com.google.common.base.Optional;
|
|
||||||
import com.intellectualcrafters.plot.flag.Flags;
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
|
||||||
import com.plotsquared.bukkit.events.PlayerEnterPlotEvent;
|
|
||||||
import com.plotsquared.bukkit.events.PlayerLeavePlotEvent;
|
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
|
||||||
import com.plotsquared.listener.PlotListener;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.UUID;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
|
||||||
import org.bukkit.event.block.BlockDamageEvent;
|
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
|
||||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
|
||||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
public class PlotPlusListener extends PlotListener implements Listener {
|
|
||||||
|
|
||||||
private static final HashMap<String, Interval> feedRunnable = new HashMap<>();
|
|
||||||
private static final HashMap<String, Interval> healRunnable = new HashMap<>();
|
|
||||||
|
|
||||||
public static void startRunnable(JavaPlugin plugin) {
|
|
||||||
plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (!healRunnable.isEmpty()) {
|
|
||||||
for (Iterator<Entry<String, Interval>> iterator = healRunnable.entrySet().iterator(); iterator.hasNext(); ) {
|
|
||||||
Entry<String, Interval> entry = iterator.next();
|
|
||||||
Interval value = entry.getValue();
|
|
||||||
++value.count;
|
|
||||||
if (value.count == value.interval) {
|
|
||||||
value.count = 0;
|
|
||||||
Player player = Bukkit.getPlayer(entry.getKey());
|
|
||||||
if (player == null) {
|
|
||||||
iterator.remove();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
double level = player.getHealth();
|
|
||||||
if (level != value.max) {
|
|
||||||
player.setHealth(Math.min(level + value.amount, value.max));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!feedRunnable.isEmpty()) {
|
|
||||||
for (Iterator<Entry<String, Interval>> iterator = feedRunnable.entrySet().iterator(); iterator.hasNext(); ) {
|
|
||||||
Entry<String, Interval> entry = iterator.next();
|
|
||||||
Interval value = entry.getValue();
|
|
||||||
++value.count;
|
|
||||||
if (value.count == value.interval) {
|
|
||||||
value.count = 0;
|
|
||||||
Player player = Bukkit.getPlayer(entry.getKey());
|
|
||||||
if (player == null) {
|
|
||||||
iterator.remove();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
int level = player.getFoodLevel();
|
|
||||||
if (level != value.max) {
|
|
||||||
player.setFoodLevel(Math.min(level + value.amount, value.max));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 0L, 20L);
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
|
||||||
public void onInteract(BlockDamageEvent event) {
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
if (player.getGameMode() != GameMode.SURVIVAL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Plot plot = BukkitUtil.getLocation(player).getOwnedPlot();
|
|
||||||
if (plot == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Flags.INSTABREAK.isTrue(plot)) {
|
|
||||||
Block block = event.getBlock();
|
|
||||||
BlockBreakEvent call = new BlockBreakEvent(block, player);
|
|
||||||
Bukkit.getServer().getPluginManager().callEvent(call);
|
|
||||||
if (!call.isCancelled()) {
|
|
||||||
event.getBlock().breakNaturally();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
|
||||||
public void onDamage(EntityDamageEvent event) {
|
|
||||||
if (event.getEntityType() != EntityType.PLAYER) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Player player = (Player) event.getEntity();
|
|
||||||
Plot plot = BukkitUtil.getLocation(player).getOwnedPlot();
|
|
||||||
if (plot == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Flags.INVINCIBLE.isTrue(plot)) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onItemPickup(PlayerPickupItemEvent event) {
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
|
||||||
Plot plot = BukkitUtil.getLocation(player).getOwnedPlot();
|
|
||||||
if (plot == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
UUID uuid = pp.getUUID();
|
|
||||||
if (plot.isAdded(uuid) && Flags.DROP_PROTECTION.isTrue(plot)) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onItemDrop(PlayerDropItemEvent event) {
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
|
||||||
Plot plot = BukkitUtil.getLocation(player).getOwnedPlot();
|
|
||||||
if (plot == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
UUID uuid = pp.getUUID();
|
|
||||||
if (!plot.isAdded(uuid)) {
|
|
||||||
if (Flags.ITEM_DROP.isFalse(plot)) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onPlotEnter(PlayerEnterPlotEvent event) {
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
Plot plot = event.getPlot();
|
|
||||||
Optional<Integer[]> feed = plot.getFlag(Flags.FEED);
|
|
||||||
if (feed.isPresent()) {
|
|
||||||
Integer[] value = feed.get();
|
|
||||||
feedRunnable.put(player.getName(), new Interval(value[0], value[1], 20));
|
|
||||||
}
|
|
||||||
Optional<Integer[]> heal = plot.getFlag(Flags.HEAL);
|
|
||||||
if (heal.isPresent()) {
|
|
||||||
Integer[] value = heal.get();
|
|
||||||
healRunnable.put(player.getName(), new Interval(value[0], value[1], 20));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
String name = player.getName();
|
|
||||||
feedRunnable.remove(name);
|
|
||||||
healRunnable.remove(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onPlotLeave(PlayerLeavePlotEvent event) {
|
|
||||||
Player leaver = event.getPlayer();
|
|
||||||
Plot plot = event.getPlot();
|
|
||||||
if (!plot.hasOwner()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
BukkitUtil.getPlayer(leaver);
|
|
||||||
String name = leaver.getName();
|
|
||||||
feedRunnable.remove(name);
|
|
||||||
healRunnable.remove(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class Interval {
|
|
||||||
|
|
||||||
final int interval;
|
|
||||||
final int amount;
|
|
||||||
final int max;
|
|
||||||
public int count = 0;
|
|
||||||
|
|
||||||
Interval(int interval, int amount, int max) {
|
|
||||||
this.interval = interval;
|
|
||||||
this.amount = amount;
|
|
||||||
this.max = max;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.listeners;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
|
||||||
import com.intellectualcrafters.plot.generator.GeneratorWrapper;
|
|
||||||
import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.world.WorldInitEvent;
|
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
|
||||||
|
|
||||||
public class WorldEvents implements Listener {
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
|
||||||
public void onWorldInit(WorldInitEvent event) {
|
|
||||||
World world = event.getWorld();
|
|
||||||
String name = world.getName();
|
|
||||||
ChunkGenerator gen = world.getGenerator();
|
|
||||||
if (gen instanceof GeneratorWrapper) {
|
|
||||||
PS.get().loadWorld(name, (GeneratorWrapper<?>) gen);
|
|
||||||
} else {
|
|
||||||
PS.get().loadWorld(name, new BukkitPlotGenerator(name, gen));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,89 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.managers;
|
||||||
|
|
||||||
|
import com.google.inject.Singleton;
|
||||||
|
import com.plotsquared.core.configuration.file.YamlConfiguration;
|
||||||
|
import com.plotsquared.core.util.PlatformWorldManager;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.WorldCreator;
|
||||||
|
import org.bukkit.WorldType;
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default Bukkit world manager. It will handle world creation by
|
||||||
|
* registering the generator in bukkit.yml
|
||||||
|
*/
|
||||||
|
@Singleton
|
||||||
|
public class BukkitWorldManager implements PlatformWorldManager<World> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initialize() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable World handleWorldCreation(@NonNull String worldName, @Nullable String generator) {
|
||||||
|
this.setGenerator(worldName, generator);
|
||||||
|
final WorldCreator wc = new WorldCreator(worldName);
|
||||||
|
wc.environment(World.Environment.NORMAL);
|
||||||
|
if (generator != null) {
|
||||||
|
wc.generator(generator);
|
||||||
|
wc.type(WorldType.FLAT);
|
||||||
|
}
|
||||||
|
return Bukkit.createWorld(wc);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setGenerator(final @Nullable String worldName, final @Nullable String generator) {
|
||||||
|
if (generator == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
File file = new File("bukkit.yml").getAbsoluteFile();
|
||||||
|
YamlConfiguration yml = YamlConfiguration.loadConfiguration(file);
|
||||||
|
yml.set(String.format("worlds.%s.generator", worldName), generator);
|
||||||
|
try {
|
||||||
|
yml.save(file);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "bukkit";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<String> getWorlds() {
|
||||||
|
final List<World> worlds = Bukkit.getWorlds();
|
||||||
|
final List<String> worldNames = new ArrayList<>();
|
||||||
|
for (final World world : worlds) {
|
||||||
|
worldNames.add(world.getName());
|
||||||
|
}
|
||||||
|
return worldNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.managers;
|
||||||
|
|
||||||
|
/*
|
||||||
|
import com.google.inject.Singleton;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
import se.hyperver.hyperverse.Hyperverse;
|
||||||
|
import se.hyperver.hyperverse.world.WorldConfiguration;
|
||||||
|
import se.hyperver.hyperverse.world.WorldConfigurationBuilder;
|
||||||
|
import se.hyperver.hyperverse.world.WorldFeatures;
|
||||||
|
import se.hyperver.hyperverse.world.WorldType;
|
||||||
|
|
||||||
|
Hyperverse implementation is currently put on ice until Hyperverse is released on a stable line and deployed to the central
|
||||||
|
repository.
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
public class HyperverseWorldManager extends BukkitWorldManager {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable World handleWorldCreation(@NonNull String worldName, @Nullable String generator) {
|
||||||
|
// First let Bukkit register the world
|
||||||
|
this.setGenerator(worldName, generator);
|
||||||
|
// Create the world
|
||||||
|
final WorldConfigurationBuilder worldConfigurationBuilder = WorldConfiguration.builder()
|
||||||
|
.setName(worldName).setType(WorldType.OVER_WORLD);
|
||||||
|
if (generator != null) {
|
||||||
|
worldConfigurationBuilder.setGenerator(generator).setWorldFeatures(WorldFeatures.FLATLAND);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return Hyperverse.getApi().createWorld(worldConfigurationBuilder.createWorldConfiguration())
|
||||||
|
.getBukkitWorld();
|
||||||
|
} catch (final Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "bukkit-hyperverse";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* PlotSquared, a land and world management plugin for Minecraft.
|
||||||
|
* Copyright (C) IntellectualSites <https://intellectualsites.com>
|
||||||
|
* Copyright (C) IntellectualSites team and contributors
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.bukkit.managers;
|
||||||
|
|
||||||
|
import com.google.inject.Singleton;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Multiverse specific manager that informs Multiverse of
|
||||||
|
* world creation by executing a console command
|
||||||
|
*
|
||||||
|
* @deprecated Deprecated and scheduled for removal without replacement
|
||||||
|
* in favor of the build in setup wizard.
|
||||||
|
* However, this class will be kept around for a while, given it's not a maintenance burden.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
@Singleton
|
||||||
|
public class MultiverseWorldManager extends BukkitWorldManager {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable World handleWorldCreation(final @NonNull String worldName, final @Nullable String generator) {
|
||||||
|
// First let Bukkit register the world
|
||||||
|
this.setGenerator(worldName, generator);
|
||||||
|
// Then we send the console command
|
||||||
|
final StringBuilder commandBuilder = new StringBuilder("mv create ")
|
||||||
|
.append(worldName).append(" normal");
|
||||||
|
if (generator != null) {
|
||||||
|
commandBuilder.append(" -g ").append(generator);
|
||||||
|
}
|
||||||
|
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), commandBuilder.toString());
|
||||||
|
return Bukkit.getWorld(worldName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "bukkit-multiverse";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,138 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.object;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.object.LazyBlock;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
|
|
||||||
public class BukkitLazyBlock extends LazyBlock {
|
|
||||||
|
|
||||||
private int id;
|
|
||||||
private Block block;
|
|
||||||
private PlotBlock pb;
|
|
||||||
|
|
||||||
public BukkitLazyBlock(int id, Block block) {
|
|
||||||
this.id = id;
|
|
||||||
this.block = block;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BukkitLazyBlock(PlotBlock pb) {
|
|
||||||
this.id = pb.id;
|
|
||||||
this.pb = pb;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BukkitLazyBlock(Block block) {
|
|
||||||
this.block = block;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PlotBlock getPlotBlock() {
|
|
||||||
if (this.pb != null) {
|
|
||||||
return this.pb;
|
|
||||||
}
|
|
||||||
if (this.id == 0) {
|
|
||||||
this.id = this.block.getTypeId();
|
|
||||||
}
|
|
||||||
byte data;
|
|
||||||
switch (this.id) {
|
|
||||||
case 0:
|
|
||||||
case 2:
|
|
||||||
case 4:
|
|
||||||
case 13:
|
|
||||||
case 14:
|
|
||||||
case 15:
|
|
||||||
case 20:
|
|
||||||
case 21:
|
|
||||||
case 22:
|
|
||||||
case 24:
|
|
||||||
case 25:
|
|
||||||
case 30:
|
|
||||||
case 32:
|
|
||||||
case 37:
|
|
||||||
case 39:
|
|
||||||
case 40:
|
|
||||||
case 41:
|
|
||||||
case 42:
|
|
||||||
case 45:
|
|
||||||
case 46:
|
|
||||||
case 47:
|
|
||||||
case 48:
|
|
||||||
case 49:
|
|
||||||
case 51:
|
|
||||||
case 52:
|
|
||||||
case 54:
|
|
||||||
case 55:
|
|
||||||
case 56:
|
|
||||||
case 57:
|
|
||||||
case 58:
|
|
||||||
case 60:
|
|
||||||
case 61:
|
|
||||||
case 62:
|
|
||||||
case 7:
|
|
||||||
case 8:
|
|
||||||
case 9:
|
|
||||||
case 10:
|
|
||||||
case 11:
|
|
||||||
case 73:
|
|
||||||
case 74:
|
|
||||||
case 78:
|
|
||||||
case 79:
|
|
||||||
case 80:
|
|
||||||
case 81:
|
|
||||||
case 82:
|
|
||||||
case 83:
|
|
||||||
case 84:
|
|
||||||
case 85:
|
|
||||||
case 87:
|
|
||||||
case 88:
|
|
||||||
case 101:
|
|
||||||
case 102:
|
|
||||||
case 103:
|
|
||||||
case 110:
|
|
||||||
case 112:
|
|
||||||
case 113:
|
|
||||||
case 117:
|
|
||||||
case 121:
|
|
||||||
case 122:
|
|
||||||
case 123:
|
|
||||||
case 124:
|
|
||||||
case 129:
|
|
||||||
case 133:
|
|
||||||
case 138:
|
|
||||||
case 137:
|
|
||||||
case 140:
|
|
||||||
case 165:
|
|
||||||
case 166:
|
|
||||||
case 169:
|
|
||||||
case 170:
|
|
||||||
case 172:
|
|
||||||
case 173:
|
|
||||||
case 174:
|
|
||||||
case 176:
|
|
||||||
case 177:
|
|
||||||
case 181:
|
|
||||||
case 182:
|
|
||||||
case 188:
|
|
||||||
case 189:
|
|
||||||
case 190:
|
|
||||||
case 191:
|
|
||||||
case 192:
|
|
||||||
data = 0;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
data = this.block.getData();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
this.pb = PlotBlock.get((short) this.id, data);
|
|
||||||
return this.pb;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getId() {
|
|
||||||
if (this.id == 0) {
|
|
||||||
this.id = this.block.getTypeId();
|
|
||||||
}
|
|
||||||
return this.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.object;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
|
|
||||||
import org.bukkit.OfflinePlayer;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class BukkitOfflinePlayer implements OfflinePlotPlayer {
|
|
||||||
|
|
||||||
public final OfflinePlayer player;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Please do not use this method. Instead use BukkitUtil.getPlayer(Player),
|
|
||||||
* as it caches player objects.
|
|
||||||
*
|
|
||||||
* @param player
|
|
||||||
*/
|
|
||||||
public BukkitOfflinePlayer(OfflinePlayer player) {
|
|
||||||
this.player = player;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UUID getUUID() {
|
|
||||||
return this.player.getUniqueId();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getLastPlayed() {
|
|
||||||
return this.player.getLastPlayed();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOnline() {
|
|
||||||
return this.player.isOnline();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return this.player.getName();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,244 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.object;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
|
||||||
import com.intellectualcrafters.plot.util.EconHandler;
|
|
||||||
import com.intellectualcrafters.plot.util.PlotGameMode;
|
|
||||||
import com.intellectualcrafters.plot.util.PlotWeather;
|
|
||||||
import com.intellectualcrafters.plot.util.StringMan;
|
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
|
||||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
|
||||||
import org.bukkit.Effect;
|
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.WeatherType;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventException;
|
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import org.bukkit.plugin.RegisteredListener;
|
|
||||||
|
|
||||||
public class BukkitPlayer extends PlotPlayer {
|
|
||||||
|
|
||||||
public final Player player;
|
|
||||||
public boolean offline;
|
|
||||||
private UUID uuid;
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Please do not use this method. Instead use
|
|
||||||
* BukkitUtil.getPlayer(Player), as it caches player objects.</p>
|
|
||||||
* @param player
|
|
||||||
*/
|
|
||||||
public BukkitPlayer(Player player) {
|
|
||||||
this.player = player;
|
|
||||||
super.populatePersistentMetaMap();
|
|
||||||
}
|
|
||||||
|
|
||||||
public BukkitPlayer(Player player, boolean offline) {
|
|
||||||
this.player = player;
|
|
||||||
this.offline = offline;
|
|
||||||
super.populatePersistentMetaMap();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Location getLocation() {
|
|
||||||
Location location = super.getLocation();
|
|
||||||
return location == null ? BukkitUtil.getLocation(this.player) : location;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UUID getUUID() {
|
|
||||||
if (this.uuid == null) {
|
|
||||||
this.uuid = UUIDHandler.getUUID(this);
|
|
||||||
}
|
|
||||||
return this.uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public long getLastPlayed() {
|
|
||||||
return this.player.getLastPlayed();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canTeleport(Location loc) {
|
|
||||||
org.bukkit.Location to = BukkitUtil.getLocation(loc);
|
|
||||||
org.bukkit.Location from = player.getLocation();
|
|
||||||
PlayerTeleportEvent event = new PlayerTeleportEvent(player, from, to);
|
|
||||||
RegisteredListener[] listeners = event.getHandlers().getRegisteredListeners();
|
|
||||||
for (RegisteredListener listener : listeners) {
|
|
||||||
if (listener.getPlugin().getName().equals(PS.imp().getPluginName())) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
listener.callEvent(event);
|
|
||||||
} catch (EventException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (event.isCancelled() || !event.getTo().equals(to)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
event = new PlayerTeleportEvent(player, to, from);
|
|
||||||
for (RegisteredListener listener : listeners) {
|
|
||||||
if (listener.getPlugin().getName().equals(PS.imp().getPluginName())) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
listener.callEvent(event);
|
|
||||||
} catch (EventException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasPermission(String permission) {
|
|
||||||
if (this.offline && EconHandler.manager != null) {
|
|
||||||
return EconHandler.manager.hasPermission(getName(), permission);
|
|
||||||
}
|
|
||||||
return this.player.hasPermission(permission);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendMessage(String message) {
|
|
||||||
if (!StringMan.isEqual(this.<String>getMeta("lastMessage"), message) || (System.currentTimeMillis() - this.<Long>getMeta("lastMessageTime") > 5000)) {
|
|
||||||
setMeta("lastMessage", message);
|
|
||||||
setMeta("lastMessageTime", System.currentTimeMillis());
|
|
||||||
this.player.sendMessage(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void teleport(Location location) {
|
|
||||||
if (Math.abs(location.getX()) >= 30000000 || Math.abs(location.getZ()) >= 30000000) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.player.teleport(
|
|
||||||
new org.bukkit.Location(BukkitUtil.getWorld(location.getWorld()), location.getX() + 0.5, location.getY(), location.getZ() + 0.5,
|
|
||||||
location.getYaw(), location.getPitch()), TeleportCause.COMMAND);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
if (this.name == null) {
|
|
||||||
this.name = this.player.getName();
|
|
||||||
}
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOnline() {
|
|
||||||
return !this.offline && this.player.isOnline();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setCompassTarget(Location location) {
|
|
||||||
this.player.setCompassTarget(
|
|
||||||
new org.bukkit.Location(BukkitUtil.getWorld(location.getWorld()), location.getX(), location.getY(), location.getZ()));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Location getLocationFull() {
|
|
||||||
return BukkitUtil.getLocationFull(this.player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setWeather(PlotWeather weather) {
|
|
||||||
switch (weather) {
|
|
||||||
case CLEAR:
|
|
||||||
this.player.setPlayerWeather(WeatherType.CLEAR);
|
|
||||||
break;
|
|
||||||
case RAIN:
|
|
||||||
this.player.setPlayerWeather(WeatherType.DOWNFALL);
|
|
||||||
break;
|
|
||||||
case RESET:
|
|
||||||
this.player.resetPlayerWeather();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
this.player.resetPlayerWeather();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PlotGameMode getGameMode() {
|
|
||||||
switch (this.player.getGameMode()) {
|
|
||||||
case ADVENTURE:
|
|
||||||
return PlotGameMode.ADVENTURE;
|
|
||||||
case CREATIVE:
|
|
||||||
return PlotGameMode.CREATIVE;
|
|
||||||
case SPECTATOR:
|
|
||||||
return PlotGameMode.SPECTATOR;
|
|
||||||
case SURVIVAL:
|
|
||||||
return PlotGameMode.SURVIVAL;
|
|
||||||
default:
|
|
||||||
return PlotGameMode.NOT_SET;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setGameMode(PlotGameMode gameMode) {
|
|
||||||
switch (gameMode) {
|
|
||||||
case ADVENTURE:
|
|
||||||
this.player.setGameMode(GameMode.ADVENTURE);
|
|
||||||
break;
|
|
||||||
case CREATIVE:
|
|
||||||
this.player.setGameMode(GameMode.CREATIVE);
|
|
||||||
break;
|
|
||||||
case SPECTATOR:
|
|
||||||
this.player.setGameMode(GameMode.SPECTATOR);
|
|
||||||
break;
|
|
||||||
case SURVIVAL:
|
|
||||||
this.player.setGameMode(GameMode.SURVIVAL);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
this.player.setGameMode(GameMode.SURVIVAL);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setTime(long time) {
|
|
||||||
if (time != Long.MAX_VALUE) {
|
|
||||||
this.player.setPlayerTime(time, false);
|
|
||||||
} else {
|
|
||||||
this.player.resetPlayerTime();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFlight(boolean fly) {
|
|
||||||
this.player.setAllowFlight(fly);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean getFlight() {
|
|
||||||
return player.getAllowFlight();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void playMusic(Location location, int id) {
|
|
||||||
//noinspection deprecation
|
|
||||||
this.player.playEffect(BukkitUtil.getLocation(location), Effect.RECORD_PLAY, id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void kick(String message) {
|
|
||||||
this.player.kickPlayer(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public void stopSpectating() {
|
|
||||||
if (getGameMode() == PlotGameMode.SPECTATOR) {
|
|
||||||
this.player.setSpectatorTarget(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isBanned() {
|
|
||||||
return this.player.isBanned();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
package com.plotsquared.bukkit.object.entity;
|
|
||||||
|
|
||||||
class AgeableStats {
|
|
||||||
|
|
||||||
int age;
|
|
||||||
boolean locked;
|
|
||||||
boolean adult;
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user