mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2026-02-18 01:42:32 +01:00
Compare commits
955 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5dcdacee07 | ||
|
|
925ef21a8e | ||
|
|
cb01515451 | ||
|
|
a9e81602b4 | ||
|
|
8645ce641d | ||
|
|
3a765e1164 | ||
|
|
a5a613e200 | ||
|
|
4e8e95e3cb | ||
|
|
f9fb9a17a9 | ||
|
|
4ea9037dd4 | ||
|
|
1d9a7cc720 | ||
|
|
f6a3084a47 | ||
|
|
41b484b1c3 | ||
|
|
df101e54b1 | ||
|
|
9a65621f68 | ||
|
|
9a91daf910 | ||
|
|
3a7b6fef7d | ||
|
|
9383b1c65c | ||
|
|
261d571be1 | ||
|
|
4461cfacd2 | ||
|
|
84353de71d | ||
|
|
1ab4645223 | ||
|
|
b6a56d6865 | ||
|
|
67cc162e07 | ||
|
|
401cc3e35b | ||
|
|
d45aac713f | ||
|
|
83c1dab963 | ||
|
|
bbcc1ee7da | ||
|
|
e749d5eb7f | ||
|
|
4d4dad0ccb | ||
|
|
380d4be9c9 | ||
|
|
b40b206bf5 | ||
|
|
a2c0a02d30 | ||
|
|
196ace4b81 | ||
|
|
b14871d499 | ||
|
|
e80c183894 | ||
|
|
fe40748929 | ||
|
|
49a6ce7b8f | ||
|
|
6127a7fe11 | ||
|
|
f1ac4ff265 | ||
|
|
d98b077be3 | ||
|
|
bbbf6777f9 | ||
|
|
c0a3d63213 | ||
|
|
5e8a840418 | ||
|
|
dbf32b4715 | ||
|
|
017e32c30a | ||
|
|
8e048300e8 | ||
|
|
2569ed0565 | ||
|
|
45b4f4a314 | ||
|
|
98e6400dd8 | ||
|
|
63d3a328c4 | ||
|
|
06a4f964e8 | ||
|
|
9aef304fd4 | ||
|
|
f32834411d | ||
|
|
577e3339f1 | ||
|
|
36f75457e3 | ||
|
|
b67b0a5b94 | ||
|
|
e389c4b8f1 | ||
|
|
303a922165 | ||
|
|
4ea5432561 | ||
|
|
9a428332a9 | ||
|
|
c43fd9bc69 | ||
|
|
77e6e79eb6 | ||
|
|
1568f71d83 | ||
|
|
f274450376 | ||
|
|
0b3a642c95 | ||
|
|
025183d434 | ||
|
|
371a3ceec7 | ||
|
|
84b3cfc309 | ||
|
|
14e5998aa0 | ||
|
|
c839837d7a | ||
|
|
e65e6ad14e | ||
|
|
fc6c804caf | ||
|
|
8228ae248f | ||
|
|
c6a4cbd715 | ||
|
|
90520cd50b | ||
|
|
8262711e7e | ||
|
|
8aa92322d1 | ||
|
|
bdfac28b44 | ||
|
|
cb89a80fd8 | ||
|
|
a2f9ab70aa | ||
|
|
5d010594dd | ||
|
|
d609b45e68 | ||
|
|
4c63eee6d5 | ||
|
|
f3aff37b46 | ||
|
|
f2c32f07da | ||
|
|
bff72486d0 | ||
|
|
0193b53988 | ||
|
|
039542f125 | ||
|
|
99b50319a3 | ||
|
|
7e5a8bc659 | ||
|
|
e66ed3f3f1 | ||
|
|
cef9fad49f | ||
|
|
8ad9419240 | ||
|
|
1871c1ec63 | ||
|
|
7a721c3229 | ||
|
|
370af987d6 | ||
|
|
a22636b2d9 | ||
|
|
399a1529f4 | ||
|
|
3734300e59 | ||
|
|
fc7b4a6790 | ||
|
|
00f5491718 | ||
|
|
67ed9d324e | ||
|
|
ddf953b3b7 | ||
|
|
f89b7ccc9f | ||
|
|
154b10209d | ||
|
|
fbc7cbf389 | ||
|
|
6f81cf7384 | ||
|
|
4f832edada | ||
|
|
85a04c71f4 | ||
|
|
c7ed3ee2a0 | ||
|
|
7e34e87bc0 | ||
|
|
b2b623505d | ||
|
|
67a57f7472 | ||
|
|
d7fe01579b | ||
|
|
e969598f58 | ||
|
|
be9aeacd70 | ||
|
|
5f39a7cb80 | ||
|
|
7b38658310 | ||
|
|
d81c3d06c5 | ||
|
|
a504bc407a | ||
|
|
67bcb8da11 | ||
|
|
55821f7703 | ||
|
|
a601360cbb | ||
|
|
444feb1c2c | ||
|
|
6592562c56 | ||
|
|
9aae4825cc | ||
|
|
22c5280d4e | ||
|
|
49a91617f0 | ||
|
|
b5bc324f97 | ||
|
|
a120981e52 | ||
|
|
1df4f74f8c | ||
|
|
d4d5d9bac1 | ||
|
|
28e963f1eb | ||
|
|
9626c06b58 | ||
|
|
baf1796b08 | ||
|
|
b39340227f | ||
|
|
105a81aede | ||
|
|
9ff8692625 | ||
|
|
280971042a | ||
|
|
6ac1c4fa2c | ||
|
|
d84d487435 | ||
|
|
43d8e08e83 | ||
|
|
859063e406 | ||
|
|
ad990dbb28 | ||
|
|
1c58bd392d | ||
|
|
cf9117097d | ||
|
|
71d1574a7d | ||
|
|
f1fc095876 | ||
|
|
3a367d71fa | ||
|
|
f4cab35a46 | ||
|
|
c22a1a0dd2 | ||
|
|
a421bd7e4c | ||
|
|
ef9b3d40e9 | ||
|
|
24458879a4 | ||
|
|
1d6a142b12 | ||
|
|
b7fc3f05e9 | ||
|
|
3cfd3b0109 | ||
|
|
bb64221c6b | ||
|
|
96b46d31cf | ||
|
|
4031674626 | ||
|
|
f028d91eb0 | ||
|
|
c46b7ed3bc | ||
|
|
71a3eb6a93 | ||
|
|
6ff13077be | ||
|
|
c51be84b50 | ||
|
|
3e5c4bc617 | ||
|
|
e5e86246f3 | ||
|
|
8f906af99c | ||
|
|
6c0da22d5e | ||
|
|
6e5feced2f | ||
|
|
6be1319927 | ||
|
|
cfeadb54be | ||
|
|
fd1a0db696 | ||
|
|
bf38f55f23 | ||
|
|
c467f79d32 | ||
|
|
9b0023d2d7 | ||
|
|
9be7c2af3c | ||
|
|
c146384227 | ||
|
|
f68ecd3214 | ||
|
|
58e506b041 | ||
|
|
40a13c4c81 | ||
|
|
02781f7458 | ||
|
|
0cd23c1b65 | ||
|
|
c758346c3f | ||
|
|
a381b6379a | ||
|
|
6241b6dfe9 | ||
|
|
061a6c2a3a | ||
|
|
ebf48e1870 | ||
|
|
92de75e002 | ||
|
|
c6e1edee91 | ||
|
|
6428c65720 | ||
|
|
3edc0bf63f | ||
|
|
fb5fd6cc39 | ||
|
|
f9b2776cb9 | ||
|
|
25c8dad1ea | ||
|
|
ad86db241c | ||
|
|
3d0ba7ce52 | ||
|
|
9a8ced7aa7 | ||
|
|
cf0b60d165 | ||
|
|
cbb726e020 | ||
|
|
0ad1530505 | ||
|
|
c0dde01f3e | ||
|
|
db3d14fa9f | ||
|
|
726b04f586 | ||
|
|
76ddcc4cf0 | ||
|
|
11c8374f6c | ||
|
|
848cee18a9 | ||
|
|
42d286e265 | ||
|
|
ebbfe72259 | ||
|
|
6d720e6ab1 | ||
|
|
661cf15be1 | ||
|
|
f30875ac4c | ||
|
|
ea0ad38fec | ||
|
|
e1f11b4059 | ||
|
|
42312349e1 | ||
|
|
c86012027e | ||
|
|
0a900d9c65 | ||
|
|
038265b033 | ||
|
|
ba34442ebb | ||
|
|
f9ce70e310 | ||
|
|
c728b233e6 | ||
|
|
e8c8f8b6a1 | ||
|
|
d3765effe0 | ||
|
|
6c77017658 | ||
|
|
f8b7d5e10d | ||
|
|
b42b4cadbe | ||
|
|
11461cc220 | ||
|
|
4f3174c68b | ||
|
|
657e66f3c5 | ||
|
|
97670f14d1 | ||
|
|
fb8213d87c | ||
|
|
7c5ebb9902 | ||
|
|
4e9f5b99b8 | ||
|
|
b48fa2d8e5 | ||
|
|
71fc9930ef | ||
|
|
ec1e7b044c | ||
|
|
ba4e9e73c3 | ||
|
|
ac4b8068b0 | ||
|
|
b1be43154a | ||
|
|
87f84a5f66 | ||
|
|
e962f645b6 | ||
|
|
6ad9c8e664 | ||
|
|
b8a146f8bd | ||
|
|
b7b0ff13e7 | ||
|
|
96742e6c42 | ||
|
|
255ae6c426 | ||
|
|
8c5ea484eb | ||
|
|
eb1f097d18 | ||
|
|
a073984621 | ||
|
|
34fc9725b9 | ||
|
|
1e1212cd7c | ||
|
|
df8f050cf1 | ||
|
|
e74bc9fd95 | ||
|
|
66878d72bf | ||
|
|
29befac27e | ||
|
|
f5590ce334 | ||
|
|
43da10a855 | ||
|
|
9ae58fd2f7 | ||
|
|
cf6d95b575 | ||
|
|
92b8d13c71 | ||
|
|
a9ed63d3d0 | ||
|
|
7889fe5249 | ||
|
|
6888a082fc | ||
|
|
1585d8157e | ||
|
|
292fc8eff2 | ||
|
|
126e1c5942 | ||
|
|
a59907fcec | ||
|
|
f1feeed670 | ||
|
|
12af9af902 | ||
|
|
6ce44b7ce8 | ||
|
|
52355b2757 | ||
|
|
13a3e9a790 | ||
|
|
4137cc0d3d | ||
|
|
8a57bbb5d9 | ||
|
|
f09fed465a | ||
|
|
4e1f535fe2 | ||
|
|
f15f25a3df | ||
|
|
384804fefa | ||
|
|
5e3a72b30d | ||
|
|
f5b3cf4350 | ||
|
|
008e29117f | ||
|
|
d48295bd72 | ||
|
|
e9987a19ed | ||
|
|
1aa4df01f9 | ||
|
|
427d8c3b21 | ||
|
|
61d87eff10 | ||
|
|
086e29c4ac | ||
|
|
6cc6de6e82 | ||
|
|
4a30fcc2de | ||
|
|
0acde4a8af | ||
|
|
d6fea9a2df | ||
|
|
5114bbc40d | ||
|
|
4fcf0b0519 | ||
|
|
da6b6841b7 | ||
|
|
95d60e646d | ||
|
|
9f8c9db4bc | ||
|
|
918b94b1ff | ||
|
|
d9dd4ea016 | ||
|
|
43aad43bf3 | ||
|
|
ed2c3975d8 | ||
|
|
ee04bebcd9 | ||
|
|
1769df98dc | ||
|
|
ca2eebf022 | ||
|
|
4101f16580 | ||
|
|
655a31d556 | ||
|
|
e1576e8d1c | ||
|
|
2605235f2a | ||
|
|
6bba647250 | ||
|
|
79ae49a6d1 | ||
|
|
f007114753 | ||
|
|
dad3e76c7c | ||
|
|
ba5428ff12 | ||
|
|
1cf1c6fab8 | ||
|
|
14ca84fa97 | ||
|
|
4a00758b6b | ||
|
|
e817dbe081 | ||
|
|
c3bacd8de6 | ||
|
|
351abae475 | ||
|
|
c1c249372a | ||
|
|
6f77bb206d | ||
|
|
0beabbf1ec | ||
|
|
51ab8d4b25 | ||
|
|
a21b4585c5 | ||
|
|
cde11b64ed | ||
|
|
d3c47935d4 | ||
|
|
c8ee5099e0 | ||
|
|
85fd0a79bc | ||
|
|
6927712a9d | ||
|
|
4cfb7a5f4b | ||
|
|
1f2e6cd5f5 | ||
|
|
b38c589125 | ||
|
|
7f40b4294f | ||
|
|
bfc26dc892 | ||
|
|
b572c0aea9 | ||
|
|
1d62f8b177 | ||
|
|
d141a28747 | ||
|
|
19c38f0cb1 | ||
|
|
c7a49dd283 | ||
|
|
f11b98c29d | ||
|
|
adc83d29a7 | ||
|
|
1e8d950767 | ||
|
|
3dca32a226 | ||
|
|
7c024314b7 | ||
|
|
f828084246 | ||
|
|
626890ed95 | ||
|
|
00a14ccb17 | ||
|
|
400e15b559 | ||
|
|
d5a4103858 | ||
|
|
0cb9bbb530 | ||
|
|
fc2a8eec7b | ||
|
|
362d036b16 | ||
|
|
ee765a0d30 | ||
|
|
8aa919f834 | ||
|
|
77c12dcc20 | ||
|
|
7581425f87 | ||
|
|
fce77b427f | ||
|
|
01a7aa4d12 | ||
|
|
6dc75760d0 | ||
|
|
fe90f1e7eb | ||
|
|
54cf356b71 | ||
|
|
4669e3e54d | ||
|
|
f4ead570d4 | ||
|
|
b34f3a1779 | ||
|
|
85e1f2eb7e | ||
|
|
6136e82ec6 | ||
|
|
ebec5d6f70 | ||
|
|
336e41b40c | ||
|
|
bec088c969 | ||
|
|
17f1062e96 | ||
|
|
92495ae9df | ||
|
|
b9c8743ee3 | ||
|
|
0d260a74c9 | ||
|
|
35368db05d | ||
|
|
5e6e8d7248 | ||
|
|
d50238caf1 | ||
|
|
164d429acc | ||
|
|
a316bb7bd2 | ||
|
|
55a4238030 | ||
|
|
f9f2a0d691 | ||
|
|
3831ca6b0f | ||
|
|
7a6b8e3156 | ||
|
|
93d10c0739 | ||
|
|
24e4c28355 | ||
|
|
6ec61ecb76 | ||
|
|
55a69006bf | ||
|
|
8a02230fd2 | ||
|
|
2a26b016d9 | ||
|
|
7be5b4ecbd | ||
|
|
565fb35217 | ||
|
|
d2b8c527ad | ||
|
|
2cdb17d64f | ||
|
|
96f06ca812 | ||
|
|
685f6d76a8 | ||
|
|
840cfbe94d | ||
|
|
605535ed60 | ||
|
|
71c72045b9 | ||
|
|
eb930883fa | ||
|
|
30ed18eb95 | ||
|
|
8508f5b8b8 | ||
|
|
dfab223eb2 | ||
|
|
dd82fa0791 | ||
|
|
af8d2dc2c7 | ||
|
|
9f9529debf | ||
|
|
495c4a33e5 | ||
|
|
203d3749ee | ||
|
|
1fcecbd3e7 | ||
|
|
d778616b2c | ||
|
|
4bdd97a302 | ||
|
|
ab2a031ee0 | ||
|
|
5663b71387 | ||
|
|
2a43bce849 | ||
|
|
592c3a2142 | ||
|
|
e9ca341476 | ||
|
|
76617c8a61 | ||
|
|
10ff097232 | ||
|
|
1e043d481a | ||
|
|
7f8c670dc1 | ||
|
|
0e536a2cb3 | ||
|
|
090cf82a39 | ||
|
|
6e60f39f82 | ||
|
|
b8078e4730 | ||
|
|
e08fe64db2 | ||
|
|
2b576568a7 | ||
|
|
e2edbaad34 | ||
|
|
184b98bbdc | ||
|
|
7cc604dbdb | ||
|
|
44ed35825f | ||
|
|
22833eea6c | ||
|
|
64dfc1e3d3 | ||
|
|
6619ca1d22 | ||
|
|
2f2a80e1ce | ||
|
|
fa1bbd2031 | ||
|
|
a39a77f89e | ||
|
|
7800e48f61 | ||
|
|
63378ae4c1 | ||
|
|
fecf83c79c | ||
|
|
f287b6d8a7 | ||
|
|
9082658357 | ||
|
|
4bda175328 | ||
|
|
ee324c77a9 | ||
|
|
210b418e44 | ||
|
|
b73eced36f | ||
|
|
6296a6adde | ||
|
|
99f6192965 | ||
|
|
bff454f397 | ||
|
|
8216dbe355 | ||
|
|
fbe26af2d7 | ||
|
|
0a1559511a | ||
|
|
aee60f2c09 | ||
|
|
9ce850f84f | ||
|
|
cbff8482ce | ||
|
|
0035762a71 | ||
|
|
3d515aab23 | ||
|
|
e77801f3c1 | ||
|
|
c83d011faa | ||
|
|
5aa4949baa | ||
|
|
906ead53dd | ||
|
|
cbcdedc67a | ||
|
|
c87b410823 | ||
|
|
0a447f68c6 | ||
|
|
e98d241452 | ||
|
|
421455224f | ||
|
|
29c55312a5 | ||
|
|
6c474c8838 | ||
|
|
03182ea24c | ||
|
|
2c6543da9e | ||
|
|
20bbdfc4ab | ||
|
|
5b2ebf4aa8 | ||
|
|
2b159adefd | ||
|
|
be2de1d487 | ||
|
|
6876f192de | ||
|
|
875db44afd | ||
|
|
2e120abe3a | ||
|
|
feeb17d6f0 | ||
|
|
6d2003d577 | ||
|
|
40b609ccd8 | ||
|
|
d64399df49 | ||
|
|
d4f2f0e11b | ||
|
|
916d9a7c8a | ||
|
|
6d5ab0edda | ||
|
|
307d483323 | ||
|
|
eb4960f307 | ||
|
|
9df72e61a2 | ||
|
|
fcb6391ba3 | ||
|
|
16a77f281e | ||
|
|
87ebf7023f | ||
|
|
028f87653a | ||
|
|
0e51983819 | ||
|
|
c174f2b829 | ||
|
|
8e9d393eb2 | ||
|
|
f1f02fd005 | ||
|
|
f279a979e3 | ||
|
|
e0bbe9cea4 | ||
|
|
d3cc23f6a0 | ||
|
|
4c3f3ee4e2 | ||
|
|
2d7c5d7fd6 | ||
|
|
8be68aa6df | ||
|
|
a731ad14ec | ||
|
|
05ca96aa7f | ||
|
|
60aa32d003 | ||
|
|
0e7ee41444 | ||
|
|
b5f6b1d97f | ||
|
|
f1ac5739e4 | ||
|
|
8cbb57df97 | ||
|
|
2c8d2998bb | ||
|
|
44684fcfd0 | ||
|
|
7081e03c23 | ||
|
|
246db98519 | ||
|
|
ee245d348f | ||
|
|
f718741044 | ||
|
|
c054ff851a | ||
|
|
755787f9ee | ||
|
|
24f8b2fbd5 | ||
|
|
ee02a19e9a | ||
|
|
cb5d38c11f | ||
|
|
15436b44da | ||
|
|
5c267663a2 | ||
|
|
fda625b235 | ||
|
|
2cbd8789d8 | ||
|
|
95167f44f1 | ||
|
|
789b51fd05 | ||
|
|
0911c86422 | ||
|
|
7d05c9d8e6 | ||
|
|
a43ae4178a | ||
|
|
c9c2c483fa | ||
|
|
133281faaa | ||
|
|
ef8987917d | ||
|
|
d6a00eaf00 | ||
|
|
69151f0855 | ||
|
|
bb27d753b1 | ||
|
|
37ce29a5e8 | ||
|
|
6297e1c79b | ||
|
|
4e2903e65c | ||
|
|
2e7f56eeb5 | ||
|
|
7e46d5ca08 | ||
|
|
a2bcce9ab1 | ||
|
|
2f7b1c38e1 | ||
|
|
789aaec186 | ||
|
|
f3d6c1727b | ||
|
|
c029b51c97 | ||
|
|
6c5fb5f398 | ||
|
|
4b20db47b2 | ||
|
|
e238ec8fc6 | ||
|
|
9689f55e5c | ||
|
|
ec0c7da494 | ||
|
|
5f9f3e8167 | ||
|
|
6388246418 | ||
|
|
86432eb426 | ||
|
|
a51585f5d0 | ||
|
|
9ec75fb470 | ||
|
|
c8a7f6d76f | ||
|
|
01a8a199d2 | ||
|
|
f85c54596a | ||
|
|
b3e1acc563 | ||
|
|
745ff21551 | ||
|
|
31c8cf9766 | ||
|
|
8901db4e18 | ||
|
|
b1b8c4d713 | ||
|
|
b14b37c22d | ||
|
|
e73e628051 | ||
|
|
3bb920f22c | ||
|
|
2bed26f18a | ||
|
|
fb3363661b | ||
|
|
315b713005 | ||
|
|
70de0ba00b | ||
|
|
25cad3afc6 | ||
|
|
11aa126b80 | ||
|
|
d0e8bb3174 | ||
|
|
6b03108052 | ||
|
|
34447ef874 | ||
|
|
dcd79e87e1 | ||
|
|
8822b4edae | ||
|
|
a24d6ff018 | ||
|
|
707195f237 | ||
|
|
321fcd7b84 | ||
|
|
c5970e9246 | ||
|
|
538a0c5d6c | ||
|
|
4c4df60b81 | ||
|
|
d1cf08c6ba | ||
|
|
e091a8eb55 | ||
|
|
d579c9a2af | ||
|
|
a711d3a3e3 | ||
|
|
2c197af9fd | ||
|
|
d58d621f96 | ||
|
|
0203252b63 | ||
|
|
22edd121d3 | ||
|
|
31b83becad | ||
|
|
6cce3098db | ||
|
|
fd3d60d112 | ||
|
|
9094e5feb8 | ||
|
|
60bfabb097 | ||
|
|
2d4cf76825 | ||
|
|
6a7279ea05 | ||
|
|
4cb4a6224b | ||
|
|
a6e445b7ef | ||
|
|
123a139e43 | ||
|
|
4054315c19 | ||
|
|
d942cedb8e | ||
|
|
ec774b590b | ||
|
|
988a11a5da | ||
|
|
1488946fc5 | ||
|
|
1f05967b0b | ||
|
|
4924391ae8 | ||
|
|
f2668d7dbb | ||
|
|
d26779bee9 | ||
|
|
c75715b186 | ||
|
|
a238b7029d | ||
|
|
98511136ee | ||
|
|
6723b3a4c6 | ||
|
|
40c61149cf | ||
|
|
4f9a463b9d | ||
|
|
f3a8208425 | ||
|
|
cbf2f34f93 | ||
|
|
898fad6be4 | ||
|
|
eaa1a8edca | ||
|
|
08db154791 | ||
|
|
e1cf4c0c67 | ||
|
|
529c43b0e6 | ||
|
|
376abdf49e | ||
|
|
11a744a772 | ||
|
|
47f73ba455 | ||
|
|
001b11efc6 | ||
|
|
089f3a0e71 | ||
|
|
af9a3c85c6 | ||
|
|
a534f9aac1 | ||
|
|
a08016647a | ||
|
|
a557fc7d3c | ||
|
|
2d3d11ec2d | ||
|
|
9bc97c6dd3 | ||
|
|
52f1e33052 | ||
|
|
272e99d41f | ||
|
|
77b67d5a79 | ||
|
|
8e1f464209 | ||
|
|
5f960fd80a | ||
|
|
bddca30668 | ||
|
|
28a2b9668d | ||
|
|
f52d9feef8 | ||
|
|
f77ae6ee15 | ||
|
|
88b99a3835 | ||
|
|
8d16af8770 | ||
|
|
fde9ba86a2 | ||
|
|
c9356f9ef5 | ||
|
|
6a0529f02d | ||
|
|
760178c061 | ||
|
|
0bb2642d24 | ||
|
|
635a4f7265 | ||
|
|
0e34202d4d | ||
|
|
3a9c55a9ea | ||
|
|
2dd1775d9a | ||
|
|
a0635eeb08 | ||
|
|
9677653c54 | ||
|
|
6cf7167c09 | ||
|
|
9718123292 | ||
|
|
420559efec | ||
|
|
f4b6d7845e | ||
|
|
b966529487 | ||
|
|
9c7b83a52e | ||
|
|
ac9447d439 | ||
|
|
a5bcc3ce58 | ||
|
|
a020890244 | ||
|
|
616200f20f | ||
|
|
1f9c3759e7 | ||
|
|
9fb72cfea8 | ||
|
|
dd84abe927 | ||
|
|
aaa69adb0c | ||
|
|
982ee13631 | ||
|
|
8927e16b1f | ||
|
|
dd01504111 | ||
|
|
50e727d591 | ||
|
|
f84e98d836 | ||
|
|
7e92905618 | ||
|
|
9b24dd306c | ||
|
|
aa796266a7 | ||
|
|
a783d0dfc8 | ||
|
|
f9879be439 | ||
|
|
5f21efb1cd | ||
|
|
8e2b8f111f | ||
|
|
08766a0ff7 | ||
|
|
5b19e2e9d2 | ||
|
|
bef28583f3 | ||
|
|
eff53d90ab | ||
|
|
2aade8b7ff | ||
|
|
de0ac51b3d | ||
|
|
b161a907a7 | ||
|
|
397ec929aa | ||
|
|
f108de9ba2 | ||
|
|
e3a139f7bd | ||
|
|
90f8132030 | ||
|
|
60d89c15e6 | ||
|
|
58a0287be7 | ||
|
|
ac3b28da8b | ||
|
|
12cb1e4161 | ||
|
|
4e013b44d8 | ||
|
|
9934ab972e | ||
|
|
30adac5e63 | ||
|
|
d3d7c254f4 | ||
|
|
93ad040936 | ||
|
|
bfeac43f12 | ||
|
|
4388430491 | ||
|
|
b4e21a7817 | ||
|
|
4fe41fe416 | ||
|
|
d8184fb298 | ||
|
|
78dec51ad4 | ||
|
|
de38826897 | ||
|
|
f63e793006 | ||
|
|
ecfdd75e36 | ||
|
|
90b31a29f5 | ||
|
|
cfa0daefc5 | ||
|
|
4aeda6e9e8 | ||
|
|
4f1f10333f | ||
|
|
342c37a02c | ||
|
|
e347bc1c9e | ||
|
|
42116f4467 | ||
|
|
7ce72bafb0 | ||
|
|
f76771f0a8 | ||
|
|
6c29da94f3 | ||
|
|
981523789e | ||
|
|
d9aacfa059 | ||
|
|
5efc5289f7 | ||
|
|
1f68f4e654 | ||
|
|
5670e6696a | ||
|
|
ca6dc5195d | ||
|
|
30ebe318e0 | ||
|
|
a1c3f0d651 | ||
|
|
347e03d75e | ||
|
|
8543382bde | ||
|
|
4f1004472c | ||
|
|
7aee829b94 | ||
|
|
98701104d8 | ||
|
|
7a14e61762 | ||
|
|
f42f5c31ed | ||
|
|
342662c944 | ||
|
|
50088fe0bd | ||
|
|
687f87a748 | ||
|
|
6815c66a0e | ||
|
|
385fe1bb05 | ||
|
|
eddadcc179 | ||
|
|
9426f44cdd | ||
|
|
af7ff3df58 | ||
|
|
7c0cc8794f | ||
|
|
eda18bc990 | ||
|
|
a2c395db36 | ||
|
|
522b085499 | ||
|
|
3ea845cfd9 | ||
|
|
93013b2db1 | ||
|
|
d5a2dea06b | ||
|
|
d188224c06 | ||
|
|
3422c5d3eb | ||
|
|
ebeebbde72 | ||
|
|
e71eff852c | ||
|
|
bfff5682b5 | ||
|
|
429a7d926a | ||
|
|
262e711bcc | ||
|
|
b44b1cc859 | ||
|
|
75dfec1236 | ||
|
|
8c2f3cff8f | ||
|
|
32336b712b | ||
|
|
cfc51e9b96 | ||
|
|
31cefbfc8c | ||
|
|
2c940ecdac | ||
|
|
e51809d066 | ||
|
|
01a18fa587 | ||
|
|
f93deeceb6 | ||
|
|
3275395d53 | ||
|
|
d0881ab3fd | ||
|
|
5db09bf45c | ||
|
|
f4406bd9cf | ||
|
|
3b441073fd | ||
|
|
da22a8ff93 | ||
|
|
f8469cbe00 | ||
|
|
0188629fe2 | ||
|
|
5d246d2701 | ||
|
|
b3cd5486d6 | ||
|
|
7e961fc2a3 | ||
|
|
8fcd286eb0 | ||
|
|
4723a7cbdb | ||
|
|
dbc7b98b0d | ||
|
|
a5bc547c40 | ||
|
|
63b332216e | ||
|
|
8e5340ebc3 | ||
|
|
e4af611c91 | ||
|
|
c31281971c | ||
|
|
eda38cba66 | ||
|
|
b5a2e76926 | ||
|
|
38cc7435dc | ||
|
|
864a760e9c | ||
|
|
0838cbb874 | ||
|
|
4844be80da | ||
|
|
62a767db89 | ||
|
|
ce3463ad6d | ||
|
|
5d059d8537 | ||
|
|
332860b9ce | ||
|
|
2a443cd9db | ||
|
|
f4d1004d32 | ||
|
|
9d8aec7eca | ||
|
|
958c116fd0 | ||
|
|
ec1a125809 | ||
|
|
2dd8e719c8 | ||
|
|
d62c68a490 | ||
|
|
3c6dd290f4 | ||
|
|
07e589aae3 | ||
|
|
1119d3c17f | ||
|
|
eac5d1ee7a | ||
|
|
56cb5c092f | ||
|
|
9d7faf9ed9 | ||
|
|
7da661546f | ||
|
|
48d3280e5e | ||
|
|
b61c65636b | ||
|
|
087a0b079f | ||
|
|
2147417322 | ||
|
|
4304970059 | ||
|
|
fc981fda20 | ||
|
|
be9ff51fd9 | ||
|
|
adde56114e | ||
|
|
5cfd2dc799 | ||
|
|
c878775c72 | ||
|
|
574cdd374b | ||
|
|
a3943aab24 | ||
|
|
1503e58d11 | ||
|
|
2650d57d8e | ||
|
|
4d402c7229 | ||
|
|
d687543910 | ||
|
|
d8ad519cd0 | ||
|
|
a23d093271 | ||
|
|
8a35d69540 | ||
|
|
097a5a0894 | ||
|
|
8760c2bbb0 | ||
|
|
dc635fe7d7 | ||
|
|
f10a1d0ffb | ||
|
|
809779e508 | ||
|
|
80d358d1fd | ||
|
|
a1be17c72c | ||
|
|
0a066f51bb | ||
|
|
294141c353 | ||
|
|
5a47f9fa86 | ||
|
|
6ee2d7d823 | ||
|
|
f2881f02c8 | ||
|
|
9f5445689c | ||
|
|
0ea163e3ee | ||
|
|
f097aa4a67 | ||
|
|
1fcb9e649e | ||
|
|
1d0dc02013 | ||
|
|
8766d31943 | ||
|
|
d857bf483e | ||
|
|
b7774251eb | ||
|
|
da7507fc75 | ||
|
|
fe4699430d | ||
|
|
df4fc8149d | ||
|
|
c156f0c346 | ||
|
|
79a17b0c1c | ||
|
|
d3051ad127 | ||
|
|
f4c53aaf8a | ||
|
|
432ff95a98 | ||
|
|
fe29bb4b9f | ||
|
|
ae5347bc0f | ||
|
|
966de87ef9 | ||
|
|
3569f9a182 | ||
|
|
70a23f8a0a | ||
|
|
857e12b96e | ||
|
|
c10525ada9 | ||
|
|
fb8592495d | ||
|
|
a48ada306c | ||
|
|
8db0d663dc | ||
|
|
70744371a3 | ||
|
|
18c322e8d6 | ||
|
|
75cbfa1b1c | ||
|
|
48c7aa3e84 | ||
|
|
87bce65098 | ||
|
|
c288dc433b | ||
|
|
0cc29d070f | ||
|
|
8fd94b625c | ||
|
|
ccca3fff26 | ||
|
|
f77446919f | ||
|
|
96fdf265d5 | ||
|
|
b964e3f7c3 | ||
|
|
d93c83f775 | ||
|
|
6b9f6c29ec | ||
|
|
09b0bf62e2 | ||
|
|
15d7d3f8a2 | ||
|
|
dedbdf890a | ||
|
|
30085e1e34 | ||
|
|
1c30146491 | ||
|
|
037022b175 | ||
|
|
0aa67727f5 | ||
|
|
8e3e1d5f11 | ||
|
|
d2d70089ca | ||
|
|
94a566acc9 | ||
|
|
daab095557 | ||
|
|
2b9b5df1ee | ||
|
|
e7e62b8d40 | ||
|
|
3d242bbdb6 | ||
|
|
e796eae3c3 | ||
|
|
a257e83a62 | ||
|
|
d527584248 | ||
|
|
0a4de6e2fc | ||
|
|
4b20f12eff | ||
|
|
0de1187012 | ||
|
|
8e474170e4 | ||
|
|
2eeb9b1f35 | ||
|
|
3de6e2c3f1 | ||
|
|
98d166808f | ||
|
|
f75e15dfdc | ||
|
|
f2b892b7d5 | ||
|
|
883ada01f8 | ||
|
|
3a8f45a04d | ||
|
|
906609696b | ||
|
|
66ccde4310 | ||
|
|
4970cdc3f4 | ||
|
|
1becc874ba | ||
|
|
b107a8dc7c | ||
|
|
37aebc1716 | ||
|
|
836877ff93 | ||
|
|
28a846e0cb | ||
|
|
0185a30ec9 | ||
|
|
38e1947302 | ||
|
|
4fb4d6fc0c | ||
|
|
6d719988bf | ||
|
|
b1c1f0e21e | ||
|
|
3f34cc7365 | ||
|
|
3c6c2837bd | ||
|
|
4bcef76fd8 | ||
|
|
2fd5d7aa81 | ||
|
|
5080c68dce | ||
|
|
3403aef37d | ||
|
|
53a34c12d2 | ||
|
|
59417d6721 | ||
|
|
93d63dbca5 | ||
|
|
4643cf1070 | ||
|
|
91bf54019e | ||
|
|
ead716ef0d | ||
|
|
8fec1af257 | ||
|
|
99248caba3 | ||
|
|
af64bdf742 | ||
|
|
66a4925371 | ||
|
|
8eb6acd60f | ||
|
|
ce6892f2e6 | ||
|
|
c14a4e9305 | ||
|
|
5825eb1696 | ||
|
|
bfebbd0095 | ||
|
|
b204507a82 | ||
|
|
9f53426511 | ||
|
|
03c2282c3f | ||
|
|
20092d55fd | ||
|
|
69a2a5cfff | ||
|
|
618cfad100 | ||
|
|
56e625a9df | ||
|
|
79a1ef5d3e | ||
|
|
10dd7619bf | ||
|
|
f9dfec5bd0 | ||
|
|
a9488bc18b | ||
|
|
f0ee708710 | ||
|
|
3390a31cc6 | ||
|
|
0b4b272223 | ||
|
|
8d200ea653 |
344
.gitignore
vendored
344
.gitignore
vendored
@@ -1,42 +1,330 @@
|
||||
# Eclipse stuff
|
||||
/.classpath
|
||||
/.project
|
||||
/.settings
|
||||
|
||||
# netbeans
|
||||
/nbproject
|
||||
### Eclipse template
|
||||
|
||||
# we use maven!
|
||||
/build.xml
|
||||
.metadata
|
||||
bin/
|
||||
tmp/
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
*~.nib
|
||||
local.properties
|
||||
.settings/
|
||||
.loadpath
|
||||
.recommenders
|
||||
|
||||
# maven
|
||||
/target
|
||||
# External tool builders
|
||||
.externalToolBuilders/
|
||||
|
||||
# vim
|
||||
.*.sw[a-p]
|
||||
# Locally stored "Eclipse launch configurations"
|
||||
*.launch
|
||||
|
||||
# various other potential build files
|
||||
/build
|
||||
/bin
|
||||
/dist
|
||||
/manifest.mf
|
||||
# PyDev specific (Python IDE for Eclipse)
|
||||
*.pydevproject
|
||||
|
||||
/world
|
||||
# CDT-specific (C/C++ Development Tooling)
|
||||
.cproject
|
||||
|
||||
# Mac filesystem dust
|
||||
*.DS_Store
|
||||
# CDT- autotools
|
||||
.autotools
|
||||
|
||||
# intellij
|
||||
# Java annotation processor (APT)
|
||||
.factorypath
|
||||
|
||||
# PDT-specific (PHP Development Tools)
|
||||
.buildpath
|
||||
|
||||
# sbteclipse plugin
|
||||
.target
|
||||
|
||||
# Tern plugin
|
||||
.tern-project
|
||||
|
||||
# TeXlipse plugin
|
||||
.texlipse
|
||||
|
||||
# STS (Spring Tool Suite)
|
||||
.springBeans
|
||||
|
||||
# Code Recommenders
|
||||
.recommenders/
|
||||
|
||||
# Annotation Processing
|
||||
.apt_generated/
|
||||
|
||||
# Scala IDE specific (Scala & Java development for Eclipse)
|
||||
.cache-main
|
||||
.scala_dependencies
|
||||
.worksheet
|
||||
### Android template
|
||||
# Built application files
|
||||
*.apk
|
||||
*.ap_
|
||||
|
||||
# Files for the ART/Dalvik VM
|
||||
*.dex
|
||||
|
||||
# Java class files
|
||||
*.class
|
||||
|
||||
# Generated files
|
||||
gen/
|
||||
out/
|
||||
|
||||
# Gradle files
|
||||
.gradle/
|
||||
build/
|
||||
|
||||
# Local configuration file (sdk path, etc)
|
||||
# Proguard folder generated by Eclipse
|
||||
proguard/
|
||||
|
||||
# Log Files
|
||||
*.log
|
||||
|
||||
# Android Studio Navigation editor temp files
|
||||
.navigation/
|
||||
|
||||
# Android Studio captures folder
|
||||
captures/
|
||||
|
||||
# IntelliJ
|
||||
*.iml
|
||||
*.ipr
|
||||
.idea/workspace.xml
|
||||
.idea/tasks.xml
|
||||
.idea/gradle.xml
|
||||
.idea/assetWizardSettings.xml
|
||||
.idea/dictionaries
|
||||
.idea/libraries
|
||||
.idea/caches
|
||||
|
||||
# Keystore files
|
||||
# Uncomment the following line if you do not want to check your keystore files in.
|
||||
#*.jks
|
||||
|
||||
# External native build folder generated in Android Studio 2.2 and later
|
||||
.externalNativeBuild
|
||||
|
||||
# Google Services (e.g. APIs or Firebase)
|
||||
google-services.json
|
||||
|
||||
# Freeline
|
||||
freeline.py
|
||||
freeline/
|
||||
freeline_project_description.json
|
||||
|
||||
# fastlane
|
||||
fastlane/report.xml
|
||||
fastlane/Preview.html
|
||||
fastlane/screenshots
|
||||
fastlane/test_output
|
||||
fastlane/readme.md
|
||||
### Dropbox template
|
||||
# Dropbox settings and caches
|
||||
.dropbox
|
||||
.dropbox.attr
|
||||
.dropbox.cache
|
||||
### Windows template
|
||||
# Windows thumbnail cache files
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
ehthumbs_vista.db
|
||||
|
||||
# Dump file
|
||||
*.stackdump
|
||||
|
||||
# Folder config file
|
||||
[Dd]esktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
### Maven template
|
||||
target/
|
||||
pom.xml.tag
|
||||
pom.xml.releaseBackup
|
||||
pom.xml.versionsBackup
|
||||
pom.xml.next
|
||||
release.properties
|
||||
dependency-reduced-pom.xml
|
||||
buildNumber.properties
|
||||
.mvn/timing.properties
|
||||
.mvn/wrapper/maven-wrapper.jar
|
||||
### NetBeans template
|
||||
nbproject/private/
|
||||
nbbuild/
|
||||
dist/
|
||||
nbdist/
|
||||
.nb-gradle/
|
||||
### macOS template
|
||||
# General
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
### Linux template
|
||||
*~
|
||||
|
||||
# temporary files which can be created if a process still has a handle open of a deleted file
|
||||
.fuse_hidden*
|
||||
|
||||
# KDE directory preferences
|
||||
.directory
|
||||
|
||||
# Linux trash folder which might appear on any partition or disk
|
||||
.Trash-*
|
||||
|
||||
# .nfs files are created when an open file is removed but is still being accessed
|
||||
.nfs*
|
||||
### GPG template
|
||||
secring.*
|
||||
|
||||
### Gradle template
|
||||
.gradle
|
||||
/build/
|
||||
|
||||
# Ignore Gradle GUI config
|
||||
gradle-app.setting
|
||||
|
||||
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
|
||||
!gradle-wrapper.jar
|
||||
|
||||
# Cache of project
|
||||
.gradletasknamecache
|
||||
|
||||
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
|
||||
# gradle/wrapper/gradle-wrapper.properties
|
||||
### SBT template
|
||||
# Simple Build Tool
|
||||
# http://www.scala-sbt.org/release/docs/Getting-Started/Directories.html#configuring-version-control
|
||||
|
||||
dist/*
|
||||
lib_managed/
|
||||
src_managed/
|
||||
project/boot/
|
||||
project/plugins/project/
|
||||
.history
|
||||
.cache
|
||||
.lib/
|
||||
### Example user template template
|
||||
### Example user template
|
||||
|
||||
# IntelliJ project files
|
||||
.idea
|
||||
out
|
||||
gen### JetBrains template
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# User-specific stuff
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/shelf
|
||||
|
||||
# Sensitive or high-churn files
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
.idea/**/dbnavigator.xml
|
||||
|
||||
# Gradle
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
|
||||
# Gradle and Maven with auto-import
|
||||
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||
# since they will be recreated, and may cause churn. Uncomment if using
|
||||
# auto-import.
|
||||
# .idea/modules.xml
|
||||
# .idea/*.iml
|
||||
# .idea/modules
|
||||
|
||||
# CMake
|
||||
cmake-build-*/
|
||||
|
||||
# Mongo Explorer plugin
|
||||
.idea/**/mongoSettings.xml
|
||||
|
||||
# File-based project format
|
||||
*.iws
|
||||
.idea/
|
||||
|
||||
# Project Stuff
|
||||
/src/main/resources/mcMMO
|
||||
# IntelliJ
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# Other Libraries
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Cursive Clojure plugin
|
||||
.idea/replstate.xml
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
# Editor-based Rest Client
|
||||
.idea/httpRequests
|
||||
### Kotlin template
|
||||
# Compiled class file
|
||||
# Log file
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# Atlassian Stuff
|
||||
/atlassian-ide-plugin.xml
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
### Java template
|
||||
# Compiled class file
|
||||
# Log file
|
||||
# BlueJ files
|
||||
# Mobile Tools for Java (J2ME)
|
||||
# Package Files #
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
|
||||
403
Changelog.txt
403
Changelog.txt
@@ -7,6 +7,401 @@ Key:
|
||||
! Change
|
||||
- Removal
|
||||
|
||||
Version 2.2.0
|
||||
mcMMO has a new config system (WIP)
|
||||
mcMMO for Bukkit no longer requires Spigot in order to play, you can now use Bukkit instead (WIP)
|
||||
mcMMO is now abstracted from the Bukkit API in order to support more platforms (WIP)
|
||||
mcMMO has changed from using maven to gradle!
|
||||
mcMMO is now a gradle project (this makes it much easier for us to support older versions of MC and other APIs)
|
||||
|
||||
Version 2.1.12
|
||||
Salvage config entries are no longer case sensitive
|
||||
Fixed a bug where Fishing was not rewarding vanilla XP orbs
|
||||
|
||||
Version 2.1.11
|
||||
Fixed a bug where Rupture was using the wrong permission node (new permission node: mcmmo.ability.swords.rupture)
|
||||
|
||||
Version 2.1.10
|
||||
Fishing command did an oopsie
|
||||
Endstone now gives the same XP as Stone (update your experience.yml)
|
||||
|
||||
Version 2.1.9
|
||||
Fixed a bug where grabbing the version of WG would throw classnotdefined errors
|
||||
|
||||
Version 2.1.8
|
||||
mcMMO now checks for WG 7 before attempting to use the WG API
|
||||
Made some optimizations for our WG integration
|
||||
Fixed a bug where Bite chance for Master Angler was displaying too many decimal places
|
||||
Fixed a bug where Abilities didn't check for permission nodes before activating
|
||||
MaxBonusLevel now has specific entries for Standard and Retro in advanced.yml
|
||||
MaxBonusLevel for Critical Strikes changed from 75/750 to 100/1000
|
||||
MaxBonusLevel of Dodge changed from 80/800 to 100/1000
|
||||
MaxBonusLevel of Rupture changed from 20/200 to 100/1000
|
||||
MaxBonusLevel of Counter Attack changed from 60/600 to 100/1000
|
||||
|
||||
Version 2.1.7
|
||||
Fixed an almost 6 year old bug where Salvage materials did not have a defined material count so they defaulted to 2 (which could lead to shovels giving back more diamonds than normal)
|
||||
Added spam detection for Unarmed's bonus damage and disarm
|
||||
Corrected an error where master angler for retro only required level 150 instead of 500 (update your skillranks.yml)
|
||||
Fixed a bug where Players could see hidden party members in the party member listings
|
||||
(API) Added addXpFromBlocks to ExperienceAPI to help make adding XP for a player easier
|
||||
(API) Added addXpFromBlocksBySkill to ExperienceAPI to help make adding XP for a player easier
|
||||
(API) Added addXpFromBlock to ExperienceAPI to help make adding XP for a player easier
|
||||
(API) Added addXpFromBlockBySkill to ExperienceAPI to help make adding XP for a player easier
|
||||
|
||||
Version 2.1.6
|
||||
Fixed a bug where Arcane Salvage could never fail
|
||||
Recolored some lines in the locale related to failure from white to red
|
||||
Fixed a bug where Salvage was giving back too many resources
|
||||
SubSkillFailure renamed to SubSkillFailed in config.yml
|
||||
SubSkillFailed now sends copies to chat by default
|
||||
SubSkillFailed no longer sends messages to the action bar by default
|
||||
|
||||
Version 2.1.5
|
||||
mcMMO no longer ignores cancelled events relating to the player left or right clicking
|
||||
|
||||
Version 2.1.4
|
||||
Fixed a bug where Alchemy didn't gain XP
|
||||
Fixed a bug where Archery gained XP from mob spawned entities
|
||||
Fixed a display bug with Roll on /acrobatics command
|
||||
Fixed a display bug for bite chance on Fishing
|
||||
Fixed a display bug for treasure drop chances on Fishing
|
||||
Fixed a display bug for Arcane Forging on Repair
|
||||
Fixed a display bug for Super Repair on Repair
|
||||
Fixed a display bug for Repair Mastery on Repair
|
||||
Fixed a display bug for Second Smelt on Smelting
|
||||
Repair Mastery now uses a rank system
|
||||
Super Repair now uses a rank system
|
||||
Changed the stat for bite chance to be more clear that its additive chance
|
||||
Fixed Styling for the /salvage command
|
||||
Temporarily disabled Flux Mining
|
||||
Removed XP from entities that target endermite to prevent easy exploitation (Credits to TheBentoBox for the tip!) [Can be turned off in experience.yml]
|
||||
Fixed a bug where static chance skills like Arcane Salvage were using incorrect calculations for success
|
||||
Advanced Salvage now uses a rank system
|
||||
Arcane Salvage now goes by your rank to determine the maximum amount of materials salvaged and is no longer percentage based
|
||||
Fixed a bug where Iron Arm was checking for Iron Grip to be unlocked instead of itself
|
||||
(Plugin Compatibility) mcMMO no longer ignores cancelled block place events (this is to prevent XP gains from placed blocks)
|
||||
(Plugin Compatibility) mcMMO now ignores cancelled events relating to the player left or right clicking
|
||||
(Locale) Changed the string for "Salvage.Ability.Bonus.1" to fit the new material recovery mechanics of Salvage
|
||||
(Config) Added a toggle for the new endermite enderman xp farm fix in experience.yml "ExploitFix.EndermanEndermiteFarms"
|
||||
(Config) Cleaned up some leftover 'unlocklevel' settings, this stuff is now handled in skillranks.yml
|
||||
(Config) Removed Salvage.MaxPercentage
|
||||
(Config) Removed Salvage.MaxPercentageChance
|
||||
(Config) Added Salvage.ArcaneSalvage.MaxBonusLevel
|
||||
(Config) Added Salvage.ArcaneSalvage.MaxChance
|
||||
|
||||
Version 2.1.3
|
||||
Temporarily removed the unarmed no-item pickup feature until its fixed
|
||||
|
||||
Version 2.1.2
|
||||
(Compatibility) mcMMO now deals custom damage type for all damage sources to be more compatible with other plugins (such as anti-cheat)
|
||||
(Perks) Fixed a bug where the Lucky perk wasn't adding to success
|
||||
(Skills) mcMMO will now listen to cancelled events to remove our temporary enchantments from tools
|
||||
(Skills) Fixing a bug where Shake didn't calculate success correctly
|
||||
(Skills) Fixed a bug where Arcane Forging didn't calculate success and failure correctly
|
||||
(Skills) Fixed a bug where Salvage didn't calculate success and failure correctly
|
||||
(Skills) Fixed a bug where Flux Mining didn't calculate success correctly
|
||||
(Skills) Fixed a bug where Shake didn't calculate correctly
|
||||
(Skills) Fixed a bug where Pummel didn't calculate correctly
|
||||
(Skills) Tree Feller now works on Mushroom Stems
|
||||
(Skills) Fixed a bug where magic chance would show as null
|
||||
(Skills) Fixed a bug where Trap percentages were added to Fishing even though they no longer exist
|
||||
(Skills) Magic Hunter now uses a rank system
|
||||
(Skills) Fixed a bug where Magic Hunter would work without treasure hunter
|
||||
(Skills) As long are you are empty handed mcMMO will no longer put items into your hands
|
||||
(Skills) Improved the styling on /smelting
|
||||
(Skills) Iron Arm Style can now reach a bonus damage of 10 (up from 8)
|
||||
(Skills) Iron Arm Style now uses a rank system
|
||||
(Skills) Iron Grip now uses a rank system
|
||||
(Skills) Disarm now uses a rank system
|
||||
(Skills) Arrow Deflect now uses a rank system
|
||||
(Skills) Flux Mining is now a passive effect when you mine ore instead of requiring a special pickaxe
|
||||
(Skills) Removed the Flux Mining mcMMO Pickaxe Item
|
||||
(Style) Locked skills now are styled differently in the skill command display
|
||||
(Experience) Phantoms have been added to the default experience.yml with a value of 4.0 (update your config!)
|
||||
(Experience) Default XP value for witch set to 0.1 instead of 0.0
|
||||
(Experience) Default XP value for ender dragon set to 1.0 instead of 0.0
|
||||
(Style) Added @ symbol styling for hover tooltips to the locale
|
||||
(Style) Added the skill names in the skill commands display to the locale so it can now be edited and styled
|
||||
(Experience) Renamed Grass to Grass_Block in treasures.yml to allow grass to give items again (update your configs manually or delete to regen)
|
||||
(Experience) Wood blocks now give XP and are affected by Tree Feller (6 sided bark blocks)
|
||||
(API) Moved XPGainReason from skills to experience package
|
||||
(API) Added XpGainSource for tracking sources of XP
|
||||
(API) You can now specify XpGainSource when adding xp to players
|
||||
(Config) The Extra Stats option for XP bars now overrides the setting for updating XP bars every time XP is gained
|
||||
(Config) Added an option for Party XP gains to not update XP bars
|
||||
(Config) Added an option for Passive XP gains to not update XP bars (smelting/brewing)
|
||||
(Config) Added warnings if mcMMO finds a MaxBonusLevel of 0 for any skill that incorporates RNG
|
||||
(Config) Removed config options for Iron Arm
|
||||
(Config) Removed the options related to the Flux Mining Item
|
||||
(Config) Second Smelt has a max activation chance of 50% instead of 100% (you can update your configs or gen new ones to get this change)
|
||||
|
||||
Version 2.1.1
|
||||
= Fixed an issue where excavation wasn't using the correct permission node
|
||||
= Added protection against AFK fishing
|
||||
= Acrobatics now uses much better anti-exploit detection
|
||||
|
||||
Version 2.1.0
|
||||
+ mcMMO now features XP bars! Configurable in experience.yml
|
||||
+ Locale files now support & codes for colors and formatting!
|
||||
+ Prevented exploits involving blocks made from entities (snowmen, etc..)
|
||||
+ Added JSON integration to all Skill Commands
|
||||
+ Added config setting to enable or disable old mcMMO skill scaling (General.RetroMode) this is on by default for existing installs
|
||||
+ You can now disable specific skills in coreskills.yml without the need for permissions
|
||||
+ Added links to mcMMO related websites to various commands
|
||||
+ Certain elements of mcMMO's UI have been restyled
|
||||
+ Added the tagline "Overhaul Era" to various locations until 3.0.0 comes out
|
||||
+ You can now disable mcMMO completely for specific worlds via world_blacklist.txt in /plugins/mcMMO/
|
||||
+ (WorldGuard) mcMMO now supports worldguard, you can use the flags "mcmmo" and "mcmmo-xp" on regions (they default to on unless otherwise specified)
|
||||
! (Scoreboards) Scoreboards are now disabled by default, I don't like them. You can turn them back on in config.yml
|
||||
+ (Sounds) Rolling now plays a sound (Graceful Roll has a different sound :) )
|
||||
+ (Sounds) Activating Super abilities plays a sound (other plays can hear this)
|
||||
+ (Sounds) Skill Unlock Notifications have sounds
|
||||
+ (Sounds) Readying a tool for a super ability now plays a sound
|
||||
+ (Sounds) Bleed DOT now plays a sound
|
||||
+ (Experience) mcMMO now notifies you when you progress in a skill!
|
||||
+ (Experience) Coral (blocks) now give Mining XP
|
||||
+ (Experience) Coral (plants) now give Herbalism XP
|
||||
+ (Experience) Blue Ice now gives Mining XP
|
||||
+ (Experience) Dolphins now give combat XP
|
||||
+ (Experience) Drowned mobs now count towards combat XP
|
||||
+ (Experience) You can now set guaranteed minimum values for XP gained if diminishing returns are enabled, this value defaults to 5% (experience.yml)
|
||||
+ (Events) Starting an XP event will now use the title API (toggle this in advanced.yml)
|
||||
+ (Sound) Volume and Pitch of sounds can now be configured in the new sounds.yml file
|
||||
+ (MySQL) Added support for SSL for MySQL/MariaDB (On by default)
|
||||
! (Skills) Taming's Gore now uses Rupture Rank 1 for its DoT calculations
|
||||
! (Skills) Sword's Bleed has been renamed to Rupture
|
||||
! (Skills) Sword's Rupture no longer has an internal hard coded limit
|
||||
! (Skills) Sword's Serrated Strikes now uses your Rupture rank to determine the damage/ticks for its bleed effect.
|
||||
! (Skills) Sword's Rupture now ticks four times as fast
|
||||
! (Skills) Sword's Rupture now refreshes bleed duration instead of adding duration when applying bleed to the same target
|
||||
! (Skills) Sword's Rupture will now deal lethal damage
|
||||
= (Skills) Fixed a bug where Rupture would apply an incorrect amount of bleed ticks
|
||||
! (Skills) Sword's Rupture now reaches its max proc chance at level 20 (200 in Retro)
|
||||
! (Skills) Sword's Rupture now has a max chance to proc of 33% instead of 70%
|
||||
! (Skills) Sword's Rupture now deals 50% more damage at above Rank 3 and can last much longer! The base damage for Bleed has been increased as well (update your advanced.yml admins)
|
||||
! (Skills) Sword's Rupture no longer triggers invincibility frames when damaging your opponent
|
||||
= (Skills) Furnaces now give XP to the last person to modify their inventory instead of the first person to open them
|
||||
+ (Skills) Ability Lengths now have a default skill cap at which they stop increasing in length, configurable in advanced.yml (endurance perks extend this limit)
|
||||
+ (Skills) Added a new subskill to some skills 'Understanding The Art' this adds nothing new, but tracks benefits that increase together that seemed unrelated, which was previously a bit obfuscated.
|
||||
+ (Skills) Tool alerts now are sent to the Action Bar
|
||||
+ (Skills) Super Ability activation alerts are now sent to the Action Bar
|
||||
+ (Skills) Certain Skill messages are now sent to the Action Bar
|
||||
+ (Skills) Added some missing information to skill stats
|
||||
+ (Config) Skill Rank requirements are now defined in skillranks.yml you cannot add or remove ranks from this file
|
||||
+ (Config) Added option to use SSL for MySQL in config.yml
|
||||
+ (Config) Added option to disable the new URL links to config.yml
|
||||
+ (Config) New config file added coreskills.yml
|
||||
+ (Config) Added rank settings for the new Woodcutting skill
|
||||
+ (Config) Added configurable parameters for the new Tree Feller
|
||||
+ (Config) Added retro toggle for Tree Feller
|
||||
+ (Config) Added toggle to disable all scoreboards
|
||||
+ (Chat) Added ability for admins to spy on party chat (off unless toggled on)
|
||||
+ (Commands) Added new info command /mmoinfo or /mcinfo
|
||||
+ (Commands) Added toggle command /mcchatspy
|
||||
+ (API) Added many missing SubSkills to SubSkillType class
|
||||
+ (Permissions) Added permission node mcmmo.commands.mcchatspy & mcmmo.commands.mcchatspy.others
|
||||
+ (Permissions) Added permission nodes for Harvest Lumber, Splinter, Nature's Bounty, and Bark Surgeon
|
||||
+ (Permissions) Added mcmmo.commands.mmoinfo for the new mmoinfo/mcinfo command
|
||||
! (Permissions) Call of the wild now uses mcmmo.ability.taming.callofthewild instead of mcmmo.ability.taming.callofthewild.all
|
||||
+ (Locale) Added locale strings for new Woodcutting abilities
|
||||
+ (Locale) Added locale strings for mcchatspy command
|
||||
+ (Locale) Added locale strings for JSON integration
|
||||
+ (Locale) Added locale strings for Taming's Pummel SubSkill
|
||||
+ (Locale) Added locale strings for Unarmed's Block Cracker SubSkill
|
||||
- (Locale) Removed localizations with the following codes for being almost empty: id, HR_hr, et_EE, lv, lt, no, pl_PL, pt_PT, tr_TR
|
||||
- (Config) Removed SkillShot's IncreaseLevel & IncreasePercentage (replaced by RankDamageMultiplier)
|
||||
- (Config) Removed AxeMastery's MaxBonus & MaxBonusLevel (replaced by RankDamageMultiplier)
|
||||
= (Events) Fixed bug where XP rate could be a negative number
|
||||
= (Experience) Fixed a bug where you could set a players levels into the negative and bad things would happen
|
||||
= (Plugin Compatibility) mcMMO now fires new custom events relating to changes it makes to player scoreboards, plugin authors can listen to these events to improve compatibility
|
||||
= (Items) Chimaera Wing now tracks cooldowns between sessions for players (no more disconnect abuse)
|
||||
= (Skills) Added missing mushroom blocks to experience.yml defaults
|
||||
= (Skills) Tridents will no longer be considered unarmed
|
||||
= (MySQL) You can now inspect offline players
|
||||
= (MySQL) When converting from MySQL to flatfile mcMMO will now properly include all users in the conversion process
|
||||
= (Commands) '/mcMMO help' no longer displays the other/special commands category to players lacking permissions
|
||||
+ (Party) Parties can now have size limits (configurable in config.yml), party size is unlimited by default
|
||||
+ (Party) You can now turn on Friendly Fire for parties in config.yml
|
||||
+ (Debug Stick) The Debug stick can now tell you about properties of a block related to Excavation
|
||||
! (Deaths) Fixed the bug where mob names would be replaced by hearts
|
||||
! (Experience) The XP values of fish are now based on their rarity and have been drastically changed
|
||||
! (Experience) Skills now start at level 1 (configurable in advanced.yml)
|
||||
! (Item) Improved some of the messages sent to the player regarding the Chimaera Wing
|
||||
! (Party) Party member list will only include members of the party that you can see (aren't vanished)
|
||||
! (Skills) Excavation Treasure Hunter is renamed to Archaeology
|
||||
! (Skills) Swords no longer require blocking with a shield to trigger counter attacks
|
||||
! (Skills) Stripping wood and right clicking on stripped wood will no longer ready your Axe
|
||||
! (Skills) Some skill level rank requirements have changed
|
||||
! (Skills) Green Thumb now uses a rank system
|
||||
! (Skills) Farmer's Diet & Fisherman's Diet now use a rank system
|
||||
! (Skills) Fixed an edge case bug where Blast Mining wouldn't inform the player that it was on cooldown
|
||||
! (Skills) mcMMO skills will now be on a scale from 1-100 instead of 0-1000 (for existing mcMMO installs this is opt-in and off by default)
|
||||
! (Skills) Skill Super Powers now use a rank system, almost all of them unlocking first at level 10
|
||||
! (Skills) Acrobatics' Roll exploit detection was tweaked to still allow for Roll to trigger even if it rewards no XP
|
||||
! (Skills) Acrobatics' Roll & Gracefull Roll are now considered the same skill (both mechanics are still there)
|
||||
! (Skills) Woodcutting's Double Drop subskill is now named Harvest Lumber
|
||||
! (Skills) Archery's Skill Shot now uses a rank system
|
||||
! (Skills) Swords' Bleed now uses a rank system
|
||||
! (Skills) Swords' Counter Attack now uses a rank system
|
||||
! (Skills) Axe's Axe Mastery now uses a rank system
|
||||
! (Skills) Axe's Impact now uses a rank system
|
||||
! (Skills) Herbalism's Farmer's Diet now uses a rank system
|
||||
! (Skills) Herbalism's Green Thumb now uses a rank system
|
||||
! (Skills) Shake now uses a rank system
|
||||
! (Skills) Flux Mining now uses a rank system
|
||||
! (Skills) Removed traps from fishing
|
||||
! (Skills) Dodge now uses a rank system
|
||||
! (Skills) Arrow Retrieval now uses a rank system
|
||||
! (Skills) Axes' Critical Strikes now uses a rank system
|
||||
! (Skills) Axes' Greater Impact now uses a rank system
|
||||
! (Skills) Taming's Beast Lore now uses a rank system
|
||||
! (Skills) Taming's Gore now uses a rank system
|
||||
! (Skills) Taming's Call of the Wild now uses a rank system
|
||||
! (Skills) Taming's Pummel now uses a rank system
|
||||
! (Kraken) Removed everything involving the kraken
|
||||
= (Skills) Shake now sends custom damage types for better nocheat compat
|
||||
! (Config) Unarmed.IronArm in advanced.yml is now Unarmed.IronArmStyle
|
||||
! (Config) Unarmed.Deflect in advanced.yml is now Unarmed.ArrowDeflect
|
||||
! (Config) Swords.Counter in advanced.yml is now Swords.CounterAttack
|
||||
! (Config) Archery.Retrieve in advanced.yml is now Archery.ArrowRetrieval
|
||||
! (Config) Axes.CriticalHit in advanced.yml is now Axes.CriticalStrikes
|
||||
! (Config) Archery's Skill Shot now uses RankDamageMultiplier for its damage bonus calculations
|
||||
! (Config) Axe's Axe mastery now uses RankDamageMultiplier for its damage bonus calculations
|
||||
! (Permissions) Replaced the old Double Drop permission node for woodcutting with a new Harvest Lumber permission node
|
||||
! (Permissions) Fast Food Service permission node renamed to mcmmo.ability.taming.fastfoodservice
|
||||
! (Permissions) Counter Attack permission node renamed to mcmmo.ability.swords.counterattack
|
||||
! (Permissions) Arrow Deflect permission node renamed to mcmmo.ability.unarmed.arrowdeflect
|
||||
! (Permissions) Iron Arm Style permission node renamed to mcmmo.ability.unarmed.ironarmstyle
|
||||
! (Permissions) Remove all mob health bar permissions, this is no longer a per-player setting.
|
||||
! (Commands) Removed the mobhealthbar command, this is no longer a per-player setting.
|
||||
! (Locale) The descriptions of a few skills have changed
|
||||
! (Locale) Removed redundant information from some skill names and descriptions en_US (other locales will need to be updated)
|
||||
! (Locale) SubSkill locale keys are now located at {ParentSkill}.SubSkill.SubSkillName
|
||||
! (Locale) Super Abilities no longer have (ABILITY) in their Skill.Effect strings
|
||||
! (API) mcMMO is now built against Spigot-API instead of Bukkit
|
||||
! (API) Moved a lot of methods from SkillCommand to SkillUtils
|
||||
! (API) SkillType is now PrimarySkillType
|
||||
! (API) SecondarySkill is now SubSkillType
|
||||
! (API) AbilityType is now SuperAbilityType
|
||||
! (API) SecondaryAbilityEvent is now SubSkillEvent
|
||||
! (API) SubSkillType has had many helpful methods added to it
|
||||
! (API) GREEN_THUMB_PLANT & GREEN_THUMB_BLOCK are replaced by GREEN_THUMB
|
||||
! (Code) Refactored some unreadable code relating to SecondaryAbilityType activation in SkillUtils
|
||||
|
||||
Version 2.0.0
|
||||
= Fixed an interaction between Tree Feller and Stripped Wood
|
||||
! Fireworks no longer fire by default for ability activation/deactivation
|
||||
! Website has been changed and the MOTD string relating to it reflects this
|
||||
! Discord link added to mcMMO command
|
||||
! Updated misc strings relating to mcMMO
|
||||
|
||||
|
||||
Version 1.5.05-SNAPSHOT
|
||||
|
||||
Version 1.5.04
|
||||
+ Added option to config.yml to control mcMMO generated sound volume
|
||||
+ Added option to config.yml to truncate existing player skill levels that exceed the skill level cap
|
||||
+ Falling blocks persist mcMMO natural data
|
||||
= Woodcutting double drops correctly identify acacia and dark oak logs
|
||||
= Skill Reset command now correctly identifies arguments
|
||||
= Hylian Treasure config options are now actually used
|
||||
= Child skills now use parent skills configured skill caps properly
|
||||
= Auto Update config now properly works
|
||||
! Item dropped from blocks now drop from the center
|
||||
! Potions Config updated for 1.9
|
||||
! Flux mining now simulates a block break event for other plugins to act upon
|
||||
! Zombie Pigmen spawned from nether portals are now considered spawner mobs
|
||||
! Flux Pickaxe lore now appends to existing lore as opposed to replacing it
|
||||
! Party chat no longer displays colors when logged in server console
|
||||
- Treefeller no longer lowers exp for big trees
|
||||
- No longer supports 1.8 :(
|
||||
- Removed plugin metrics
|
||||
|
||||
Version 1.5.03
|
||||
= Fixed bug where absorption hearts could be attacked by allied players
|
||||
= Fixed bug where new forms of stone would drop the wrong type when mined with Silk Touch
|
||||
= Fixed bug where blocks would not get tracked correctly when using sticky pistons and slime blocks in certain situations
|
||||
= Fixed bug where config value for Daze damage was ignored
|
||||
= Fixed UUID updater to not lose data on errors
|
||||
= Fixed bug where uuid update could result in large amounts of user data being deleted
|
||||
= Fixed bug where custom potions were missed in potion stage calculation
|
||||
= Fixed piston dupe bugs permanently
|
||||
= Fixed bug involving user name changes
|
||||
= Fixed old user purge to properly calculate months
|
||||
= Fixed bug where Repair would incorrectly check items
|
||||
= Fixed bug where apostrophes in locale files would not read correctly
|
||||
= Fixed bug where treasure data was limited to 255 instead of Short.MAX_VALUE
|
||||
! Moved more user loading calculations to async loading thread to reduce lag on login
|
||||
|
||||
Version 1.5.02
|
||||
+ Added option to config.yml for Chimaera Wings to stop using bed spawn points
|
||||
+ Added option to config.yml to let non-tools in hand count as unarmed
|
||||
+ Added option to experience.yml to control XP gained by killing bred animals
|
||||
+ Added support for 1.8 mobs and features
|
||||
= Fixed bug where no Mining XP was granted when Flux Mining was successful
|
||||
= Fixed bug with UUID conversions in Flatfile
|
||||
= Fixed a couple Dupe bugs that were introduced recently
|
||||
= Fixed bug where MobHealthbarTypes were not saved between server restarts
|
||||
! Changed Flux Mining mechanics. In order to use the ability, you need to infuse a pickaxe with furnace powers first.
|
||||
! Scoreboard tips are only shown a couple of times to the player, instead of once per login session
|
||||
! Changed Archery distance multiplier to be configurable
|
||||
! Archery distance XP bonus cannot exceed indefinitely anymore
|
||||
|
||||
Version 1.5.01
|
||||
+ Added new child skill; Salvage
|
||||
+ Added UUID support!
|
||||
+ Added SQL connection pooling and async loading!
|
||||
+ Added the long awaited Diminished Returns feature
|
||||
+ Added new feature to Herbalism. Instantly-regrown crops are protected from being broken for 1 second
|
||||
+ Added option to config.yml to show the /mcstats scoreboard automatically after logging in
|
||||
+ Added option to config.yml for Alchemy. Skills.Alchemy.Prevent_Hopper_Transfer_Bottles
|
||||
+ Added option to config.yml for Scoreboards, display "Ability" instead of ability names on the scoreboards
|
||||
+ Added options to experience.yml for Dirt and Sand variations
|
||||
+ Added support for `MATERIAL|data` format in treasures.yml
|
||||
+ Added API to experience events to get XP gain reason
|
||||
+ Added API to check if an entity is bleeding
|
||||
+ Added API to ExperienceAPI to get the amount of XP needed for a level
|
||||
+ Added API class SkillAPI used to get a list of valid skill names
|
||||
+ Added API events for hardcore features, McMMOPlayerPreDeathPenaltyEvent, McMMOPlayerStatLossEvent and McMMOPlayerVampirismEvent
|
||||
+ Added API to ExperienceAPI to specify if XP can be shared
|
||||
+ Added options to tools.yml and armor.yml config files to set a pretty repair material name
|
||||
+ Added full support for repairables in tools.yml and armor.yml config files
|
||||
+ Added magical mod config file import command, for Cauldron 1.7+. Check wiki for usage
|
||||
+ Added particle effects and sounds to "Call of the Wild" (Taming)
|
||||
+ Added summon length to "Call of the Wild". Summons will now commit suicide after their lifespan expires
|
||||
+ Added feature which makes tamed wolves attack a target shot by the owner
|
||||
= Fixed bug where pistons would mess with the block tracking
|
||||
= Fixed bug where the Updater was running on the main thread.
|
||||
= Fixed bug when players would use /ptp without being in a party
|
||||
= Fixed bug where player didn't have a mcMMOPlayer object in AsyncPlayerChatEvent
|
||||
= Fixed bug where dodge would check the wrong player skill level
|
||||
= Fixed bug which causes /party teleport to stop working
|
||||
= Fixed bug where SaveTimerTask would produce an IndexOutOfBoundsException
|
||||
= Fixed bug where Alchemy would not fire BrewEvents
|
||||
= Fixed bug with setting custom names and lore in treasures config
|
||||
= Fixed bug which would cause a NullPointerException with getFlowerAndGrassXp()
|
||||
= Fixed bug which could cause and SQLException regarding the connection property 'maxReconnects'.
|
||||
= Fixed bug where falling blocks were incorrectly tracked
|
||||
= Fixed bug where items would get deleted when in Berserk with a full inventory
|
||||
= Fixed bug where the console would not correctly show party chat colors
|
||||
= Fixed bug where party chat was using non thread safe methods
|
||||
= Fixed bug where Blast Mining unlock levels could be to high in certain occasions
|
||||
= Fixed bug where Blast Minings ability "Demolition Expert" would not work
|
||||
= Fixed bug where Repair_Material_Quantity wasn't read in mod config files
|
||||
! Changed SecondaryAbilityEvent to implement Cancellable and it now gets fired for damage related secondary abilities
|
||||
! Changed the way mcMMO handles bonus damage, updated for the new damage event API
|
||||
! Changed player data saving. Save tasks are now asynchronous
|
||||
! Vanished players no longer get hit by AoE effects
|
||||
! Changed Alchemy config option 'Prevent_Hopper_Transfer' renamed to 'Prevent_Hopper_Transfer_Ingredients'
|
||||
! Changed Alchemy XP distribution. XP is granted based on the stage of the potion.
|
||||
! Changed behavior of the Blast Mining ability "Demolition Expert"; now only decreases damage for the ability user
|
||||
! Updated for new getOnlinePlayers() behavior
|
||||
! Updated for new blocks and entities
|
||||
! Changed McMMOPlayerDeathPenaltyEvent to get fired after hardcore penalty calculations, use McMMOPlayerPreDeathPenaltyEvent for old behavior
|
||||
! Moved Refresh_Chunks setting from hidden.yml to config.yml
|
||||
- Removed salvage ability from Repair, salvage has it's own (child) skill now
|
||||
|
||||
Version 1.5.00
|
||||
+ Added Podzol & Red Sand to Excavation
|
||||
+ Added Hardened Clay, Stained Clay, and Packed Ice to Mining blocks
|
||||
@@ -51,7 +446,7 @@ Version 1.4.08
|
||||
= Fixed bug which prevented players from gaining Acrobatics XP when the setting 'Prevent_XP_After_Teleport' was set to false
|
||||
= Fixed bug where cooldown donor perks were reducing more than expected
|
||||
= Fixed bug where disabling hardcore mode for specific skills didn't work
|
||||
= Fixed bug which caused the backup cleanup to delete old backups while it should have kept those
|
||||
= Fixed bug which caused the net.shatteredlands.shatt.backup cleanup to delete old backups while it should have kept those
|
||||
= Fixed bug where party chat broke if the display name contained special characters
|
||||
= Fixed bug where `/addlevels all` and `/skillreset all` didn't work
|
||||
= Fixed bug which made it possible to gain XP by taming the same horse multiple times, if a player "untamed" that horse
|
||||
@@ -399,7 +794,7 @@ Version 1.4.00
|
||||
! Changed Excavation to have individual XP values for each block type, rather than a base XP value.
|
||||
! Changed the way party teleportation works. When using /ptp, the target player needs to confirm the teleport before it takes place. (Configurable)
|
||||
! Changed BeastLore: Now also displays offline player names
|
||||
! Changed backup task to include ALL config files
|
||||
! Changed net.shatteredlands.shatt.backup task to include ALL config files
|
||||
! Deprecated most functions in ExperienceAPI, replaced them with identical versions that use a String for the SkillName rather than the SkillType enum values
|
||||
! Changed Super Breaker & Giga Drill Breaker to be an enchantment-based boost, rather than an instabreak. Option exists in hidden.yml to change this to an potion-based buff.
|
||||
! Changed locales to fall back on English when translated strings cannot be found.
|
||||
@@ -622,7 +1017,7 @@ Version 1.3.07
|
||||
+ Added permission nodes for Treasure & Magic Hunter for Fishing
|
||||
+ Added a permission node for Farmer's Diet
|
||||
+ Added config options for enabling/disabling specific double drops
|
||||
+ Added automatic zip backup of flatfile database & config files
|
||||
+ Added automatic zip net.shatteredlands.shatt.backup of flatfile database & config files
|
||||
+ Added config options to enable/disable specific skills for PVP & PVE
|
||||
= Fixed bug where Tree Feller was looking at the wrong blocks for determining how much to take down.
|
||||
= Fixed bug where Green Terra consumed seeds even on Mossy Stone Brick
|
||||
@@ -1208,7 +1603,7 @@ Fixed bug with randomly receiving Taming XP
|
||||
mcmmo.users file moved into /plugins/mcMMO/FlatFileStuff/
|
||||
Leaderboard files now moved into /plugins/mcMMO/FlatFileStuff/Leaderboards
|
||||
Locale files now have the prefix locale_ instead of messages_
|
||||
Locale files are now located inside com/gmail/nossr50/locale/ instead of com/gmail/nossr50/
|
||||
Locale files are now located inside com/com.gmail/com.gmail.nossr50/locale/ instead of com/com.gmail/com.gmail.nossr50/
|
||||
Updated the code that handles permissions (this may mean 3.1.6 will finally play well!)
|
||||
Some more source code organization
|
||||
Fixed warnings for compiler
|
||||
|
||||
234
Changelog_2.1.0.md
Normal file
234
Changelog_2.1.0.md
Normal file
@@ -0,0 +1,234 @@
|
||||
# **Version 2.1.0+**
|
||||
|
||||
### Please use Spigot or Paper!
|
||||
|
||||
* **mcMMO is now built against Spigot-API instead of Bukkit**
|
||||
|
||||
### New Level Scaling
|
||||
|
||||
* mcMMO now features an optional 1-100 scaling mode!
|
||||
* This is on by default for new installs, if you are upgrading mcMMO you will be put into Retro Mode instead (1-1000) scaling.
|
||||
* The two scaling modes are the same, the changes are completely cosmetic!
|
||||
* Skill Requirements in the config file will be multiplied by 10 if you are using Retro mode unless the setting has Retro in its name, keep this in mind if you need to edit anything!
|
||||
|
||||
### WorldGuard Support
|
||||
|
||||
* Added support for WorldGuard regions!
|
||||
* `mcmmo` region flag turns on or off a players ability to use anything related to mcMMO other than commands
|
||||
* `mcmmo-xp` region flag turns on or off a player's ability to gain XP
|
||||
* These flags default to on unless you specify otherwise
|
||||
|
||||
### World Blacklist
|
||||
|
||||
* You can now disable mcMMO completely for specific worlds via `world_blacklist.txt` in /plugins/mcMMO/
|
||||
* This file appears once mcMMO has been run at least once
|
||||
* Every line of this file should be the name of a world where you don't want mcMMO to be enabled!
|
||||
|
||||
### Rank System
|
||||
|
||||
* Skills that are not yet unlocked will show up as `???` until learned
|
||||
* Many skills now make use of a rank system!
|
||||
* Rank level requirements are modified in `skillranks.yml`
|
||||
* Woodcutting's Double Drop subskill is now named Harvest Lumber
|
||||
* Archery's Skill Shot now uses a rank system
|
||||
* Swords' Bleed now uses a rank system
|
||||
* Swords' Counter Attack now uses a rank system
|
||||
* Axe's Axe Mastery now uses a rank system
|
||||
* Axe's Impact now uses a rank system
|
||||
* Herbalism's Farmer's Diet now uses a rank system
|
||||
* Herbalism's Green Thumb now uses a rank system
|
||||
* Shake now uses a rank system
|
||||
* Flux Mining now uses a rank system
|
||||
* Removed traps from fishing
|
||||
* Dodge now uses a rank system
|
||||
* Arrow Retrieval now uses a rank system
|
||||
* Axes' Critical Strikes now uses a rank system
|
||||
* Axes' Greater Impact now uses a rank system
|
||||
* Taming's Beast Lore now uses a rank system
|
||||
* Taming's Gore now uses a rank system
|
||||
* Taming's Call of the Wild now uses a rank system
|
||||
* Taming's Pummel now uses a rank system
|
||||
* Green Thumb now uses a rank system
|
||||
* Farmer's Diet & Fisherman's Diet now use a rank system
|
||||
|
||||
### mcMMO Chat Alerts
|
||||
|
||||
* mcMMO no longer spams your chat!
|
||||
* Most messages are sent to your action bar instead!
|
||||
* Completely configurable! You can have mcMMO spam your chat again if you want!
|
||||
* You can configure it so that messages will be sent to your action bar AND your chat system!
|
||||
* Improved some of the messages sent to the player regarding the Chimaera Wing
|
||||
|
||||
### Localization File
|
||||
|
||||
* The descriptions of a few skills have changed
|
||||
* Locale files now support & codes for colors and formatting!
|
||||
* Added locale strings for new Woodcutting abilities
|
||||
* Added locale strings for mcchatspy command
|
||||
* Added locale strings for JSON integration
|
||||
* Added locale strings for Taming's Pummel SubSkill
|
||||
* Added locale strings for Unarmed's Block Cracker SubSkill
|
||||
* Removed localizations with the following codes for being almost empty: `id`, `HR_hr`, `et_EE`, `lv`, `lt`, `no`, `pl_PL`, `pt_PT`, `tr_TR`
|
||||
* Removed redundant information from some skill names and descriptions `en_US` (other locales will need to be updated)
|
||||
* SubSkill locale keys are now located at `{ParentSkill}.SubSkill.SubSkillName`
|
||||
* Super Abilities no longer have `(ABILITY)` in their `Skill.Effect` strings
|
||||
|
||||
### UI
|
||||
|
||||
* Certain elements of mcMMO's UI have been restyled
|
||||
* Skills can now be clicked on and hovered over for more information!
|
||||
* Added links to mcMMO related websites to various commands
|
||||
* Customizeable and optional XP Bars
|
||||
* Added the tagline "Overhaul Era" to various locations until 3.0.0 comes out
|
||||
* Added option to disable the new URL links to `config.yml`
|
||||
|
||||
### Sounds
|
||||
|
||||
* Volume and Pitch of sounds can now be configured in the new `sounds.yml` file
|
||||
|
||||
### Super Ability Changes
|
||||
|
||||
* Skill Super Abilities now use a rank system, the default rank to unlock is level 5
|
||||
* Activating Super abilities plays a sound (other plays can hear this)
|
||||
* Ability Lengths now have a default skill cap at which they stop increasing in length
|
||||
* Setting the cap to 0 removes it!
|
||||
* Configurable in `advanced.yml` (endurance perks extend this limit)
|
||||
|
||||
### Skills
|
||||
|
||||
* mcMMO now notifies you when you progress in a skill!
|
||||
* Excavation Treasure Hunter is renamed to Archaeology
|
||||
* Readying a tool for a super ability now plays a sound
|
||||
* Skill Unlock Notifications have sounds
|
||||
* Stripping wood and right clicking on stripped wood will no longer ready your Axe
|
||||
* Added new skill 'Understanding The Art' which adds nothing new but tracks previously hidden benefits of raising a skill
|
||||
* Tool alerts now are sent to the Action Bar
|
||||
* Super Ability activation alerts are now sent to the Action Bar
|
||||
* Almost all Skill-related messages are now sent to the Action Bar
|
||||
* Added some missing information to skill stats
|
||||
* Swords no longer require blocking with a shield to trigger counter attacks
|
||||
* Sword's Bleed has been renamed to Rupture
|
||||
* Sword's Rupture no longer has an internal hard coded limit
|
||||
* Sword's Serrated Strikes now uses your Rupture rank to determine the damage/ticks for its bleed effect.
|
||||
* Sword's Rupture now ticks four times as fast
|
||||
* Sword's Rupture now refreshes bleed duration instead of adding duration when applying bleed to the same target
|
||||
* Sword's Rupture will now deal lethal damage
|
||||
* Sword's Rupture now reaches its max proc chance at level 20 (200 in Retro)
|
||||
* Sword's Rupture now has a max chance to proc of 33% instead of 70%
|
||||
* Sword's Rupture now deals 50% more damage at above Rank 3 and can last much longer!
|
||||
* The base damage for Bleed has been increased as well (update your `advanced.yml` admins)
|
||||
* Sword's Rupture no longer triggers invincibility frames when damaging your opponent
|
||||
* Sword's Rupture now plays a sound
|
||||
* Taming's Gore now uses Rupture Rank 1 for its DoT calculations
|
||||
* Furnaces now give XP to the last person to modify their inventory instead of the first person to open them
|
||||
* Rolling now plays a sound (Graceful Roll has a different sound :) )
|
||||
* Acrobatics' Roll exploit detection was tweaked to still allow for Roll to trigger even if it rewards no XP
|
||||
* Acrobatics' Roll & Gracefull Roll are now considered the same skill (both mechanics are still there)
|
||||
* Some skill level rank requirements have changed
|
||||
|
||||
### Experience
|
||||
|
||||
* Skills now start at level 1 (configurable in advanced.yml)
|
||||
* Starting an XP event will now use the title API (toggle this in `advanced.yml`)
|
||||
* The XP values of fish are now based on their rarity and have been drastically changed
|
||||
* Coral (blocks) now give Mining XP
|
||||
* Coral (plants) now give Herbalism XP
|
||||
* Blue Ice now gives Mining XP
|
||||
* Dolphins now give combat XP
|
||||
* Drowned mobs now count towards combat XP
|
||||
* Added missing mushroom blocks for XP
|
||||
* You can now set guaranteed minimum values for XP gained if diminishing returns are enabled, this value defaults to 5% (`experience.yml`)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Fixed the bug where mob names would be replaced by hearts
|
||||
* Fixed a bug where Rupture would apply an incorrect amount of bleed ticks
|
||||
* Fixed bug where XP rate could be a negative number
|
||||
* Fixed a bug where you could set a players levels into the negative and bad things would happen
|
||||
* Fixed an edge case bug where Blast Mining wouldn't inform the player that it was on cooldown
|
||||
|
||||
### Plugin Compatibility
|
||||
|
||||
* mcMMO now fires new custom events relating to changes it makes to player scoreboards, plugin authors can listen to these events to improve compatibility
|
||||
|
||||
### Exploit Fixes
|
||||
|
||||
* Prevented exploits involving blocks made from entities (snowmen, etc..)
|
||||
* Chimaera Wing now tracks cooldowns between sessions for players (no more disconnect abuse)
|
||||
* Tridents will no longer be considered unarmed
|
||||
* Prevented exploits involving 2 high herbs and chorus flowers
|
||||
* Vastly Improved the Acrobatics exploit detection checks
|
||||
|
||||
### Parties
|
||||
|
||||
* Parties can now have size limits (configurable in `config.yml`), party size is unlimited by default
|
||||
* You can now turn on Friendly Fire for parties in `config.yml`
|
||||
* Party member list will only include members of the party that you can see (aren't vanished)
|
||||
|
||||
### Scoreboards
|
||||
|
||||
* Scoreboards are now disabled by default since most of their functionality is handled better by XP bars.
|
||||
* Added toggle to disable all scoreboards (previously you had to disable them one by one)
|
||||
* You can turn them back on in `config.yml`
|
||||
* You can have XP bars and scoreboards on at the same time
|
||||
|
||||
### MySQL
|
||||
|
||||
* Added support for SSL for MySQL/MariaDB in config.yml (On by default)
|
||||
* mcMMO no longer spams your console if you are not using SSL for your MySQL server
|
||||
* You can now inspect offline players
|
||||
* When converting from MySQL to flatfile mcMMO will now properly include all users in the conversion process
|
||||
|
||||
### Admins
|
||||
|
||||
* Added ability for admins to spy on party chat (off unless toggled on) /mcchatspy
|
||||
* The Debug stick can now tell you about properties of a block related to Excavation
|
||||
|
||||
### API
|
||||
|
||||
* Detailed guide to API changes is available at http://api.mcmmo.org
|
||||
* Added many missing `SubSkills` to `SubSkillType` class
|
||||
* Moved a lot of methods from `SkillCommand` to `SkillUtils`
|
||||
* `SkillType` is now `PrimarySkillType`
|
||||
* `SecondarySkill` is now `SubSkillType`
|
||||
* `AbilityType` is now `SuperAbilityType`
|
||||
* `SecondaryAbilityEvent` is now `SubSkillEvent`
|
||||
* `SubSkillType` has had many helpful methods added to it
|
||||
* `GREEN_THUMB_PLANT` & `GREEN_THUMB_BLOCK` are replaced by `GREEN_THUMB`
|
||||
|
||||
### Permissions
|
||||
|
||||
* Removed all mob health bar permissions, this is no longer a per-player setting.
|
||||
* Added permission node `mcmmo.commands.mcchatspy` & `mcmmo.commands.mcchatspy.others`
|
||||
* Added `mcmmo.commands.mmoinfo` for the new `mmoinfo`/`mcinfo` command
|
||||
* Added permission nodes for Harvest Lumber, Splinter, Nature's Bounty, and Bark Surgeon
|
||||
* Call of the wild now uses `mcmmo.ability.taming.callofthewild` instead of `mcmmo.ability.taming.callofthewild.all`
|
||||
* Replaced the old Double Drop permission node for woodcutting with a new Harvest Lumber permission node
|
||||
* Fast Food Service permission node renamed to `mcmmo.ability.taming.fastfoodservice`
|
||||
* Counter Attack permission node renamed to `mcmmo.ability.swords.counterattack`
|
||||
* Arrow Deflect permission node renamed to `mcmmo.ability.unarmed.arrowdeflect`
|
||||
* Iron Arm Style permission node renamed to `mcmmo.ability.unarmed.ironarmstyle`
|
||||
|
||||
### Commands
|
||||
|
||||
* Added new info command `/mmoinfo` or `/mcinfo`
|
||||
* Added toggle command `/mcchatspy`
|
||||
* `/mcMMO help` no longer displays the other/special commands category to players lacking permissions
|
||||
* Removed the `mobhealthbar` command, this is no longer a per-player setting.
|
||||
|
||||
### Misc Config Changes
|
||||
|
||||
* Removed `SkillShot`'s `IncreaseLevel` & `IncreasePercentage` (replaced by `RankDamageMultiplier`)
|
||||
* Removed `AxeMastery`'s `MaxBonus` & `MaxBonusLevel` (replaced by `RankDamageMultiplier`)
|
||||
* `Unarmed.IronArm` in `advanced.yml` is now `Unarmed.IronArmStyle`
|
||||
* `Unarmed.Deflect` in `advanced.yml` is now `Unarmed.ArrowDeflect`
|
||||
* `Swords.Counter` in `advanced.yml` is now `Swords.CounterAttack`
|
||||
* `Archery.Retrieve` in `advanced.yml` is now `Archery.ArrowRetrieval`
|
||||
* `Axes.CriticalHit` in `advanced.yml` is now `Axes.CriticalStrikes`
|
||||
* Archery's Skill Shot now uses `RankDamageMultiplier` for its damage bonus calculations
|
||||
* Axe's Axe mastery now uses `RankDamageMultiplier` for its damage bonus calculations
|
||||
|
||||
### Misc Changes
|
||||
|
||||
* Removed everything involving the kraken
|
||||
* Code cleanup in a lot of places... unfortunately there is still much left to do!
|
||||
69
README.md
69
README.md
@@ -1,40 +1,56 @@
|
||||
# mcMMO
|
||||
## The RPG lovers mod
|
||||
|
||||
### Dev builds
|
||||
Our latest development builds are available ~~[here](http://ci.mcmmo.info)~~. Unfortunately, the mcMMO site is down; a temporary dev build location is hosted [here](http://ci.ecocitycraft.com/job/mcMMO/).
|
||||
## Website
|
||||
I'm working on a brand new website for mcMMO
|
||||
|
||||
You can check it out here http://www.mcmmo.org
|
||||
|
||||
I plan to post links to our new wiki (its still under development), downloads, and dev blogs there.
|
||||
|
||||
### Contributing
|
||||
As the plugin is being developed for multiple Minecraft versions, and multiple Minecraft platforms (read: [sponge](https://spongepowered.org/), [spigot](https://spigotmc.org/), bukkit, and [paper](https://papermc.io)), the
|
||||
overall build process is handled by [Gradle](https://gradle.org/) with [Kotlin-dsl](https://github.com/gradle/kotlin-dsl) based scripts.
|
||||
As such, an IDE is strongly recommended when attempting to contribute features, additions, changes, bug fixes, etc. to mcMMO as the scripts handle a
|
||||
majority of our dependencies and rebuilding a production worthy jar.
|
||||
|
||||
To get started, a few things need to be installed:
|
||||
- JDK 8 (not 9, 10, 11, or 7)
|
||||
- git
|
||||
- Your favorite IDE (can be [Eclipse](https://eclipse.org/), [IntelliJ](https://jetbrains.org/)
|
||||
- BuildTools.jar from [Spigot](https://www.spigotmc.org/wiki/buildtools/)
|
||||
|
||||
##### Using BuildTools
|
||||
BuildTools is used to generate the craftbukkit/spigot dependencies used for varoius versions of Minecraft.
|
||||
The key with this tool is that it can build and deploy multiple vesions of Minecraft based on "reviewions".
|
||||
|
||||
|
||||
### Builds
|
||||
Currently, you can obtain our builds via the Spigot resource page: https://spigot.mcmmo.org
|
||||
|
||||
### Brief Description
|
||||
The goal of mcMMO is to take core Minecraft game mechanics and expand them into add an extensive and quality RPG experience. Everything in mcMMO has been carefully thought out and is constantly being improved upon. Currently, mcMMO adds fourteen unique skills to train and level in. Each of these skills is highly customizable through our configuration files, allowing server admins to tweak mcMMO to best suit the needs of his or her server. Know that the mcMMO team is dedicated to providing an ever-evolving experience, and that we carefully read all feedback and bug reports in order to evaluate and balance the mechanics of mcMMO in every update.
|
||||
|
||||
## About the Team
|
||||
|
||||
mcMMO is currently developed by a team of individuals from all over the world.
|
||||
### Glorious Leader
|
||||
[]
|
||||
(https://github.com/gmcferrin)
|
||||
|
||||
### Project Lead & Founder
|
||||
[](https://github.com/com.gmail.nossr50)
|
||||
|
||||
### Former Lead
|
||||
[](https://github.com/gmcferrin)
|
||||
|
||||
### Developers
|
||||
[]
|
||||
(https://github.com/bm01)
|
||||
[]
|
||||
(https://github.com/Glitchfinder)
|
||||
[]
|
||||
(https://github.com/nossr50)
|
||||
[]
|
||||
(https://github.com/NuclearW)
|
||||
[]
|
||||
(https://github.com/shatteredbeam)
|
||||
[]
|
||||
(https://github.com/TfT-02)
|
||||
[]
|
||||
(https://github.com/t00thpick1)
|
||||
[]
|
||||
(https://github.com/riking)
|
||||
[](https://github.com/bm01)
|
||||
[](https://github.com/Glitchfinder)
|
||||
[](https://github.com/NuclearW)
|
||||
[](https://github.com/shatteredbeam)
|
||||
[](https://github.com/TfT-02)
|
||||
[](https://github.com/t00thpick1)
|
||||
[](https://github.com/riking)
|
||||
|
||||
### Special thanks
|
||||
[]
|
||||
(https://github.com/EasyMFnE)
|
||||
[](https://github.com/EasyMFnE)
|
||||
Added the Alchemy skill
|
||||
|
||||
## Compiling
|
||||
@@ -44,8 +60,7 @@ mcMMO uses Maven 3 to manage dependencies, packaging, and shading of necessary c
|
||||
The typical command used to build mcMMO is: `mvn clean package install`
|
||||
|
||||
Required Libraries:
|
||||
* JUnit
|
||||
* EMetrics
|
||||
* Bukkit
|
||||
* JUnit
|
||||
|
||||
http://dev.bukkit.org/server-mods/mcmmo for more up to date information.
|
||||
https://spigot.mcmmo.org for more up to date information.
|
||||
|
||||
139
build.gradle.kts
Normal file
139
build.gradle.kts
Normal file
@@ -0,0 +1,139 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
|
||||
/*
|
||||
* Declares the version of the Gradle wrapper. We need 4.9 for now because
|
||||
* ForgeGradle 3+ is a hard dependency for Gradle 4.9, 4.10 is not compatible
|
||||
*/
|
||||
val wrapper by tasks.getting(Wrapper::class) {
|
||||
gradleVersion = "4.9"
|
||||
}
|
||||
|
||||
/*
|
||||
* Sets up project references to be used in child scripts, like
|
||||
* ":bukkit", ":core", ":sponge" where these projects need to be
|
||||
* referred to for dependencies, paths, outputs etc.
|
||||
* Projects is specifically an object stored in <root>/buildSrc/src/main/java/Config.kt
|
||||
* It's a nullable variable, but we just store it here and use it elsewhere.
|
||||
*/
|
||||
Projects.core = project("core")
|
||||
Projects.bukkit = project("bukkit")
|
||||
Projects.sponge = project("sponge")
|
||||
/*
|
||||
Declares the various other projects and stores them to Gradle's `extra` properties.
|
||||
These are potentially usable for other purposes, but for now, they're here only to
|
||||
declare the values for this root project's dependency (for shadowjar)
|
||||
*/
|
||||
var core: Project by extra { project("core") }
|
||||
val bukkit by extra { project("bukkit") }
|
||||
val bukkit_18 by extra { bukkit.project("1_8_8") }
|
||||
val bukkit_112 by extra { bukkit.project("1_12") }
|
||||
val bukkit_113 by extra { bukkit.project("1_13") }
|
||||
val sponge by extra { project("sponge") }
|
||||
val sponge_7 by extra { sponge.project("api7") }
|
||||
|
||||
group = properties["pluginGroup"]!!
|
||||
version = properties["pluginVersion"]!!
|
||||
|
||||
/*
|
||||
Even though all projects declares some of these plugins, we want to declare them the traditional
|
||||
way so that we can have IDE utiliziation and processing, it helps with writing these scripts.
|
||||
*/
|
||||
plugins {
|
||||
`java-library`
|
||||
`maven-publish`
|
||||
id("com.github.johnrengelman.shadow") version "4.0.4"
|
||||
}
|
||||
|
||||
/*
|
||||
Default management for ALL projects, not just root, or ":bukkit", but all projects and
|
||||
their children projects.
|
||||
*/
|
||||
allprojects {
|
||||
/*
|
||||
We need the java library processing, and shadow allows us to run
|
||||
shadowJar to relocate dependencies and bundle dependencies into a fat jar.
|
||||
*/
|
||||
apply(plugin="java-library")
|
||||
apply(plugin="com.github.johnrengelman.shadow")
|
||||
|
||||
/*
|
||||
Defines all the repositories for all project dependency resolutions. Some of these
|
||||
repositories are meant for specific dependencies, so the content filters will
|
||||
prevent attempts at resolving those dependencies being requested at those repositories.
|
||||
Constants are defined in <root>/buildSrc/src/main/java/Config.kt
|
||||
*/
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven(Repos.sk89q) // WorldEdit/WorldGuard
|
||||
maven(Repos.bstats) // bstats
|
||||
maven(Repos.sponge) // Sponge, Configurate, and some other things
|
||||
maven(Repos.spigot) // Spigot and Bukkit
|
||||
maven(Repos.sonatype) // General Maven
|
||||
mavenLocal() // For nms packages
|
||||
}
|
||||
|
||||
// Sets all projects compatibility level to Java 8
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
// Encoding for all packages is UTF-8
|
||||
tasks.getting(JavaCompile::class) {
|
||||
options.encoding = "UTF-8"
|
||||
}
|
||||
// Default shadow jar configuration. Sub projects will override and add on,
|
||||
// but this sets up at the very least the jdbc connection dependencies to be relocated
|
||||
val shadowJar by tasks.getting(ShadowJar::class) { // Configure basics of relocation
|
||||
relocate(Shadow.Origin.juli, Shadow.Target.juli)
|
||||
relocate(Shadow.Origin.tomcat, Shadow.Target.tomcat)
|
||||
exclude(Shadow.Exclude.ForgeGradle.dummyThing)
|
||||
exclude(Shadow.Exclude.ForgeGradle.template)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
All subprojects shadowjar tasks that will exclude various dependencies, while
|
||||
the root project will include some of these dependencies (like jdbc, configurate)
|
||||
so that the sub project jars are already somewhat minimized, in the event those
|
||||
platform jars are to be deployed individually versus an overall "all platforms"
|
||||
jar.
|
||||
*/
|
||||
subprojects {
|
||||
val shadowJar by tasks.getting(ShadowJar::class) {
|
||||
dependencies {
|
||||
exclude(dependency("${Deps.Groups.sponge}:${Deps.Modules.configurate_yaml}"))
|
||||
exclude(dependency(Shadow.Exclude.guava))
|
||||
exclude(dependency(Shadow.Exclude.snakeyaml))
|
||||
exclude(dependency(Shadow.Exclude.tomcat))
|
||||
exclude(dependency(Shadow.Exclude.juli))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sets up this root project to depend on all the implementations supported.
|
||||
// By default, they all already should have shadow relocations and packaging,
|
||||
// and their dependencies should not be leaking into this project.
|
||||
dependencies {
|
||||
compile(bukkit)
|
||||
compile(sponge)
|
||||
compile(bukkit_18)
|
||||
compile(bukkit_112)
|
||||
compile(bukkit_113)
|
||||
compile(sponge_7)
|
||||
}
|
||||
|
||||
// Configure shadow for the root project, we want to relocate bstats-bukkit
|
||||
// and whatever else is configured in the allProjects configuration
|
||||
val shadowJar by tasks.getting(ShadowJar::class) { // Root shadow relocation
|
||||
|
||||
relocate(Shadow.Origin.bstatsBukkit, Shadow.Target.bstatsBukkit)
|
||||
|
||||
baseName = "mcMMO"
|
||||
classifier = "bundle"
|
||||
}
|
||||
|
||||
// Tell the build task to depend on shadowjar.
|
||||
val build by tasks
|
||||
build.dependsOn(shadowJar)
|
||||
8
buildSrc/build.gradle.kts
Normal file
8
buildSrc/build.gradle.kts
Normal file
@@ -0,0 +1,8 @@
|
||||
plugins {
|
||||
`kotlin-dsl`
|
||||
}
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
|
||||
191
buildSrc/src/main/java/Config.kt
Normal file
191
buildSrc/src/main/java/Config.kt
Normal file
@@ -0,0 +1,191 @@
|
||||
@file:Suppress("MayBeConstant", "unused")
|
||||
|
||||
import org.gradle.api.Project
|
||||
|
||||
object Plugins {
|
||||
const val spongeGradleId = "${Deps.Groups.sponge}.plugin"
|
||||
|
||||
object FG2_3 {
|
||||
const val classpath = "net.minecraftforge.gradle:ForgeGradle:${Versions.fg23}"
|
||||
const val extensionName = "minecraft"
|
||||
const val id = "net.minecraftforge.gradle.forge"
|
||||
}
|
||||
}
|
||||
|
||||
object Repos {
|
||||
const val sk89q = "https://maven.sk89q.com/repo"
|
||||
// bStats
|
||||
const val bstats = "https://repo.codemc.org/repository/maven-public"
|
||||
// configurate
|
||||
const val sponge = "https://repo.spongepowered.org/maven/"
|
||||
const val spigot = "https://hub.spigotmc.org/nexus/content/repositories/snapshots"
|
||||
const val sonatype = "https://oss.sonatype.org/content/repositories/snapshots"
|
||||
const val forge = "https://files.minecraftforge.net/maven/"
|
||||
}
|
||||
|
||||
object Config {
|
||||
|
||||
object Libs {
|
||||
const val configurate = "${Deps.Groups.sponge}:${Deps.Modules.configurate_yaml}:${Versions.configurate}"
|
||||
const val jdbc = "${Deps.Groups.tomcat}:${Deps.Modules.jdbc}:${Versions.jdbc}"
|
||||
const val juli = "${Deps.Groups.tomcat}:${Deps.Modules.juli}:${Versions.jdbc}"
|
||||
const val junitDep = "${Deps.Groups.junit}:${Deps.Modules.junit}:${Versions.junit}"
|
||||
const val flowmath = "${Deps.Groups.flowpowered}:${Deps.Modules.flowmath}:${Versions.flowmath}"
|
||||
|
||||
object Bukkit {
|
||||
object `1_8` {
|
||||
const val api = "$bukkit:${Versions.bukkit18}"
|
||||
const val spigotApi = "${Bukkit.spigotApi}:${Versions.bukkit18}"
|
||||
const val spigot = "$${Bukkit.spigot}:${Versions.bukkit18}"
|
||||
const val nms = "$craftbukkit:${Versions.bukkit18}"
|
||||
// only legacy existed at this point, no core.
|
||||
const val wgLegacy = "${Bukkit.wgLegacy}:${Versions.wg18}"
|
||||
}
|
||||
|
||||
object `1_12` {
|
||||
const val api = "$bukkit:${Versions.bukkit112}"
|
||||
const val spigotApi = "${Bukkit.spigotApi}:${Versions.bukkit112}"
|
||||
const val spigot = "$${Bukkit.spigot}:${Versions.bukkit112}"
|
||||
const val nms = "$craftbukkit:${Versions.bukkit112}"
|
||||
// only legacy existed at this point, no core.
|
||||
const val wgLegacy = "${Bukkit.wgLegacy}:${Versions.wg112}"
|
||||
}
|
||||
|
||||
object `1_13` {
|
||||
const val api = "$bukkit:${Versions.bukkit113}"
|
||||
const val spigotApi = "${Bukkit.spigotApi}:${Versions.bukkit113}"
|
||||
const val spigot = "$${Bukkit.spigot}:${Versions.bukkit113}"
|
||||
const val nms = "$craftbukkit:${Versions.bukkit113}"
|
||||
const val wgCore = "${Bukkit.wgCore}:${Versions.wg113}"
|
||||
const val wgLegacy = "${Bukkit.wgLegacy}:${Versions.wg113}"
|
||||
}
|
||||
|
||||
const val bukkit = "${Deps.Groups.bukkit}:${Deps.Modules.bukkit}"
|
||||
const val craftbukkit = "${Deps.Groups.bukkit}:${Deps.Modules.craftbukkit}"
|
||||
const val wgCore = "${Deps.Groups.worldguard}:${Deps.Modules.wgCore}"
|
||||
const val wgLegacy = "${Deps.Groups.worldguard}:${Deps.Modules.wgLegacy}"
|
||||
const val spigotApi = "${Deps.Groups.spigot}:${Deps.Modules.spigotApi}"
|
||||
const val spigot = "${Deps.Groups.spigot}:${Deps.Modules.spigot}"
|
||||
const val bstats = "${Deps.Groups.bstats}:${Deps.Modules.bstatsBukit}:${Versions.bstats}"
|
||||
}
|
||||
|
||||
object Sponge {
|
||||
object API7 { // All of these are specific to the API7 module, API8 will change
|
||||
const val forgeGradleId = "net.minecraftforge.gradle.forge"
|
||||
const val spongeGradleId = "${Deps.Groups.sponge}.plugin"
|
||||
const val spongeGradleVersion = "0.9.0"
|
||||
const val api = "${Sponge.api}:${Versions.sapi7}"
|
||||
const val common = "${Sponge.common}:${Versions.spongeImpl7}"
|
||||
const val forge_version = "14.23.5.2768"
|
||||
const val minecraftVersion = "1.12.2-$forge_version"
|
||||
const val mappings = "snapshot_20180808"
|
||||
}
|
||||
|
||||
object Exclude {
|
||||
const val group = Deps.Groups.sponge
|
||||
const val module = Deps.Modules.spongeAPI
|
||||
}
|
||||
|
||||
const val api = "${Deps.Groups.sponge}:${Deps.Modules.spongeAPI}"
|
||||
const val common = "${Deps.Groups.sponge}:${Deps.Modules.spongecommon}"
|
||||
const val bstats = "${Deps.Groups.bstats}:${Deps.Modules.bstatsSponge}:${Versions.bstats}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object Deps {
|
||||
object Groups {
|
||||
const val nossr = "com.gmail.nossr50"
|
||||
const val google = "com.google"
|
||||
const val guava = "com.google.guava"
|
||||
const val gson = "com.google.code.gson"
|
||||
const val yaml = "org.yaml"
|
||||
const val sk89q = "com.sk89q"
|
||||
const val apache = "org.apache"
|
||||
const val worldguard = "$sk89q.worldguard"
|
||||
const val worldedit = "$sk89q.worldedit"
|
||||
const val sponge = "org.spongepowered"
|
||||
const val spigot = "org.spigotmc"
|
||||
const val md5 = "net.md_5"
|
||||
const val bukkit = "org.bukkit"
|
||||
const val bstats = "org.bstats"
|
||||
const val tomcat = "org.apache.tomcat"
|
||||
const val junit = "junit"
|
||||
const val checker = "org.checkerframework"
|
||||
const val flowpowered = "com.flowpowered"
|
||||
}
|
||||
|
||||
object Modules {
|
||||
const val guava = "guava"
|
||||
const val gson = "gson"
|
||||
const val snakeyaml = "snakeyaml"
|
||||
const val wgCore = "worldguard-core"
|
||||
const val wgLegacy = "worldguard-legacy"
|
||||
const val bungeecordChat = "bungeecord-chat"
|
||||
const val spongeAPI = "spongeapi"
|
||||
const val spongecommon = "spongecommon"
|
||||
const val spongeforge = "spongeforge"
|
||||
const val spongevanilla = "spongevanilla"
|
||||
const val bukkit = "bukkit"
|
||||
const val craftbukkit = "craftbukkit"
|
||||
const val bstatsBukit = "bstats-bukkit"
|
||||
const val bstatsSponge = "bstats-sponge"
|
||||
const val spigotApi = "spigot-api"
|
||||
const val spigot = "spigot"
|
||||
const val configurate = "configurate"
|
||||
const val configurate_core = "${configurate}-core"
|
||||
const val configurate_yaml = "${configurate}-yaml"
|
||||
const val jdbc = "tomcat-jdbc"
|
||||
const val juli = "tomcat-juli"
|
||||
const val junit = "junit"
|
||||
const val checker = "checker-qual"
|
||||
const val flowmath = "flow-math"
|
||||
}
|
||||
}
|
||||
|
||||
object Projects {
|
||||
var core: Project? = null
|
||||
var bukkit: Project? = null
|
||||
var sponge: Project? = null
|
||||
}
|
||||
|
||||
object Shadow {
|
||||
object Origin {
|
||||
const val juli = "${Deps.Groups.apache}.juli"
|
||||
const val tomcat = "${Deps.Groups.apache}.tomcat"
|
||||
const val apache = "${Deps.Groups.apache}.commons.logging"
|
||||
const val bstatsBukkit = "${Deps.Groups.bstats}.bukkit"
|
||||
const val configurate = "ninja.leaping.configurate"
|
||||
const val checker = "org.checkerframework"
|
||||
}
|
||||
|
||||
object Target {
|
||||
const val juli = "${Deps.Groups.nossr}.database.tomcat.juli"
|
||||
const val tomcat = "${Deps.Groups.nossr}.database.tomcat"
|
||||
const val apache = "${Deps.Groups.nossr}.commons.logging"
|
||||
const val bstatsBukkit = "${Deps.Groups.nossr}.metrics.bstat"
|
||||
const val configurate = "${Deps.Groups.nossr}.${Deps.Modules.configurate}"
|
||||
const val checker = "${Deps.Groups.nossr}.${Deps.Modules.configurate}.checkerframework"
|
||||
}
|
||||
|
||||
object Exclude {
|
||||
const val tomcat = "${Deps.Groups.tomcat}:${Deps.Modules.jdbc}"
|
||||
const val juli = "${Deps.Groups.apache}:${Deps.Modules.juli}"
|
||||
const val guava = "${Deps.Groups.guava}:${Deps.Modules.guava}"
|
||||
const val snakeyaml = "${Deps.Groups.yaml}:${Deps.Modules.snakeyaml}"
|
||||
const val bukkit = Deps.Groups.bukkit
|
||||
const val spigot = Deps.Groups.spigot
|
||||
const val sk89q = "com.sk89q"
|
||||
const val wg = "$sk89q.worldguard"
|
||||
const val intake = "$sk89q.intake"
|
||||
const val flyway = "com.flywaydb"
|
||||
const val khelekore = "org.khelekore"
|
||||
const val findbugs = "com.google.code.findbugs"
|
||||
const val bstats = "${Deps.Groups.bstats}"
|
||||
|
||||
object ForgeGradle {
|
||||
const val dummyThing = "dummyThing"
|
||||
const val template = "Version.java.template"
|
||||
}
|
||||
}
|
||||
}
|
||||
16
buildSrc/src/main/java/Versions.kt
Normal file
16
buildSrc/src/main/java/Versions.kt
Normal file
@@ -0,0 +1,16 @@
|
||||
object Versions {
|
||||
const val configurate = "3.6" // Latest configurate
|
||||
const val flowmath = "1.0.4-SNAPSHOT"
|
||||
const val bukkit18 = "1.8.8-R0.1-SNAPSHOT" // Last bukkit 1.8.8
|
||||
const val bukkit112 = "1.12.2-R0.1-SNAPSHOT" // Last bukkit 1.12.2
|
||||
const val bukkit113 = "1.13.2-R0.1-SNAPSHOT" // Latest bukkit
|
||||
const val sapi7 = "7.1.0" // Latest SpongeAPI stable
|
||||
const val spongeImpl7 = "7.1.5" // Latest SpongeCommon stable
|
||||
const val jdbc = "7.0.52"
|
||||
const val junit = "4.12"
|
||||
const val fg23 = "2.3-SNAPSHOT" // ForgeGradle to support MC 1.12.2
|
||||
const val wg18 = "6.1.2" // Bukkit/CraftBukkit/Spigot 1.8.8 supported build, works on newer, but last one to support 1.8.8
|
||||
const val wg112 = "6.2" // Last WorldGuard to support 1.12
|
||||
const val wg113 = "7.0.0-SNAPSHOT" // Latest WorldGuard to support 1.13.2
|
||||
const val bstats = "1.4" // Supports all backwards compatible. Always relocated
|
||||
}
|
||||
27
bukkit/1_12/build.gradle.kts
Normal file
27
bukkit/1_12/build.gradle.kts
Normal file
@@ -0,0 +1,27 @@
|
||||
import Config.Libs.Bukkit.`1_12` as Bukkit
|
||||
// Config is located in <root>/buildSrc/src/main/java/Config.kt
|
||||
// It provides a bunch of constant values we use as dependency
|
||||
// strings, so we don't have to duplicate a bunch of them in
|
||||
// various scripts.
|
||||
|
||||
plugins {
|
||||
java // This is already provided, but for static compilation,
|
||||
// we declare it here so we can use the IDE static type references
|
||||
}
|
||||
|
||||
/*
|
||||
Dependency inheritance is as follows
|
||||
- ":core", which provides
|
||||
configurate, tomcat jdbc/juli, and flowmath. It excludes sub
|
||||
dependencies like guava and apache commons lang.
|
||||
- ":bukkit", which provides nothing on it's own, except the
|
||||
core bukkit classes that can be built on 1.13.2 API (which may change).
|
||||
It also defines all subprojects to depend on ":core", and ":bukkit",
|
||||
and bstats-bukkit.
|
||||
*/
|
||||
dependencies {
|
||||
compileOnly(Bukkit.api) // Bukkit API for 1.12.2
|
||||
compileOnly(Bukkit.nms) // CraftBukkit for 1.12.2
|
||||
compileOnly(Bukkit.wgLegacy) // WorldGuard for 1.12.2 bukkit
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.gmail.nossr50.bukkit.v1_12;
|
||||
|
||||
import com.gmail.nossr50.VersionedHandler;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import net.minecraft.server.v1_12_R1.Chunk;
|
||||
import net.minecraft.server.v1_12_R1.EntityTypes;
|
||||
import net.minecraft.server.v1_12_R1.IBlockData;
|
||||
import net.minecraft.server.v1_12_R1.IBlockState;
|
||||
import net.minecraft.server.v1_12_R1.MinecraftKey;
|
||||
import net.minecraft.server.v1_12_R1.RegistryBlocks;
|
||||
import net.minecraft.server.v1_12_R1.RegistryMaterials;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.CraftChunk;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.block.CraftBlockState;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class NmsHandler extends VersionedHandler {
|
||||
/**
|
||||
* Static reference to the block registry. Don't really care about the fact that
|
||||
* it is being stored as a reference here, but for imports reasons, it's smaller
|
||||
* line length makes it optimal to read for method usages.
|
||||
*/
|
||||
private static final RegistryBlocks<MinecraftKey, net.minecraft.server.v1_12_R1.Block> BLOCK_REGISTRY = net.minecraft.server.v1_12_R1.Block.REGISTRY;
|
||||
/**
|
||||
* We can keep track of block state id's by generating them on demand, i.e., when
|
||||
* they're being requested from Blocks, or BlockDatas.
|
||||
*/
|
||||
private static final RegistryMaterials<MinecraftKey, IBlockData> BLOCK_STATE_REGISTRY = new RegistryMaterials<>();
|
||||
|
||||
NmsHandler(mcMMO plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdFor(Block block) {
|
||||
// We have to get the underlying nms block by the block, which might as well just be the type id.
|
||||
final Chunk chunk = ((CraftChunk) block.getChunk()).getHandle();
|
||||
// Get the block state from the underlying chunk (stored by reference in CraftBlock)
|
||||
final IBlockData blockState = chunk.a(block.getX(), block.getY(), block.getZ());
|
||||
// Sadly, Mojang doesn't store the string id onto blocks, states, or any of their types, they just call the registry.
|
||||
final MinecraftKey key = BLOCK_REGISTRY.b(blockState.getBlock());
|
||||
return key.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdFor(Entity entity) {
|
||||
// Every entity knows it's "type". Here, we just use the right method getter to get the EntityTypes instance for that entity
|
||||
final net.minecraft.server.v1_12_R1.Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||
// And then... well. we get the string id from the registry, based on the entity class to id mapping in EntityTypes.
|
||||
final MinecraftKey key = EntityTypes.a(nmsEntity);
|
||||
// If the key is null, well, we've got bigger problems...
|
||||
return key == null ? "minecraft:slime" : key.toString();
|
||||
}
|
||||
|
||||
@SuppressWarnings("Duplicates")
|
||||
@Override
|
||||
public String getIdFor(BlockState block) {
|
||||
// Since we don't really want to trust what "BlockState" gives us, and the API doesn't give us anything but
|
||||
// what the API wants to give us, we have to dig into internals to get the true BlockState representation
|
||||
final CraftBlockState craftState = (CraftBlockState) block;
|
||||
// Because CraftBlock also stores the chunk reference, we can short cut in to use the chunk, instead of pinging
|
||||
// the chunk map on WorldServer
|
||||
final CraftChunk craftChunk = (CraftChunk) craftState.getChunk();
|
||||
// Then query for the block state from the chunk.
|
||||
final IBlockData nmsState = craftChunk.getHandle().a(block.getX(), block.getY(), block.getZ());
|
||||
// And then we're gucci
|
||||
final net.minecraft.server.v1_12_R1.Block nmsBlock = nmsState.getBlock();
|
||||
final MinecraftKey blockKey = BLOCK_REGISTRY.b(nmsBlock);
|
||||
// Now we can check if our blockstate registry actually has the block state.
|
||||
final MinecraftKey stateKey = BLOCK_STATE_REGISTRY.b(nmsState);
|
||||
if (stateKey != null) { // If the state has been registered by the handler, then by all means.
|
||||
return stateKey.toString();
|
||||
}
|
||||
// If not, well, it needs to have a key generated and registered.
|
||||
final String nameSpace = blockKey.getKey();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append(nameSpace); // We only want to get the block id, not the domain id, since that's going to be appended later
|
||||
|
||||
// Get the full Property -> Value mapping for the block state
|
||||
final ImmutableMap<IBlockState<?>, Comparable<?>> properties = nmsState.t();
|
||||
if (!properties.isEmpty()) {
|
||||
builder.append('[');
|
||||
Joiner joiner = Joiner.on(',');
|
||||
List<String> propertyValues = new ArrayList<>();
|
||||
// Yadadadada, go through all property entries and add each as a string for the "propertyName=value" (like "variant=oak")
|
||||
for (Map.Entry<IBlockState<?>, Comparable<?>> entry : properties.entrySet()) {
|
||||
// a() gets the inputted "name" for the state, the value, well, that gets the value, which is always toStringable.
|
||||
propertyValues.add(entry.getKey().a() + "=" + entry.getValue());
|
||||
}
|
||||
builder.append(joiner.join(propertyValues));
|
||||
builder.append(']');
|
||||
}
|
||||
// Now we can make the MinecraftKey...
|
||||
final MinecraftKey newKey = new MinecraftKey(builder.toString());
|
||||
BLOCK_STATE_REGISTRY.a(newKey, nmsState);
|
||||
return newKey.toString();
|
||||
}
|
||||
}
|
||||
27
bukkit/1_13/build.gradle.kts
Normal file
27
bukkit/1_13/build.gradle.kts
Normal file
@@ -0,0 +1,27 @@
|
||||
import Config.Libs.Bukkit.`1_13` as Bukkit
|
||||
// Config is located in <root>/buildSrc/src/main/java/Config.kt
|
||||
// It provides a bunch of constant values we use as dependency
|
||||
// strings, so we don't have to duplicate a bunch of them in
|
||||
// various scripts. The import allows us to "import as" for shorthand
|
||||
|
||||
plugins {
|
||||
`java-library` // This is already provided, but for static compilation,
|
||||
// we declare it here so we can use the IDE static type references
|
||||
}
|
||||
|
||||
/*
|
||||
Dependency inheritance is as follows
|
||||
- ":core", which provides
|
||||
configurate, tomcat jdbc/juli, and flowmath. It excludes sub
|
||||
dependencies like guava and apache commons lang.
|
||||
- ":bukkit", which provides nothing on it's own, except the
|
||||
core bukkit classes that can be built on 1.13.2 API (which may change).
|
||||
It also defines all subprojects to depend on ":core", and ":bukkit",
|
||||
and bstats-bukkit.
|
||||
*/
|
||||
dependencies {
|
||||
compileOnly(Bukkit.api) // Bukkit API for 1.13.2 - Defined in <root>/buildSrc/src/main/java/Config.kt
|
||||
compileOnly(Bukkit.nms) // CraftBukkit-1.13.2-R0.1-SNAPSHOT - Defined in <root>/buildSrc/src/main/java/Config.kt
|
||||
compileOnly(Bukkit.wgCore) // WorldGuard-core - Defined in <root>/buildSrc/src/main/java/Config.kt
|
||||
compileOnly(Bukkit.wgLegacy) // WorldGuard-legacy - Defined in <root>/buildSrc/src/main/java/Config.kt
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.gmail.nossr50.bukkit.v1_13;
|
||||
|
||||
import com.gmail.nossr50.VersionedHandler;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import net.minecraft.server.v1_13_R2.EntityTypes;
|
||||
import net.minecraft.server.v1_13_R2.IBlockData;
|
||||
import net.minecraft.server.v1_13_R2.IBlockState;
|
||||
import net.minecraft.server.v1_13_R2.IRegistry;
|
||||
import net.minecraft.server.v1_13_R2.MinecraftKey;
|
||||
import net.minecraft.server.v1_13_R2.RegistryMaterials;
|
||||
import net.minecraft.server.v1_13_R2.WorldServer;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.craftbukkit.v1_13_R2.block.CraftBlock;
|
||||
import org.bukkit.craftbukkit.v1_13_R2.block.CraftBlockState;
|
||||
import org.bukkit.craftbukkit.v1_13_R2.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class NmsHandler extends VersionedHandler {
|
||||
|
||||
private static final IRegistry<net.minecraft.server.v1_13_R2.Block> BLOCK_REGISTRY = IRegistry.BLOCK;
|
||||
private static final IRegistry<EntityTypes<?>> ENTITY_REGISTRY = IRegistry.ENTITY_TYPE;
|
||||
/**
|
||||
* We use {@link RegistryMaterials} because we don't want to default to another block state,
|
||||
* if a {@link IBlockData} is not registered, we need to generate an ID and register that key to
|
||||
* that {@link IBlockData}. By default, this should be populated during plugin startup by
|
||||
* calling some init method, but that will be determined later.
|
||||
*/
|
||||
private static final IRegistry<IBlockData> BLOCK_STATE_REGISTRY = new RegistryMaterials<>();
|
||||
|
||||
NmsHandler(mcMMO plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdFor(Block block) {
|
||||
// We have to get the underlying nms block by the block, which might as well just be the type id.
|
||||
final WorldServer world = ((CraftBlock) block).getCraftWorld().getHandle();
|
||||
// The registry.c(T) will return MinecraftKey, and the toString() returns the "$mod:$name", so "minecraft:stone"
|
||||
final IBlockData blockState = world.getType(((CraftBlock) block).getPosition());
|
||||
// Sadly, Mojang doesn't store the string id onto blocks, states, or any of their types, they just call the registry.
|
||||
final MinecraftKey key = BLOCK_REGISTRY.getKey(blockState.getBlock());
|
||||
// Sometimes, there's a rare case with mods where the key is going to be null, but should never happen in bukkit/spigot.
|
||||
return key == null ? "minecraft:air" : key.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdFor(Entity entity) {
|
||||
// Every entity knows it's "type". Here, we just use the right method getter to get the EntityTypes instance for that entity
|
||||
final EntityTypes<?> entityType = ((CraftEntity) entity).getHandle().P();
|
||||
// And then... well. we get the string id from the registry!
|
||||
final MinecraftKey key = ENTITY_REGISTRY.getKey(entityType);
|
||||
// If the key is null, well, we've got bigger problems...
|
||||
return key == null ? "minecraft:slime" : key.toString();
|
||||
}
|
||||
|
||||
@SuppressWarnings("Duplicates")
|
||||
@Override
|
||||
public String getIdFor(BlockState block) {
|
||||
// Much like #getIdFor(Block) except here we have the "state" by numerical id. So.. we have to grab it from
|
||||
// the world.
|
||||
final CraftBlockState craftState = (CraftBlockState) block;
|
||||
final IBlockData nmsState = craftState.getHandle();
|
||||
final net.minecraft.server.v1_13_R2.Block nmsBlock = nmsState.getBlock();
|
||||
final MinecraftKey blockKey = BLOCK_REGISTRY.getKey(nmsBlock);
|
||||
// Now we can check if our blockstate registry actually has the block state.
|
||||
final MinecraftKey stateKey = BLOCK_STATE_REGISTRY.getKey(nmsState);
|
||||
if (stateKey != null) { // If the state has been registered by the handler, then by all means.
|
||||
return stateKey.toString();
|
||||
}
|
||||
// If not, well, it needs to have a key generated and registered.
|
||||
final String nameSpace = blockKey.getKey();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append(nameSpace); // We only want to get the block id, not the domain id, since that's going to be appended later
|
||||
|
||||
// Get the full Property -> Value mapping for the block state
|
||||
final ImmutableMap<IBlockState<?>, Comparable<?>> properties = nmsState.getStateMap();
|
||||
if (!properties.isEmpty()) {
|
||||
builder.append('[');
|
||||
Joiner joiner = Joiner.on(',');
|
||||
List<String> propertyValues = new ArrayList<>();
|
||||
// Yadadadada, go through all property entries and add each as a string for the "propertyName=value" (like "variant=oak")
|
||||
for (Map.Entry<IBlockState<?>, Comparable<?>> entry : properties.entrySet()) {
|
||||
// a() gets the inputted "name" for the state, the value, well, that gets the value, which is always toStringable.
|
||||
propertyValues.add(entry.getKey().a() + "=" + entry.getValue());
|
||||
}
|
||||
builder.append(joiner.join(propertyValues));
|
||||
builder.append(']');
|
||||
}
|
||||
// Now we can make the MinecraftKey...
|
||||
final MinecraftKey newKey = new MinecraftKey(builder.toString());
|
||||
BLOCK_STATE_REGISTRY.a(newKey, nmsState);
|
||||
return newKey.toString();
|
||||
}
|
||||
}
|
||||
23
bukkit/1_8_8/build.gradle.kts
Normal file
23
bukkit/1_8_8/build.gradle.kts
Normal file
@@ -0,0 +1,23 @@
|
||||
import Config.Libs.Bukkit.`1_8` as Bukkit
|
||||
|
||||
plugins {
|
||||
java
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Dependency inheritance is as follows
|
||||
- ":core", which provides
|
||||
configurate, tomcat jdbc/juli, and flowmath. It excludes sub
|
||||
dependencies like guava and apache commons lang.
|
||||
- ":bukkit", which provides nothing on it's own, except the
|
||||
core bukkit classes that can be built on 1.13.2 API (which may change).
|
||||
It also defines all subprojects to depend on ":core", and ":bukkit",
|
||||
and bstats-bukkit.
|
||||
*/
|
||||
dependencies {
|
||||
compileOnly(Bukkit.api) // Bukkit API for 1.8.8 - Defined in <root>/buildSrc/src/main/java/Config.kt
|
||||
compileOnly(Bukkit.nms) // CraftBukkit-1.8.8-R0.3-SNAPSHOT - Defined in <root>/buildSrc/src/main/java/Config.kt
|
||||
compileOnly(Bukkit.wgLegacy) // Old worldguard - Defined in <root>/buildSrc/src/main/java/Config.kt
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.gmail.nossr50.bukkit.v1_8;
|
||||
|
||||
import com.gmail.nossr50.VersionedHandler;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import net.minecraft.server.v1_8_R3.Blocks;
|
||||
import net.minecraft.server.v1_8_R3.EntityTypes;
|
||||
import net.minecraft.server.v1_8_R3.IBlockData;
|
||||
import net.minecraft.server.v1_8_R3.IBlockState;
|
||||
import net.minecraft.server.v1_8_R3.MinecraftKey;
|
||||
import net.minecraft.server.v1_8_R3.RegistryBlocks;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@SuppressWarnings({"unused", "Duplicates"}) // We use reflection to load this handler on 1.8 versions
|
||||
public class NmsHandler extends VersionedHandler {
|
||||
|
||||
/**
|
||||
* Static reference to the block registry. Don't really care about the fact that
|
||||
* it is being stored as a reference here, but for imports reasons, it's smaller
|
||||
* line length makes it optimal to read for method usages.
|
||||
*/
|
||||
private static final RegistryBlocks<MinecraftKey, net.minecraft.server.v1_8_R3.Block> BLOCK_REGISTRY = net.minecraft.server.v1_8_R3.Block.REGISTRY;
|
||||
/**
|
||||
* We can keep track of block state id's by generating them on demand, i.e., when
|
||||
* they're being requested from Blocks, or BlockDatas.
|
||||
*/
|
||||
private static final RegistryBlocks<MinecraftKey, IBlockData> BLOCK_STATE_REGISTRY = new RegistryBlocks<>(BLOCK_REGISTRY.c(Blocks.AIR)); // Default to AIR
|
||||
|
||||
NmsHandler(mcMMO plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdFor(Block block) {
|
||||
// We have to get the underlying nms block by the block, which might as well just be the type id.
|
||||
final net.minecraft.server.v1_8_R3.Block block1 = CraftMagicNumbers.getBlock(block);
|
||||
// The registry.c(T) will return MinecraftKey, and the toString() returns the "$mod:$name", so "minecraft:stone"
|
||||
final MinecraftKey key = BLOCK_REGISTRY.c(block1);
|
||||
return key.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdFor(Entity entity) {
|
||||
// EntityTypes maintains the maps of Class<? extends nms.Entity> to String for id's and to numerical id numbers.
|
||||
// We of course are using the method that gets us the String id of the entity, such as "minecraft:creeper"
|
||||
return EntityTypes.b(((CraftEntity) entity).getHandle());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdFor(BlockState block) {
|
||||
// Much like #getIdFor(Block) except here we have the "state" by numerical id. So.. we have to grab it from
|
||||
// the world.
|
||||
final net.minecraft.server.v1_8_R3.Block nmsBlock = net.minecraft.server.v1_8_R3.Block.REGISTRY.a(block.getTypeId());
|
||||
final MinecraftKey blockKey = net.minecraft.server.v1_8_R3.Block.REGISTRY.c(nmsBlock);
|
||||
final IBlockData blockState = nmsBlock.fromLegacyData(block.getRawData());
|
||||
// Now we can check if our blockstate registry actually has the block state.
|
||||
final MinecraftKey stateKey = BLOCK_STATE_REGISTRY.c(blockState);
|
||||
if (stateKey != null) { // If the state has been registered by the handler, then by all means.
|
||||
return stateKey.toString();
|
||||
}
|
||||
// If not, well, it needs to have a key generated and registered.
|
||||
final String nameSpace = blockKey.a();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append(blockKey.a()); // We only want to get the block id, not the domain id, since that's going to be appended later
|
||||
|
||||
// Get the full Property -> Value mapping for the block state
|
||||
final ImmutableMap<IBlockState, Comparable> properties = blockState.b();
|
||||
if (!properties.isEmpty()) {
|
||||
builder.append('[');
|
||||
Joiner joiner = Joiner.on(',');
|
||||
List<String> propertyValues = new ArrayList<>();
|
||||
for (Map.Entry<IBlockState, Comparable> entry : properties.entrySet()) {
|
||||
// a() gets the inputted "name" for the state, the value, well, that gets the value, which is always toStringable.
|
||||
propertyValues.add(entry.getKey().a() + "=" + entry.getValue());
|
||||
}
|
||||
builder.append(joiner.join(propertyValues));
|
||||
builder.append(']');
|
||||
}
|
||||
// Now we can make the MinecraftKey...
|
||||
final MinecraftKey newKey = new MinecraftKey(builder.toString());
|
||||
BLOCK_STATE_REGISTRY.a(newKey, blockState);
|
||||
return newKey.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.gmail.nossr50.platform.bukkit;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.block.CraftBlock;
|
||||
|
||||
public class Testing18 {
|
||||
|
||||
Material material;
|
||||
|
||||
CraftBlock block;
|
||||
|
||||
}
|
||||
77
bukkit/build.gradle.kts
Normal file
77
bukkit/build.gradle.kts
Normal file
@@ -0,0 +1,77 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import Config.Libs.Bukkit as Bukkit
|
||||
// Config is located in <root>/buildSrc/src/main/java/Config.kt
|
||||
// It provides a bunch of constant values we use as dependency
|
||||
// strings, so we don't have to duplicate a bunch of them in
|
||||
// various scripts. The import as allows for shorthand.
|
||||
|
||||
val bukkit: Project = Projects.bukkit!! // Static project references
|
||||
val core: Project = Projects.core!! // Stored by Config.kt and created in <root>/build.gradle.kts
|
||||
|
||||
/* This configures ":bukkit" and it's dependent projects:
|
||||
- ":bukkit:1_8_8"
|
||||
- ":bukkit:1_12"
|
||||
- ":bukkit:1_13"
|
||||
Basically sets up all projects to depend on ":core" and
|
||||
bstats-bukkit. Also sets up shadow to relocate bukkit related
|
||||
packages to limit platform interference
|
||||
*/
|
||||
allprojects {
|
||||
|
||||
dependencies {
|
||||
compile(core) // includes junit for tests
|
||||
implementation(Bukkit.bstats) // Bukkit bstats
|
||||
}
|
||||
|
||||
// TODO dunno if this works yet... project needs to compile.
|
||||
val shadowJar by tasks.getting(ShadowJar::class) {
|
||||
// Relocate bstats for bukkit, as per requirement for bstats
|
||||
relocate(Shadow.Origin.bstatsBukkit, Shadow.Target.bstatsBukkit)
|
||||
// Relocate the bukkit platform classes of mcmmo so we don't
|
||||
// interfere with other platform classes (or core)
|
||||
relocate(Deps.Groups.nossr, "${Deps.Groups.nossr}.bukkit") {
|
||||
exclude("${Deps.Groups.nossr}.core")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Tells all subprojects of ":bukkit" (":bukkit:1_8_8", ":bukkit:1_12",etc.)
|
||||
// to depend on this project (":bukkit") to inherit the dependencies, and
|
||||
// does NOT inherit the same configurations (anything configured outside
|
||||
// here does not persist to child projects).
|
||||
subprojects {
|
||||
dependencies {
|
||||
// Provide the base bukkit plugin dependency for plugin classloading.
|
||||
// All "versioned" implementations will be properly classloaded by the bukkit parent
|
||||
compileOnly(bukkit)
|
||||
}
|
||||
}
|
||||
plugins {
|
||||
`java-library` // This is already provided, but for static compilation,
|
||||
// we declare it here so we can use the IDE static type references
|
||||
}
|
||||
dependencies {
|
||||
// Temporary dependencies while things are being moved.
|
||||
compileOnly(Bukkit.`1_13`.spigotApi) { // Spigot API for generic usage. Based on 1.13.2
|
||||
isTransitive = true // We don't want the dependencies
|
||||
}
|
||||
compileOnly(Bukkit.`1_13`.api) { // Bukkit API for generic usage. Based on 1.13.2
|
||||
isTransitive = true // We don't want the dependencies
|
||||
|
||||
}
|
||||
compileOnly(Bukkit.`1_13`.wgCore) { // WorldGuard dependency, again, for 1.13.2
|
||||
isTransitive = true // We don't want the dependencies
|
||||
exclude(group = Shadow.Exclude.sk89q)
|
||||
exclude(group = Shadow.Exclude.intake, module = "intake")
|
||||
exclude(group = Shadow.Exclude.sk89q, module = "squirrelid")
|
||||
exclude(group = Shadow.Exclude.flyway)
|
||||
exclude(group = Shadow.Exclude.khelekore)
|
||||
exclude(group = Shadow.Exclude.findbugs)
|
||||
}
|
||||
compileOnly(Bukkit.`1_13`.wgLegacy) {
|
||||
isTransitive = true // We don't want the dependencies
|
||||
exclude(group = Shadow.Exclude.bukkit)
|
||||
exclude(group = Shadow.Exclude.sk89q, module = "commandbook")
|
||||
exclude(group = Shadow.Exclude.bstats)
|
||||
}
|
||||
}
|
||||
12
bukkit/src/main/java/com/gmail/nossr50/BukkitBlockType.java
Normal file
12
bukkit/src/main/java/com/gmail/nossr50/BukkitBlockType.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
public class BukkitBlockType {
|
||||
|
||||
private Material material;
|
||||
|
||||
private BlockData blockData;
|
||||
|
||||
}
|
||||
74
bukkit/src/main/java/com/gmail/nossr50/VersionedHandler.java
Normal file
74
bukkit/src/main/java/com/gmail/nossr50/VersionedHandler.java
Normal file
@@ -0,0 +1,74 @@
|
||||
package com.gmail.nossr50;
|
||||
|
||||
import com.sk89q.worldedit.extension.platform.NoCapablePlatformException;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
public abstract class VersionedHandler {
|
||||
private static VersionedHandler instance;
|
||||
|
||||
private final mcMMO plugin;
|
||||
|
||||
protected VersionedHandler(mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string value id of the BlockType, note that this is not the
|
||||
* blockstate.
|
||||
*
|
||||
* Examples include: "minecraft:stone", "minecraft:chest", "thaumcraft:log2"
|
||||
* BlockStates are more specific like "minecraft:log[variant=oak,axis=x]"
|
||||
*
|
||||
* This should be casting down and retrieving the id from the block registry maintained by vanilla.
|
||||
*
|
||||
* @param block The block instance (holds byte/numerical id or sometimes block state in newer versions)
|
||||
* @return The string id of the block type
|
||||
*/
|
||||
public abstract String getIdFor(Block block);
|
||||
|
||||
/**
|
||||
* Gets the string value id of the Entity, much like blocks, this is not
|
||||
* the full string representation of the entity, just the string id of the
|
||||
* TYPE.
|
||||
*
|
||||
* Examples include: "minecraft:creeeper", "minecraft:sheep", "thaumcraft:wisp"
|
||||
*
|
||||
* @param entity The entity instance
|
||||
* @return The string id of the entity's registered type.
|
||||
*/
|
||||
public abstract String getIdFor(Entity entity);
|
||||
|
||||
// Technically can be TileEntity snapshot references as well.
|
||||
public abstract String getIdFor(BlockState block);
|
||||
|
||||
/**
|
||||
* Gets the {@link VersionedHandler} instance for this running platform.
|
||||
* Note that all the handler does is perform various operations necessitated
|
||||
* by either a lack of, or bridging an implementation of some API/core aspects
|
||||
* that are not available through Bukkit API (like getting BlockType id's, or
|
||||
* BlockState id's).
|
||||
*
|
||||
* @param plugin The mcmmo plugin
|
||||
* @return The version handler instance
|
||||
*/
|
||||
public VersionedHandler getInstance(mcMMO plugin) {
|
||||
if (instance == null) {
|
||||
final String serverPackage = mcMMO.p.getServer().getClass().getPackage().getName();
|
||||
final String serverVersion = serverPackage.substring(serverPackage.lastIndexOf(".") + 1);
|
||||
try {
|
||||
final Class<?> clazz = Class.forName("com.gmail.nossr50.bukkit." + serverVersion + ".NmsHandler");
|
||||
if (VersionedHandler.class.isAssignableFrom(clazz)) {
|
||||
instance = (VersionedHandler) clazz.getConstructor(mcMMO.class).newInstance(plugin);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new NoCapablePlatformException("Could not discover a valid mcMMO VersionedHandler for version:" + serverVersion);
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.gmail.nossr50.commands;
|
||||
|
||||
import com.gmail.nossr50.core.config.MainConfig;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.data.database.FlatfileDatabaseManager;
|
||||
import com.gmail.nossr50.core.data.database.SQLDatabaseManager;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MHDCommand implements TabExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (mcMMO.getDatabaseManager() instanceof SQLDatabaseManager) {
|
||||
SQLDatabaseManager m = (SQLDatabaseManager) mcMMO.getDatabaseManager();
|
||||
m.resetMobHealthSettings();
|
||||
for (McMMOPlayer player : UserManager.getPlayers()) {
|
||||
player.getProfile().setMobHealthbarType(MainConfig.getInstance().getMobHealthbarDefault());
|
||||
}
|
||||
sender.sendMessage("Mob health reset");
|
||||
return true;
|
||||
}
|
||||
if (mcMMO.getDatabaseManager() instanceof FlatfileDatabaseManager) {
|
||||
FlatfileDatabaseManager m = (FlatfileDatabaseManager) mcMMO.getDatabaseManager();
|
||||
m.resetMobHealthSettings();
|
||||
for (McMMOPlayer player : UserManager.getPlayers()) {
|
||||
player.getProfile().setMobHealthbarType(MainConfig.getInstance().getMobHealthbarDefault());
|
||||
}
|
||||
sender.sendMessage("Mob health reset");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,325 @@
|
||||
package com.gmail.nossr50.commands;
|
||||
|
||||
import com.gmail.nossr50.core.skills.ModConfigType;
|
||||
import com.gmail.nossr50.core.util.Misc;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class McImportCommand implements CommandExecutor {
|
||||
int fileAmount;
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
importModConfig();
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean importModConfig() {
|
||||
String importFilePath = mcMMO.getModDirectory() + File.separator + "import";
|
||||
File importFile = new File(importFilePath, "import.log");
|
||||
mcMMO.p.getLogger().info("Starting import of mod materials...");
|
||||
fileAmount = 0;
|
||||
|
||||
HashMap<ModConfigType, ArrayList<String>> materialNames = new HashMap<ModConfigType, ArrayList<String>>();
|
||||
|
||||
BufferedReader in = null;
|
||||
|
||||
try {
|
||||
// Open the file
|
||||
in = new BufferedReader(new FileReader(importFile));
|
||||
|
||||
String line;
|
||||
String materialName;
|
||||
String modName;
|
||||
|
||||
// While not at the end of the file
|
||||
while ((line = in.readLine()) != null) {
|
||||
String[] split1 = line.split("material ");
|
||||
|
||||
if (split1.length != 2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String[] split2 = split1[1].split(" with");
|
||||
|
||||
if (split2.length != 2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
materialName = split2[0];
|
||||
|
||||
// Categorise each material under a mod config type
|
||||
ModConfigType type = ModConfigType.getModConfigType(materialName);
|
||||
|
||||
if (!materialNames.containsKey(type)) {
|
||||
materialNames.put(type, new ArrayList<String>());
|
||||
}
|
||||
|
||||
materialNames.get(type).add(materialName);
|
||||
continue;
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
mcMMO.p.getLogger().warning("Could not find " + importFile.getAbsolutePath() + " ! (No such file or directory)");
|
||||
mcMMO.p.getLogger().warning("Copy and paste latest.log to " + importFile.getParentFile().getAbsolutePath() + " and rename it to import.log");
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
} finally {
|
||||
tryClose(in);
|
||||
}
|
||||
|
||||
createOutput(materialNames);
|
||||
|
||||
mcMMO.p.getLogger().info("Import finished! Created " + fileAmount + " files!");
|
||||
return true;
|
||||
}
|
||||
|
||||
private void createOutput(HashMap<ModConfigType, ArrayList<String>> materialNames) {
|
||||
for (ModConfigType modConfigType : materialNames.keySet()) {
|
||||
HashMap<String, ArrayList<String>> materialNamesType = new HashMap<String, ArrayList<String>>();
|
||||
|
||||
for (String materialName : materialNames.get(modConfigType)) {
|
||||
String modName = Misc.getModName(materialName);
|
||||
|
||||
if (!materialNamesType.containsKey(modName)) {
|
||||
materialNamesType.put(modName, new ArrayList<String>());
|
||||
}
|
||||
|
||||
materialNamesType.get(modName).add(materialName);
|
||||
}
|
||||
|
||||
createOutput(modConfigType, materialNamesType);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void tryClose(Closeable c) {
|
||||
if (c == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
c.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void createOutput(ModConfigType modConfigType, HashMap<String, ArrayList<String>> materialNames) {
|
||||
File outputFilePath = new File(mcMMO.getModDirectory() + File.separator + "output");
|
||||
if (!outputFilePath.exists() && !outputFilePath.mkdirs()) {
|
||||
mcMMO.p.getLogger().severe("Could not create output directory! " + outputFilePath.getAbsolutePath());
|
||||
}
|
||||
|
||||
FileWriter out = null;
|
||||
String type = modConfigType.name().toLowerCase();
|
||||
|
||||
for (String modName : materialNames.keySet()) {
|
||||
File outputFile = new File(outputFilePath, modName + "." + type + ".yml");
|
||||
mcMMO.p.getLogger().info("Creating " + outputFile.getName());
|
||||
try {
|
||||
if (outputFile.exists() && !outputFile.delete()) {
|
||||
mcMMO.p.getLogger().severe("Not able to delete old output file! " + outputFile.getAbsolutePath());
|
||||
}
|
||||
|
||||
if (!outputFile.createNewFile()) {
|
||||
mcMMO.p.getLogger().severe("Could not create output file! " + outputFile.getAbsolutePath());
|
||||
continue;
|
||||
}
|
||||
|
||||
StringBuilder writer = new StringBuilder();
|
||||
HashMap<String, ArrayList<String>> configSections = getConfigSections(modConfigType, modName, materialNames);
|
||||
|
||||
if (configSections == null) {
|
||||
mcMMO.p.getLogger().severe("Something went wrong!! type is " + type);
|
||||
return;
|
||||
}
|
||||
|
||||
// Write the file, go through each skill and write all the materials
|
||||
for (String configSection : configSections.keySet()) {
|
||||
if (configSection.equals("UNIDENTIFIED")) {
|
||||
writer.append("# This isn't a valid config section and all materials in this category need to be").append("\r\n");
|
||||
writer.append("# copy and pasted to a valid section of this config file.").append("\r\n");
|
||||
}
|
||||
writer.append(configSection).append(":").append("\r\n");
|
||||
|
||||
for (String line : configSections.get(configSection)) {
|
||||
writer.append(line).append("\r\n");
|
||||
}
|
||||
|
||||
writer.append("\r\n");
|
||||
}
|
||||
|
||||
out = new FileWriter(outputFile);
|
||||
out.write(writer.toString());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
} finally {
|
||||
tryClose(out);
|
||||
fileAmount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private HashMap<String, ArrayList<String>> getConfigSections(ModConfigType type, String modName, HashMap<String, ArrayList<String>> materialNames) {
|
||||
switch (type) {
|
||||
case BLOCKS:
|
||||
return getConfigSectionsBlocks(modName, materialNames);
|
||||
case TOOLS:
|
||||
return getConfigSectionsTools(modName, materialNames);
|
||||
case ARMOR:
|
||||
return getConfigSectionsArmor(modName, materialNames);
|
||||
case UNKNOWN:
|
||||
return getConfigSectionsUnknown(modName, materialNames);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private HashMap<String, ArrayList<String>> getConfigSectionsBlocks(String modName, HashMap<String, ArrayList<String>> materialNames) {
|
||||
HashMap<String, ArrayList<String>> configSections = new HashMap<String, ArrayList<String>>();
|
||||
|
||||
// Go through all the materials and categorise them under a skill
|
||||
for (String materialName : materialNames.get(modName)) {
|
||||
String skillName = "UNIDENTIFIED";
|
||||
if (materialName.contains("ORE")) {
|
||||
skillName = "Mining";
|
||||
} else if (materialName.contains("LOG") || materialName.contains("LEAVES")) {
|
||||
skillName = "Woodcutting";
|
||||
} else if (materialName.contains("GRASS") || materialName.contains("FLOWER") || materialName.contains("CROP")) {
|
||||
skillName = "Herbalism";
|
||||
} else if (materialName.contains("DIRT") || materialName.contains("SAND")) {
|
||||
skillName = "Excavation";
|
||||
}
|
||||
|
||||
if (!configSections.containsKey(skillName)) {
|
||||
configSections.put(skillName, new ArrayList<String>());
|
||||
}
|
||||
|
||||
ArrayList<String> skillContents = configSections.get(skillName);
|
||||
skillContents.add(" " + materialName + "|0:");
|
||||
skillContents.add(" " + " " + "XP_Gain: 99");
|
||||
skillContents.add(" " + " " + "Double_Drops_Enabled: true");
|
||||
|
||||
if (skillName.equals("Mining")) {
|
||||
skillContents.add(" " + " " + "Smelting_XP_Gain: 9");
|
||||
} else if (skillName.equals("Woodcutting")) {
|
||||
skillContents.add(" " + " " + "Is_Log: " + materialName.contains("LOG"));
|
||||
}
|
||||
}
|
||||
|
||||
return configSections;
|
||||
}
|
||||
|
||||
private HashMap<String, ArrayList<String>> getConfigSectionsTools(String modName, HashMap<String, ArrayList<String>> materialNames) {
|
||||
HashMap<String, ArrayList<String>> configSections = new HashMap<String, ArrayList<String>>();
|
||||
|
||||
// Go through all the materials and categorise them under a tool type
|
||||
for (String materialName : materialNames.get(modName)) {
|
||||
String toolType = "UNIDENTIFIED";
|
||||
if (materialName.contains("PICKAXE")) {
|
||||
toolType = "Pickaxes";
|
||||
} else if (materialName.contains("AXE")) {
|
||||
toolType = "Axes";
|
||||
} else if (materialName.contains("BOW")) {
|
||||
toolType = "Bows";
|
||||
} else if (materialName.contains("HOE")) {
|
||||
toolType = "Hoes";
|
||||
} else if (materialName.contains("SHOVEL") || materialName.contains("SPADE")) {
|
||||
toolType = "Shovels";
|
||||
} else if (materialName.contains("SWORD")) {
|
||||
toolType = "Swords";
|
||||
}
|
||||
|
||||
if (!configSections.containsKey(toolType)) {
|
||||
configSections.put(toolType, new ArrayList<String>());
|
||||
}
|
||||
|
||||
ArrayList<String> skillContents = configSections.get(toolType);
|
||||
skillContents.add(" " + materialName + ":");
|
||||
skillContents.add(" " + " " + "XP_Modifier: 1.0");
|
||||
skillContents.add(" " + " " + "Tier: 1");
|
||||
skillContents.add(" " + " " + "Ability_Enabled: true");
|
||||
addRepairableLines(materialName, skillContents);
|
||||
}
|
||||
|
||||
return configSections;
|
||||
}
|
||||
|
||||
private HashMap<String, ArrayList<String>> getConfigSectionsArmor(String modName, HashMap<String, ArrayList<String>> materialNames) {
|
||||
HashMap<String, ArrayList<String>> configSections = new HashMap<String, ArrayList<String>>();
|
||||
|
||||
// Go through all the materials and categorise them under an armor type
|
||||
for (String materialName : materialNames.get(modName)) {
|
||||
String toolType = "UNIDENTIFIED";
|
||||
if (materialName.contains("BOOT") || materialName.contains("SHOE")) {
|
||||
toolType = "Boots";
|
||||
} else if (materialName.contains("CHESTPLATE") || materialName.contains("CHEST")) {
|
||||
toolType = "Chestplates";
|
||||
} else if (materialName.contains("HELM") || materialName.contains("HAT")) {
|
||||
toolType = "Helmets";
|
||||
} else if (materialName.contains("LEGGINGS") || materialName.contains("LEGS") || materialName.contains("PANTS")) {
|
||||
toolType = "Leggings";
|
||||
}
|
||||
|
||||
if (!configSections.containsKey(toolType)) {
|
||||
configSections.put(toolType, new ArrayList<String>());
|
||||
}
|
||||
|
||||
ArrayList<String> skillContents = configSections.get(toolType);
|
||||
skillContents.add(" " + materialName + ":");
|
||||
addRepairableLines(materialName, skillContents);
|
||||
}
|
||||
|
||||
return configSections;
|
||||
}
|
||||
|
||||
private void addRepairableLines(String materialName, ArrayList<String> skillContents) {
|
||||
skillContents.add(" " + " " + "Repairable: true");
|
||||
skillContents.add(" " + " " + "Repair_Material: REPAIR_MATERIAL_NAME");
|
||||
skillContents.add(" " + " " + "Repair_Material_Data_Value: 0");
|
||||
skillContents.add(" " + " " + "Repair_Material_Quantity: 9");
|
||||
skillContents.add(" " + " " + "Repair_Material_Pretty_Name: Repair Item Name");
|
||||
skillContents.add(" " + " " + "Repair_MinimumLevel: 0");
|
||||
skillContents.add(" " + " " + "Repair_XpMultiplier: 1.0");
|
||||
|
||||
Material material = Material.matchMaterial(materialName);
|
||||
short durability = (material == null) ? (short) 9999 : material.getMaxDurability();
|
||||
skillContents.add(" " + " " + "Durability: " + ((durability > 0) ? durability : (short) 9999));
|
||||
}
|
||||
|
||||
private HashMap<String, ArrayList<String>> getConfigSectionsUnknown(String modName, HashMap<String, ArrayList<String>> materialNames) {
|
||||
HashMap<String, ArrayList<String>> configSections = new HashMap<String, ArrayList<String>>();
|
||||
|
||||
// Go through all the materials and print them
|
||||
for (String materialName : materialNames.get(modName)) {
|
||||
String configKey = "UNIDENTIFIED";
|
||||
|
||||
if (!configSections.containsKey(configKey)) {
|
||||
configSections.put(configKey, new ArrayList<String>());
|
||||
}
|
||||
|
||||
ArrayList<String> skillContents = configSections.get(configKey);
|
||||
skillContents.add(" " + materialName);
|
||||
}
|
||||
|
||||
return configSections;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,10 @@
|
||||
package com.gmail.nossr50.commands;
|
||||
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
public class McabilityCommand extends ToggleCommand {
|
||||
@Override
|
||||
protected boolean hasOtherPermission(CommandSender sender) {
|
||||
@@ -1,32 +1,27 @@
|
||||
package com.gmail.nossr50.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.commands.database.ConvertDatabaseCommand;
|
||||
import com.gmail.nossr50.commands.experience.ConvertExperienceCommand;
|
||||
import com.gmail.nossr50.core.data.database.DatabaseManagerFactory;
|
||||
import com.gmail.nossr50.core.datatypes.database.DatabaseType;
|
||||
import com.gmail.nossr50.core.datatypes.experience.FormulaType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.commands.database.ConvertDatabaseCommand;
|
||||
import com.gmail.nossr50.commands.experience.ConvertExperienceCommand;
|
||||
import com.gmail.nossr50.database.DatabaseManagerFactory;
|
||||
import com.gmail.nossr50.datatypes.database.DatabaseType;
|
||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class McconvertCommand implements TabExecutor {
|
||||
private static final List<String> FORMULA_TYPES;
|
||||
private static final List<String> DATABASE_TYPES;
|
||||
private static final List<String> SUBCOMMANDS = ImmutableList.of("database", "experience");
|
||||
|
||||
private CommandExecutor databaseConvertCommand = new ConvertDatabaseCommand();
|
||||
private CommandExecutor experienceConvertCommand = new ConvertExperienceCommand();
|
||||
|
||||
static {
|
||||
ArrayList<String> formulaTypes = new ArrayList<String>();
|
||||
ArrayList<String> databaseTypes = new ArrayList<String>();
|
||||
@@ -54,14 +49,16 @@ public class McconvertCommand implements TabExecutor {
|
||||
|
||||
}
|
||||
|
||||
private CommandExecutor databaseConvertCommand = new ConvertDatabaseCommand();
|
||||
private CommandExecutor experienceConvertCommand = new ConvertExperienceCommand();
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
if (args[0].equalsIgnoreCase("database") || args[0].equalsIgnoreCase("db")) {
|
||||
return databaseConvertCommand.onCommand(sender, command, label, args);
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("experience") || args[0].equalsIgnoreCase("xp") || args[1].equalsIgnoreCase("exp")) {
|
||||
} else if (args[0].equalsIgnoreCase("experience") || args[0].equalsIgnoreCase("xp") || args[1].equalsIgnoreCase("exp")) {
|
||||
return experienceConvertCommand.onCommand(sender, command, label, args);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package com.gmail.nossr50.commands;
|
||||
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
public class McgodCommand extends ToggleCommand {
|
||||
@Override
|
||||
protected boolean hasOtherPermission(CommandSender sender) {
|
||||
@@ -1,16 +1,15 @@
|
||||
package com.gmail.nossr50.commands;
|
||||
|
||||
import com.gmail.nossr50.commands.party.PartySubcommandType;
|
||||
import com.gmail.nossr50.core.config.MainConfig;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.commands.party.PartySubcommandType;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
public class McmmoCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@@ -25,9 +24,9 @@ public class McmmoCommand implements CommandExecutor {
|
||||
String[] mcSplit = description.split(",");
|
||||
sender.sendMessage(mcSplit);
|
||||
|
||||
if (Config.getInstance().getDonateMessageEnabled()) {
|
||||
if (MainConfig.getInstance().getDonateMessageEnabled()) {
|
||||
sender.sendMessage(LocaleLoader.getString("MOTD.Donate"));
|
||||
sender.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "gjmcferrin@gmail.com" + ChatColor.GOLD + " Paypal");
|
||||
sender.sendMessage(ChatColor.GOLD + " - " + ChatColor.GREEN + "com.gmail.nossr50@com.gmail.com" + ChatColor.GOLD + " Paypal");
|
||||
}
|
||||
|
||||
if (Permissions.showversion(sender)) {
|
||||
@@ -71,6 +70,10 @@ public class McmmoCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
private void displayOtherCommands(CommandSender sender) {
|
||||
//Don't show them this category if they have none of the permissions
|
||||
if (!Permissions.skillreset(sender) && !Permissions.mmoedit(sender) && !Permissions.adminChat(sender) && !Permissions.mcgod(sender))
|
||||
return;
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Other"));
|
||||
|
||||
if (Permissions.skillreset(sender)) {
|
||||
@@ -1,17 +1,15 @@
|
||||
package com.gmail.nossr50.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.List;
|
||||
|
||||
public class McnotifyCommand implements TabExecutor {
|
||||
@Override
|
||||
@@ -1,11 +1,10 @@
|
||||
package com.gmail.nossr50.commands;
|
||||
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
public class McrefreshCommand extends ToggleCommand {
|
||||
@Override
|
||||
protected boolean hasOtherPermission(CommandSender sender) {
|
||||
@@ -1,19 +1,17 @@
|
||||
package com.gmail.nossr50.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.core.config.MainConfig;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.core.util.scoreboards.ScoreboardManager;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class McscoreboardCommand implements TabExecutor {
|
||||
private static final List<String> FIRST_ARGS = ImmutableList.of("keep", "time", "clear");
|
||||
@@ -33,7 +31,7 @@ public class McscoreboardCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("keep")) {
|
||||
if (!Config.getInstance().getAllowKeepBoard()) {
|
||||
if (!MainConfig.getInstance().getAllowKeepBoard() || !MainConfig.getInstance().getScoreboardsEnabled()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Disabled"));
|
||||
return true;
|
||||
}
|
||||
@@ -1,18 +1,16 @@
|
||||
package com.gmail.nossr50.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.util.commands.CommandUtils;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class ToggleCommand implements TabExecutor {
|
||||
@Override
|
||||
@@ -28,6 +26,10 @@ public abstract class ToggleCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!CommandUtils.hasPlayerDataKey(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
applyCommandAction(UserManager.getPlayer(sender.getName()));
|
||||
return true;
|
||||
|
||||
@@ -69,7 +71,10 @@ public abstract class ToggleCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
protected abstract boolean hasOtherPermission(CommandSender sender);
|
||||
|
||||
protected abstract boolean hasSelfPermission(CommandSender sender);
|
||||
|
||||
protected abstract void applyCommandAction(McMMOPlayer mcMMOPlayer);
|
||||
|
||||
protected abstract void sendSuccessMessage(CommandSender sender, String playerName);
|
||||
}
|
||||
@@ -1,21 +1,22 @@
|
||||
package com.gmail.nossr50.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.core.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import com.gmail.nossr50.core.util.StringUtils;
|
||||
import com.gmail.nossr50.core.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.core.util.player.NotificationManager;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class XprateCommand implements TabExecutor {
|
||||
private final double ORIGINAL_XP_RATE = ExperienceConfig.getInstance().getExperienceGainsGlobalMultiplier();
|
||||
@@ -24,7 +25,7 @@ public class XprateCommand implements TabExecutor {
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
if (!args[0].equalsIgnoreCase("reset")) {
|
||||
if (!args[0].equalsIgnoreCase("reset") && !args[0].equalsIgnoreCase("clear")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -34,7 +35,17 @@ public class XprateCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
if (mcMMO.p.isXPEventEnabled()) {
|
||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.xprate.over"));
|
||||
|
||||
if (AdvancedConfig.getInstance().useTitlesForXPEvent()) {
|
||||
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
|
||||
LocaleLoader.getString("Commands.Event.Stop"),
|
||||
LocaleLoader.getString("Commands.Event.Stop.Subtitle"),
|
||||
10, 10 * 20, 20);
|
||||
}
|
||||
|
||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop"));
|
||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop.Subtitle"));
|
||||
|
||||
mcMMO.p.toggleXpEventEnabled();
|
||||
}
|
||||
|
||||
@@ -53,22 +64,31 @@ public class XprateCommand implements TabExecutor {
|
||||
|
||||
if (CommandUtils.shouldDisableToggle(args[1])) {
|
||||
mcMMO.p.setXPEventEnabled(false);
|
||||
}
|
||||
else if (CommandUtils.shouldEnableToggle(args[1])) {
|
||||
} else if (CommandUtils.shouldEnableToggle(args[1])) {
|
||||
mcMMO.p.setXPEventEnabled(true);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
int newXpRate = Integer.parseInt(args[0]);
|
||||
|
||||
if (newXpRate < 0) {
|
||||
sender.sendMessage(ChatColor.RED + LocaleLoader.getString("Commands.NegativeNumberWarn"));
|
||||
return true;
|
||||
}
|
||||
|
||||
ExperienceConfig.getInstance().setExperienceGainsGlobalMultiplier(newXpRate);
|
||||
|
||||
if (mcMMO.p.isXPEventEnabled()) {
|
||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.xprate.started.0"));
|
||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.xprate.started.1", newXpRate));
|
||||
}
|
||||
else {
|
||||
if (AdvancedConfig.getInstance().useTitlesForXPEvent()) {
|
||||
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
|
||||
LocaleLoader.getString("Commands.Event.Start"),
|
||||
LocaleLoader.getString("Commands.Event.XP", newXpRate),
|
||||
10, 10 * 20, 20);
|
||||
}
|
||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Start"));
|
||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.XP", newXpRate));
|
||||
} else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.xprate.modified", newXpRate));
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package com.gmail.nossr50.commands.chat;
|
||||
|
||||
import com.gmail.nossr50.core.datatypes.chat.ChatMode;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.gmail.nossr50.datatypes.chat.ChatMode;
|
||||
|
||||
public class AdminChatCommand extends ChatCommand {
|
||||
public AdminChatCommand() {
|
||||
super(ChatMode.ADMIN);
|
||||
@@ -1,30 +1,28 @@
|
||||
package com.gmail.nossr50.commands.chat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.core.chat.ChatManager;
|
||||
import com.gmail.nossr50.core.chat.ChatManagerFactory;
|
||||
import com.gmail.nossr50.core.config.MainConfig;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.chat.ChatMode;
|
||||
import com.gmail.nossr50.core.datatypes.party.PartyFeature;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.chat.ChatManager;
|
||||
import com.gmail.nossr50.chat.ChatManagerFactory;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.chat.ChatMode;
|
||||
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class ChatCommand implements TabExecutor {
|
||||
private ChatMode chatMode;
|
||||
protected ChatManager chatManager;
|
||||
private ChatMode chatMode;
|
||||
|
||||
public ChatCommand(ChatMode chatMode) {
|
||||
this.chatMode = chatMode;
|
||||
@@ -41,18 +39,25 @@ public abstract class ChatCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!CommandUtils.hasPlayerDataKey(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
||||
|
||||
if (mcMMOPlayer.isChatEnabled(chatMode)) {
|
||||
disableChatMode(mcMMOPlayer, sender);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
enableChatMode(mcMMOPlayer, sender);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
if (!CommandUtils.hasPlayerDataKey(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (CommandUtils.shouldEnableToggle(args[0])) {
|
||||
if (CommandUtils.noConsoleUsage(sender)) {
|
||||
return true;
|
||||
@@ -113,7 +118,7 @@ public abstract class ChatCommand implements TabExecutor {
|
||||
return;
|
||||
}
|
||||
|
||||
if (chatMode == ChatMode.PARTY && (mcMMOPlayer.getParty().getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.CHAT))) {
|
||||
if (chatMode == ChatMode.PARTY && (mcMMOPlayer.getParty().getLevel() < MainConfig.getInstance().getPartyFeatureUnlockLevel(PartyFeature.CHAT))) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.1"));
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.gmail.nossr50.commands.chat;
|
||||
|
||||
import com.gmail.nossr50.commands.ToggleCommand;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class McChatSpy extends ToggleCommand {
|
||||
@Override
|
||||
protected boolean hasOtherPermission(CommandSender sender) {
|
||||
return Permissions.adminChatSpyOthers(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasSelfPermission(CommandSender sender) {
|
||||
return Permissions.adminChatSpy(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyCommandAction(McMMOPlayer mcMMOPlayer) {
|
||||
mcMMOPlayer.getPlayer().sendMessage(LocaleLoader.getString("Commands.AdminChatSpy." + (mcMMOPlayer.isPartyChatSpying() ? "Disabled" : "Enabled")));
|
||||
mcMMOPlayer.togglePartyChatSpying();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void sendSuccessMessage(CommandSender sender, String playerName) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.AdminChatSpy.Toggle", playerName));
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,16 @@
|
||||
package com.gmail.nossr50.commands.chat;
|
||||
|
||||
import com.gmail.nossr50.core.chat.PartyChatManager;
|
||||
import com.gmail.nossr50.core.config.MainConfig;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.chat.ChatMode;
|
||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||
import com.gmail.nossr50.core.datatypes.party.PartyFeature;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.party.PartyManager;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.chat.PartyChatManager;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.chat.ChatMode;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public class PartyChatCommand extends ChatCommand {
|
||||
public PartyChatCommand() {
|
||||
super(ChatMode.PARTY);
|
||||
@@ -30,14 +29,13 @@ public class PartyChatCommand extends ChatCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if (party.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.CHAT)) {
|
||||
if (party.getLevel() < MainConfig.getInstance().getPartyFeatureUnlockLevel(PartyFeature.CHAT)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.1"));
|
||||
return;
|
||||
}
|
||||
|
||||
message = buildChatMessage(args, 0);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (args.length < 2) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.Specify"));
|
||||
return;
|
||||
@@ -1,19 +1,19 @@
|
||||
package com.gmail.nossr50.commands.database;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.data.database.DatabaseManager;
|
||||
import com.gmail.nossr50.core.data.database.DatabaseManagerFactory;
|
||||
import com.gmail.nossr50.core.datatypes.database.DatabaseType;
|
||||
import com.gmail.nossr50.core.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.runnables.database.DatabaseConversionTask;
|
||||
import com.gmail.nossr50.core.runnables.player.PlayerProfileLoadingTask;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.database.DatabaseManager;
|
||||
import com.gmail.nossr50.database.DatabaseManagerFactory;
|
||||
import com.gmail.nossr50.datatypes.database.DatabaseType;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.runnables.database.DatabaseConversionTask;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public class ConvertDatabaseCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@@ -41,8 +41,7 @@ public class ConvertDatabaseCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
oldDatabase = DatabaseManagerFactory.createCustomDatabaseManager((Class<? extends DatabaseManager>) clazz);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcconvert.Database.InvalidType", args[1]));
|
||||
return true;
|
||||
@@ -55,13 +54,13 @@ public class ConvertDatabaseCommand implements CommandExecutor {
|
||||
UserManager.clearAll();
|
||||
|
||||
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
|
||||
PlayerProfile profile = oldDatabase.loadPlayerProfile(player.getName(), false);
|
||||
PlayerProfile profile = oldDatabase.loadPlayerProfile(player.getUniqueId());
|
||||
|
||||
if (profile.isLoaded()) {
|
||||
mcMMO.getDatabaseManager().saveUser(profile);
|
||||
}
|
||||
|
||||
UserManager.addUser(player);
|
||||
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
||||
}
|
||||
|
||||
new DatabaseConversionTask(oldDatabase, sender, previousType.toString(), newType.toString()).runTaskAsynchronously(mcMMO.p);
|
||||
@@ -1,16 +1,14 @@
|
||||
package com.gmail.nossr50.commands.database;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.core.config.MainConfig;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.List;
|
||||
|
||||
public class McpurgeCommand implements TabExecutor {
|
||||
@Override
|
||||
@@ -19,7 +17,7 @@ public class McpurgeCommand implements TabExecutor {
|
||||
case 0:
|
||||
mcMMO.getDatabaseManager().purgePowerlessUsers();
|
||||
|
||||
if (Config.getInstance().getOldUsersCutoff() != -1) {
|
||||
if (MainConfig.getInstance().getOldUsersCutoff() != -1) {
|
||||
mcMMO.getDatabaseManager().purgeOldUsers();
|
||||
}
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
package com.gmail.nossr50.commands.database;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class McremoveCommand implements TabExecutor {
|
||||
@Override
|
||||
@@ -28,8 +26,7 @@ public class McremoveCommand implements TabExecutor {
|
||||
|
||||
if (mcMMO.getDatabaseManager().removeUser(playerName)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mcremove.Success", playerName));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
sender.sendMessage(playerName + " could not be removed from the database."); // Pretty sure this should NEVER happen.
|
||||
}
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
package com.gmail.nossr50.commands.database;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.core.config.MainConfig;
|
||||
import com.gmail.nossr50.core.data.database.DatabaseManagerFactory;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.database.DatabaseManagerFactory;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.List;
|
||||
|
||||
public class MmoshowdbCommand implements TabExecutor {
|
||||
@Override
|
||||
@@ -24,7 +22,7 @@ public class MmoshowdbCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mmoshowdb", (Config.getInstance().getUseMySQL() ? "sql" : "flatfile")));
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.mmoshowdb", (MainConfig.getInstance().getUseMySQL() ? "sql" : "flatfile")));
|
||||
return true;
|
||||
|
||||
default:
|
||||
@@ -1,14 +1,14 @@
|
||||
package com.gmail.nossr50.commands.experience;
|
||||
|
||||
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
|
||||
import com.gmail.nossr50.core.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.util.EventUtils;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.EventUtils;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
public class AddlevelsCommand extends ExperienceCommand {
|
||||
@Override
|
||||
protected boolean permissionsCheckSelf(CommandSender sender) {
|
||||
@@ -21,16 +21,16 @@ public class AddlevelsCommand extends ExperienceCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleCommand(Player player, PlayerProfile profile, SkillType skill, int value) {
|
||||
protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value) {
|
||||
float xpRemoved = profile.getSkillXpLevelRaw(skill);
|
||||
profile.addLevels(skill, value);
|
||||
|
||||
if (player == null) {
|
||||
profile.save();
|
||||
profile.scheduleAsyncSave();
|
||||
return;
|
||||
}
|
||||
|
||||
EventUtils.handleLevelChangeEvent(player, skill, value, xpRemoved, true);
|
||||
EventUtils.handleLevelChangeEvent(player, skill, value, xpRemoved, true, XPGainReason.COMMAND);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -39,7 +39,7 @@ public class AddlevelsCommand extends ExperienceCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handlePlayerMessageSkill(Player player, int value, SkillType skill) {
|
||||
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", value, skill.getName()));
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,15 @@
|
||||
package com.gmail.nossr50.commands.experience;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
|
||||
import com.gmail.nossr50.core.datatypes.experience.XPGainSource;
|
||||
import com.gmail.nossr50.core.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public class AddxpCommand extends ExperienceCommand {
|
||||
@Override
|
||||
protected boolean permissionsCheckSelf(CommandSender sender) {
|
||||
@@ -21,13 +22,12 @@ public class AddxpCommand extends ExperienceCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleCommand(Player player, PlayerProfile profile, SkillType skill, int value) {
|
||||
protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value) {
|
||||
if (player != null) {
|
||||
UserManager.getPlayer(player).applyXpGain(skill, value);
|
||||
}
|
||||
else {
|
||||
UserManager.getPlayer(player).applyXpGain(skill, value, XPGainReason.COMMAND, XPGainSource.COMMAND);
|
||||
} else {
|
||||
profile.addXp(skill, value);
|
||||
profile.save();
|
||||
profile.scheduleAsyncSave();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class AddxpCommand extends ExperienceCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handlePlayerMessageSkill(Player player, int value, SkillType skill) {
|
||||
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", value, skill.getName()));
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
package com.gmail.nossr50.commands.experience;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.experience.FormulaType;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.runnables.database.FormulaConversionTask;
|
||||
import com.gmail.nossr50.core.runnables.player.PlayerProfileLoadingTask;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.runnables.database.FormulaConversionTask;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public class ConvertExperienceCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@@ -37,7 +37,7 @@ public class ConvertExperienceCommand implements CommandExecutor {
|
||||
new FormulaConversionTask(sender, newType).runTaskLater(mcMMO.p, 1);
|
||||
|
||||
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
|
||||
UserManager.addUser(player);
|
||||
new PlayerProfileLoadingTask(player).runTaskLaterAsynchronously(mcMMO.p, 1); // 1 Tick delay to ensure the player is marked as online before we begin loading
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1,28 +1,36 @@
|
||||
package com.gmail.nossr50.commands.experience;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public abstract class ExperienceCommand implements TabExecutor {
|
||||
protected static void handleSenderMessage(CommandSender sender, String playerName, PrimarySkillType skill) {
|
||||
if (skill == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
|
||||
} else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", skill.getName(), playerName));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
SkillType skill;
|
||||
PrimarySkillType skill;
|
||||
|
||||
switch (args.length) {
|
||||
case 2:
|
||||
@@ -39,12 +47,17 @@ public abstract class ExperienceCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
skill = SkillType.getSkill(args[0]);
|
||||
skill = PrimarySkillType.getSkill(args[0]);
|
||||
|
||||
if (args[1].equalsIgnoreCase("all")) {
|
||||
skill = null;
|
||||
}
|
||||
|
||||
if (skill != null && skill.isChildSkill()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill"));
|
||||
return true;
|
||||
}
|
||||
|
||||
editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), skill, Integer.parseInt(args[1]));
|
||||
return true;
|
||||
|
||||
@@ -58,12 +71,17 @@ public abstract class ExperienceCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
skill = SkillType.getSkill(args[1]);
|
||||
skill = PrimarySkillType.getSkill(args[1]);
|
||||
|
||||
if (args[1].equalsIgnoreCase("all")) {
|
||||
skill = null;
|
||||
}
|
||||
|
||||
if (skill != null && skill.isChildSkill()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.ChildSkill"));
|
||||
return true;
|
||||
}
|
||||
|
||||
int value = Integer.parseInt(args[2]);
|
||||
|
||||
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
||||
@@ -71,15 +89,19 @@ public abstract class ExperienceCommand implements TabExecutor {
|
||||
|
||||
// If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
|
||||
if (mcMMOPlayer == null) {
|
||||
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName, false);
|
||||
UUID uuid = null;
|
||||
OfflinePlayer player = mcMMO.p.getServer().getOfflinePlayer(playerName);
|
||||
if (player != null) {
|
||||
uuid = player.getUniqueId();
|
||||
}
|
||||
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName, uuid, false);
|
||||
|
||||
if (CommandUtils.unloadedProfile(sender, profile)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
editValues(null, profile, skill, value);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
editValues(mcMMOPlayer.getPlayer(), mcMMOPlayer.getProfile(), skill, value);
|
||||
}
|
||||
|
||||
@@ -98,42 +120,36 @@ public abstract class ExperienceCommand implements TabExecutor {
|
||||
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
||||
case 2:
|
||||
return StringUtil.copyPartialMatches(args[1], SkillType.SKILL_NAMES, new ArrayList<String>(SkillType.SKILL_NAMES.size()));
|
||||
return StringUtil.copyPartialMatches(args[1], PrimarySkillType.SKILL_NAMES, new ArrayList<String>(PrimarySkillType.SKILL_NAMES.size()));
|
||||
default:
|
||||
return ImmutableList.of();
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract boolean permissionsCheckSelf(CommandSender sender);
|
||||
|
||||
protected abstract boolean permissionsCheckOthers(CommandSender sender);
|
||||
protected abstract void handleCommand(Player player, PlayerProfile profile, SkillType skill, int value);
|
||||
|
||||
protected abstract void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value);
|
||||
|
||||
protected abstract void handlePlayerMessageAll(Player player, int value);
|
||||
protected abstract void handlePlayerMessageSkill(Player player, int value, SkillType skill);
|
||||
|
||||
protected abstract void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill);
|
||||
|
||||
private boolean validateArguments(CommandSender sender, String skillName, String value) {
|
||||
return !(CommandUtils.isInvalidInteger(sender, value) || (!skillName.equalsIgnoreCase("all") && CommandUtils.isInvalidSkill(sender, skillName)));
|
||||
}
|
||||
|
||||
protected static void handleSenderMessage(CommandSender sender, String playerName, SkillType skill) {
|
||||
protected void editValues(Player player, PlayerProfile profile, PrimarySkillType skill, int value) {
|
||||
if (skill == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", skill.getName(), playerName));
|
||||
}
|
||||
}
|
||||
|
||||
protected void editValues(Player player, PlayerProfile profile, SkillType skill, int value) {
|
||||
if (skill == null) {
|
||||
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
|
||||
handleCommand(player, profile, skillType, value);
|
||||
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
|
||||
handleCommand(player, profile, primarySkillType, value);
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
handlePlayerMessageAll(player, value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
handleCommand(player, profile, skill, value);
|
||||
|
||||
if (player != null) {
|
||||
@@ -1,14 +1,14 @@
|
||||
package com.gmail.nossr50.commands.experience;
|
||||
|
||||
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
|
||||
import com.gmail.nossr50.core.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.util.EventUtils;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.EventUtils;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
public class MmoeditCommand extends ExperienceCommand {
|
||||
@Override
|
||||
protected boolean permissionsCheckSelf(CommandSender sender) {
|
||||
@@ -21,14 +21,14 @@ public class MmoeditCommand extends ExperienceCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleCommand(Player player, PlayerProfile profile, SkillType skill, int value) {
|
||||
protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value) {
|
||||
int skillLevel = profile.getSkillLevel(skill);
|
||||
float xpRemoved = profile.getSkillXpLevelRaw(skill);
|
||||
|
||||
profile.modifySkill(skill, value);
|
||||
|
||||
if (player == null) {
|
||||
profile.save();
|
||||
profile.scheduleAsyncSave();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class MmoeditCommand extends ExperienceCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
EventUtils.handleLevelChangeEvent(player, skill, value, xpRemoved, value > skillLevel);
|
||||
EventUtils.handleLevelChangeEvent(player, skill, value, xpRemoved, value > skillLevel, XPGainReason.COMMAND);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -45,7 +45,7 @@ public class MmoeditCommand extends ExperienceCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handlePlayerMessageSkill(Player player, int value, SkillType skill) {
|
||||
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", skill.getName(), value));
|
||||
}
|
||||
}
|
||||
@@ -1,33 +1,43 @@
|
||||
package com.gmail.nossr50.commands.experience;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.experience.XPGainReason;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.util.EventUtils;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import com.gmail.nossr50.core.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.EventUtils;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* This class mirrors the structure of ExperienceCommand, except the
|
||||
* value/quantity argument is removed.
|
||||
*/
|
||||
public class SkillresetCommand implements TabExecutor {
|
||||
protected static void handleSenderMessage(CommandSender sender, String playerName, PrimarySkillType skill) {
|
||||
if (skill == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
|
||||
} else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", skill.getName(), playerName));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
PrimarySkillType skill;
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
if (CommandUtils.noConsoleUsage(sender)) {
|
||||
@@ -43,7 +53,13 @@ public class SkillresetCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), SkillType.getSkill(args[0]));
|
||||
if (args[0].equalsIgnoreCase("all")) {
|
||||
skill = null;
|
||||
} else {
|
||||
skill = PrimarySkillType.getSkill(args[1]);
|
||||
}
|
||||
|
||||
editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), skill);
|
||||
return true;
|
||||
|
||||
case 2:
|
||||
@@ -56,12 +72,10 @@ public class SkillresetCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
SkillType skill;
|
||||
if (args[1].equalsIgnoreCase("all")) {
|
||||
skill = null;
|
||||
}
|
||||
else {
|
||||
skill = SkillType.getSkill(args[1]);
|
||||
} else {
|
||||
skill = PrimarySkillType.getSkill(args[1]);
|
||||
}
|
||||
|
||||
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
||||
@@ -69,15 +83,19 @@ public class SkillresetCommand implements TabExecutor {
|
||||
|
||||
// If the mcMMOPlayer doesn't exist, create a temporary profile and check if it's present in the database. If it's not, abort the process.
|
||||
if (mcMMOPlayer == null) {
|
||||
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName, false);
|
||||
UUID uuid = null;
|
||||
OfflinePlayer player = mcMMO.p.getServer().getOfflinePlayer(playerName);
|
||||
if (player != null) {
|
||||
uuid = player.getUniqueId();
|
||||
}
|
||||
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName, uuid, false);
|
||||
|
||||
if (CommandUtils.unloadedProfile(sender, profile)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
editValues(null, profile, skill);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
editValues(mcMMOPlayer.getPlayer(), mcMMOPlayer.getProfile(), skill);
|
||||
}
|
||||
|
||||
@@ -96,24 +114,24 @@ public class SkillresetCommand implements TabExecutor {
|
||||
List<String> playerNames = CommandUtils.getOnlinePlayerNames(sender);
|
||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
||||
case 2:
|
||||
return StringUtil.copyPartialMatches(args[1], SkillType.SKILL_NAMES, new ArrayList<String>(SkillType.SKILL_NAMES.size()));
|
||||
return StringUtil.copyPartialMatches(args[1], PrimarySkillType.SKILL_NAMES, new ArrayList<String>(PrimarySkillType.SKILL_NAMES.size()));
|
||||
default:
|
||||
return ImmutableList.of();
|
||||
}
|
||||
}
|
||||
|
||||
protected void handleCommand(Player player, PlayerProfile profile, SkillType skill) {
|
||||
protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill) {
|
||||
int levelsRemoved = profile.getSkillLevel(skill);
|
||||
float xpRemoved = profile.getSkillXpLevelRaw(skill);
|
||||
|
||||
profile.modifySkill(skill, 0);
|
||||
|
||||
if (player == null) {
|
||||
profile.save();
|
||||
profile.scheduleAsyncSave();
|
||||
return;
|
||||
}
|
||||
|
||||
EventUtils.handleLevelChangeEvent(player, skill, levelsRemoved, xpRemoved, false);
|
||||
EventUtils.handleLevelChangeEvent(player, skill, levelsRemoved, xpRemoved, false, XPGainReason.COMMAND);
|
||||
}
|
||||
|
||||
protected boolean permissionsCheckSelf(CommandSender sender) {
|
||||
@@ -128,34 +146,24 @@ public class SkillresetCommand implements TabExecutor {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Reset.All"));
|
||||
}
|
||||
|
||||
protected void handlePlayerMessageSkill(Player player, SkillType skill) {
|
||||
protected void handlePlayerMessageSkill(Player player, PrimarySkillType skill) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Reset.Single", skill.getName()));
|
||||
}
|
||||
|
||||
private boolean validateArguments(CommandSender sender, String skillName) {
|
||||
return !(CommandUtils.isInvalidSkill(sender, skillName) && !skillName.equalsIgnoreCase("all"));
|
||||
return skillName.equalsIgnoreCase("all") || !CommandUtils.isInvalidSkill(sender, skillName);
|
||||
}
|
||||
|
||||
protected static void handleSenderMessage(CommandSender sender, String playerName, SkillType skill) {
|
||||
protected void editValues(Player player, PlayerProfile profile, PrimarySkillType skill) {
|
||||
if (skill == null) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.2", playerName));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.2", skill.getName(), playerName));
|
||||
}
|
||||
}
|
||||
|
||||
protected void editValues(Player player, PlayerProfile profile, SkillType skill) {
|
||||
if (skill == null) {
|
||||
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
|
||||
handleCommand(player, profile, skillType);
|
||||
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
|
||||
handleCommand(player, profile, primarySkillType);
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
handlePlayerMessageAll(player);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
handleCommand(player, profile, skill);
|
||||
|
||||
if (player != null) {
|
||||
@@ -1,12 +1,11 @@
|
||||
package com.gmail.nossr50.commands.hardcore;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.gmail.nossr50.core.config.MainConfig;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class HardcoreCommand extends HardcoreModeCommand {
|
||||
@Override
|
||||
@@ -20,10 +19,10 @@ public class HardcoreCommand extends HardcoreModeCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkEnabled(SkillType skill) {
|
||||
protected boolean checkEnabled(PrimarySkillType skill) {
|
||||
if (skill == null) {
|
||||
for (SkillType skillType : SkillType.values()) {
|
||||
if (!skillType.getHardcoreStatLossEnabled()) {
|
||||
for (PrimarySkillType primarySkillType : PrimarySkillType.values()) {
|
||||
if (!primarySkillType.getHardcoreStatLossEnabled()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -35,28 +34,27 @@ public class HardcoreCommand extends HardcoreModeCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void enable(SkillType skill) {
|
||||
protected void enable(PrimarySkillType skill) {
|
||||
toggle(true, skill);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void disable(SkillType skill) {
|
||||
protected void disable(PrimarySkillType skill) {
|
||||
toggle(false, skill);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void modify(CommandSender sender, double newPercentage) {
|
||||
Config.getInstance().setHardcoreDeathStatPenaltyPercentage(newPercentage);
|
||||
MainConfig.getInstance().setHardcoreDeathStatPenaltyPercentage(newPercentage);
|
||||
sender.sendMessage(LocaleLoader.getString("Hardcore.DeathStatLoss.PercentageChanged", percent.format(newPercentage / 100.0D)));
|
||||
}
|
||||
|
||||
private void toggle(boolean enable, SkillType skill) {
|
||||
private void toggle(boolean enable, PrimarySkillType skill) {
|
||||
if (skill == null) {
|
||||
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
|
||||
skillType.setHardcoreStatLossEnabled(enable);
|
||||
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
|
||||
primarySkillType.setHardcoreStatLossEnabled(enable);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
skill.setHardcoreStatLossEnabled(enable);
|
||||
}
|
||||
|
||||
@@ -1,20 +1,18 @@
|
||||
package com.gmail.nossr50.commands.hardcore;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import com.gmail.nossr50.core.util.StringUtils;
|
||||
import com.gmail.nossr50.core.util.commands.CommandUtils;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class HardcoreModeCommand implements TabExecutor {
|
||||
protected final DecimalFormat percent = new DecimalFormat("##0.00%");
|
||||
@@ -30,8 +28,7 @@ public abstract class HardcoreModeCommand implements TabExecutor {
|
||||
|
||||
if (checkEnabled(null)) {
|
||||
disable(null);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
enable(null);
|
||||
}
|
||||
|
||||
@@ -76,7 +73,7 @@ public abstract class HardcoreModeCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
SkillType skill = SkillType.getSkill(args[0]);
|
||||
PrimarySkillType skill = PrimarySkillType.getSkill(args[0]);
|
||||
|
||||
if (!CommandUtils.isChildSkill(sender, skill)) {
|
||||
return true;
|
||||
@@ -124,9 +121,14 @@ public abstract class HardcoreModeCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
protected abstract boolean checkTogglePermissions(CommandSender sender);
|
||||
|
||||
protected abstract boolean checkModifyPermissions(CommandSender sender);
|
||||
protected abstract boolean checkEnabled(SkillType skill);
|
||||
protected abstract void enable(SkillType skill);
|
||||
protected abstract void disable(SkillType skill);
|
||||
|
||||
protected abstract boolean checkEnabled(PrimarySkillType skill);
|
||||
|
||||
protected abstract void enable(PrimarySkillType skill);
|
||||
|
||||
protected abstract void disable(PrimarySkillType skill);
|
||||
|
||||
protected abstract void modify(CommandSender sender, double newPercentage);
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
package com.gmail.nossr50.commands.hardcore;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.gmail.nossr50.core.config.MainConfig;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class VampirismCommand extends HardcoreModeCommand {
|
||||
@Override
|
||||
@@ -20,10 +19,10 @@ public class VampirismCommand extends HardcoreModeCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkEnabled(SkillType skill) {
|
||||
protected boolean checkEnabled(PrimarySkillType skill) {
|
||||
if (skill == null) {
|
||||
for (SkillType skillType : SkillType.values()) {
|
||||
if (!skillType.getHardcoreVampirismEnabled()) {
|
||||
for (PrimarySkillType primarySkillType : PrimarySkillType.values()) {
|
||||
if (!primarySkillType.getHardcoreVampirismEnabled()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -35,28 +34,27 @@ public class VampirismCommand extends HardcoreModeCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void enable(SkillType skill) {
|
||||
protected void enable(PrimarySkillType skill) {
|
||||
toggle(true, skill);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void disable(SkillType skill) {
|
||||
protected void disable(PrimarySkillType skill) {
|
||||
toggle(false, skill);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void modify(CommandSender sender, double newPercentage) {
|
||||
Config.getInstance().setHardcoreVampirismStatLeechPercentage(newPercentage);
|
||||
MainConfig.getInstance().setHardcoreVampirismStatLeechPercentage(newPercentage);
|
||||
sender.sendMessage(LocaleLoader.getString("Hardcore.Vampirism.PercentageChanged", percent.format(newPercentage / 100.0D)));
|
||||
}
|
||||
|
||||
private void toggle(boolean enable, SkillType skill) {
|
||||
private void toggle(boolean enable, PrimarySkillType skill) {
|
||||
if (skill == null) {
|
||||
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
|
||||
skillType.setHardcoreVampirismEnabled(enable);
|
||||
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
|
||||
primarySkillType.setHardcoreVampirismEnabled(enable);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
skill.setHardcoreVampirismEnabled(enable);
|
||||
}
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.party.PartyManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public class PartyAcceptCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@@ -1,16 +1,17 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.party.PartyManager;
|
||||
import com.gmail.nossr50.core.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public class PartyChangeOwnerCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@@ -18,13 +19,14 @@ public class PartyChangeOwnerCommand implements CommandExecutor {
|
||||
case 2:
|
||||
Party playerParty = UserManager.getPlayer((Player) sender).getParty();
|
||||
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
|
||||
OfflinePlayer target = mcMMO.p.getServer().getOfflinePlayer(targetName);
|
||||
|
||||
if (!playerParty.getMembers().contains(targetName)) {
|
||||
if (!playerParty.hasMember(target.getUniqueId())) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetName));
|
||||
return true;
|
||||
}
|
||||
|
||||
PartyManager.setPartyLeader(targetName, playerParty);
|
||||
PartyManager.setPartyLeader(target.getUniqueId(), playerParty);
|
||||
return true;
|
||||
|
||||
default:
|
||||
@@ -1,14 +1,13 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public class PartyChangePasswordCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@@ -1,10 +1,15 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.commands.chat.PartyChatCommand;
|
||||
import com.gmail.nossr50.commands.party.alliance.PartyAllianceCommand;
|
||||
import com.gmail.nossr50.commands.party.teleport.PtpCommand;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import com.gmail.nossr50.core.util.commands.CommandUtils;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -12,18 +17,10 @@ import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.commands.chat.PartyChatCommand;
|
||||
import com.gmail.nossr50.commands.party.alliance.PartyAllianceCommand;
|
||||
import com.gmail.nossr50.commands.party.teleport.PtpCommand;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class PartyCommand implements TabExecutor {
|
||||
private static final List<String> PARTY_SUBCOMMANDS;
|
||||
@@ -41,24 +38,24 @@ public class PartyCommand implements TabExecutor {
|
||||
PARTY_SUBCOMMANDS = ImmutableList.copyOf(subcommands);
|
||||
}
|
||||
|
||||
private CommandExecutor partyJoinCommand = new PartyJoinCommand();
|
||||
private CommandExecutor partyAcceptCommand = new PartyAcceptCommand();
|
||||
private CommandExecutor partyCreateCommand = new PartyCreateCommand();
|
||||
private CommandExecutor partyQuitCommand = new PartyQuitCommand();
|
||||
private CommandExecutor partyXpShareCommand = new PartyXpShareCommand();
|
||||
private CommandExecutor partyItemShareCommand = new PartyItemShareCommand();
|
||||
private CommandExecutor partyInviteCommand = new PartyInviteCommand();
|
||||
private CommandExecutor partyKickCommand = new PartyKickCommand();
|
||||
private CommandExecutor partyDisbandCommand = new PartyDisbandCommand();
|
||||
private CommandExecutor partyChangeOwnerCommand = new PartyChangeOwnerCommand();
|
||||
private CommandExecutor partyLockCommand = new PartyLockCommand();
|
||||
private CommandExecutor partyJoinCommand = new PartyJoinCommand();
|
||||
private CommandExecutor partyAcceptCommand = new PartyAcceptCommand();
|
||||
private CommandExecutor partyCreateCommand = new PartyCreateCommand();
|
||||
private CommandExecutor partyQuitCommand = new PartyQuitCommand();
|
||||
private CommandExecutor partyXpShareCommand = new PartyXpShareCommand();
|
||||
private CommandExecutor partyItemShareCommand = new PartyItemShareCommand();
|
||||
private CommandExecutor partyInviteCommand = new PartyInviteCommand();
|
||||
private CommandExecutor partyKickCommand = new PartyKickCommand();
|
||||
private CommandExecutor partyDisbandCommand = new PartyDisbandCommand();
|
||||
private CommandExecutor partyChangeOwnerCommand = new PartyChangeOwnerCommand();
|
||||
private CommandExecutor partyLockCommand = new PartyLockCommand();
|
||||
private CommandExecutor partyChangePasswordCommand = new PartyChangePasswordCommand();
|
||||
private CommandExecutor partyRenameCommand = new PartyRenameCommand();
|
||||
private CommandExecutor partyInfoCommand = new PartyInfoCommand();
|
||||
private CommandExecutor partyHelpCommand = new PartyHelpCommand();
|
||||
private CommandExecutor partyTeleportCommand = mcMMO.p.getCommand("ptp").getExecutor();
|
||||
private CommandExecutor partyChatCommand = new PartyChatCommand();
|
||||
private CommandExecutor partyAllianceCommand = new PartyAllianceCommand();
|
||||
private CommandExecutor partyRenameCommand = new PartyRenameCommand();
|
||||
private CommandExecutor partyInfoCommand = new PartyInfoCommand();
|
||||
private CommandExecutor partyHelpCommand = new PartyHelpCommand();
|
||||
private CommandExecutor partyTeleportCommand = new PtpCommand();
|
||||
private CommandExecutor partyChatCommand = new PartyChatCommand();
|
||||
private CommandExecutor partyAllianceCommand = new PartyAllianceCommand();
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@@ -72,6 +69,11 @@ public class PartyCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if (args.length < 1) {
|
||||
@@ -130,7 +132,7 @@ public class PartyCommand implements TabExecutor {
|
||||
}
|
||||
|
||||
// Party leader commands
|
||||
if (!mcMMOPlayer.getParty().getLeader().equalsIgnoreCase(player.getName())) {
|
||||
if (!mcMMOPlayer.getParty().getLeader().getUniqueId().equals(player.getUniqueId())) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.NotOwner"));
|
||||
return true;
|
||||
}
|
||||
@@ -1,15 +1,14 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.party.PartyManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public class PartyCreateCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@@ -1,16 +1,15 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.party.PartyManager;
|
||||
import com.gmail.nossr50.core.events.party.McMMOPartyChangeEvent.EventReason;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public class PartyDisbandCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@@ -1,11 +1,10 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
|
||||
public class PartyHelpCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
@@ -1,22 +1,21 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.core.config.MainConfig;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||
import com.gmail.nossr50.core.datatypes.party.PartyFeature;
|
||||
import com.gmail.nossr50.core.datatypes.party.ShareMode;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.party.PartyManager;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||
import com.gmail.nossr50.datatypes.party.ShareMode;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PartyInfoCommand implements CommandExecutor {
|
||||
@Override
|
||||
@@ -66,8 +65,7 @@ public class PartyInfoCommand implements CommandExecutor {
|
||||
|
||||
if (isUnlockedFeature(party, partyFeature)) {
|
||||
unlockedPartyFeatures.add(partyFeature.getLocaleString());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
lockedPartyFeatures.add(partyFeature.getFeatureLockedLocaleString());
|
||||
}
|
||||
}
|
||||
@@ -80,7 +78,7 @@ public class PartyInfoCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
private boolean isUnlockedFeature(Party party, PartyFeature partyFeature) {
|
||||
return party.getLevel() >= Config.getInstance().getPartyFeatureUnlockLevel(partyFeature);
|
||||
return party.getLevel() >= MainConfig.getInstance().getPartyFeatureUnlockLevel(partyFeature);
|
||||
}
|
||||
|
||||
private void displayShareModeInfo(Player player, Party party) {
|
||||
@@ -116,11 +114,15 @@ public class PartyInfoCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
private void displayMemberInfo(Player player, McMMOPlayer mcMMOPlayer, Party party) {
|
||||
List<Player> nearMembers = PartyManager.getNearMembers(mcMMOPlayer);
|
||||
int membersOnline = party.getOnlineMembers().size() - 1;
|
||||
/*
|
||||
* Only show members of the party that this member can see
|
||||
*/
|
||||
|
||||
List<Player> nearMembers = PartyManager.getNearVisibleMembers(mcMMOPlayer);
|
||||
int membersOnline = party.getVisibleMembers(player).size();
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.Members.Header"));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.MembersNear", nearMembers.size(), membersOnline));
|
||||
player.sendMessage(party.createMembersList(player.getName(), nearMembers));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.MembersNear", nearMembers.size() + 1, membersOnline));
|
||||
player.sendMessage(party.createMembersList(player));
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,17 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.core.config.MainConfig;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.party.PartyManager;
|
||||
import com.gmail.nossr50.core.util.commands.CommandUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public class PartyInviteCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@@ -45,6 +45,12 @@ public class PartyInviteCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
Party playerParty = mcMMOPlayer.getParty();
|
||||
|
||||
if (PartyManager.isPartyFull(target, playerParty)) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.PartyFull.Invite", target.getName(), playerParty.toString(), MainConfig.getInstance().getPartyMaxSize()));
|
||||
return true;
|
||||
}
|
||||
|
||||
mcMMOTarget.setPartyInvite(playerParty);
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Invite.Success"));
|
||||
@@ -1,26 +1,25 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.core.config.MainConfig;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.party.ItemShareType;
|
||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||
import com.gmail.nossr50.core.datatypes.party.PartyFeature;
|
||||
import com.gmail.nossr50.core.datatypes.party.ShareMode;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.util.StringUtils;
|
||||
import com.gmail.nossr50.core.util.commands.CommandUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.party.ItemShareType;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||
import com.gmail.nossr50.datatypes.party.ShareMode;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public class PartyItemShareCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
Party party = UserManager.getPlayer((Player) sender).getParty();
|
||||
|
||||
if (party.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.ITEM_SHARE)) {
|
||||
if (party.getLevel() < MainConfig.getInstance().getPartyFeatureUnlockLevel(PartyFeature.ITEM_SHARE)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.4"));
|
||||
return true;
|
||||
}
|
||||
@@ -42,19 +41,16 @@ public class PartyItemShareCommand implements CommandExecutor {
|
||||
|
||||
if (CommandUtils.shouldEnableToggle(args[2])) {
|
||||
toggle = true;
|
||||
}
|
||||
else if (CommandUtils.shouldDisableToggle(args[2])) {
|
||||
} else if (CommandUtils.shouldDisableToggle(args[2])) {
|
||||
toggle = false;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "itemshare", "<loot | mining | herbalism | woodcutting | misc> <true | false>"));
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
handleToggleItemShareCategory(party, ItemShareType.valueOf(args[1].toUpperCase()), toggle);
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
} catch (IllegalArgumentException ex) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "itemshare", "<loot | mining | herbalism | woodcutting | misc> <true | false>"));
|
||||
}
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.party.PartyManager;
|
||||
import com.gmail.nossr50.core.util.commands.CommandUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public class PartyJoinCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@@ -55,6 +54,11 @@ public class PartyJoinCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (PartyManager.isPartyFull(player, targetParty)) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.PartyFull", targetParty.toString()));
|
||||
return true;
|
||||
}
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.Join", partyName));
|
||||
PartyManager.addToParty(mcMMOPlayer, targetParty);
|
||||
return true;
|
||||
@@ -1,19 +1,18 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.party.PartyManager;
|
||||
import com.gmail.nossr50.core.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.core.events.party.McMMOPartyChangeEvent.EventReason;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public class PartyKickCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@@ -22,7 +21,7 @@ public class PartyKickCommand implements CommandExecutor {
|
||||
Party playerParty = UserManager.getPlayer((Player) sender).getParty();
|
||||
String targetName = CommandUtils.getMatchedPlayerName(args[1]);
|
||||
|
||||
if (!playerParty.getMembers().contains(targetName)) {
|
||||
if (!playerParty.hasMember(targetName)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.NotInYourParty", targetName));
|
||||
return true;
|
||||
}
|
||||
@@ -1,16 +1,15 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import com.gmail.nossr50.core.util.commands.CommandUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public class PartyLockCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@@ -18,8 +17,7 @@ public class PartyLockCommand implements CommandExecutor {
|
||||
case 1:
|
||||
if (args[0].equalsIgnoreCase("lock")) {
|
||||
togglePartyLock(sender, true);
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("unlock")) {
|
||||
} else if (args[0].equalsIgnoreCase("unlock")) {
|
||||
togglePartyLock(sender, false);
|
||||
}
|
||||
|
||||
@@ -33,11 +31,9 @@ public class PartyLockCommand implements CommandExecutor {
|
||||
|
||||
if (CommandUtils.shouldEnableToggle(args[1])) {
|
||||
togglePartyLock(sender, true);
|
||||
}
|
||||
else if (CommandUtils.shouldDisableToggle(args[1])) {
|
||||
} else if (CommandUtils.shouldDisableToggle(args[1])) {
|
||||
togglePartyLock(sender, false);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
sendUsageStrings(sender);
|
||||
}
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.party.PartyManager;
|
||||
import com.gmail.nossr50.core.events.party.McMMOPartyChangeEvent.EventReason;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public class PartyQuitCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@@ -1,17 +1,16 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.party.PartyManager;
|
||||
import com.gmail.nossr50.core.events.party.McMMOPartyChangeEvent.EventReason;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public class PartyRenameCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@@ -36,7 +35,7 @@ public class PartyRenameCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
String leaderName = playerParty.getLeader();
|
||||
String leaderName = playerParty.getLeader().getPlayerName();
|
||||
|
||||
for (Player member : playerParty.getOnlineMembers()) {
|
||||
if (!PartyManager.handlePartyChangeEvent(member, oldPartyName, newPartyName, EventReason.CHANGED_PARTIES)) {
|
||||
@@ -30,20 +30,15 @@ public enum PartySubcommandType {
|
||||
|
||||
if (commandName.equalsIgnoreCase("?")) {
|
||||
return HELP;
|
||||
}
|
||||
else if (commandName.equalsIgnoreCase("q") || commandName.equalsIgnoreCase("leave")) {
|
||||
} else if (commandName.equalsIgnoreCase("q") || commandName.equalsIgnoreCase("leave")) {
|
||||
return QUIT;
|
||||
}
|
||||
else if (commandName.equalsIgnoreCase("leader")) {
|
||||
} else if (commandName.equalsIgnoreCase("leader")) {
|
||||
return OWNER;
|
||||
}
|
||||
else if (commandName.equalsIgnoreCase("xpshare") || commandName.equalsIgnoreCase("shareexp") || commandName.equalsIgnoreCase("sharexp")) {
|
||||
} else if (commandName.equalsIgnoreCase("xpshare") || commandName.equalsIgnoreCase("shareexp") || commandName.equalsIgnoreCase("sharexp")) {
|
||||
return XPSHARE;
|
||||
}
|
||||
else if (commandName.equalsIgnoreCase("shareitem") || commandName.equalsIgnoreCase("shareitems")) {
|
||||
} else if (commandName.equalsIgnoreCase("shareitem") || commandName.equalsIgnoreCase("shareitems")) {
|
||||
return ITEMSHARE;
|
||||
}
|
||||
else if (commandName.equalsIgnoreCase("ally")) {
|
||||
} else if (commandName.equalsIgnoreCase("ally")) {
|
||||
return ALLIANCE;
|
||||
}
|
||||
|
||||
@@ -1,25 +1,24 @@
|
||||
package com.gmail.nossr50.commands.party;
|
||||
|
||||
import com.gmail.nossr50.core.config.MainConfig;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||
import com.gmail.nossr50.core.datatypes.party.PartyFeature;
|
||||
import com.gmail.nossr50.core.datatypes.party.ShareMode;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.util.StringUtils;
|
||||
import com.gmail.nossr50.core.util.commands.CommandUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||
import com.gmail.nossr50.datatypes.party.ShareMode;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public class PartyXpShareCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
Party party = UserManager.getPlayer((Player) sender).getParty();
|
||||
|
||||
if (party.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.XP_SHARE)) {
|
||||
if (party.getLevel() < MainConfig.getInstance().getPartyFeatureUnlockLevel(PartyFeature.XP_SHARE)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.5"));
|
||||
return true;
|
||||
}
|
||||
@@ -28,11 +27,9 @@ public class PartyXpShareCommand implements CommandExecutor {
|
||||
case 2:
|
||||
if (args[1].equalsIgnoreCase("none") || CommandUtils.shouldDisableToggle(args[1])) {
|
||||
handleChangingShareMode(party, ShareMode.NONE);
|
||||
}
|
||||
else if (args[1].equalsIgnoreCase("equal") || args[1].equalsIgnoreCase("even") || CommandUtils.shouldEnableToggle(args[1])) {
|
||||
} else if (args[1].equalsIgnoreCase("equal") || args[1].equalsIgnoreCase("even") || CommandUtils.shouldEnableToggle(args[1])) {
|
||||
handleChangingShareMode(party, ShareMode.EQUAL);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Usage.2", "party", "xpshare", "<NONE | EQUAL>"));
|
||||
}
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
package com.gmail.nossr50.commands.party.alliance;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.party.PartyManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public class PartyAllianceAcceptCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@@ -1,8 +1,14 @@
|
||||
package com.gmail.nossr50.commands.party.alliance;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.core.config.MainConfig;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||
import com.gmail.nossr50.core.datatypes.party.PartyFeature;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.party.PartyManager;
|
||||
import com.gmail.nossr50.core.util.commands.CommandUtils;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@@ -11,24 +17,14 @@ import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PartyAllianceCommand implements TabExecutor {
|
||||
public static final List<String> ALLIANCE_SUBCOMMANDS = ImmutableList.of("invite", "accept", "disband");
|
||||
private Player player;
|
||||
private Party playerParty;
|
||||
private Party targetParty;
|
||||
|
||||
public static final List<String> ALLIANCE_SUBCOMMANDS = ImmutableList.of("invite", "accept", "disband");
|
||||
|
||||
private CommandExecutor partyAllianceInviteCommand = new PartyAllianceInviteCommand();
|
||||
private CommandExecutor partyAllianceAcceptCommand = new PartyAllianceAcceptCommand();
|
||||
private CommandExecutor partyAllianceDisbandCommand = new PartyAllianceDisbandCommand();
|
||||
@@ -46,7 +42,7 @@ public class PartyAllianceCommand implements TabExecutor {
|
||||
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
if (playerParty.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.ALLIANCE)) {
|
||||
if (playerParty.getLevel() < MainConfig.getInstance().getPartyFeatureUnlockLevel(PartyFeature.ALLIANCE)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.3"));
|
||||
return true;
|
||||
}
|
||||
@@ -64,7 +60,7 @@ public class PartyAllianceCommand implements TabExecutor {
|
||||
|
||||
case 2:
|
||||
case 3:
|
||||
if (playerParty.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.ALLIANCE)) {
|
||||
if (playerParty.getLevel() < MainConfig.getInstance().getPartyFeatureUnlockLevel(PartyFeature.ALLIANCE)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.3"));
|
||||
return true;
|
||||
}
|
||||
@@ -128,8 +124,8 @@ public class PartyAllianceCommand implements TabExecutor {
|
||||
private void displayMemberInfo(McMMOPlayer mcMMOPlayer) {
|
||||
List<Player> nearMembers = PartyManager.getNearMembers(mcMMOPlayer);
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.Alliance.Members.Header"));
|
||||
player.sendMessage(playerParty.createMembersList(player.getName(), nearMembers));
|
||||
player.sendMessage(playerParty.createMembersList(player));
|
||||
player.sendMessage(ChatColor.DARK_GRAY + "----------------------------");
|
||||
player.sendMessage(targetParty.createMembersList(player.getName(), nearMembers));
|
||||
player.sendMessage(targetParty.createMembersList(player));
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,15 @@
|
||||
package com.gmail.nossr50.commands.party.alliance;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.party.PartyManager;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public class PartyAllianceDisbandCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@@ -1,17 +1,16 @@
|
||||
package com.gmail.nossr50.commands.party.alliance;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.party.PartyManager;
|
||||
import com.gmail.nossr50.core.util.commands.CommandUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public class PartyAllianceInviteCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@@ -44,7 +43,7 @@ public class PartyAllianceInviteCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!mcMMOTarget.getParty().getLeader().equalsIgnoreCase(targetName)) {
|
||||
if (!mcMMOTarget.getParty().getLeader().getUniqueId().equals(target.getUniqueId())) {
|
||||
player.sendMessage(LocaleLoader.getString("Party.Target.NotOwner", targetName));
|
||||
return true;
|
||||
}
|
||||
@@ -1,14 +1,13 @@
|
||||
package com.gmail.nossr50.commands.party.teleport;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.party.PartyTeleportRecord;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public class PtpAcceptAnyCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@@ -21,8 +20,7 @@ public class PtpAcceptAnyCommand implements CommandExecutor {
|
||||
|
||||
if (ptpRecord.isConfirmRequired()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Disabled"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.ptp.AcceptAny.Enabled"));
|
||||
}
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
package com.gmail.nossr50.commands.party.teleport;
|
||||
|
||||
import com.gmail.nossr50.core.config.MainConfig;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.party.PartyTeleportRecord;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import com.gmail.nossr50.core.util.skills.SkillUtils;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
public class PtpAcceptCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@@ -29,7 +28,7 @@ public class PtpAcceptCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (SkillUtils.cooldownExpired(ptpRecord.getTimeout(), Config.getInstance().getPTPCommandTimeout())) {
|
||||
if (SkillUtils.cooldownExpired(ptpRecord.getTimeout(), MainConfig.getInstance().getPTPCommandTimeout())) {
|
||||
ptpRecord.removeRequest();
|
||||
player.sendMessage(LocaleLoader.getString("Commands.ptp.RequestExpired"));
|
||||
return true;
|
||||
@@ -42,7 +41,7 @@ public class PtpAcceptCommand implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Config.getInstance().getPTPCommandWorldPermissions()) {
|
||||
if (MainConfig.getInstance().getPTPCommandWorldPermissions()) {
|
||||
World targetWorld = target.getWorld();
|
||||
World playerWorld = player.getWorld();
|
||||
|
||||
@@ -50,8 +49,7 @@ public class PtpAcceptCommand implements CommandExecutor {
|
||||
if (!Permissions.partyTeleportWorld(target, targetWorld)) {
|
||||
target.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", targetWorld.getName()));
|
||||
return true;
|
||||
}
|
||||
else if (targetWorld != playerWorld && !Permissions.partyTeleportWorld(target, playerWorld)) {
|
||||
} else if (targetWorld != playerWorld && !Permissions.partyTeleportWorld(target, playerWorld)) {
|
||||
target.sendMessage(LocaleLoader.getString("Commands.ptp.NoWorldPermissions", playerWorld.getName()));
|
||||
return true;
|
||||
}
|
||||
@@ -1,8 +1,24 @@
|
||||
package com.gmail.nossr50.commands.party.teleport;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.core.config.MainConfig;
|
||||
import com.gmail.nossr50.core.config.WorldBlacklist;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.party.Party;
|
||||
import com.gmail.nossr50.core.datatypes.party.PartyFeature;
|
||||
import com.gmail.nossr50.core.datatypes.party.PartyTeleportRecord;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.party.PartyManager;
|
||||
import com.gmail.nossr50.core.runnables.items.TeleportationWarmup;
|
||||
import com.gmail.nossr50.core.util.EventUtils;
|
||||
import com.gmail.nossr50.core.util.Misc;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import com.gmail.nossr50.core.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.core.util.skills.SkillUtils;
|
||||
import com.gmail.nossr50.core.worldguard.WorldGuardManager;
|
||||
import com.gmail.nossr50.core.worldguard.WorldGuardUtils;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -10,23 +26,8 @@ import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.party.Party;
|
||||
import com.gmail.nossr50.datatypes.party.PartyFeature;
|
||||
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.runnables.items.TeleportationWarmup;
|
||||
import com.gmail.nossr50.util.EventUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PtpCommand implements TabExecutor {
|
||||
public static final List<String> TELEPORT_SUBCOMMANDS = ImmutableList.of("toggle", "accept", "acceptany", "acceptall");
|
||||
@@ -35,116 +36,6 @@ public class PtpCommand implements TabExecutor {
|
||||
private CommandExecutor ptpAcceptAnyCommand = new PtpAcceptAnyCommand();
|
||||
private CommandExecutor ptpAcceptCommand = new PtpAcceptCommand();
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (CommandUtils.noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
Party party = mcMMOPlayer.getParty();
|
||||
|
||||
if (party.getLevel() < Config.getInstance().getPartyFeatureUnlockLevel(PartyFeature.TELEPORT)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.2"));
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
if (args[0].equalsIgnoreCase("toggle")) {
|
||||
return ptpToggleCommand.onCommand(sender, command, label, args);
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("acceptany") || args[0].equalsIgnoreCase("acceptall")) {
|
||||
return ptpAcceptAnyCommand.onCommand(sender, command, label, args);
|
||||
}
|
||||
|
||||
long recentlyHurt = mcMMOPlayer.getRecentlyHurt();
|
||||
int hurtCooldown = Config.getInstance().getPTPCommandRecentlyHurtCooldown();
|
||||
|
||||
if (hurtCooldown > 0) {
|
||||
int timeRemaining = SkillUtils.calculateTimeLeft(recentlyHurt * Misc.TIME_CONVERSION_FACTOR, hurtCooldown, player);
|
||||
|
||||
if (timeRemaining > 0) {
|
||||
player.sendMessage(LocaleLoader.getString("Item.Injured.Wait", timeRemaining));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("accept")) {
|
||||
return ptpAcceptCommand.onCommand(sender, command, label, args);
|
||||
}
|
||||
|
||||
if (!Permissions.partyTeleportSend(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
int ptpCooldown = Config.getInstance().getPTPCommandCooldown();
|
||||
long ptpLastUse = mcMMOPlayer.getPartyTeleportRecord().getLastUse();
|
||||
|
||||
if (ptpCooldown > 0) {
|
||||
int timeRemaining = SkillUtils.calculateTimeLeft(ptpLastUse * Misc.TIME_CONVERSION_FACTOR, ptpCooldown, player);
|
||||
|
||||
if (timeRemaining > 0) {
|
||||
player.sendMessage(LocaleLoader.getString("Item.Generic.Wait", timeRemaining));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
sendTeleportRequest(sender, player, CommandUtils.getMatchedPlayerName(args[0]));
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
List<String> matches = StringUtil.copyPartialMatches(args[0], TELEPORT_SUBCOMMANDS, new ArrayList<String>(TELEPORT_SUBCOMMANDS.size()));
|
||||
|
||||
if (matches.size() == 0) {
|
||||
Player player = (Player) sender;
|
||||
Party party = UserManager.getPlayer(player).getParty();
|
||||
|
||||
List<String> playerNames = party.getOnlinePlayerNames(player);
|
||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
||||
}
|
||||
|
||||
return matches;
|
||||
default:
|
||||
return ImmutableList.of();
|
||||
}
|
||||
}
|
||||
|
||||
private void sendTeleportRequest(CommandSender sender, Player player, String targetName) {
|
||||
if (!canTeleport(sender, player, targetName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetName);
|
||||
Player target = mcMMOTarget.getPlayer();
|
||||
|
||||
PartyTeleportRecord ptpRecord = mcMMOTarget.getPartyTeleportRecord();
|
||||
|
||||
if (!ptpRecord.isConfirmRequired()) {
|
||||
handleTeleportWarmup(player, target);
|
||||
return;
|
||||
}
|
||||
|
||||
ptpRecord.setRequestor(player);
|
||||
ptpRecord.actualizeTimeout();
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Invite.Success"));
|
||||
|
||||
target.sendMessage(LocaleLoader.getString("Commands.ptp.Request1", player.getName()));
|
||||
target.sendMessage(LocaleLoader.getString("Commands.ptp.Request2", Config.getInstance().getPTPCommandTimeout()));
|
||||
}
|
||||
|
||||
protected static boolean canTeleport(CommandSender sender, Player player, String targetName) {
|
||||
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetName);
|
||||
|
||||
@@ -181,16 +72,150 @@ public class PtpCommand implements TabExecutor {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(teleportingPlayer);
|
||||
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetPlayer);
|
||||
|
||||
long warmup = Config.getInstance().getPTPCommandWarmup();
|
||||
long warmup = MainConfig.getInstance().getPTPCommandWarmup();
|
||||
|
||||
mcMMOPlayer.actualizeTeleportCommenceLocation(teleportingPlayer);
|
||||
|
||||
if (warmup > 0) {
|
||||
teleportingPlayer.sendMessage(LocaleLoader.getString("Teleport.Commencing", warmup));
|
||||
new TeleportationWarmup(mcMMOPlayer, mcMMOTarget).runTaskLater(mcMMO.p, 20 * warmup);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
EventUtils.handlePartyTeleportEvent(teleportingPlayer, targetPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (CommandUtils.noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = (Player) sender;
|
||||
|
||||
/* WORLD GUARD MAIN FLAG CHECK */
|
||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||
return true;
|
||||
}
|
||||
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(player.getWorld()))
|
||||
return true;
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if (!mcMMOPlayer.inParty()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Party.None"));
|
||||
return true;
|
||||
}
|
||||
|
||||
Party party = mcMMOPlayer.getParty();
|
||||
|
||||
if (party.getLevel() < MainConfig.getInstance().getPartyFeatureUnlockLevel(PartyFeature.TELEPORT)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Party.Feature.Disabled.2"));
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
if (args[0].equalsIgnoreCase("toggle")) {
|
||||
return ptpToggleCommand.onCommand(sender, command, label, args);
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("acceptany") || args[0].equalsIgnoreCase("acceptall")) {
|
||||
return ptpAcceptAnyCommand.onCommand(sender, command, label, args);
|
||||
}
|
||||
|
||||
long recentlyHurt = mcMMOPlayer.getRecentlyHurt();
|
||||
int hurtCooldown = MainConfig.getInstance().getPTPCommandRecentlyHurtCooldown();
|
||||
|
||||
if (hurtCooldown > 0) {
|
||||
int timeRemaining = SkillUtils.calculateTimeLeft(recentlyHurt * Misc.TIME_CONVERSION_FACTOR, hurtCooldown, player);
|
||||
|
||||
if (timeRemaining > 0) {
|
||||
player.sendMessage(LocaleLoader.getString("Item.Injured.Wait", timeRemaining));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("accept")) {
|
||||
return ptpAcceptCommand.onCommand(sender, command, label, args);
|
||||
}
|
||||
|
||||
if (!Permissions.partyTeleportSend(sender)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
int ptpCooldown = MainConfig.getInstance().getPTPCommandCooldown();
|
||||
long ptpLastUse = mcMMOPlayer.getPartyTeleportRecord().getLastUse();
|
||||
|
||||
if (ptpCooldown > 0) {
|
||||
int timeRemaining = SkillUtils.calculateTimeLeft(ptpLastUse * Misc.TIME_CONVERSION_FACTOR, ptpCooldown, player);
|
||||
|
||||
if (timeRemaining > 0) {
|
||||
player.sendMessage(LocaleLoader.getString("Item.Generic.Wait", timeRemaining));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
sendTeleportRequest(sender, player, CommandUtils.getMatchedPlayerName(args[0]));
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
List<String> matches = StringUtil.copyPartialMatches(args[0], TELEPORT_SUBCOMMANDS, new ArrayList<String>(TELEPORT_SUBCOMMANDS.size()));
|
||||
|
||||
if (matches.size() == 0) {
|
||||
Player player = (Player) sender;
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if (!mcMMOPlayer.inParty()) {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
List<String> playerNames = mcMMOPlayer.getParty().getOnlinePlayerNames(player);
|
||||
return StringUtil.copyPartialMatches(args[0], playerNames, new ArrayList<String>(playerNames.size()));
|
||||
}
|
||||
|
||||
return matches;
|
||||
default:
|
||||
return ImmutableList.of();
|
||||
}
|
||||
}
|
||||
|
||||
private void sendTeleportRequest(CommandSender sender, Player player, String targetName) {
|
||||
if (!canTeleport(sender, player, targetName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOTarget = UserManager.getPlayer(targetName);
|
||||
Player target = mcMMOTarget.getPlayer();
|
||||
|
||||
PartyTeleportRecord ptpRecord = mcMMOTarget.getPartyTeleportRecord();
|
||||
|
||||
if (!ptpRecord.isConfirmRequired()) {
|
||||
handleTeleportWarmup(player, target);
|
||||
return;
|
||||
}
|
||||
|
||||
ptpRecord.setRequestor(player);
|
||||
ptpRecord.actualizeTimeout();
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Invite.Success"));
|
||||
|
||||
target.sendMessage(LocaleLoader.getString("Commands.ptp.Request1", player.getName()));
|
||||
target.sendMessage(LocaleLoader.getString("Commands.ptp.Request2", MainConfig.getInstance().getPTPCommandTimeout()));
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,13 @@
|
||||
package com.gmail.nossr50.commands.party.teleport;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.party.PartyTeleportRecord;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
public class PtpToggleCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@@ -21,8 +20,7 @@ public class PtpToggleCommand implements CommandExecutor {
|
||||
|
||||
if (ptpRecord.isEnabled()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.ptp.Disabled"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.ptp.Enabled"));
|
||||
}
|
||||
|
||||
@@ -1,26 +1,24 @@
|
||||
package com.gmail.nossr50.commands.player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.core.config.MainConfig;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import com.gmail.nossr50.core.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.core.util.scoreboards.ScoreboardManager;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class InspectCommand implements TabExecutor {
|
||||
@Override
|
||||
@@ -34,14 +32,18 @@ public class InspectCommand implements TabExecutor {
|
||||
if (mcMMOPlayer == null) {
|
||||
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName, false); // Temporary Profile
|
||||
|
||||
if (!CommandUtils.isLoaded(sender, profile)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (CommandUtils.inspectOffline(sender, profile, Permissions.inspectOffline(sender))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sender instanceof Player && Config.getInstance().getInspectUseBoard()) {
|
||||
if (MainConfig.getInstance().getScoreboardsEnabled() && sender instanceof Player && MainConfig.getInstance().getInspectUseBoard()) {
|
||||
ScoreboardManager.enablePlayerInspectScoreboard((Player) sender, profile);
|
||||
|
||||
if (!Config.getInstance().getInspectUseChat()) {
|
||||
if (!MainConfig.getInstance().getInspectUseChat()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -49,22 +51,21 @@ public class InspectCommand implements TabExecutor {
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.OfflineStats", playerName));
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Stats.Header.Gathering"));
|
||||
for (SkillType skill : SkillType.GATHERING_SKILLS) {
|
||||
for (PrimarySkillType skill : PrimarySkillType.GATHERING_SKILLS) {
|
||||
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Stats.Header.Combat"));
|
||||
for (SkillType skill : SkillType.COMBAT_SKILLS) {
|
||||
for (PrimarySkillType skill : PrimarySkillType.COMBAT_SKILLS) {
|
||||
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.getString("Stats.Header.Misc"));
|
||||
for (SkillType skill : SkillType.MISC_SKILLS) {
|
||||
for (PrimarySkillType skill : PrimarySkillType.MISC_SKILLS) {
|
||||
sender.sendMessage(CommandUtils.displaySkill(profile, skill));
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Player target = mcMMOPlayer.getPlayer();
|
||||
|
||||
if (CommandUtils.hidden(sender, target, Permissions.inspectHidden(sender))) {
|
||||
@@ -72,15 +73,14 @@ public class InspectCommand implements TabExecutor {
|
||||
sender.sendMessage(LocaleLoader.getString("Inspect.Offline"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (CommandUtils.tooFar(sender, target, Permissions.inspectFar(sender))) {
|
||||
} else if (CommandUtils.tooFar(sender, target, Permissions.inspectFar(sender))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (sender instanceof Player && Config.getInstance().getInspectUseBoard()) {
|
||||
if (MainConfig.getInstance().getScoreboardsEnabled() && sender instanceof Player && MainConfig.getInstance().getInspectUseBoard()) {
|
||||
ScoreboardManager.enablePlayerInspectScoreboard((Player) sender, mcMMOPlayer.getProfile());
|
||||
|
||||
if (!Config.getInstance().getInspectUseChat()) {
|
||||
if (!MainConfig.getInstance().getInspectUseChat()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,19 @@
|
||||
package com.gmail.nossr50.commands.player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.core.config.MainConfig;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.skills.SuperAbilityType;
|
||||
import com.gmail.nossr50.core.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.core.util.scoreboards.ScoreboardManager;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.AbilityType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.List;
|
||||
|
||||
public class MccooldownCommand implements TabExecutor {
|
||||
@Override
|
||||
@@ -24,14 +22,18 @@ public class MccooldownCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!CommandUtils.hasPlayerDataKey(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (Config.getInstance().getCooldownUseBoard()) {
|
||||
if (MainConfig.getInstance().getScoreboardsEnabled() && MainConfig.getInstance().getCooldownUseBoard()) {
|
||||
ScoreboardManager.enablePlayerCooldownScoreboard(player);
|
||||
|
||||
if (!Config.getInstance().getCooldownUseChat()) {
|
||||
if (!MainConfig.getInstance().getCooldownUseChat()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -41,7 +43,7 @@ public class MccooldownCommand implements TabExecutor {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Header"));
|
||||
player.sendMessage(LocaleLoader.getString("mcMMO.NoSkillNote"));
|
||||
|
||||
for (AbilityType ability : AbilityType.values()) {
|
||||
for (SuperAbilityType ability : SuperAbilityType.values()) {
|
||||
if (!ability.getPermissions(player)) {
|
||||
continue;
|
||||
}
|
||||
@@ -50,8 +52,7 @@ public class MccooldownCommand implements TabExecutor {
|
||||
|
||||
if (seconds <= 0) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Row.Y", ability.getName()));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Cooldowns.Row.N", ability.getName(), seconds));
|
||||
}
|
||||
}
|
||||
@@ -1,24 +1,23 @@
|
||||
package com.gmail.nossr50.commands.player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.core.config.MainConfig;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.runnables.commands.McrankCommandAsyncTask;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import com.gmail.nossr50.core.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.runnables.commands.McrankCommandAsyncTask;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class McrankCommand implements TabExecutor {
|
||||
@Override
|
||||
@@ -34,6 +33,10 @@ public class McrankCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!CommandUtils.hasPlayerDataKey(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
display(sender, sender.getName());
|
||||
|
||||
return true;
|
||||
@@ -44,6 +47,10 @@ public class McrankCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!CommandUtils.hasPlayerDataKey(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
String playerName = CommandUtils.getMatchedPlayerName(args[0]);
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getOfflinePlayer(playerName);
|
||||
|
||||
@@ -54,8 +61,7 @@ public class McrankCommand implements TabExecutor {
|
||||
if (CommandUtils.tooFar(sender, player, Permissions.mcrankFar(sender))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (CommandUtils.inspectOffline(sender, mcMMO.getDatabaseManager().loadPlayerProfile(playerName, false), Permissions.mcrankOffline(sender))) {
|
||||
} else if (CommandUtils.inspectOffline(sender, mcMMO.getDatabaseManager().loadPlayerProfile(playerName, false), Permissions.mcrankOffline(sender))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -81,18 +87,25 @@ public class McrankCommand implements TabExecutor {
|
||||
private void display(CommandSender sender, String playerName) {
|
||||
if (sender instanceof Player) {
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
||||
long cooldownMillis = Math.max(Config.getInstance().getDatabasePlayerCooldown(), 1750);
|
||||
long cooldownMillis = Math.max(MainConfig.getInstance().getDatabasePlayerCooldown(), 1750);
|
||||
|
||||
if (mcMMOPlayer.getDatabaseATS() + cooldownMillis > System.currentTimeMillis()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Database.Cooldown"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (((Player) sender).hasMetadata(mcMMO.databaseCommandKey)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Database.Processing"));
|
||||
return;
|
||||
} else {
|
||||
((Player) sender).setMetadata(mcMMO.databaseCommandKey, new FixedMetadataValue(mcMMO.p, null));
|
||||
}
|
||||
|
||||
mcMMOPlayer.actualizeDatabaseATS();
|
||||
}
|
||||
|
||||
boolean useBoard = (sender instanceof Player) && (Config.getInstance().getRankUseBoard());
|
||||
boolean useChat = !useBoard || Config.getInstance().getRankUseChat();
|
||||
boolean useBoard = MainConfig.getInstance().getScoreboardsEnabled() && (sender instanceof Player) && (MainConfig.getInstance().getRankUseBoard());
|
||||
boolean useChat = !useBoard || MainConfig.getInstance().getRankUseChat();
|
||||
|
||||
new McrankCommandAsyncTask(playerName, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
|
||||
}
|
||||
@@ -1,19 +1,17 @@
|
||||
package com.gmail.nossr50.commands.player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.core.config.MainConfig;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.core.util.scoreboards.ScoreboardManager;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.List;
|
||||
|
||||
public class McstatsCommand implements TabExecutor {
|
||||
@Override
|
||||
@@ -22,14 +20,18 @@ public class McstatsCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!CommandUtils.hasPlayerDataKey(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
Player player = (Player) sender;
|
||||
|
||||
if (Config.getInstance().getStatsUseBoard()) {
|
||||
if (MainConfig.getInstance().getStatsUseBoard() && MainConfig.getInstance().getScoreboardsEnabled()) {
|
||||
ScoreboardManager.enablePlayerStatsScoreboard(player);
|
||||
|
||||
if (!Config.getInstance().getStatsUseChat()) {
|
||||
if (!MainConfig.getInstance().getStatsUseChat()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -41,12 +43,11 @@ public class McstatsCommand implements TabExecutor {
|
||||
CommandUtils.printCombatSkills(player);
|
||||
CommandUtils.printMiscSkills(player);
|
||||
|
||||
int powerLevelCap = Config.getInstance().getPowerLevelCap();
|
||||
int powerLevelCap = MainConfig.getInstance().getPowerLevelCap();
|
||||
|
||||
if (powerLevelCap != Integer.MAX_VALUE) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Capped", UserManager.getPlayer(player).getPowerLevel(), powerLevelCap));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.PowerLevel", UserManager.getPlayer(player).getPowerLevel()));
|
||||
}
|
||||
|
||||
@@ -1,31 +1,30 @@
|
||||
package com.gmail.nossr50.commands.player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.core.config.MainConfig;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.runnables.commands.MctopCommandAsyncTask;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import com.gmail.nossr50.core.util.StringUtils;
|
||||
import com.gmail.nossr50.core.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.runnables.commands.MctopCommandAsyncTask;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MctopCommand implements TabExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
SkillType skill = null;
|
||||
PrimarySkillType skill = null;
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
@@ -70,46 +69,62 @@ public class MctopCommand implements TabExecutor {
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
return StringUtil.copyPartialMatches(args[0], SkillType.SKILL_NAMES, new ArrayList<String>(SkillType.SKILL_NAMES.size()));
|
||||
return StringUtil.copyPartialMatches(args[0], PrimarySkillType.SKILL_NAMES, new ArrayList<String>(PrimarySkillType.SKILL_NAMES.size()));
|
||||
default:
|
||||
return ImmutableList.of();
|
||||
}
|
||||
}
|
||||
|
||||
private void display(int page, SkillType skill, CommandSender sender, Command command) {
|
||||
private void display(int page, PrimarySkillType skill, CommandSender sender, Command command) {
|
||||
if (skill != null && !Permissions.mctop(sender, skill)) {
|
||||
sender.sendMessage(command.getPermissionMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
if (sender instanceof Player) {
|
||||
if (!CommandUtils.hasPlayerDataKey(sender)) {
|
||||
return;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
||||
long cooldownMillis = Math.max(Config.getInstance().getDatabasePlayerCooldown(), 1750);
|
||||
long cooldownMillis = Math.max(MainConfig.getInstance().getDatabasePlayerCooldown(), 1750);
|
||||
|
||||
if (mcMMOPlayer.getDatabaseATS() + cooldownMillis > System.currentTimeMillis()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Database.Cooldown"));
|
||||
double seconds = ((mcMMOPlayer.getDatabaseATS() + cooldownMillis) - System.currentTimeMillis()) / 1000;
|
||||
if (seconds < 1) {
|
||||
seconds = 1;
|
||||
}
|
||||
|
||||
sender.sendMessage(LocaleLoader.formatString(LocaleLoader.getString("Commands.Database.Cooldown"), seconds));
|
||||
return;
|
||||
}
|
||||
|
||||
if (((Player) sender).hasMetadata(mcMMO.databaseCommandKey)) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Database.Processing"));
|
||||
return;
|
||||
} else {
|
||||
((Player) sender).setMetadata(mcMMO.databaseCommandKey, new FixedMetadataValue(mcMMO.p, null));
|
||||
}
|
||||
|
||||
mcMMOPlayer.actualizeDatabaseATS();
|
||||
}
|
||||
|
||||
display(page, skill, sender);
|
||||
}
|
||||
|
||||
private void display(int page, SkillType skill, CommandSender sender) {
|
||||
boolean useBoard = (sender instanceof Player) && (Config.getInstance().getTopUseBoard());
|
||||
boolean useChat = !useBoard || Config.getInstance().getTopUseChat();
|
||||
private void display(int page, PrimarySkillType skill, CommandSender sender) {
|
||||
boolean useBoard = (sender instanceof Player) && (MainConfig.getInstance().getTopUseBoard());
|
||||
boolean useChat = !useBoard || MainConfig.getInstance().getTopUseChat();
|
||||
|
||||
new MctopCommandAsyncTask(page, skill, sender, useBoard, useChat).runTaskAsynchronously(mcMMO.p);
|
||||
}
|
||||
|
||||
private SkillType extractSkill(CommandSender sender, String skillName) {
|
||||
private PrimarySkillType extractSkill(CommandSender sender, String skillName) {
|
||||
if (CommandUtils.isInvalidSkill(sender, skillName)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
SkillType skill = SkillType.getSkill(skillName);
|
||||
PrimarySkillType skill = PrimarySkillType.getSkill(skillName);
|
||||
|
||||
if (CommandUtils.isChildSkill(sender, skill)) {
|
||||
return null;
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.gmail.nossr50.commands.server;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
/**
|
||||
* This command facilitates switching the skill system scale between classic and modern scale
|
||||
*/
|
||||
public class Mcmmoupgrade implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.skills.SubSkillType;
|
||||
import com.gmail.nossr50.core.skills.subskills.AbstractSubSkill;
|
||||
import com.gmail.nossr50.core.util.TextComponentFactory;
|
||||
import com.gmail.nossr50.core.util.random.RandomChanceSkill;
|
||||
import com.gmail.nossr50.core.util.random.RandomChanceUtil;
|
||||
import com.gmail.nossr50.core.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.listeners.InteractionManager;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AcrobaticsCommand extends SkillCommand {
|
||||
private String dodgeChance;
|
||||
private String dodgeChanceLucky;
|
||||
|
||||
private boolean canDodge;
|
||||
private boolean canRoll;
|
||||
|
||||
public AcrobaticsCommand() {
|
||||
super(PrimarySkillType.ACROBATICS);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
// ACROBATICS_DODGE
|
||||
if (canDodge) {
|
||||
String[] dodgeStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ACROBATICS_DODGE);
|
||||
dodgeChance = dodgeStrings[0];
|
||||
dodgeChanceLucky = dodgeStrings[1];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canDodge = canUseSubskill(player, SubSkillType.ACROBATICS_DODGE);
|
||||
canRoll = canUseSubskill(player, SubSkillType.ACROBATICS_ROLL);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<String>();
|
||||
|
||||
if (canDodge) {
|
||||
messages.add(getStatMessage(SubSkillType.ACROBATICS_DODGE, dodgeChance)
|
||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", dodgeChanceLucky) : ""));
|
||||
}
|
||||
|
||||
if (canRoll) {
|
||||
|
||||
AbstractSubSkill abstractSubSkill = InteractionManager.getAbstractByName("Roll");
|
||||
|
||||
if (abstractSubSkill != null) {
|
||||
double rollChance, graceChance;
|
||||
|
||||
//Chance to roll at half
|
||||
RandomChanceSkill roll_rcs = new RandomChanceSkill(player, SubSkillType.ACROBATICS_ROLL);
|
||||
|
||||
//Chance to graceful roll
|
||||
RandomChanceSkill grace_rcs = new RandomChanceSkill(player, SubSkillType.ACROBATICS_ROLL);
|
||||
grace_rcs.setSkillLevel(grace_rcs.getSkillLevel() * 2); //Double Odds
|
||||
|
||||
//Chance Stat Calculations
|
||||
rollChance = RandomChanceUtil.getRandomChanceExecutionChance(roll_rcs);
|
||||
graceChance = RandomChanceUtil.getRandomChanceExecutionChance(grace_rcs);
|
||||
//damageThreshold = AdvancedConfig.getInstance().getRollDamageThreshold();
|
||||
|
||||
String rollStrings[] = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ACROBATICS_ROLL);
|
||||
|
||||
//Format
|
||||
double rollChanceLucky = rollChance * 1.333D;
|
||||
double graceChanceLucky = graceChance * 1.333D;
|
||||
|
||||
messages.add(getStatMessage(SubSkillType.ACROBATICS_ROLL, rollStrings[0])
|
||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", rollStrings[1]) : ""));
|
||||
|
||||
/*messages.add(getStatMessage(true, false, SubSkillType.ACROBATICS_ROLL, String.valueOf(graceChance))
|
||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", String.valueOf(graceChanceLucky)) : ""));*/
|
||||
}
|
||||
}
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TextComponent> getTextComponents(Player player) {
|
||||
List<TextComponent> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.ACROBATICS);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.skills.SubSkillType;
|
||||
import com.gmail.nossr50.core.skills.primary.alchemy.AlchemyManager;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import com.gmail.nossr50.core.util.TextComponentFactory;
|
||||
import com.gmail.nossr50.core.util.skills.RankUtils;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AlchemyCommand extends SkillCommand {
|
||||
private String brewSpeed;
|
||||
private String brewSpeedLucky;
|
||||
|
||||
private int tier;
|
||||
private int ingredientCount;
|
||||
private String ingredientList;
|
||||
|
||||
private boolean canCatalysis;
|
||||
private boolean canConcoctions;
|
||||
|
||||
public AlchemyCommand() {
|
||||
super(PrimarySkillType.ALCHEMY);
|
||||
}
|
||||
|
||||
protected String[] calculateAbilityDisplayValues(Player player) {
|
||||
AlchemyManager alchemyManager = UserManager.getPlayer(player).getAlchemyManager();
|
||||
String[] displayValues = new String[2];
|
||||
|
||||
boolean isLucky = Permissions.lucky(player, PrimarySkillType.ALCHEMY);
|
||||
|
||||
displayValues[0] = decimal.format(alchemyManager.calculateBrewSpeed(false)) + "x";
|
||||
displayValues[1] = isLucky ? decimal.format(alchemyManager.calculateBrewSpeed(true)) + "x" : null;
|
||||
|
||||
return displayValues;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
// ALCHEMY_CATALYSIS
|
||||
if (canCatalysis) {
|
||||
String[] catalysisStrings = calculateAbilityDisplayValues(player);
|
||||
brewSpeed = catalysisStrings[0];
|
||||
brewSpeedLucky = catalysisStrings[1];
|
||||
}
|
||||
|
||||
// ALCHEMY_CONCOCTIONS
|
||||
if (canConcoctions) {
|
||||
AlchemyManager alchemyManager = UserManager.getPlayer(player).getAlchemyManager();
|
||||
tier = alchemyManager.getTier();
|
||||
ingredientCount = alchemyManager.getIngredients().size();
|
||||
ingredientList = alchemyManager.getIngredientList();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canCatalysis = canUseSubskill(player, SubSkillType.ALCHEMY_CATALYSIS);
|
||||
canConcoctions = canUseSubskill(player, SubSkillType.ALCHEMY_CONCOCTIONS);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<String>();
|
||||
|
||||
if (canCatalysis) {
|
||||
messages.add(getStatMessage(SubSkillType.ALCHEMY_CATALYSIS, brewSpeed)
|
||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", brewSpeedLucky) : ""));
|
||||
}
|
||||
|
||||
if (canConcoctions) {
|
||||
messages.add(getStatMessage(false, true, SubSkillType.ALCHEMY_CONCOCTIONS, String.valueOf(tier), String.valueOf(RankUtils.getHighestRank(SubSkillType.ALCHEMY_CONCOCTIONS))));
|
||||
messages.add(getStatMessage(true, true, SubSkillType.ALCHEMY_CONCOCTIONS, String.valueOf(ingredientCount), ingredientList));
|
||||
|
||||
//messages.add(LocaleLoader.getString("Alchemy.Concoctions.Rank", tier, RankUtils.getHighestRank(SubSkillType.ALCHEMY_CONCOCTIONS)));
|
||||
//messages.add(LocaleLoader.getString("Alchemy.Concoctions.Ingredients", ingredientCount, ingredientList));
|
||||
}
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TextComponent> getTextComponents(Player player) {
|
||||
List<TextComponent> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.ALCHEMY);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
}
|
||||
@@ -1,27 +1,24 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.util.HolidayManager.FakeSkillType;
|
||||
import com.gmail.nossr50.core.util.Misc;
|
||||
import com.gmail.nossr50.core.util.StringUtils;
|
||||
import com.gmail.nossr50.core.util.commands.CommandUtils;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.HolidayManager.FakeSkillType;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AprilCommand implements TabExecutor {
|
||||
private String skillName;
|
||||
|
||||
protected DecimalFormat percent = new DecimalFormat("##0.00%");
|
||||
protected DecimalFormat decimal = new DecimalFormat("##0.00");
|
||||
private String skillName;
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.skills.SubSkillType;
|
||||
import com.gmail.nossr50.core.skills.primary.archery.Archery;
|
||||
import com.gmail.nossr50.core.util.TextComponentFactory;
|
||||
import com.gmail.nossr50.core.util.skills.SkillActivationType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ArcheryCommand extends SkillCommand {
|
||||
private String skillShotBonus;
|
||||
private String dazeChance;
|
||||
private String dazeChanceLucky;
|
||||
private String retrieveChance;
|
||||
private String retrieveChanceLucky;
|
||||
|
||||
private boolean canSkillShot;
|
||||
private boolean canDaze;
|
||||
private boolean canRetrieve;
|
||||
|
||||
public ArcheryCommand() {
|
||||
super(PrimarySkillType.ARCHERY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
// ARCHERY_ARROW_RETRIEVAL
|
||||
if (canRetrieve) {
|
||||
String[] retrieveStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ARCHERY_ARROW_RETRIEVAL);
|
||||
retrieveChance = retrieveStrings[0];
|
||||
retrieveChanceLucky = retrieveStrings[1];
|
||||
}
|
||||
|
||||
// ARCHERY_DAZE
|
||||
if (canDaze) {
|
||||
String[] dazeStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.ARCHERY_DAZE);
|
||||
dazeChance = dazeStrings[0];
|
||||
dazeChanceLucky = dazeStrings[1];
|
||||
}
|
||||
|
||||
// SKILL SHOT
|
||||
if (canSkillShot) {
|
||||
skillShotBonus = percent.format(Archery.getDamageBonusPercent(player));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canSkillShot = canUseSubskill(player, SubSkillType.ARCHERY_SKILL_SHOT);
|
||||
canDaze = canUseSubskill(player, SubSkillType.ARCHERY_DAZE);
|
||||
canRetrieve = canUseSubskill(player, SubSkillType.ARCHERY_ARROW_RETRIEVAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<String>();
|
||||
|
||||
if (canRetrieve) {
|
||||
messages.add(getStatMessage(SubSkillType.ARCHERY_ARROW_RETRIEVAL, retrieveChance)
|
||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", retrieveChanceLucky) : ""));
|
||||
}
|
||||
|
||||
if (canDaze) {
|
||||
messages.add(getStatMessage(SubSkillType.ARCHERY_DAZE, dazeChance)
|
||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", dazeChanceLucky) : ""));
|
||||
}
|
||||
|
||||
if (canSkillShot) {
|
||||
messages.add(getStatMessage(SubSkillType.ARCHERY_SKILL_SHOT, skillShotBonus));
|
||||
}
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TextComponent> getTextComponents(Player player) {
|
||||
List<TextComponent> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.ARCHERY);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.skills.SubSkillType;
|
||||
import com.gmail.nossr50.core.skills.primary.axes.Axes;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import com.gmail.nossr50.core.util.TextComponentFactory;
|
||||
import com.gmail.nossr50.core.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.core.util.skills.SkillActivationType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AxesCommand extends SkillCommand {
|
||||
private String critChance;
|
||||
private String critChanceLucky;
|
||||
private double axeMasteryDamage;
|
||||
private double impactDamage;
|
||||
private String skullSplitterLength;
|
||||
private String skullSplitterLengthEndurance;
|
||||
|
||||
private boolean canSkullSplitter;
|
||||
private boolean canCritical;
|
||||
private boolean canAxeMastery;
|
||||
private boolean canImpact;
|
||||
private boolean canGreaterImpact;
|
||||
|
||||
public AxesCommand() {
|
||||
super(PrimarySkillType.AXES);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
// ARMOR IMPACT
|
||||
if (canImpact) {
|
||||
impactDamage = UserManager.getPlayer(player).getAxesManager().getImpactDurabilityDamage();
|
||||
}
|
||||
|
||||
// AXE MASTERY
|
||||
if (canAxeMastery) {
|
||||
axeMasteryDamage = Axes.getAxeMasteryBonusDamage(player);
|
||||
}
|
||||
|
||||
// CRITICAL HIT
|
||||
if (canCritical) {
|
||||
String[] criticalHitStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.AXES_CRITICAL_STRIKES);
|
||||
critChance = criticalHitStrings[0];
|
||||
critChanceLucky = criticalHitStrings[1];
|
||||
}
|
||||
|
||||
// SKULL SPLITTER
|
||||
if (canSkullSplitter) {
|
||||
String[] skullSplitterStrings = calculateLengthDisplayValues(player, skillValue);
|
||||
skullSplitterLength = skullSplitterStrings[0];
|
||||
skullSplitterLengthEndurance = skullSplitterStrings[1];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canSkullSplitter = Permissions.skullSplitter(player) && RankUtils.hasUnlockedSubskill(player, SubSkillType.AXES_SKULL_SPLITTER);
|
||||
canCritical = canUseSubskill(player, SubSkillType.AXES_CRITICAL_STRIKES);
|
||||
canAxeMastery = canUseSubskill(player, SubSkillType.AXES_AXE_MASTERY);
|
||||
canImpact = canUseSubskill(player, SubSkillType.AXES_ARMOR_IMPACT);
|
||||
canGreaterImpact = canUseSubskill(player, SubSkillType.AXES_GREATER_IMPACT);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<String>();
|
||||
|
||||
if (canImpact) {
|
||||
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Axes.Ability.Bonus.2"), LocaleLoader.getString("Axes.Ability.Bonus.3", impactDamage)));
|
||||
}
|
||||
|
||||
if (canAxeMastery) {
|
||||
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Axes.Ability.Bonus.0"), LocaleLoader.getString("Axes.Ability.Bonus.1", axeMasteryDamage)));
|
||||
}
|
||||
|
||||
if (canCritical) {
|
||||
messages.add(getStatMessage(SubSkillType.AXES_CRITICAL_STRIKES, critChance)
|
||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", critChanceLucky) : ""));
|
||||
}
|
||||
|
||||
if (canGreaterImpact) {
|
||||
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Axes.Ability.Bonus.4"), LocaleLoader.getString("Axes.Ability.Bonus.5", Axes.greaterImpactBonusDamage)));
|
||||
}
|
||||
|
||||
if (canSkullSplitter) {
|
||||
messages.add(getStatMessage(SubSkillType.AXES_SKULL_SPLITTER, skullSplitterLength)
|
||||
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", skullSplitterLengthEndurance) : ""));
|
||||
}
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TextComponent> getTextComponents(Player player) {
|
||||
List<TextComponent> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.AXES);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.skills.SubSkillType;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import com.gmail.nossr50.core.util.TextComponentFactory;
|
||||
import com.gmail.nossr50.core.util.skills.RankUtils;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ExcavationCommand extends SkillCommand {
|
||||
private String gigaDrillBreakerLength;
|
||||
private String gigaDrillBreakerLengthEndurance;
|
||||
|
||||
private boolean canGigaDrill;
|
||||
private boolean canTreasureHunt;
|
||||
|
||||
public ExcavationCommand() {
|
||||
super(PrimarySkillType.EXCAVATION);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
// GIGA DRILL BREAKER
|
||||
if (canGigaDrill) {
|
||||
String gigaDrillStrings[] = calculateLengthDisplayValues(player, skillValue);
|
||||
gigaDrillBreakerLength = gigaDrillStrings[0];
|
||||
gigaDrillBreakerLengthEndurance = gigaDrillStrings[1];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canGigaDrill = Permissions.gigaDrillBreaker(player) && RankUtils.hasUnlockedSubskill(player, SubSkillType.EXCAVATION_GIGA_DRILL_BREAKER);
|
||||
canTreasureHunt = canUseSubskill(player, SubSkillType.EXCAVATION_ARCHAEOLOGY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<String>();
|
||||
|
||||
if (canGigaDrill) {
|
||||
messages.add(getStatMessage(SubSkillType.EXCAVATION_GIGA_DRILL_BREAKER, gigaDrillBreakerLength)
|
||||
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", gigaDrillBreakerLengthEndurance) : ""));
|
||||
|
||||
//messages.add(LocaleLoader.getString("Excavation.Effect.Length", gigaDrillBreakerLength) + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", gigaDrillBreakerLengthEndurance) : ""));
|
||||
}
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TextComponent> getTextComponents(Player player) {
|
||||
List<TextComponent> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.EXCAVATION);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.core.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.core.config.treasure.TreasureConfig;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.skills.SubSkillType;
|
||||
import com.gmail.nossr50.core.skills.primary.fishing.Fishing;
|
||||
import com.gmail.nossr50.core.skills.primary.fishing.FishingManager;
|
||||
import com.gmail.nossr50.core.skills.treasure.Rarity;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import com.gmail.nossr50.core.util.TextComponentFactory;
|
||||
import com.gmail.nossr50.core.util.random.RandomChanceUtil;
|
||||
import com.gmail.nossr50.core.util.skills.RankUtils;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class FishingCommand extends SkillCommand {
|
||||
private int lootTier;
|
||||
private String shakeChance;
|
||||
private String shakeChanceLucky;
|
||||
private int fishermansDietRank;
|
||||
private String biteChance;
|
||||
|
||||
private String trapTreasure;
|
||||
private String commonTreasure;
|
||||
private String uncommonTreasure;
|
||||
private String rareTreasure;
|
||||
private String epicTreasure;
|
||||
private String legendaryTreasure;
|
||||
private String recordTreasure;
|
||||
|
||||
private String magicChance;
|
||||
|
||||
private boolean canTreasureHunt;
|
||||
private boolean canMagicHunt;
|
||||
private boolean canShake;
|
||||
private boolean canFishermansDiet;
|
||||
private boolean canMasterAngler;
|
||||
private boolean canIceFish;
|
||||
|
||||
public FishingCommand() {
|
||||
super(PrimarySkillType.FISHING);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager();
|
||||
|
||||
// TREASURE HUNTER
|
||||
if (canTreasureHunt) {
|
||||
lootTier = fishingManager.getLootTier();
|
||||
|
||||
// ItemStack drop rates
|
||||
commonTreasure = percent.format(TreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.COMMON) / 100.0);
|
||||
uncommonTreasure = percent.format(TreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.UNCOMMON) / 100.0);
|
||||
rareTreasure = percent.format(TreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.RARE) / 100.0);
|
||||
epicTreasure = percent.format(TreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.EPIC) / 100.0);
|
||||
legendaryTreasure = percent.format(TreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.LEGENDARY) / 100.0);
|
||||
recordTreasure = percent.format(TreasureConfig.getInstance().getItemDropRate(lootTier, Rarity.RECORD) / 100.0);
|
||||
|
||||
// Magic hunter drop rates
|
||||
double totalEnchantChance = 0;
|
||||
|
||||
for (Rarity rarity : Rarity.values()) {
|
||||
if (rarity != Rarity.RECORD) {
|
||||
totalEnchantChance += TreasureConfig.getInstance().getEnchantmentDropRate(lootTier, rarity);
|
||||
}
|
||||
}
|
||||
|
||||
if (totalEnchantChance >= 1)
|
||||
magicChance = percent.format(totalEnchantChance / 100.0);
|
||||
else
|
||||
magicChance = percent.format(0);
|
||||
}
|
||||
|
||||
// FISHING_SHAKE
|
||||
if (canShake) {
|
||||
String[] shakeStrings = RandomChanceUtil.calculateAbilityDisplayValuesStatic(player, PrimarySkillType.FISHING, fishingManager.getShakeChance());
|
||||
shakeChance = shakeStrings[0];
|
||||
shakeChanceLucky = shakeStrings[1];
|
||||
}
|
||||
|
||||
// FISHERMAN'S DIET
|
||||
if (canFishermansDiet) {
|
||||
fishermansDietRank = calculateRank(skillValue, Fishing.fishermansDietMaxLevel, Fishing.fishermansDietRankLevel1);
|
||||
}
|
||||
|
||||
// MASTER ANGLER
|
||||
if (canMasterAngler) {
|
||||
double rawBiteChance = 1.0 / (player.getWorld().hasStorm() ? 300 : 500);
|
||||
|
||||
Location location = fishingManager.getHookLocation();
|
||||
|
||||
if (location == null) {
|
||||
location = player.getLocation();
|
||||
}
|
||||
|
||||
if (Fishing.masterAnglerBiomes.contains(location.getBlock().getBiome())) {
|
||||
rawBiteChance = rawBiteChance * AdvancedConfig.getInstance().getMasterAnglerBiomeModifier();
|
||||
}
|
||||
|
||||
if (player.isInsideVehicle() && player.getVehicle().getType() == EntityType.BOAT) {
|
||||
rawBiteChance = rawBiteChance * AdvancedConfig.getInstance().getMasterAnglerBoatModifier();
|
||||
}
|
||||
|
||||
double luckyModifier = Permissions.lucky(player, PrimarySkillType.FISHING) ? 1.333D : 1.0D;
|
||||
|
||||
biteChance = percent.format((rawBiteChance * 100.0D) * luckyModifier);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canTreasureHunt = canUseSubskill(player, SubSkillType.FISHING_TREASURE_HUNTER);
|
||||
canMagicHunt = canUseSubskill(player, SubSkillType.FISHING_MAGIC_HUNTER) && canUseSubskill(player, SubSkillType.FISHING_TREASURE_HUNTER);
|
||||
canShake = canUseSubskill(player, SubSkillType.FISHING_SHAKE);
|
||||
canFishermansDiet = canUseSubskill(player, SubSkillType.FISHING_FISHERMANS_DIET);
|
||||
canMasterAngler = canUseSubskill(player, SubSkillType.FISHING_MASTER_ANGLER);
|
||||
canIceFish = canUseSubskill(player, SubSkillType.FISHING_ICE_FISHING);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<String>();
|
||||
|
||||
if (canFishermansDiet) {
|
||||
messages.add(getStatMessage(false, true, SubSkillType.FISHING_FISHERMANS_DIET, String.valueOf(fishermansDietRank)));
|
||||
}
|
||||
|
||||
if (canIceFish) {
|
||||
messages.add(getStatMessage(SubSkillType.FISHING_ICE_FISHING, SubSkillType.FISHING_ICE_FISHING.getLocaleStatDescription()));
|
||||
}
|
||||
|
||||
if (canMagicHunt) {
|
||||
messages.add(getStatMessage(SubSkillType.FISHING_MAGIC_HUNTER, magicChance));
|
||||
}
|
||||
|
||||
if (canMasterAngler) {
|
||||
//TODO: Update this with more details
|
||||
messages.add(getStatMessage(false, true, SubSkillType.FISHING_MASTER_ANGLER, biteChance));
|
||||
}
|
||||
|
||||
if (canShake) {
|
||||
messages.add(getStatMessage(SubSkillType.FISHING_SHAKE, shakeChance)
|
||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", shakeChanceLucky) : ""));
|
||||
}
|
||||
|
||||
if (canTreasureHunt) {
|
||||
messages.add(getStatMessage(false, true, SubSkillType.FISHING_TREASURE_HUNTER, String.valueOf(lootTier), String.valueOf(RankUtils.getHighestRank(SubSkillType.FISHING_TREASURE_HUNTER))));
|
||||
messages.add(getStatMessage(true, true, SubSkillType.FISHING_TREASURE_HUNTER,
|
||||
String.valueOf(commonTreasure),
|
||||
String.valueOf(uncommonTreasure),
|
||||
String.valueOf(rareTreasure),
|
||||
String.valueOf(epicTreasure),
|
||||
String.valueOf(legendaryTreasure),
|
||||
String.valueOf(recordTreasure)));
|
||||
}
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TextComponent> getTextComponents(Player player) {
|
||||
List<TextComponent> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.FISHING);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.skills.SubSkillType;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import com.gmail.nossr50.core.util.TextComponentFactory;
|
||||
import com.gmail.nossr50.core.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.core.util.skills.SkillActivationType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class HerbalismCommand extends SkillCommand {
|
||||
private String greenTerraLength;
|
||||
private String greenTerraLengthEndurance;
|
||||
private String greenThumbChance;
|
||||
private String greenThumbChanceLucky;
|
||||
private int greenThumbStage;
|
||||
private int farmersDietRank;
|
||||
private String doubleDropChance;
|
||||
private String doubleDropChanceLucky;
|
||||
private String hylianLuckChance;
|
||||
private String hylianLuckChanceLucky;
|
||||
private String shroomThumbChance;
|
||||
private String shroomThumbChanceLucky;
|
||||
|
||||
private boolean hasHylianLuck;
|
||||
private boolean canGreenTerra;
|
||||
private boolean canGreenThumbPlants;
|
||||
private boolean canGreenThumbBlocks;
|
||||
private boolean canFarmersDiet;
|
||||
private boolean canDoubleDrop;
|
||||
private boolean canShroomThumb;
|
||||
|
||||
public HerbalismCommand() {
|
||||
super(PrimarySkillType.HERBALISM);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
|
||||
// DOUBLE DROPS
|
||||
if (canDoubleDrop) {
|
||||
String[] doubleDropStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.HERBALISM_DOUBLE_DROPS);
|
||||
;
|
||||
doubleDropChance = doubleDropStrings[0];
|
||||
doubleDropChanceLucky = doubleDropStrings[1];
|
||||
}
|
||||
|
||||
// FARMERS DIET
|
||||
if (canFarmersDiet) {
|
||||
farmersDietRank = RankUtils.getRank(player, SubSkillType.HERBALISM_FARMERS_DIET);
|
||||
}
|
||||
|
||||
// GREEN TERRA
|
||||
if (canGreenTerra) {
|
||||
String[] greenTerraStrings = calculateLengthDisplayValues(player, skillValue);
|
||||
greenTerraLength = greenTerraStrings[0];
|
||||
greenTerraLengthEndurance = greenTerraStrings[1];
|
||||
}
|
||||
|
||||
// GREEN THUMB
|
||||
if (canGreenThumbBlocks || canGreenThumbPlants) {
|
||||
greenThumbStage = RankUtils.getRank(player, SubSkillType.HERBALISM_GREEN_THUMB);
|
||||
|
||||
String[] greenThumbStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.HERBALISM_GREEN_THUMB);
|
||||
greenThumbChance = greenThumbStrings[0];
|
||||
greenThumbChanceLucky = greenThumbStrings[1];
|
||||
}
|
||||
|
||||
// HYLIAN LUCK
|
||||
if (hasHylianLuck) {
|
||||
String[] hylianLuckStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.HERBALISM_HYLIAN_LUCK);
|
||||
hylianLuckChance = hylianLuckStrings[0];
|
||||
hylianLuckChanceLucky = hylianLuckStrings[1];
|
||||
}
|
||||
|
||||
// SHROOM THUMB
|
||||
if (canShroomThumb) {
|
||||
String[] shroomThumbStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.HERBALISM_SHROOM_THUMB);
|
||||
shroomThumbChance = shroomThumbStrings[0];
|
||||
shroomThumbChanceLucky = shroomThumbStrings[1];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
hasHylianLuck = canUseSubskill(player, SubSkillType.HERBALISM_HYLIAN_LUCK);
|
||||
canGreenTerra = Permissions.greenTerra(player);
|
||||
canGreenThumbPlants = RankUtils.hasUnlockedSubskill(player, SubSkillType.HERBALISM_GREEN_THUMB) && (Permissions.greenThumbPlant(player, Material.WHEAT) || Permissions.greenThumbPlant(player, Material.CARROT) || Permissions.greenThumbPlant(player, Material.POTATO) || Permissions.greenThumbPlant(player, Material.BEETROOT) || Permissions.greenThumbPlant(player, Material.NETHER_WART) || Permissions.greenThumbPlant(player, Material.COCOA));
|
||||
canGreenThumbBlocks = RankUtils.hasUnlockedSubskill(player, SubSkillType.HERBALISM_GREEN_THUMB) && (Permissions.greenThumbBlock(player, Material.DIRT) || Permissions.greenThumbBlock(player, Material.COBBLESTONE) || Permissions.greenThumbBlock(player, Material.COBBLESTONE_WALL) || Permissions.greenThumbBlock(player, Material.STONE_BRICKS));
|
||||
canFarmersDiet = canUseSubskill(player, SubSkillType.HERBALISM_FARMERS_DIET);
|
||||
canDoubleDrop = canUseSubskill(player, SubSkillType.HERBALISM_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled();
|
||||
canShroomThumb = canUseSubskill(player, SubSkillType.HERBALISM_SHROOM_THUMB);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<String>();
|
||||
|
||||
if (canDoubleDrop) {
|
||||
messages.add(getStatMessage(SubSkillType.HERBALISM_DOUBLE_DROPS, doubleDropChance)
|
||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : ""));
|
||||
}
|
||||
|
||||
if (canFarmersDiet) {
|
||||
messages.add(getStatMessage(false, true, SubSkillType.HERBALISM_FARMERS_DIET, String.valueOf(farmersDietRank)));
|
||||
}
|
||||
|
||||
if (canGreenTerra) {
|
||||
messages.add(getStatMessage(SubSkillType.HERBALISM_GREEN_TERRA, greenTerraLength)
|
||||
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", greenTerraLengthEndurance) : ""));
|
||||
|
||||
//messages.add(LocaleLoader.getString("Herbalism.Ability.GTe.Length", greenTerraLength) + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", greenTerraLengthEndurance) : ""));
|
||||
}
|
||||
|
||||
if (canGreenThumbBlocks || canGreenThumbPlants) {
|
||||
messages.add(getStatMessage(SubSkillType.HERBALISM_GREEN_THUMB, greenThumbChance)
|
||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", greenThumbChanceLucky) : ""));
|
||||
//messages.add(LocaleLoader.getString("Herbalism.Ability.GTh.Chance", greenThumbChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", greenThumbChanceLucky) : ""));
|
||||
}
|
||||
|
||||
if (canGreenThumbPlants) {
|
||||
messages.add(getStatMessage(true, true, SubSkillType.HERBALISM_GREEN_THUMB, String.valueOf(greenThumbStage)));
|
||||
}
|
||||
|
||||
if (hasHylianLuck) {
|
||||
messages.add(getStatMessage(SubSkillType.HERBALISM_HYLIAN_LUCK, hylianLuckChance)
|
||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", hylianLuckChanceLucky) : ""));
|
||||
}
|
||||
|
||||
if (canShroomThumb) {
|
||||
messages.add(getStatMessage(SubSkillType.HERBALISM_SHROOM_THUMB, shroomThumbChance)
|
||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", shroomThumbChanceLucky) : ""));
|
||||
}
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TextComponent> getTextComponents(Player player) {
|
||||
List<TextComponent> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.HERBALISM);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.skills.SubSkillType;
|
||||
import com.gmail.nossr50.core.skills.primary.mining.MiningManager;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import com.gmail.nossr50.core.util.TextComponentFactory;
|
||||
import com.gmail.nossr50.core.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.core.util.skills.SkillActivationType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MiningCommand extends SkillCommand {
|
||||
private String doubleDropChance;
|
||||
private String doubleDropChanceLucky;
|
||||
private String superBreakerLength;
|
||||
private String superBreakerLengthEndurance;
|
||||
|
||||
private int blastMiningRank;
|
||||
private int bonusTNTDrops;
|
||||
private double blastRadiusIncrease;
|
||||
private String oreBonus;
|
||||
private String debrisReduction;
|
||||
private String blastDamageDecrease;
|
||||
|
||||
private boolean canSuperBreaker;
|
||||
private boolean canDoubleDrop;
|
||||
private boolean canBlast;
|
||||
private boolean canBiggerBombs;
|
||||
private boolean canDemoExpert;
|
||||
|
||||
public MiningCommand() {
|
||||
super(PrimarySkillType.MINING);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
// BLAST MINING
|
||||
if (canBlast || canDemoExpert || canBiggerBombs) {
|
||||
MiningManager miningManager = UserManager.getPlayer(player).getMiningManager();
|
||||
|
||||
blastMiningRank = miningManager.getBlastMiningTier();
|
||||
bonusTNTDrops = miningManager.getDropMultiplier();
|
||||
oreBonus = percent.format(miningManager.getOreBonus() / 30.0D); // Base received in TNT is 30%
|
||||
debrisReduction = percent.format(miningManager.getDebrisReduction() / 30.0D); // Base received in TNT is 30%
|
||||
blastDamageDecrease = percent.format(miningManager.getBlastDamageModifier() / 100.0D);
|
||||
blastRadiusIncrease = miningManager.getBlastRadiusModifier();
|
||||
}
|
||||
|
||||
// DOUBLE DROPS
|
||||
if (canDoubleDrop) {
|
||||
String[] doubleDropStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.MINING_DOUBLE_DROPS);
|
||||
doubleDropChance = doubleDropStrings[0];
|
||||
doubleDropChanceLucky = doubleDropStrings[1];
|
||||
}
|
||||
|
||||
// SUPER BREAKER
|
||||
if (canSuperBreaker) {
|
||||
String[] superBreakerStrings = calculateLengthDisplayValues(player, skillValue);
|
||||
superBreakerLength = superBreakerStrings[0];
|
||||
superBreakerLengthEndurance = superBreakerStrings[1];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canBiggerBombs = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_BIGGER_BOMBS) && Permissions.biggerBombs(player);
|
||||
canBlast = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_BLAST_MINING) && Permissions.remoteDetonation(player);
|
||||
canDemoExpert = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_DEMOLITIONS_EXPERTISE) && Permissions.demolitionsExpertise(player);
|
||||
canDoubleDrop = Permissions.isSubSkillEnabled(player, SubSkillType.MINING_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled();
|
||||
canSuperBreaker = RankUtils.hasUnlockedSubskill(player, SubSkillType.MINING_SUPER_BREAKER) && Permissions.superBreaker(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<String>();
|
||||
|
||||
if (canBiggerBombs) {
|
||||
messages.add(getStatMessage(true, true, SubSkillType.MINING_BLAST_MINING, String.valueOf(blastRadiusIncrease)));
|
||||
//messages.add(LocaleLoader.getString("Mining.Blast.Radius.Increase", blastRadiusIncrease));
|
||||
}
|
||||
|
||||
if (canBlast) {
|
||||
messages.add(getStatMessage(false, true, SubSkillType.MINING_BLAST_MINING, String.valueOf(blastMiningRank), String.valueOf(RankUtils.getHighestRank(SubSkillType.MINING_BLAST_MINING)), LocaleLoader.getString("Mining.Blast.Effect", oreBonus, debrisReduction, bonusTNTDrops)));
|
||||
//messages.add(LocaleLoader.getString("Mining.Blast.Rank", blastMiningRank, RankUtils.getHighestRank(SubSkillType.MINING_BLAST_MINING), LocaleLoader.getString("Mining.Blast.Effect", oreBonus, debrisReduction, bonusTNTDrops)));
|
||||
}
|
||||
|
||||
if (canDemoExpert) {
|
||||
messages.add(getStatMessage(SubSkillType.MINING_DEMOLITIONS_EXPERTISE, blastDamageDecrease));
|
||||
//messages.add(LocaleLoader.getString("Mining.Effect.Decrease", blastDamageDecrease));
|
||||
}
|
||||
|
||||
if (canDoubleDrop) {
|
||||
messages.add(getStatMessage(SubSkillType.HERBALISM_DOUBLE_DROPS, doubleDropChance)
|
||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : ""));
|
||||
//messages.add(LocaleLoader.getString("Mining.Effect.DropChance", doubleDropChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : ""));
|
||||
}
|
||||
|
||||
if (canSuperBreaker) {
|
||||
messages.add(getStatMessage(SubSkillType.MINING_SUPER_BREAKER, superBreakerLength)
|
||||
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", superBreakerLengthEndurance) : ""));
|
||||
//messages.add(LocaleLoader.getString("Mining.Ability.Length", superBreakerLength) + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", superBreakerLengthEndurance) : ""));
|
||||
}
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TextComponent> getTextComponents(Player player) {
|
||||
List<TextComponent> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.MINING);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.skills.SubSkillType;
|
||||
import com.gmail.nossr50.core.skills.subskills.AbstractSubSkill;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import com.gmail.nossr50.core.util.TextComponentFactory;
|
||||
import com.gmail.nossr50.listeners.InteractionManager;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This is the command that retrieves data about skills from in-game sources
|
||||
*/
|
||||
public class MmoInfoCommand implements TabExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) {
|
||||
/*
|
||||
* Only allow players to use this command
|
||||
*/
|
||||
if (commandSender instanceof Player) {
|
||||
if (args.length < 1)
|
||||
return false;
|
||||
|
||||
Player player = (Player) commandSender;
|
||||
if (Permissions.mmoinfo(player)) {
|
||||
if (args == null || args[0] == null)
|
||||
return false;
|
||||
|
||||
if (args[0].equalsIgnoreCase("???")) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header"));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", "???"));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader"));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Mystery"));
|
||||
return true;
|
||||
} else if (InteractionManager.getAbstractByName(args[0]) != null || PrimarySkillType.SUBSKILL_NAMES.contains(args[0])) {
|
||||
displayInfo(player, args[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
//Not a real skill
|
||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.NoMatch"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
return StringUtil.copyPartialMatches(args[0], PrimarySkillType.SUBSKILL_NAMES, new ArrayList<String>(PrimarySkillType.SUBSKILL_NAMES.size()));
|
||||
default:
|
||||
return ImmutableList.of();
|
||||
}
|
||||
}
|
||||
|
||||
private void displayInfo(Player player, String subSkillName) {
|
||||
//Check to see if the skill exists in the new system
|
||||
AbstractSubSkill abstractSubSkill = InteractionManager.getAbstractByName(subSkillName);
|
||||
if (abstractSubSkill != null) {
|
||||
/* New System Skills are programmable */
|
||||
abstractSubSkill.printInfo(player);
|
||||
//TextComponentFactory.sendPlayerUrlHeader(player);
|
||||
} else {
|
||||
/*
|
||||
* Skill is only in the old system
|
||||
*/
|
||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header"));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", subSkillName));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.DetailsHeader"));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.OldSkill"));
|
||||
}
|
||||
|
||||
for (SubSkillType subSkillType : SubSkillType.values()) {
|
||||
if (subSkillType.getNiceNameNoSpaces(subSkillType).equalsIgnoreCase(subSkillName))
|
||||
subSkillName = subSkillType.getWikiName(subSkillType.toString());
|
||||
}
|
||||
|
||||
//Send Player Wiki Link
|
||||
TextComponentFactory.sendPlayerSubSkillWikiLink(player, subSkillName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.skills.MaterialType;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.skills.SubSkillType;
|
||||
import com.gmail.nossr50.core.skills.primary.repair.ArcaneForging;
|
||||
import com.gmail.nossr50.core.skills.primary.repair.Repair;
|
||||
import com.gmail.nossr50.core.skills.primary.repair.RepairManager;
|
||||
import com.gmail.nossr50.core.skills.primary.repair.repairables.Repairable;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import com.gmail.nossr50.core.util.TextComponentFactory;
|
||||
import com.gmail.nossr50.core.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.core.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RepairCommand extends SkillCommand {
|
||||
private String repairMasteryBonus;
|
||||
private String superRepairChance;
|
||||
private String superRepairChanceLucky;
|
||||
|
||||
private boolean canSuperRepair;
|
||||
private boolean canMasterRepair;
|
||||
private boolean canArcaneForge;
|
||||
private boolean canRepairStone;
|
||||
private boolean canRepairIron;
|
||||
private boolean canRepairGold;
|
||||
private boolean canRepairDiamond;
|
||||
private boolean canRepairString;
|
||||
private boolean canRepairLeather;
|
||||
private boolean canRepairWood;
|
||||
private boolean arcaneBypass;
|
||||
|
||||
private int diamondLevel;
|
||||
private int goldLevel;
|
||||
private int ironLevel;
|
||||
private int stoneLevel;
|
||||
|
||||
public RepairCommand() {
|
||||
super(PrimarySkillType.REPAIR);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
// We're using pickaxes here, not the best but it works
|
||||
Repairable diamondRepairable = mcMMO.getRepairableManager().getRepairable(Material.DIAMOND_PICKAXE);
|
||||
Repairable goldRepairable = mcMMO.getRepairableManager().getRepairable(Material.GOLDEN_PICKAXE);
|
||||
Repairable ironRepairable = mcMMO.getRepairableManager().getRepairable(Material.IRON_PICKAXE);
|
||||
Repairable stoneRepairable = mcMMO.getRepairableManager().getRepairable(Material.STONE_PICKAXE);
|
||||
|
||||
// TODO: This isn't really accurate - if they don't have pickaxes loaded it doesn't always mean the repair level is 0
|
||||
diamondLevel = (diamondRepairable == null) ? 0 : diamondRepairable.getMinimumLevel();
|
||||
goldLevel = (goldRepairable == null) ? 0 : goldRepairable.getMinimumLevel();
|
||||
ironLevel = (ironRepairable == null) ? 0 : ironRepairable.getMinimumLevel();
|
||||
stoneLevel = (stoneRepairable == null) ? 0 : stoneRepairable.getMinimumLevel();
|
||||
|
||||
// REPAIR MASTERY
|
||||
if (canMasterRepair) {
|
||||
repairMasteryBonus = percent.format(Math.min(((Repair.repairMasteryMaxBonus / Repair.repairMasteryMaxBonusLevel) * skillValue), Repair.repairMasteryMaxBonus) / 100D);
|
||||
}
|
||||
|
||||
// SUPER REPAIR
|
||||
if (canSuperRepair) {
|
||||
String[] superRepairStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.REPAIR_SUPER_REPAIR);
|
||||
superRepairChance = superRepairStrings[0];
|
||||
superRepairChanceLucky = superRepairStrings[1];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canSuperRepair = canUseSubskill(player, SubSkillType.REPAIR_SUPER_REPAIR);
|
||||
canMasterRepair = canUseSubskill(player, SubSkillType.REPAIR_REPAIR_MASTERY);
|
||||
canArcaneForge = canUseSubskill(player, SubSkillType.REPAIR_ARCANE_FORGING);
|
||||
canRepairDiamond = Permissions.repairMaterialType(player, MaterialType.DIAMOND);
|
||||
canRepairGold = Permissions.repairMaterialType(player, MaterialType.GOLD);
|
||||
canRepairIron = Permissions.repairMaterialType(player, MaterialType.IRON);
|
||||
canRepairStone = Permissions.repairMaterialType(player, MaterialType.STONE);
|
||||
canRepairString = Permissions.repairMaterialType(player, MaterialType.STRING);
|
||||
canRepairLeather = Permissions.repairMaterialType(player, MaterialType.LEATHER);
|
||||
canRepairWood = Permissions.repairMaterialType(player, MaterialType.WOOD);
|
||||
arcaneBypass = Permissions.arcaneBypass(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<String>();
|
||||
|
||||
if (canArcaneForge) {
|
||||
RepairManager repairManager = UserManager.getPlayer(player).getRepairManager();
|
||||
|
||||
messages.add(getStatMessage(false, true,
|
||||
SubSkillType.REPAIR_ARCANE_FORGING,
|
||||
String.valueOf(RankUtils.getRank(player, SubSkillType.REPAIR_ARCANE_FORGING)),
|
||||
RankUtils.getHighestRankStr(SubSkillType.REPAIR_ARCANE_FORGING)));
|
||||
|
||||
if (ArcaneForging.arcaneForgingEnchantLoss || ArcaneForging.arcaneForgingDowngrades) {
|
||||
messages.add(getStatMessage(true, true, SubSkillType.REPAIR_ARCANE_FORGING,
|
||||
String.valueOf(arcaneBypass ? 100 : repairManager.getKeepEnchantChance()),
|
||||
String.valueOf(arcaneBypass ? 0 : repairManager.getDowngradeEnchantChance()))); //Jesus those parentheses
|
||||
}
|
||||
}
|
||||
|
||||
if (canMasterRepair) {
|
||||
messages.add(getStatMessage(false, true, SubSkillType.REPAIR_REPAIR_MASTERY, repairMasteryBonus));
|
||||
}
|
||||
|
||||
if (canSuperRepair) {
|
||||
messages.add(getStatMessage(SubSkillType.REPAIR_SUPER_REPAIR, superRepairChance)
|
||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", superRepairChanceLucky) : ""));
|
||||
}
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TextComponent> getTextComponents(Player player) {
|
||||
List<TextComponent> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.REPAIR);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.skills.SubSkillType;
|
||||
import com.gmail.nossr50.core.skills.child.salvage.Salvage;
|
||||
import com.gmail.nossr50.core.skills.child.salvage.SalvageManager;
|
||||
import com.gmail.nossr50.core.util.TextComponentFactory;
|
||||
import com.gmail.nossr50.core.util.skills.RankUtils;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SalvageCommand extends SkillCommand {
|
||||
private boolean canAdvancedSalvage;
|
||||
private boolean canArcaneSalvage;
|
||||
|
||||
public SalvageCommand() {
|
||||
super(PrimarySkillType.SALVAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canAdvancedSalvage = canUseSubskill(player, SubSkillType.SALVAGE_ADVANCED_SALVAGE);
|
||||
canArcaneSalvage = canUseSubskill(player, SubSkillType.SALVAGE_ARCANE_SALVAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<String>();
|
||||
SalvageManager salvageManager = UserManager.getPlayer(player).getSalvageManager();
|
||||
|
||||
if (canAdvancedSalvage) {
|
||||
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Salvage.Ability.Bonus.0"),
|
||||
LocaleLoader.getString("Salvage.Ability.Bonus.1", salvageManager.getSalvageableAmount())));
|
||||
}
|
||||
|
||||
if (canArcaneSalvage) {
|
||||
messages.add(getStatMessage(false, true, SubSkillType.SALVAGE_ARCANE_SALVAGE,
|
||||
String.valueOf(salvageManager.getArcaneSalvageRank()),
|
||||
String.valueOf(RankUtils.getHighestRank(SubSkillType.SALVAGE_ARCANE_SALVAGE))));
|
||||
|
||||
if (Salvage.arcaneSalvageEnchantLoss) {
|
||||
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Salvage.Arcane.ExtractFull"), percent.format(salvageManager.getExtractFullEnchantChance() / 100)));
|
||||
}
|
||||
|
||||
if (Salvage.arcaneSalvageDowngrades) {
|
||||
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Salvage.Arcane.ExtractPartial"), percent.format(salvageManager.getExtractPartialEnchantChance() / 100)));
|
||||
}
|
||||
}
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TextComponent> getTextComponents(Player player) {
|
||||
List<TextComponent> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.SALVAGE);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,290 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.core.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.core.config.MainConfig;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.skills.SubSkillType;
|
||||
import com.gmail.nossr50.core.skills.child.FamilyTree;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import com.gmail.nossr50.core.util.StringUtils;
|
||||
import com.gmail.nossr50.core.util.TextComponentFactory;
|
||||
import com.gmail.nossr50.core.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.core.util.random.RandomChanceUtil;
|
||||
import com.gmail.nossr50.core.util.scoreboards.ScoreboardManager;
|
||||
import com.gmail.nossr50.core.util.skills.PerksUtils;
|
||||
import com.gmail.nossr50.core.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.core.util.skills.SkillActivationType;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public abstract class SkillCommand implements TabExecutor {
|
||||
protected PrimarySkillType skill;
|
||||
protected DecimalFormat percent = new DecimalFormat("##0.00%");
|
||||
protected DecimalFormat decimal = new DecimalFormat("##0.00");
|
||||
private String skillName;
|
||||
private CommandExecutor skillGuideCommand;
|
||||
|
||||
public SkillCommand(PrimarySkillType skill) {
|
||||
this.skill = skill;
|
||||
skillName = skill.getName();
|
||||
skillGuideCommand = new SkillGuideCommand(skill);
|
||||
}
|
||||
|
||||
public static String[] addItemToFirstPositionOfArray(String itemToAdd, String... existingArray) {
|
||||
String[] newArray = new String[existingArray.length + 1];
|
||||
newArray[0] = itemToAdd;
|
||||
|
||||
System.arraycopy(existingArray, 0, newArray, 1, existingArray.length);
|
||||
|
||||
return newArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (CommandUtils.noConsoleUsage(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!CommandUtils.hasPlayerDataKey(sender)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
Player player = (Player) sender;
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
boolean isLucky = Permissions.lucky(player, skill);
|
||||
boolean hasEndurance = (PerksUtils.handleActivationPerks(player, 0, 0) != 0);
|
||||
float skillValue = mcMMOPlayer.getSkillLevel(skill);
|
||||
|
||||
//Send the players a few blank lines to make finding the top of the skill command easier
|
||||
if (AdvancedConfig.getInstance().doesSkillCommandSendBlankLines())
|
||||
for (int i = 0; i < 2; i++) {
|
||||
player.sendMessage("");
|
||||
}
|
||||
|
||||
permissionsCheck(player);
|
||||
dataCalculations(player, skillValue);
|
||||
|
||||
sendSkillCommandHeader(player, mcMMOPlayer, (int) skillValue);
|
||||
|
||||
//Make JSON text components
|
||||
List<TextComponent> subskillTextComponents = getTextComponents(player);
|
||||
|
||||
//Subskills Header
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", LocaleLoader.getString("Effects.SubSkills.Overhaul")));
|
||||
|
||||
//Send JSON text components
|
||||
|
||||
TextComponentFactory.sendPlayerSubSkillList(player, subskillTextComponents);
|
||||
|
||||
/*for(TextComponent tc : subskillTextComponents)
|
||||
{
|
||||
player.spigot().sendMessage(new TextComponent[]{tc, new TextComponent(": TESTING")});
|
||||
}*/
|
||||
|
||||
//Stats
|
||||
getStatMessages(player, isLucky, hasEndurance, skillValue);
|
||||
|
||||
//Header
|
||||
|
||||
|
||||
//Link Header
|
||||
if (MainConfig.getInstance().getUrlLinksEnabled()) {
|
||||
player.sendMessage(LocaleLoader.getString("Overhaul.mcMMO.Header"));
|
||||
TextComponentFactory.sendPlayerUrlHeader(player);
|
||||
}
|
||||
|
||||
|
||||
if (MainConfig.getInstance().getScoreboardsEnabled() && MainConfig.getInstance().getSkillUseBoard()) {
|
||||
ScoreboardManager.enablePlayerSkillScoreboard(player, skill);
|
||||
}
|
||||
|
||||
return true;
|
||||
default:
|
||||
return skillGuideCommand.onCommand(sender, command, label, args);
|
||||
}
|
||||
}
|
||||
|
||||
private void getStatMessages(Player player, boolean isLucky, boolean hasEndurance, float skillValue) {
|
||||
List<String> statsMessages = statsDisplay(player, skillValue, hasEndurance, isLucky);
|
||||
|
||||
if (!statsMessages.isEmpty()) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", LocaleLoader.getString("Commands.Stats.Self.Overhaul")));
|
||||
|
||||
for (String message : statsMessages) {
|
||||
player.sendMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Guides.Available", skillName, skillName.toLowerCase()));
|
||||
}
|
||||
|
||||
private void sendSkillCommandHeader(Player player, McMMOPlayer mcMMOPlayer, int skillValue) {
|
||||
ChatColor hd1 = ChatColor.DARK_AQUA;
|
||||
ChatColor c1 = ChatColor.GOLD;
|
||||
ChatColor c2 = ChatColor.RED;
|
||||
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", skillName));
|
||||
|
||||
if (!skill.isChildSkill()) {
|
||||
/*
|
||||
* NON-CHILD SKILLS
|
||||
*/
|
||||
|
||||
//XP GAIN METHOD
|
||||
player.sendMessage(LocaleLoader.getString("Commands.XPGain.Overhaul", LocaleLoader.getString("Commands.XPGain." + StringUtils.getCapitalized(skill.toString()))));
|
||||
|
||||
//LEVEL
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Level.Overhaul", skillValue, mcMMOPlayer.getSkillXpLevel(skill), mcMMOPlayer.getXpToLevel(skill)));
|
||||
|
||||
} else {
|
||||
/*
|
||||
* CHILD SKILLS
|
||||
*/
|
||||
|
||||
|
||||
Set<PrimarySkillType> parents = FamilyTree.getParents(skill);
|
||||
ArrayList<PrimarySkillType> parentList = new ArrayList<>();
|
||||
|
||||
//TODO: Add JSON here
|
||||
for (PrimarySkillType parent : parents) {
|
||||
parentList.add(parent);
|
||||
/*player.sendMessage(parent.getName() + " - " + LocaleLoader.getString("Effects.Level.Overhaul", mcMMOPlayer.getSkillLevel(parent), mcMMOPlayer.getSkillXpLevel(parent), mcMMOPlayer.getXpToLevel(parent)))*/
|
||||
;
|
||||
}
|
||||
|
||||
String parentMessage = "";
|
||||
|
||||
for (int i = 0; i < parentList.size(); i++) {
|
||||
if (i + 1 < parentList.size()) {
|
||||
parentMessage += LocaleLoader.getString("Effects.Child.ParentList", parentList.get(i).getName(), mcMMOPlayer.getSkillLevel(parentList.get(i)));
|
||||
parentMessage += ChatColor.GRAY + ", ";
|
||||
} else {
|
||||
parentMessage += LocaleLoader.getString("Effects.Child.ParentList", parentList.get(i).getName(), mcMMOPlayer.getSkillLevel(parentList.get(i)));
|
||||
}
|
||||
}
|
||||
|
||||
//XP GAIN METHOD
|
||||
player.sendMessage(LocaleLoader.getString("Commands.XPGain.Overhaul", LocaleLoader.getString("Commands.XPGain.Child")));
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Child.Overhaul", skillValue, parentMessage));
|
||||
//LEVEL
|
||||
//player.sendMessage(LocaleLoader.getString("Effects.Child.Overhaul", skillValue, skillValue));
|
||||
|
||||
}
|
||||
/*
|
||||
if (!skill.isChildSkill()) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", skillName));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.XPGain", LocaleLoader.getString("Commands.XPGain." + StringUtils.getCapitalized(skill.toString()))));
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Level", skillValue, mcMMOPlayer.getSkillXpLevel(skill), mcMMOPlayer.getXpToLevel(skill)));
|
||||
} else {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", skillName + " " + LocaleLoader.getString("Skills.Child")));
|
||||
player.sendMessage(LocaleLoader.getString("Commands.XPGain", LocaleLoader.getString("Commands.XPGain.Child")));
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Child", skillValue));
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Skills.Header", LocaleLoader.getString("Skills.Parents")));
|
||||
Set<PrimarySkillType> parents = FamilyTree.getParents(skill);
|
||||
|
||||
for (PrimarySkillType parent : parents) {
|
||||
player.sendMessage(parent.getName() + " - " + LocaleLoader.getString("Effects.Level", mcMMOPlayer.getSkillLevel(parent), mcMMOPlayer.getSkillXpLevel(parent), mcMMOPlayer.getXpToLevel(parent)));
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
switch (args.length) {
|
||||
case 1:
|
||||
return ImmutableList.of("?");
|
||||
default:
|
||||
return ImmutableList.of();
|
||||
}
|
||||
}
|
||||
|
||||
protected int calculateRank(float skillValue, int maxLevel, int rankChangeLevel) {
|
||||
return Math.min((int) skillValue, maxLevel) / rankChangeLevel;
|
||||
}
|
||||
|
||||
protected String[] getAbilityDisplayValues(SkillActivationType skillActivationType, Player player, SubSkillType subSkill) {
|
||||
return RandomChanceUtil.calculateAbilityDisplayValues(skillActivationType, player, subSkill);
|
||||
}
|
||||
|
||||
protected String[] calculateLengthDisplayValues(Player player, float skillValue) {
|
||||
int maxLength = skill.getAbility().getMaxLength();
|
||||
int abilityLengthVar = AdvancedConfig.getInstance().getAbilityLength();
|
||||
int abilityLengthCap = AdvancedConfig.getInstance().getAbilityLengthCap();
|
||||
|
||||
int length;
|
||||
|
||||
if (abilityLengthCap <= 0) {
|
||||
length = 2 + (int) (skillValue / abilityLengthVar);
|
||||
} else {
|
||||
length = 2 + (int) (Math.min(abilityLengthCap, skillValue) / abilityLengthVar);
|
||||
}
|
||||
|
||||
int enduranceLength = PerksUtils.handleActivationPerks(player, length, maxLength);
|
||||
|
||||
if (maxLength != 0) {
|
||||
length = Math.min(length, maxLength);
|
||||
}
|
||||
|
||||
return new String[]{String.valueOf(length), String.valueOf(enduranceLength)};
|
||||
}
|
||||
|
||||
protected String getStatMessage(SubSkillType subSkillType, String... vars) {
|
||||
return getStatMessage(false, false, subSkillType, vars);
|
||||
}
|
||||
|
||||
protected String getStatMessage(boolean isExtra, boolean isCustom, SubSkillType subSkillType, String... vars) {
|
||||
String templateKey = isCustom ? "Ability.Generic.Template.Custom" : "Ability.Generic.Template";
|
||||
String statDescriptionKey = !isExtra ? subSkillType.getLocaleKeyStatDescription() : subSkillType.getLocaleKeyStatExtraDescription();
|
||||
|
||||
if (isCustom)
|
||||
//Cast to Object[] to suppress warnings
|
||||
return LocaleLoader.getString(templateKey, LocaleLoader.getString(statDescriptionKey, (Object[]) vars));
|
||||
else {
|
||||
String[] mergedList = addItemToFirstPositionOfArray(LocaleLoader.getString(statDescriptionKey), vars);
|
||||
//Cast to Object[] to suppress warnings
|
||||
return LocaleLoader.getString(templateKey, (Object[]) mergedList);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void dataCalculations(Player player, float skillValue);
|
||||
|
||||
protected abstract void permissionsCheck(Player player);
|
||||
|
||||
//protected abstract List<String> effectsDisplay();
|
||||
|
||||
protected abstract List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky);
|
||||
|
||||
protected abstract List<TextComponent> getTextComponents(Player player);
|
||||
|
||||
/**
|
||||
* Checks if a player can use a skill
|
||||
*
|
||||
* @param player target player
|
||||
* @param subSkillType target subskill
|
||||
* @return true if the player has permission and has the skill unlocked
|
||||
*/
|
||||
protected boolean canUseSubskill(Player player, SubSkillType subSkillType) {
|
||||
return Permissions.isSubSkillEnabled(player, subSkillType) && RankUtils.hasUnlockedSubskill(player, subSkillType);
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,14 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.util.StringUtils;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.StringUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class SkillGuideCommand implements CommandExecutor {
|
||||
private String header;
|
||||
@@ -17,7 +16,7 @@ public class SkillGuideCommand implements CommandExecutor {
|
||||
|
||||
private String invalidPage = LocaleLoader.getString("Guides.Page.Invalid");
|
||||
|
||||
public SkillGuideCommand(SkillType skill) {
|
||||
public SkillGuideCommand(PrimarySkillType skill) {
|
||||
header = LocaleLoader.getString("Guides.Header", skill.getName());
|
||||
guide = getGuide(skill);
|
||||
}
|
||||
@@ -76,8 +75,7 @@ public class SkillGuideCommand implements CommandExecutor {
|
||||
while (allStrings.size() < 9) {
|
||||
if (pageIndexStart + allStrings.size() > guide.size()) {
|
||||
allStrings.add("");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
allStrings.add(guide.get(pageIndexStart + (allStrings.size() - 1)));
|
||||
}
|
||||
}
|
||||
@@ -86,7 +84,7 @@ public class SkillGuideCommand implements CommandExecutor {
|
||||
return allStrings;
|
||||
}
|
||||
|
||||
private ArrayList<String> getGuide(SkillType skill) {
|
||||
private ArrayList<String> getGuide(PrimarySkillType skill) {
|
||||
ArrayList<String> guide = new ArrayList<String>();
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.skills.SubSkillType;
|
||||
import com.gmail.nossr50.core.skills.child.smelting.Smelting;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import com.gmail.nossr50.core.util.TextComponentFactory;
|
||||
import com.gmail.nossr50.core.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.core.util.skills.SkillActivationType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SmeltingCommand extends SkillCommand {
|
||||
private String burnTimeModifier;
|
||||
private String str_secondSmeltChance;
|
||||
private String str_secondSmeltChanceLucky;
|
||||
private String str_fluxMiningChance;
|
||||
private String str_fluxMiningChanceLucky;
|
||||
|
||||
private boolean canFuelEfficiency;
|
||||
private boolean canSecondSmelt;
|
||||
private boolean canFluxMine;
|
||||
private boolean canUnderstandTheArt;
|
||||
|
||||
public SmeltingCommand() {
|
||||
super(PrimarySkillType.SMELTING);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
// FUEL EFFICIENCY
|
||||
if (canFuelEfficiency) {
|
||||
burnTimeModifier = decimal.format(1 + ((skillValue / Smelting.burnModifierMaxLevel) * Smelting.burnTimeMultiplier));
|
||||
}
|
||||
|
||||
// FLUX MINING
|
||||
/*if (canFluxMine) {
|
||||
String[] fluxMiningStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.SMELTING_FLUX_MINING);
|
||||
str_fluxMiningChance = fluxMiningStrings[0];
|
||||
str_fluxMiningChanceLucky = fluxMiningStrings[1];
|
||||
}*/
|
||||
|
||||
// SECOND SMELT
|
||||
if (canSecondSmelt) {
|
||||
String[] secondSmeltStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.SMELTING_SECOND_SMELT);
|
||||
str_secondSmeltChance = secondSmeltStrings[0];
|
||||
str_secondSmeltChanceLucky = secondSmeltStrings[1];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canFuelEfficiency = canUseSubskill(player, SubSkillType.SMELTING_FUEL_EFFICIENCY);
|
||||
canSecondSmelt = canUseSubskill(player, SubSkillType.SMELTING_SECOND_SMELT);
|
||||
canFluxMine = canUseSubskill(player, SubSkillType.SMELTING_FLUX_MINING);
|
||||
canUnderstandTheArt = Permissions.vanillaXpBoost(player, skill) && RankUtils.hasUnlockedSubskill(player, SubSkillType.SMELTING_UNDERSTANDING_THE_ART);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<String>();
|
||||
|
||||
/*if (canFluxMine) {
|
||||
messages.add(getStatMessage(SubSkillType.SMELTING_FLUX_MINING, str_fluxMiningChance)
|
||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", str_fluxMiningChanceLucky) : ""));
|
||||
//messages.add(LocaleLoader.getString("Smelting.Ability.FluxMining", str_fluxMiningChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", str_fluxMiningChanceLucky) : ""));
|
||||
}*/
|
||||
|
||||
if (canFuelEfficiency) {
|
||||
messages.add(getStatMessage(false, true, SubSkillType.SMELTING_FUEL_EFFICIENCY, burnTimeModifier));
|
||||
}
|
||||
|
||||
if (canSecondSmelt) {
|
||||
messages.add(getStatMessage(SubSkillType.SMELTING_SECOND_SMELT, str_secondSmeltChance)
|
||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", str_secondSmeltChanceLucky) : ""));
|
||||
}
|
||||
|
||||
if (canUnderstandTheArt) {
|
||||
messages.add(getStatMessage(false, true, SubSkillType.SMELTING_UNDERSTANDING_THE_ART,
|
||||
String.valueOf(UserManager.getPlayer(player).getSmeltingManager().getVanillaXpMultiplier())));
|
||||
}
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TextComponent> getTextComponents(Player player) {
|
||||
List<TextComponent> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.SMELTING);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.core.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.skills.SubSkillType;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import com.gmail.nossr50.core.util.TextComponentFactory;
|
||||
import com.gmail.nossr50.core.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.core.util.skills.SkillActivationType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SwordsCommand extends SkillCommand {
|
||||
private String counterChance;
|
||||
private String counterChanceLucky;
|
||||
private int bleedLength;
|
||||
private String bleedChance;
|
||||
private String bleedChanceLucky;
|
||||
private String serratedStrikesLength;
|
||||
private String serratedStrikesLengthEndurance;
|
||||
|
||||
private boolean canCounter;
|
||||
private boolean canSerratedStrike;
|
||||
private boolean canBleed;
|
||||
|
||||
public SwordsCommand() {
|
||||
super(PrimarySkillType.SWORDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
// SWORDS_COUNTER_ATTACK
|
||||
if (canCounter) {
|
||||
String[] counterStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.SWORDS_COUNTER_ATTACK);
|
||||
counterChance = counterStrings[0];
|
||||
counterChanceLucky = counterStrings[1];
|
||||
}
|
||||
|
||||
// SWORDS_RUPTURE
|
||||
if (canBleed) {
|
||||
bleedLength = UserManager.getPlayer(player).getSwordsManager().getRuptureBleedTicks();
|
||||
|
||||
String[] bleedStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.SWORDS_RUPTURE);
|
||||
bleedChance = bleedStrings[0];
|
||||
bleedChanceLucky = bleedStrings[1];
|
||||
}
|
||||
|
||||
// SERRATED STRIKES
|
||||
if (canSerratedStrike) {
|
||||
String[] serratedStrikesStrings = calculateLengthDisplayValues(player, skillValue);
|
||||
serratedStrikesLength = serratedStrikesStrings[0];
|
||||
serratedStrikesLengthEndurance = serratedStrikesStrings[1];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canBleed = canUseSubskill(player, SubSkillType.SWORDS_RUPTURE);
|
||||
canCounter = canUseSubskill(player, SubSkillType.SWORDS_COUNTER_ATTACK);
|
||||
canSerratedStrike = RankUtils.hasUnlockedSubskill(player, SubSkillType.SWORDS_SERRATED_STRIKES) && Permissions.serratedStrikes(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<String>();
|
||||
|
||||
int ruptureTicks = UserManager.getPlayer(player).getSwordsManager().getRuptureBleedTicks();
|
||||
double ruptureDamagePlayers = RankUtils.getRank(player, SubSkillType.SWORDS_RUPTURE) >= 3 ? AdvancedConfig.getInstance().getRuptureDamagePlayer() * 1.5D : AdvancedConfig.getInstance().getRuptureDamagePlayer();
|
||||
double ruptureDamageMobs = RankUtils.getRank(player, SubSkillType.SWORDS_RUPTURE) >= 3 ? AdvancedConfig.getInstance().getRuptureDamageMobs() * 1.5D : AdvancedConfig.getInstance().getRuptureDamageMobs();
|
||||
|
||||
if (canCounter) {
|
||||
messages.add(getStatMessage(SubSkillType.SWORDS_COUNTER_ATTACK, counterChance)
|
||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", counterChanceLucky) : ""));
|
||||
}
|
||||
|
||||
if (canBleed) {
|
||||
messages.add(getStatMessage(SubSkillType.SWORDS_RUPTURE, bleedChance)
|
||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", bleedChanceLucky) : ""));
|
||||
messages.add(getStatMessage(true, true, SubSkillType.SWORDS_RUPTURE,
|
||||
String.valueOf(ruptureTicks),
|
||||
String.valueOf(ruptureDamagePlayers),
|
||||
String.valueOf(ruptureDamageMobs)));
|
||||
|
||||
messages.add(LocaleLoader.getString("Swords.Combat.Rupture.Note"));
|
||||
}
|
||||
|
||||
if (canSerratedStrike) {
|
||||
messages.add(getStatMessage(SubSkillType.SWORDS_SERRATED_STRIKES, serratedStrikesLength)
|
||||
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", serratedStrikesLengthEndurance) : ""));
|
||||
}
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TextComponent> getTextComponents(Player player) {
|
||||
List<TextComponent> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.SWORDS);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.skills.SubSkillType;
|
||||
import com.gmail.nossr50.core.skills.primary.taming.Taming;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import com.gmail.nossr50.core.util.TextComponentFactory;
|
||||
import com.gmail.nossr50.core.util.skills.SkillActivationType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TamingCommand extends SkillCommand {
|
||||
private String goreChance;
|
||||
private String goreChanceLucky;
|
||||
|
||||
private boolean canBeastLore;
|
||||
private boolean canGore;
|
||||
private boolean canSharpenedClaws;
|
||||
private boolean canEnvironmentallyAware;
|
||||
private boolean canThickFur;
|
||||
private boolean canShockProof;
|
||||
private boolean canCallWild;
|
||||
private boolean canFastFood;
|
||||
private boolean canHolyHound;
|
||||
|
||||
public TamingCommand() {
|
||||
super(PrimarySkillType.TAMING);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
if (canGore) {
|
||||
String[] goreStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.TAMING_GORE);
|
||||
goreChance = goreStrings[0];
|
||||
goreChanceLucky = goreStrings[1];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canBeastLore = canUseSubskill(player, SubSkillType.TAMING_BEAST_LORE);
|
||||
canCallWild = Permissions.callOfTheWild(player, EntityType.HORSE) || Permissions.callOfTheWild(player, EntityType.WOLF) || Permissions.callOfTheWild(player, EntityType.OCELOT);
|
||||
canEnvironmentallyAware = canUseSubskill(player, SubSkillType.TAMING_ENVIRONMENTALLY_AWARE);
|
||||
canFastFood = canUseSubskill(player, SubSkillType.TAMING_FAST_FOOD_SERVICE);
|
||||
canGore = canUseSubskill(player, SubSkillType.TAMING_GORE);
|
||||
canSharpenedClaws = canUseSubskill(player, SubSkillType.TAMING_SHARPENED_CLAWS);
|
||||
canShockProof = canUseSubskill(player, SubSkillType.TAMING_SHOCK_PROOF);
|
||||
canThickFur = canUseSubskill(player, SubSkillType.TAMING_THICK_FUR);
|
||||
canHolyHound = canUseSubskill(player, SubSkillType.TAMING_HOLY_HOUND);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<String>();
|
||||
|
||||
if (canEnvironmentallyAware) {
|
||||
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.0"), LocaleLoader.getString("Taming.Ability.Bonus.1")));
|
||||
}
|
||||
|
||||
if (canFastFood) {
|
||||
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.8"), LocaleLoader.getString("Taming.Ability.Bonus.9", percent.format(Taming.fastFoodServiceActivationChance / 100D))));
|
||||
}
|
||||
|
||||
if (canGore) {
|
||||
messages.add(LocaleLoader.getString("Ability.Generic.Template",
|
||||
LocaleLoader.getString("Taming.Combat.Chance.Gore"),
|
||||
goreChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", goreChanceLucky) : ""));
|
||||
}
|
||||
|
||||
if (canHolyHound) {
|
||||
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.10"), LocaleLoader.getString("Taming.Ability.Bonus.11")));
|
||||
}
|
||||
|
||||
if (canSharpenedClaws) {
|
||||
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.6"), LocaleLoader.getString("Taming.Ability.Bonus.7", Taming.sharpenedClawsBonusDamage)));
|
||||
}
|
||||
|
||||
if (canShockProof) {
|
||||
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.4"), LocaleLoader.getString("Taming.Ability.Bonus.5", Taming.shockProofModifier)));
|
||||
}
|
||||
|
||||
if (canThickFur) {
|
||||
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Taming.Ability.Bonus.2"), LocaleLoader.getString("Taming.Ability.Bonus.3", Taming.thickFurModifier)));
|
||||
}
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TextComponent> getTextComponents(Player player) {
|
||||
List<TextComponent> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, this.skill);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.skills.SubSkillType;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import com.gmail.nossr50.core.util.TextComponentFactory;
|
||||
import com.gmail.nossr50.core.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.core.util.skills.SkillActivationType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class UnarmedCommand extends SkillCommand {
|
||||
private String berserkLength;
|
||||
private String berserkLengthEndurance;
|
||||
private String deflectChance;
|
||||
private String deflectChanceLucky;
|
||||
private String disarmChance;
|
||||
private String disarmChanceLucky;
|
||||
private String ironGripChance;
|
||||
private String ironGripChanceLucky;
|
||||
private double ironArmBonus;
|
||||
|
||||
private boolean canBerserk;
|
||||
private boolean canDisarm;
|
||||
private boolean canIronArm;
|
||||
private boolean canDeflect;
|
||||
private boolean canIronGrip;
|
||||
|
||||
public UnarmedCommand() {
|
||||
super(PrimarySkillType.UNARMED);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
// UNARMED_ARROW_DEFLECT
|
||||
if (canDeflect) {
|
||||
String[] deflectStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.UNARMED_ARROW_DEFLECT);
|
||||
;
|
||||
deflectChance = deflectStrings[0];
|
||||
deflectChanceLucky = deflectStrings[1];
|
||||
}
|
||||
|
||||
// BERSERK
|
||||
if (canBerserk) {
|
||||
String[] berserkStrings = calculateLengthDisplayValues(player, skillValue);
|
||||
berserkLength = berserkStrings[0];
|
||||
berserkLengthEndurance = berserkStrings[1];
|
||||
}
|
||||
|
||||
// UNARMED_DISARM
|
||||
if (canDisarm) {
|
||||
String[] disarmStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.UNARMED_DISARM);
|
||||
;
|
||||
disarmChance = disarmStrings[0];
|
||||
disarmChanceLucky = disarmStrings[1];
|
||||
}
|
||||
|
||||
// IRON ARM
|
||||
if (canIronArm) {
|
||||
ironArmBonus = UserManager.getPlayer(player).getUnarmedManager().getIronArmDamage();
|
||||
}
|
||||
|
||||
// IRON GRIP
|
||||
if (canIronGrip) {
|
||||
String[] ironGripStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.UNARMED_IRON_GRIP);
|
||||
ironGripChance = ironGripStrings[0];
|
||||
ironGripChanceLucky = ironGripStrings[1];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canBerserk = RankUtils.hasUnlockedSubskill(player, SubSkillType.UNARMED_BERSERK) && Permissions.berserk(player);
|
||||
canIronArm = canUseSubskill(player, SubSkillType.UNARMED_IRON_ARM_STYLE);
|
||||
canDeflect = canUseSubskill(player, SubSkillType.UNARMED_ARROW_DEFLECT);
|
||||
canDisarm = canUseSubskill(player, SubSkillType.UNARMED_DISARM);
|
||||
canIronGrip = canUseSubskill(player, SubSkillType.UNARMED_IRON_GRIP);
|
||||
// TODO: Apparently we forgot about block cracker?
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<String>();
|
||||
|
||||
if (canDeflect) {
|
||||
messages.add(getStatMessage(SubSkillType.UNARMED_ARROW_DEFLECT, deflectChance)
|
||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", deflectChanceLucky) : ""));
|
||||
//messages.add(LocaleLoader.getString("Unarmed.Ability.Chance.ArrowDeflect", deflectChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", deflectChanceLucky) : ""));
|
||||
}
|
||||
|
||||
if (canBerserk) {
|
||||
messages.add(getStatMessage(SubSkillType.UNARMED_BERSERK, berserkLength)
|
||||
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", berserkLengthEndurance) : ""));
|
||||
//messages.add(LocaleLoader.getString("Unarmed.Ability.Berserk.Length", berserkLength) + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", berserkLengthEndurance) : ""));
|
||||
}
|
||||
|
||||
if (canDisarm) {
|
||||
messages.add(getStatMessage(SubSkillType.UNARMED_DISARM, disarmChance)
|
||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", disarmChanceLucky) : ""));
|
||||
//messages.add(LocaleLoader.getString("Unarmed.Ability.Chance.Disarm", disarmChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", disarmChanceLucky) : ""));
|
||||
}
|
||||
|
||||
if (canIronArm) {
|
||||
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Unarmed.Ability.Bonus.0"), LocaleLoader.getString("Unarmed.Ability.Bonus.1", ironArmBonus)));
|
||||
}
|
||||
|
||||
if (canIronGrip) {
|
||||
messages.add(getStatMessage(SubSkillType.UNARMED_IRON_GRIP, ironGripChance)
|
||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", ironGripChanceLucky) : ""));
|
||||
//messages.add(LocaleLoader.getString("Unarmed.Ability.Chance.IronGrip", ironGripChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", ironGripChanceLucky) : ""));
|
||||
}
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TextComponent> getTextComponents(Player player) {
|
||||
List<TextComponent> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.UNARMED);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.core.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.skills.SubSkillType;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import com.gmail.nossr50.core.util.TextComponentFactory;
|
||||
import com.gmail.nossr50.core.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.core.util.skills.SkillActivationType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class WoodcuttingCommand extends SkillCommand {
|
||||
private String treeFellerLength;
|
||||
private String treeFellerLengthEndurance;
|
||||
private String doubleDropChance;
|
||||
private String doubleDropChanceLucky;
|
||||
|
||||
private boolean canTreeFell;
|
||||
private boolean canLeafBlow;
|
||||
private boolean canDoubleDrop;
|
||||
private boolean canSplinter;
|
||||
private boolean canBarkSurgeon;
|
||||
private boolean canNaturesBounty;
|
||||
|
||||
public WoodcuttingCommand() {
|
||||
super(PrimarySkillType.WOODCUTTING);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dataCalculations(Player player, float skillValue) {
|
||||
// DOUBLE DROPS
|
||||
if (canDoubleDrop) {
|
||||
setDoubleDropClassicChanceStrings(player);
|
||||
}
|
||||
|
||||
// TREE FELLER
|
||||
if (canTreeFell) {
|
||||
String[] treeFellerStrings = calculateLengthDisplayValues(player, skillValue);
|
||||
treeFellerLength = treeFellerStrings[0];
|
||||
treeFellerLengthEndurance = treeFellerStrings[1];
|
||||
}
|
||||
}
|
||||
|
||||
private void setDoubleDropClassicChanceStrings(Player player) {
|
||||
String[] doubleDropStrings = getAbilityDisplayValues(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, player, SubSkillType.WOODCUTTING_HARVEST_LUMBER);
|
||||
;
|
||||
doubleDropChance = doubleDropStrings[0];
|
||||
doubleDropChanceLucky = doubleDropStrings[1];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void permissionsCheck(Player player) {
|
||||
canTreeFell = RankUtils.hasUnlockedSubskill(player, SubSkillType.WOODCUTTING_TREE_FELLER) && Permissions.treeFeller(player);
|
||||
canDoubleDrop = canUseSubskill(player, SubSkillType.WOODCUTTING_HARVEST_LUMBER) && !skill.getDoubleDropsDisabled() && RankUtils.getRank(player, SubSkillType.WOODCUTTING_HARVEST_LUMBER) >= 1;
|
||||
canLeafBlow = canUseSubskill(player, SubSkillType.WOODCUTTING_LEAF_BLOWER);
|
||||
/*canSplinter = canUseSubskill(player, SubSkillType.WOODCUTTING_SPLINTER);
|
||||
canBarkSurgeon = canUseSubskill(player, SubSkillType.WOODCUTTING_BARK_SURGEON);
|
||||
canNaturesBounty = canUseSubskill(player, SubSkillType.WOODCUTTING_NATURES_BOUNTY);*/
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||
List<String> messages = new ArrayList<String>();
|
||||
|
||||
if (canDoubleDrop) {
|
||||
messages.add(getStatMessage(SubSkillType.WOODCUTTING_HARVEST_LUMBER, doubleDropChance)
|
||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : ""));
|
||||
}
|
||||
|
||||
if (canLeafBlow) {
|
||||
messages.add(LocaleLoader.getString("Ability.Generic.Template", LocaleLoader.getString("Woodcutting.Ability.0"), LocaleLoader.getString("Woodcutting.Ability.1")));
|
||||
}
|
||||
|
||||
if (canTreeFell) {
|
||||
messages.add(getStatMessage(SubSkillType.WOODCUTTING_TREE_FELLER, treeFellerLength)
|
||||
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", treeFellerLengthEndurance) : ""));
|
||||
}
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TextComponent> getTextComponents(Player player) {
|
||||
List<TextComponent> textComponents = new ArrayList<>();
|
||||
|
||||
TextComponentFactory.getSubSkillTextComponents(player, textComponents, PrimarySkillType.WOODCUTTING);
|
||||
|
||||
return textComponents;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,566 @@
|
||||
package com.gmail.nossr50.listeners;
|
||||
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.core.config.MainConfig;
|
||||
import com.gmail.nossr50.core.config.ChunkConversionOptions;
|
||||
import com.gmail.nossr50.core.config.WorldBlacklist;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.skills.SuperAbilityType;
|
||||
import com.gmail.nossr50.core.skills.ToolType;
|
||||
import com.gmail.nossr50.core.skills.child.salvage.Salvage;
|
||||
import com.gmail.nossr50.core.skills.primary.alchemy.Alchemy;
|
||||
import com.gmail.nossr50.core.skills.primary.excavation.ExcavationManager;
|
||||
import com.gmail.nossr50.core.skills.primary.herbalism.Herbalism;
|
||||
import com.gmail.nossr50.core.skills.primary.herbalism.HerbalismManager;
|
||||
import com.gmail.nossr50.core.skills.primary.mining.MiningManager;
|
||||
import com.gmail.nossr50.core.skills.primary.repair.Repair;
|
||||
import com.gmail.nossr50.core.skills.primary.woodcutting.WoodcuttingManager;
|
||||
import com.gmail.nossr50.core.util.BlockUtils;
|
||||
import com.gmail.nossr50.core.util.EventUtils;
|
||||
import com.gmail.nossr50.core.util.ItemUtils;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import com.gmail.nossr50.core.util.skills.SkillUtils;
|
||||
import com.gmail.nossr50.core.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.core.util.sounds.SoundType;
|
||||
import com.gmail.nossr50.core.worldguard.WorldGuardManager;
|
||||
import com.gmail.nossr50.core.worldguard.WorldGuardUtils;
|
||||
import com.gmail.nossr50.core.events.fake.FakeBlockBreakEvent;
|
||||
import com.gmail.nossr50.core.events.fake.FakeBlockDamageEvent;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Tag;
|
||||
import org.bukkit.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.*;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockListener implements Listener {
|
||||
private final mcMMO plugin;
|
||||
|
||||
public BlockListener(final mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor BlockPistonExtend events.
|
||||
*
|
||||
* @param event The event to monitor
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onBlockPistonExtend(BlockPistonExtendEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
||||
return;
|
||||
|
||||
BlockFace direction = event.getDirection();
|
||||
Block movedBlock = event.getBlock();
|
||||
movedBlock = movedBlock.getRelative(direction, 2);
|
||||
|
||||
for (Block b : event.getBlocks()) {
|
||||
if (BlockUtils.shouldBeWatched(b.getState()) && mcMMO.getPlaceStore().isTrue(b)) {
|
||||
movedBlock = b.getRelative(direction);
|
||||
mcMMO.getPlaceStore().setTrue(movedBlock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor BlockPistonRetract events.
|
||||
*
|
||||
* @param event The event to watch
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
||||
return;
|
||||
|
||||
// Get opposite direction so we get correct block
|
||||
BlockFace direction = event.getDirection();
|
||||
Block movedBlock = event.getBlock().getRelative(direction);
|
||||
mcMMO.getPlaceStore().setTrue(movedBlock);
|
||||
|
||||
for (Block block : event.getBlocks()) {
|
||||
movedBlock = block.getRelative(direction);
|
||||
mcMMO.getPlaceStore().setTrue(movedBlock);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor blocks formed by entities (snowmen)
|
||||
*
|
||||
* @param event The event to watch
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onEntityBlockFormEvent(EntityBlockFormEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
||||
return;
|
||||
|
||||
if (BlockUtils.shouldBeWatched(event.getBlock().getState())) {
|
||||
mcMMO.getPlaceStore().setTrue(event.getBlock());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor falling blocks.
|
||||
*
|
||||
* @param event The event to watch
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onFallingBlock(EntityChangeBlockEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
||||
return;
|
||||
|
||||
if (BlockUtils.shouldBeWatched(event.getBlock().getState()) && event.getEntityType().equals(EntityType.FALLING_BLOCK)) {
|
||||
if (event.getTo().equals(Material.AIR) && mcMMO.getPlaceStore().isTrue(event.getBlock())) {
|
||||
event.getEntity().setMetadata("mcMMOBlockFall", new FixedMetadataValue(plugin, event.getBlock().getLocation()));
|
||||
} else {
|
||||
List<MetadataValue> values = event.getEntity().getMetadata("mcMMOBlockFall");
|
||||
|
||||
if (!values.isEmpty()) {
|
||||
|
||||
if (values.get(0).value() == null) return;
|
||||
Block spawn = ((org.bukkit.Location) values.get(0).value()).getBlock();
|
||||
|
||||
|
||||
mcMMO.getPlaceStore().setTrue(event.getBlock());
|
||||
mcMMO.getPlaceStore().setFalse(spawn);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor BlockPlace events.
|
||||
*
|
||||
* @param event The event to watch
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
BlockState blockState = event.getBlock().getState();
|
||||
|
||||
/* Check if the blocks placed should be monitored so they do not give out XP in the future */
|
||||
if (BlockUtils.shouldBeWatched(blockState)) {
|
||||
// Don't count de-barking wood
|
||||
if (!Tag.LOGS.isTagged(event.getBlockReplacedState().getType()) || !Tag.LOGS.isTagged(event.getBlockPlaced().getType()))
|
||||
mcMMO.getPlaceStore().setTrue(blockState);
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
if (blockState.getType() == Repair.anvilMaterial && PrimarySkillType.REPAIR.getPermissions(player)) {
|
||||
mcMMOPlayer.getRepairManager().placedAnvilCheck();
|
||||
} else if (blockState.getType() == Salvage.anvilMaterial && PrimarySkillType.SALVAGE.getPermissions(player)) {
|
||||
mcMMOPlayer.getSalvageManager().placedAnvilCheck();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor BlockMultiPlace events.
|
||||
*
|
||||
* @param event The event to watch
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onBlockMultiPlace(BlockMultiPlaceEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (BlockState replacedBlockState : event.getReplacedBlockStates()) {
|
||||
BlockState blockState = replacedBlockState.getBlock().getState();
|
||||
|
||||
/* Check if the blocks placed should be monitored so they do not give out XP in the future */
|
||||
if (BlockUtils.shouldBeWatched(blockState)) {
|
||||
mcMMO.getPlaceStore().setTrue(blockState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onBlockGrow(BlockGrowEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
||||
return;
|
||||
|
||||
BlockState blockState = event.getBlock().getState();
|
||||
|
||||
if (!BlockUtils.shouldBeWatched(blockState)) {
|
||||
return;
|
||||
}
|
||||
|
||||
mcMMO.getPlaceStore().setFalse(blockState);
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor BlockBreak events.
|
||||
*
|
||||
* @param event The event to monitor
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
||||
return;
|
||||
|
||||
/* WORLD GUARD MAIN FLAG CHECK */
|
||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||
if (!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
|
||||
return;
|
||||
}
|
||||
|
||||
if (event instanceof FakeBlockBreakEvent) {
|
||||
return;
|
||||
}
|
||||
|
||||
BlockState blockState = event.getBlock().getState();
|
||||
Location location = blockState.getLocation();
|
||||
|
||||
if (!BlockUtils.shouldBeWatched(blockState)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* ALCHEMY - Cancel any brew in progress for that BrewingStand */
|
||||
if (blockState instanceof BrewingStand && Alchemy.brewingStandMap.containsKey(location)) {
|
||||
Alchemy.brewingStandMap.get(location).cancelBrew();
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) {
|
||||
return;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||
|
||||
/* HERBALISM */
|
||||
if (BlockUtils.affectedByGreenTerra(blockState)) {
|
||||
HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager();
|
||||
|
||||
/* Green Terra */
|
||||
if (herbalismManager.canActivateAbility()) {
|
||||
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.HERBALISM);
|
||||
}
|
||||
|
||||
/*
|
||||
* We don't check the block store here because herbalism has too many unusual edge cases.
|
||||
* Instead, we check it inside the drops handler.
|
||||
*/
|
||||
if (PrimarySkillType.HERBALISM.getPermissions(player)) {
|
||||
herbalismManager.herbalismBlockCheck(blockState);
|
||||
}
|
||||
}
|
||||
|
||||
/* MINING */
|
||||
else if (BlockUtils.affectedBySuperBreaker(blockState) && ItemUtils.isPickaxe(heldItem) && PrimarySkillType.MINING.getPermissions(player) && !mcMMO.getPlaceStore().isTrue(blockState)) {
|
||||
MiningManager miningManager = mcMMOPlayer.getMiningManager();
|
||||
miningManager.miningBlockCheck(blockState);
|
||||
}
|
||||
|
||||
/* WOOD CUTTING */
|
||||
else if (BlockUtils.isLog(blockState) && ItemUtils.isAxe(heldItem) && PrimarySkillType.WOODCUTTING.getPermissions(player) && !mcMMO.getPlaceStore().isTrue(blockState)) {
|
||||
WoodcuttingManager woodcuttingManager = mcMMOPlayer.getWoodcuttingManager();
|
||||
if (woodcuttingManager.canUseTreeFeller(heldItem)) {
|
||||
woodcuttingManager.processTreeFeller(blockState);
|
||||
} else {
|
||||
woodcuttingManager.woodcuttingBlockCheck(blockState);
|
||||
}
|
||||
}
|
||||
|
||||
/* EXCAVATION */
|
||||
else if (BlockUtils.affectedByGigaDrillBreaker(blockState) && ItemUtils.isShovel(heldItem) && PrimarySkillType.EXCAVATION.getPermissions(player) && !mcMMO.getPlaceStore().isTrue(blockState)) {
|
||||
ExcavationManager excavationManager = mcMMOPlayer.getExcavationManager();
|
||||
excavationManager.excavationBlockCheck(blockState);
|
||||
|
||||
if (mcMMOPlayer.getAbilityMode(SuperAbilityType.GIGA_DRILL_BREAKER)) {
|
||||
excavationManager.gigaDrillBreaker(blockState);
|
||||
}
|
||||
}
|
||||
|
||||
/* Remove metadata from placed watched blocks */
|
||||
mcMMO.getPlaceStore().setFalse(blockState);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle BlockBreak events where the event is modified.
|
||||
*
|
||||
* @param event The event to modify
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onBlockBreakHigher(BlockBreakEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
||||
return;
|
||||
|
||||
/* WORLD GUARD MAIN FLAG CHECK */
|
||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||
if (!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
|
||||
return;
|
||||
}
|
||||
|
||||
if (event instanceof FakeBlockBreakEvent) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player) || player.getGameMode() == GameMode.CREATIVE) {
|
||||
return;
|
||||
}
|
||||
|
||||
BlockState blockState = event.getBlock().getState();
|
||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||
|
||||
if (Herbalism.isRecentlyRegrown(blockState)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ItemUtils.isSword(heldItem)) {
|
||||
HerbalismManager herbalismManager = UserManager.getPlayer(player).getHerbalismManager();
|
||||
|
||||
if (herbalismManager.canUseHylianLuck()) {
|
||||
if (herbalismManager.processHylianLuck(blockState)) {
|
||||
blockState.update(true);
|
||||
event.setCancelled(true);
|
||||
} else if (blockState.getType() == Material.FLOWER_POT) {
|
||||
blockState.setType(Material.AIR);
|
||||
blockState.update(true);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*else if (!heldItem.containsEnchantment(Enchantment.SILK_TOUCH)) {
|
||||
SmeltingManager smeltingManager = UserManager.getPlayer(player).getSmeltingManager();
|
||||
|
||||
if (smeltingManager.canUseFluxMining(blockState)) {
|
||||
if (smeltingManager.processFluxMining(blockState)) {
|
||||
blockState.update(true);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor BlockDamage events.
|
||||
*
|
||||
* @param event The event to watch
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onBlockDamage(BlockDamageEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
BlockState blockState = event.getBlock().getState();
|
||||
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
||||
return;
|
||||
|
||||
/* WORLD GUARD MAIN FLAG CHECK */
|
||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||
if (!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
|
||||
return;
|
||||
}
|
||||
|
||||
if (event instanceof FakeBlockDamageEvent) {
|
||||
return;
|
||||
}
|
||||
if (!UserManager.hasPlayerDataKey(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
|
||||
/*
|
||||
* ABILITY PREPARATION CHECKS
|
||||
*
|
||||
* We check permissions here before processing activation.
|
||||
*/
|
||||
if (BlockUtils.canActivateAbilities(blockState)) {
|
||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||
|
||||
if (mcMMOPlayer.getToolPreparationMode(ToolType.HOE) && ItemUtils.isHoe(heldItem) && (BlockUtils.affectedByGreenTerra(blockState) || BlockUtils.canMakeMossy(blockState)) && Permissions.greenTerra(player)) {
|
||||
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.HERBALISM);
|
||||
} else if (mcMMOPlayer.getToolPreparationMode(ToolType.AXE) && ItemUtils.isAxe(heldItem) && BlockUtils.isLog(blockState) && Permissions.treeFeller(player)) {
|
||||
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.WOODCUTTING);
|
||||
} else if (mcMMOPlayer.getToolPreparationMode(ToolType.PICKAXE) && ItemUtils.isPickaxe(heldItem) && BlockUtils.affectedBySuperBreaker(blockState) && Permissions.superBreaker(player)) {
|
||||
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.MINING);
|
||||
} else if (mcMMOPlayer.getToolPreparationMode(ToolType.SHOVEL) && ItemUtils.isShovel(heldItem) && BlockUtils.affectedByGigaDrillBreaker(blockState) && Permissions.gigaDrillBreaker(player)) {
|
||||
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.EXCAVATION);
|
||||
} else if (mcMMOPlayer.getToolPreparationMode(ToolType.FISTS) && heldItem.getType() == Material.AIR && (BlockUtils.affectedByGigaDrillBreaker(blockState) || blockState.getType() == Material.SNOW || BlockUtils.affectedByBlockCracker(blockState) && Permissions.berserk(player))) {
|
||||
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.UNARMED);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* TREE FELLER SOUNDS
|
||||
*
|
||||
* We don't need to check permissions here because they've already been checked for the ability to even activate.
|
||||
*/
|
||||
if (mcMMOPlayer.getAbilityMode(SuperAbilityType.TREE_FELLER) && BlockUtils.isLog(blockState) && MainConfig.getInstance().getTreeFellerSoundsEnabled()) {
|
||||
SoundManager.sendSound(player, blockState.getLocation(), SoundType.FIZZ);
|
||||
}
|
||||
}
|
||||
|
||||
private Player getPlayerFromFurnace(Block furnaceBlock) {
|
||||
List<MetadataValue> metadata = furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey);
|
||||
|
||||
if (metadata.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return plugin.getServer().getPlayerExact(metadata.get(0).asString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle BlockDamage events where the event is modified.
|
||||
*
|
||||
* @param event The event to modify
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onBlockDamageHigher(BlockDamageEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
||||
return;
|
||||
|
||||
/* WORLD GUARD MAIN FLAG CHECK */
|
||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||
if (!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
|
||||
return;
|
||||
}
|
||||
|
||||
if (event instanceof FakeBlockDamageEvent) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||
Block block = event.getBlock();
|
||||
BlockState blockState = block.getState();
|
||||
|
||||
/*
|
||||
* ABILITY TRIGGER CHECKS
|
||||
*
|
||||
* We don't need to check permissions here because they've already been checked for the ability to even activate.
|
||||
*/
|
||||
if (mcMMOPlayer.getAbilityMode(SuperAbilityType.GREEN_TERRA) && BlockUtils.canMakeMossy(blockState)) {
|
||||
if (mcMMOPlayer.getHerbalismManager().processGreenTerra(blockState)) {
|
||||
blockState.update(true);
|
||||
}
|
||||
} else if (mcMMOPlayer.getAbilityMode(SuperAbilityType.BERSERK) && heldItem.getType() == Material.AIR) {
|
||||
if (SuperAbilityType.BERSERK.blockCheck(block.getState()) && EventUtils.simulateBlockBreak(block, player, true)) {
|
||||
event.setInstaBreak(true);
|
||||
SoundManager.sendSound(player, block.getLocation(), SoundType.POP);
|
||||
} else if (mcMMOPlayer.getUnarmedManager().canUseBlockCracker() && BlockUtils.affectedByBlockCracker(blockState) && EventUtils.simulateBlockBreak(block, player, true)) {
|
||||
if (mcMMOPlayer.getUnarmedManager().blockCrackerCheck(blockState)) {
|
||||
blockState.update();
|
||||
}
|
||||
}
|
||||
} else if (mcMMOPlayer.getWoodcuttingManager().canUseLeafBlower(heldItem) && BlockUtils.isLeaves(blockState) && EventUtils.simulateBlockBreak(block, player, true)) {
|
||||
event.setInstaBreak(true);
|
||||
SoundManager.sendSound(player, block.getLocation(), SoundType.POP);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onBlockDamageCleanup(BlockDamageEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||
BlockState blockState = event.getBlock().getState();
|
||||
|
||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||
|
||||
cleanupAbilityTools(player, mcMMOPlayer, blockState, heldItem);
|
||||
|
||||
debugStickDump(player, blockState);
|
||||
}
|
||||
|
||||
public void debugStickDump(Player player, BlockState blockState) {
|
||||
if (player.getInventory().getItemInMainHand().getType() == Material.DEBUG_STICK) {
|
||||
if (mcMMO.getPlaceStore().isTrue(blockState))
|
||||
player.sendMessage("[mcMMO DEBUG] This block is not natural and does not reward treasures/XP");
|
||||
else {
|
||||
player.sendMessage("[mcMMO DEBUG] This block is considered natural by mcMMO");
|
||||
UserManager.getPlayer(player).getExcavationManager().printExcavationDebug(player, blockState);
|
||||
}
|
||||
|
||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||
if (WorldGuardManager.getInstance().hasMainFlag(player))
|
||||
player.sendMessage("[mcMMO DEBUG] World Guard main flag is permitted for this player in this region");
|
||||
else
|
||||
player.sendMessage("[mcMMO DEBUG] World Guard main flag is DENIED for this player in this region");
|
||||
|
||||
if (WorldGuardManager.getInstance().hasXPFlag(player))
|
||||
player.sendMessage("[mcMMO DEBUG] World Guard xp flag is permitted for this player in this region");
|
||||
else
|
||||
player.sendMessage("[mcMMO DEBUG] World Guard xp flag is not permitted for this player in this region");
|
||||
}
|
||||
|
||||
if (blockState instanceof Furnace) {
|
||||
Furnace furnace = (Furnace) blockState;
|
||||
if (furnace.hasMetadata(mcMMO.furnaceMetadataKey)) {
|
||||
player.sendMessage("[mcMMO DEBUG] This furnace has a registered owner");
|
||||
Player furnacePlayer = getPlayerFromFurnace(furnace.getBlock());
|
||||
if (furnacePlayer != null) {
|
||||
player.sendMessage("[mcMMO DEBUG] This furnace is owned by player " + furnacePlayer.getName());
|
||||
}
|
||||
} else
|
||||
player.sendMessage("[mcMMO DEBUG] This furnace does not have a registered owner");
|
||||
}
|
||||
|
||||
if (ExperienceConfig.getInstance().isExperienceBarsEnabled())
|
||||
player.sendMessage("[mcMMO DEBUG] XP bars are enabled, however you should check per-skill settings to make sure those are enabled.");
|
||||
}
|
||||
}
|
||||
|
||||
public void cleanupAbilityTools(Player player, McMMOPlayer mcMMOPlayer, BlockState blockState, ItemStack heldItem) {
|
||||
if (ChunkConversionOptions.getInstance().useEnchantmentBuffs()) {
|
||||
if ((ItemUtils.isPickaxe(heldItem) && !mcMMOPlayer.getAbilityMode(SuperAbilityType.SUPER_BREAKER)) || (ItemUtils.isShovel(heldItem) && !mcMMOPlayer.getAbilityMode(SuperAbilityType.GIGA_DRILL_BREAKER))) {
|
||||
SkillUtils.removeAbilityBuff(heldItem);
|
||||
}
|
||||
} else {
|
||||
if ((mcMMOPlayer.getAbilityMode(SuperAbilityType.SUPER_BREAKER) && !BlockUtils.affectedBySuperBreaker(blockState)) || (mcMMOPlayer.getAbilityMode(SuperAbilityType.GIGA_DRILL_BREAKER) && !BlockUtils.affectedByGigaDrillBreaker(blockState))) {
|
||||
SkillUtils.handleAbilitySpeedDecrease(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,65 +1,51 @@
|
||||
package com.gmail.nossr50.listeners;
|
||||
|
||||
import com.gmail.nossr50.core.config.experience.ExperienceConfig;
|
||||
import com.gmail.nossr50.core.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.core.config.MainConfig;
|
||||
import com.gmail.nossr50.core.config.WorldBlacklist;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.datatypes.meta.OldName;
|
||||
import com.gmail.nossr50.core.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.core.party.PartyManager;
|
||||
import com.gmail.nossr50.core.skills.SubSkillType;
|
||||
import com.gmail.nossr50.core.skills.primary.archery.Archery;
|
||||
import com.gmail.nossr50.core.skills.primary.fishing.Fishing;
|
||||
import com.gmail.nossr50.core.skills.primary.mining.BlastMining;
|
||||
import com.gmail.nossr50.core.skills.primary.mining.MiningManager;
|
||||
import com.gmail.nossr50.core.skills.primary.taming.Taming;
|
||||
import com.gmail.nossr50.core.skills.primary.taming.TamingManager;
|
||||
import com.gmail.nossr50.core.skills.subskills.interfaces.InteractType;
|
||||
import com.gmail.nossr50.core.util.BlockUtils;
|
||||
import com.gmail.nossr50.core.util.Misc;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import com.gmail.nossr50.core.util.skills.CombatUtils;
|
||||
import com.gmail.nossr50.core.worldguard.WorldGuardManager;
|
||||
import com.gmail.nossr50.core.worldguard.WorldGuardUtils;
|
||||
import com.gmail.nossr50.core.events.fake.FakeEntityDamageByEntityEvent;
|
||||
import com.gmail.nossr50.core.events.fake.FakeEntityDamageEvent;
|
||||
import com.gmail.nossr50.core.events.fake.FakeEntityTameEvent;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.AnimalTamer;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Enderman;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.bukkit.entity.*;
|
||||
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.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.*;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.event.entity.EntityTameEvent;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
import org.bukkit.event.entity.PotionSplashEvent;
|
||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.projectiles.ProjectileSource;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
|
||||
import com.gmail.nossr50.events.fake.FakeEntityDamageEvent;
|
||||
import com.gmail.nossr50.events.fake.FakeEntityTameEvent;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.runnables.skills.BleedTimerTask;
|
||||
import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager;
|
||||
import com.gmail.nossr50.skills.archery.Archery;
|
||||
import com.gmail.nossr50.skills.fishing.Fishing;
|
||||
import com.gmail.nossr50.skills.herbalism.Herbalism;
|
||||
import com.gmail.nossr50.skills.mining.MiningManager;
|
||||
import com.gmail.nossr50.skills.taming.Taming;
|
||||
import com.gmail.nossr50.skills.taming.TamingManager;
|
||||
import com.gmail.nossr50.util.BlockUtils;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import java.util.List;
|
||||
|
||||
public class EntityListener implements Listener {
|
||||
private final mcMMO plugin;
|
||||
@@ -68,15 +54,43 @@ public class EntityListener implements Listener {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onEntityTargetEntity(EntityTargetLivingEntityEvent event) {
|
||||
if (!ExperienceConfig.getInstance().isEndermanEndermiteFarmingPrevented())
|
||||
return;
|
||||
|
||||
//Prevent entities from giving XP if they target endermite
|
||||
if (event.getTarget() instanceof Endermite) {
|
||||
if (event.getEntity().getMetadata(mcMMO.entityMetadataKey) == null || event.getEntity().getMetadata(mcMMO.entityMetadataKey).size() <= 0)
|
||||
event.getEntity().setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onEntityShootBow(EntityShootBowEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||
return;
|
||||
|
||||
if (event.getEntity() instanceof Player) {
|
||||
Player player = (Player) event.getEntity();
|
||||
|
||||
/* WORLD GUARD MAIN FLAG CHECK */
|
||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Entity projectile = event.getProjectile();
|
||||
|
||||
if (!(projectile instanceof Arrow)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getBow().containsEnchantment(Enchantment.ARROW_INFINITE)) {
|
||||
ItemStack bow = event.getBow();
|
||||
|
||||
if (bow != null && bow.containsEnchantment(Enchantment.ARROW_INFINITE)) {
|
||||
projectile.setMetadata(mcMMO.infiniteArrowKey, mcMMO.metadataValue);
|
||||
}
|
||||
|
||||
@@ -86,6 +100,20 @@ public class EntityListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onProjectileLaunch(ProjectileLaunchEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||
return;
|
||||
|
||||
if (event.getEntity() instanceof Player) {
|
||||
Player player = (Player) event.getEntity();
|
||||
|
||||
/* WORLD GUARD MAIN FLAG CHECK */
|
||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Projectile projectile = event.getEntity();
|
||||
|
||||
if (!(projectile instanceof Arrow) || projectile.hasMetadata(mcMMO.bowForceKey)) {
|
||||
@@ -103,9 +131,16 @@ public class EntityListener implements Listener {
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onEntityChangeBlock(EntityChangeBlockEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||
return;
|
||||
|
||||
Block block = event.getBlock();
|
||||
|
||||
if (!BlockUtils.shouldBeWatched(block.getState())) {
|
||||
// When the event is fired for the falling block that changes back to a
|
||||
// normal block
|
||||
// event.getBlock().getType() returns AIR
|
||||
if (!BlockUtils.shouldBeWatched(block.getState()) && block.getType() != Material.AIR) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -117,12 +152,12 @@ public class EntityListener implements Listener {
|
||||
if (mcMMO.getPlaceStore().isTrue(block) && !isTracked) {
|
||||
mcMMO.getPlaceStore().setFalse(block);
|
||||
entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
|
||||
}
|
||||
else if (isTracked) {
|
||||
} else if (isTracked) {
|
||||
mcMMO.getPlaceStore().setTrue(block);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else if ((block.getType() == Material.REDSTONE_ORE)) {
|
||||
return;
|
||||
} else {
|
||||
if (mcMMO.getPlaceStore().isTrue(block)) {
|
||||
mcMMO.getPlaceStore().setFalse(block);
|
||||
}
|
||||
@@ -136,22 +171,62 @@ public class EntityListener implements Listener {
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||
return;
|
||||
|
||||
if (event instanceof FakeEntityDamageByEntityEvent) {
|
||||
return;
|
||||
}
|
||||
|
||||
double damage = event.getDamage();
|
||||
|
||||
if (damage <= 0) {
|
||||
if (event.getEntity() instanceof ArmorStand) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getDamager().hasMetadata(mcMMO.funfettiMetadataKey)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
double damage = event.getFinalDamage();
|
||||
Entity defender = event.getEntity();
|
||||
Entity attacker = event.getDamager();
|
||||
|
||||
if (attacker instanceof Player) {
|
||||
Player player = (Player) attacker;
|
||||
|
||||
/* WORLD GUARD MAIN FLAG CHECK */
|
||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (damage <= 0) {
|
||||
if (defender instanceof Player && attacker instanceof Player) {
|
||||
Player defendingPlayer = (Player) defender;
|
||||
Player attackingPlayer = (Player) attacker;
|
||||
if (event.getDamage(DamageModifier.ABSORPTION) > 0) {
|
||||
//If friendly fire is off don't allow players to hurt one another
|
||||
if (!MainConfig.getInstance().getPartyFriendlyFire())
|
||||
if ((PartyManager.inSameParty(defendingPlayer, attackingPlayer) || PartyManager.areAllies(defendingPlayer, attackingPlayer)) && !(Permissions.friendlyFire(attackingPlayer) && Permissions.friendlyFire(defendingPlayer))) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
As far as I can tell at one point we registered meta-data about custom damage and we no longer do that.
|
||||
|
||||
if (defender.hasMetadata(mcMMO.customDamageKey)) {
|
||||
defender.removeMetadata(mcMMO.customDamageKey, plugin);
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
if (Misc.isNPCEntity(defender) || !defender.isValid() || !(defender instanceof LivingEntity)) {
|
||||
return;
|
||||
@@ -163,7 +238,6 @@ public class EntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
Entity attacker = event.getDamager();
|
||||
|
||||
if (Misc.isNPCEntity(attacker)) {
|
||||
return;
|
||||
@@ -175,13 +249,16 @@ public class EntityListener implements Listener {
|
||||
if (projectileSource instanceof LivingEntity) {
|
||||
attacker = (LivingEntity) projectileSource;
|
||||
}
|
||||
}
|
||||
else if (attacker instanceof Tameable) {
|
||||
} else if (attacker instanceof Tameable) {
|
||||
AnimalTamer animalTamer = ((Tameable) attacker).getOwner();
|
||||
|
||||
if (animalTamer != null && ((OfflinePlayer) animalTamer).isOnline()) {
|
||||
attacker = (Entity) animalTamer;
|
||||
}
|
||||
} else if (attacker instanceof TNTPrimed && defender instanceof Player) {
|
||||
if (BlastMining.processBlastMiningExplosion(event, (TNTPrimed) attacker, (Player) defender)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (defender instanceof Player && attacker instanceof Player) {
|
||||
@@ -192,19 +269,40 @@ public class EntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
// We want to make sure we're not gaining XP or applying abilities when we hit ourselves
|
||||
// We want to make sure we're not gaining XP or applying abilities
|
||||
// when we hit ourselves
|
||||
if (defendingPlayer.equals(attackingPlayer)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((PartyManager.inSameParty(defendingPlayer, attackingPlayer) || PartyManager.areAllies(defendingPlayer, attackingPlayer)) && !(Permissions.friendlyFire(attackingPlayer) && Permissions.friendlyFire(defendingPlayer))) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
//Party Friendly Fire
|
||||
if (!MainConfig.getInstance().getPartyFriendlyFire())
|
||||
if ((PartyManager.inSameParty(defendingPlayer, attackingPlayer) || PartyManager.areAllies(defendingPlayer, attackingPlayer)) && !(Permissions.friendlyFire(attackingPlayer) && Permissions.friendlyFire(defendingPlayer))) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
CombatUtils.processCombatAttack(event, attacker, target);
|
||||
CombatUtils.handleHealthbars(attacker, target, event.getDamage());
|
||||
CombatUtils.handleHealthbars(attacker, target, event.getFinalDamage(), plugin);
|
||||
|
||||
/**
|
||||
* This sets entity names back to whatever they are supposed to be
|
||||
*/
|
||||
if (!(attacker instanceof Player) && defender instanceof Player) {
|
||||
if (event.getFinalDamage() >= ((LivingEntity) defender).getHealth()) {
|
||||
List<MetadataValue> metadataValue = attacker.getMetadata("mcMMO_oldName");
|
||||
|
||||
if (metadataValue.size() <= 0)
|
||||
return;
|
||||
|
||||
if (metadataValue != null) {
|
||||
OldName oldName = (OldName) metadataValue.get(0);
|
||||
attacker.setCustomName(oldName.asString());
|
||||
attacker.setCustomNameVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -214,11 +312,34 @@ public class EntityListener implements Listener {
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onEntityDamage(EntityDamageEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||
return;
|
||||
|
||||
if (event.getEntity() instanceof Player) {
|
||||
Player player = (Player) event.getEntity();
|
||||
/* WORLD GUARD MAIN FLAG CHECK */
|
||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Process Registered Interactions
|
||||
*/
|
||||
|
||||
InteractionManager.processEvent(event, plugin, InteractType.ON_ENTITY_DAMAGE);
|
||||
|
||||
/*
|
||||
* Old code
|
||||
*/
|
||||
|
||||
if (event instanceof FakeEntityDamageEvent) {
|
||||
return;
|
||||
}
|
||||
|
||||
double damage = event.getDamage();
|
||||
double damage = event.getFinalDamage();
|
||||
|
||||
if (damage <= 0) {
|
||||
return;
|
||||
@@ -226,10 +347,13 @@ public class EntityListener implements Listener {
|
||||
|
||||
Entity entity = event.getEntity();
|
||||
|
||||
/*
|
||||
As far as I can tell at one point we registered meta-data about custom damage and we no longer do that.
|
||||
if (entity.hasMetadata(mcMMO.customDamageKey)) {
|
||||
entity.removeMetadata(mcMMO.customDamageKey, plugin);
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
if (Misc.isNPCEntity(entity) || !entity.isValid() || !(entity instanceof LivingEntity)) {
|
||||
return;
|
||||
@@ -258,49 +382,23 @@ public class EntityListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (cause) {
|
||||
case FALL:
|
||||
if (!SkillUtils.cooldownExpired((long) mcMMOPlayer.getTeleportATS(), Config.getInstance().getXPAfterTeleportCooldown())) {
|
||||
return;
|
||||
}
|
||||
|
||||
AcrobaticsManager acrobaticsManager = mcMMOPlayer.getAcrobaticsManager();
|
||||
|
||||
if (acrobaticsManager.canRoll()) {
|
||||
event.setDamage(acrobaticsManager.rollCheck(event.getDamage()));
|
||||
|
||||
if (event.getDamage() == 0) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case BLOCK_EXPLOSION:
|
||||
MiningManager miningManager = mcMMOPlayer.getMiningManager();
|
||||
|
||||
if (miningManager.canUseDemolitionsExpertise()) {
|
||||
event.setDamage(miningManager.processDemolitionsExpertise(event.getDamage()));
|
||||
|
||||
if (event.getDamage() == 0) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (event.getDamage() >= 1) {
|
||||
if (event.getFinalDamage() >= 1) {
|
||||
mcMMOPlayer.actualizeRecentlyHurt();
|
||||
}
|
||||
}
|
||||
else if (livingEntity instanceof Tameable) {
|
||||
|
||||
} else if (livingEntity instanceof Tameable) {
|
||||
Tameable pet = (Tameable) livingEntity;
|
||||
AnimalTamer owner = pet.getOwner();
|
||||
|
||||
if (owner instanceof Player) {
|
||||
Player player = (Player) owner;
|
||||
/* WORLD GUARD MAIN FLAG CHECK */
|
||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (Taming.canPreventDamage(pet, owner)) {
|
||||
Player player = (Player) owner;
|
||||
Wolf wolf = (Wolf) pet;
|
||||
@@ -327,7 +425,7 @@ public class EntityListener implements Listener {
|
||||
if (tamingManager.canUseThickFur()) {
|
||||
event.setDamage(Taming.processThickFur(wolf, event.getDamage()));
|
||||
|
||||
if (event.getDamage() == 0) {
|
||||
if (event.getFinalDamage() == 0) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@@ -353,7 +451,7 @@ public class EntityListener implements Listener {
|
||||
if (tamingManager.canUseShockProof()) {
|
||||
event.setDamage(Taming.processShockProof(wolf, event.getDamage()));
|
||||
|
||||
if (event.getDamage() == 0) {
|
||||
if (event.getFinalDamage() == 0) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@@ -373,6 +471,10 @@ public class EntityListener implements Listener {
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onEntityDeathLowest(EntityDeathEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||
return;
|
||||
|
||||
LivingEntity entity = event.getEntity();
|
||||
|
||||
if (Misc.isNPCEntity(entity)) {
|
||||
@@ -388,6 +490,10 @@ public class EntityListener implements Listener {
|
||||
entity.setCustomNameVisible(entity.getMetadata(mcMMO.customVisibleKey).get(0).asBoolean());
|
||||
entity.removeMetadata(mcMMO.customVisibleKey, plugin);
|
||||
}
|
||||
|
||||
if (entity.hasMetadata(mcMMO.entityMetadataKey)) {
|
||||
entity.removeMetadata(mcMMO.entityMetadataKey, plugin);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -397,13 +503,16 @@ public class EntityListener implements Listener {
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onEntityDeath(EntityDeathEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||
return;
|
||||
|
||||
LivingEntity entity = event.getEntity();
|
||||
|
||||
if (Misc.isNPCEntity(entity)) {
|
||||
return;
|
||||
}
|
||||
|
||||
BleedTimerTask.remove(entity);
|
||||
Archery.arrowRetrievalCheck(entity);
|
||||
}
|
||||
|
||||
@@ -414,19 +523,29 @@ public class EntityListener implements Listener {
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onCreatureSpawn(CreatureSpawnEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||
return;
|
||||
|
||||
LivingEntity entity = event.getEntity();
|
||||
|
||||
switch (event.getSpawnReason()) {
|
||||
case NETHER_PORTAL:
|
||||
case SPAWNER:
|
||||
case SPAWNER_EGG:
|
||||
LivingEntity entity = event.getEntity();
|
||||
Entity passenger = entity.getPassenger();
|
||||
|
||||
entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
|
||||
|
||||
Entity passenger = entity.getPassenger();
|
||||
|
||||
if (passenger != null) {
|
||||
passenger.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
|
||||
}
|
||||
return;
|
||||
|
||||
case BREEDING:
|
||||
entity.setMetadata(mcMMO.bredMetadataKey, mcMMO.metadataValue);
|
||||
return;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
@@ -439,19 +558,30 @@ public class EntityListener implements Listener {
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onExplosionPrime(ExplosionPrimeEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||
return;
|
||||
|
||||
Entity entity = event.getEntity();
|
||||
|
||||
if (!(entity instanceof TNTPrimed) || !entity.hasMetadata(mcMMO.tntMetadataKey)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We can make this assumption because we (should) be the only ones using this exact metadata
|
||||
// We can make this assumption because we (should) be the only ones
|
||||
// using this exact metadata
|
||||
Player player = plugin.getServer().getPlayerExact(entity.getMetadata(mcMMO.tntMetadataKey).get(0).asString());
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* WORLD GUARD MAIN FLAG CHECK */
|
||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||
return;
|
||||
}
|
||||
|
||||
MiningManager miningManager = UserManager.getPlayer(player).getMiningManager();
|
||||
|
||||
if (miningManager.canUseBiggerBombs()) {
|
||||
@@ -466,19 +596,30 @@ public class EntityListener implements Listener {
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onEnitityExplode(EntityExplodeEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||
return;
|
||||
|
||||
Entity entity = event.getEntity();
|
||||
|
||||
if (!(entity instanceof TNTPrimed) || !entity.hasMetadata(mcMMO.tntMetadataKey)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We can make this assumption because we (should) be the only ones using this exact metadata
|
||||
// We can make this assumption because we (should) be the only ones
|
||||
// using this exact metadata
|
||||
Player player = plugin.getServer().getPlayerExact(entity.getMetadata(mcMMO.tntMetadataKey).get(0).asString());
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* WORLD GUARD MAIN FLAG CHECK */
|
||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||
return;
|
||||
}
|
||||
|
||||
MiningManager miningManager = UserManager.getPlayer(player).getMiningManager();
|
||||
|
||||
if (miningManager.canUseBlastMining()) {
|
||||
@@ -494,6 +635,10 @@ public class EntityListener implements Listener {
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onEntityExplodeMonitor(EntityExplodeEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||
return;
|
||||
|
||||
Entity entity = event.getEntity();
|
||||
|
||||
if (!(entity instanceof TNTPrimed) || !entity.hasMetadata(mcMMO.tntsafeMetadataKey)) {
|
||||
@@ -510,6 +655,10 @@ public class EntityListener implements Listener {
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onFoodLevelChange(FoodLevelChangeEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||
return;
|
||||
|
||||
Entity entity = event.getEntity();
|
||||
|
||||
if (!(entity instanceof Player)) {
|
||||
@@ -518,6 +667,12 @@ public class EntityListener implements Listener {
|
||||
|
||||
Player player = (Player) entity;
|
||||
|
||||
/* WORLD GUARD MAIN FLAG CHECK */
|
||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||
return;
|
||||
}
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player)) {
|
||||
return;
|
||||
}
|
||||
@@ -531,40 +686,61 @@ public class EntityListener implements Listener {
|
||||
}
|
||||
|
||||
/*
|
||||
* Some foods have 3 ranks
|
||||
* Some foods have 5 ranks
|
||||
* The number of ranks is based on how 'common' the item is
|
||||
* We can adjust this quite easily if we find something is giving too much of a bonus
|
||||
* Some foods have 3 ranks Some foods have 5 ranks The number of ranks
|
||||
* is based on how 'common' the item is We can adjust this quite easily
|
||||
* if we find something is giving too much of a bonus
|
||||
*/
|
||||
switch (player.getItemInHand().getType()) {
|
||||
case BAKED_POTATO: /* RESTORES 3 HUNGER - RESTORES 5 1/2 HUNGER @ 1000 */
|
||||
case BREAD: /* RESTORES 2 1/2 HUNGER - RESTORES 5 HUNGER @ 1000 */
|
||||
case CARROT_ITEM: /* RESTORES 2 HUNGER - RESTORES 4 1/2 HUNGER @ 1000 */
|
||||
case GOLDEN_CARROT: /* RESTORES 3 HUNGER - RESTORES 5 1/2 HUNGER @ 1000 */
|
||||
case MUSHROOM_SOUP: /* RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @ 1000 */
|
||||
case PUMPKIN_PIE: /* RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @ 1000 */
|
||||
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FARMERS_DIET)) {
|
||||
event.setFoodLevel(UserManager.getPlayer(player).getHerbalismManager().farmersDiet(Herbalism.farmersDietRankLevel1, newFoodLevel));
|
||||
switch (player.getInventory().getItemInMainHand().getType()) {
|
||||
case BAKED_POTATO: /*
|
||||
* RESTORES 3 HUNGER - RESTORES 5 1/2 HUNGER @
|
||||
* 1000
|
||||
*/
|
||||
case BEETROOT:
|
||||
case BREAD: /* RESTORES 2 1/2 HUNGER - RESTORES 5 HUNGER @ 1000 */
|
||||
case CARROT: /*
|
||||
* RESTORES 2 HUNGER - RESTORES 4 1/2 HUNGER @
|
||||
* 1000
|
||||
*/
|
||||
case GOLDEN_CARROT: /*
|
||||
* RESTORES 3 HUNGER - RESTORES 5 1/2 HUNGER @
|
||||
* 1000
|
||||
*/
|
||||
case MUSHROOM_STEW: /*
|
||||
* RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @
|
||||
* 1000
|
||||
*/
|
||||
case PUMPKIN_PIE: /*
|
||||
* RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @
|
||||
* 1000
|
||||
*/
|
||||
if (Permissions.isSubSkillEnabled(player, SubSkillType.HERBALISM_FARMERS_DIET)) {
|
||||
event.setFoodLevel(UserManager.getPlayer(player).getHerbalismManager().farmersDiet(newFoodLevel));
|
||||
}
|
||||
return;
|
||||
|
||||
case COOKIE: /* RESTORES 1/2 HUNGER - RESTORES 2 HUNGER @ 1000 */
|
||||
case MELON: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
|
||||
case POISONOUS_POTATO: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
|
||||
case POTATO_ITEM: /* RESTORES 1/2 HUNGER - RESTORES 2 HUNGER @ 1000 */
|
||||
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FARMERS_DIET)) {
|
||||
event.setFoodLevel(UserManager.getPlayer(player).getHerbalismManager().farmersDiet(Herbalism.farmersDietRankLevel2, newFoodLevel));
|
||||
case COOKIE: /* RESTORES 1/2 HUNGER - RESTORES 2 HUNGER @ 1000 */
|
||||
case MELON_SLICE: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
|
||||
case POISONOUS_POTATO: /*
|
||||
* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER
|
||||
* @ 1000
|
||||
*/
|
||||
case POTATO: /* RESTORES 1/2 HUNGER - RESTORES 2 HUNGER @ 1000 */
|
||||
if (Permissions.isSubSkillEnabled(player, SubSkillType.HERBALISM_FARMERS_DIET)) {
|
||||
event.setFoodLevel(UserManager.getPlayer(player).getHerbalismManager().farmersDiet(newFoodLevel));
|
||||
}
|
||||
return;
|
||||
|
||||
case COOKED_FISH: /* RESTORES 2 1/2 HUNGER - RESTORES 5 HUNGER @ 1000 */
|
||||
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FISHERMANS_DIET)) {
|
||||
case COOKED_SALMON: /*
|
||||
* RESTORES 2 1/2 HUNGER - RESTORES 5 HUNGER @
|
||||
* 1000
|
||||
*/
|
||||
if (Permissions.isSubSkillEnabled(player, SubSkillType.FISHING_FISHERMANS_DIET)) {
|
||||
event.setFoodLevel(UserManager.getPlayer(player).getFishingManager().handleFishermanDiet(Fishing.fishermansDietRankLevel1, newFoodLevel));
|
||||
}
|
||||
return;
|
||||
|
||||
case RAW_FISH: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
|
||||
if (Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FISHERMANS_DIET)) {
|
||||
case SALMON: /* RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */
|
||||
if (Permissions.isSubSkillEnabled(player, SubSkillType.FISHING_FISHERMANS_DIET)) {
|
||||
event.setFoodLevel(UserManager.getPlayer(player).getFishingManager().handleFishermanDiet(Fishing.fishermansDietRankLevel2, newFoodLevel));
|
||||
}
|
||||
return;
|
||||
@@ -581,11 +757,22 @@ public class EntityListener implements Listener {
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onEntityTame(EntityTameEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||
return;
|
||||
|
||||
if (event instanceof FakeEntityTameEvent) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = (Player) event.getOwner();
|
||||
|
||||
/* WORLD GUARD MAIN FLAG CHECK */
|
||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||
return;
|
||||
}
|
||||
|
||||
LivingEntity entity = event.getEntity();
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player) || Misc.isNPCEntity(entity) || entity.hasMetadata(mcMMO.entityMetadataKey)) {
|
||||
@@ -603,6 +790,10 @@ public class EntityListener implements Listener {
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onEntityTarget(EntityTargetEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||
return;
|
||||
|
||||
Entity entity = event.getEntity();
|
||||
Entity target = event.getTarget();
|
||||
|
||||
@@ -611,13 +802,21 @@ public class EntityListener implements Listener {
|
||||
}
|
||||
|
||||
Player player = (Player) target;
|
||||
|
||||
/* WORLD GUARD MAIN FLAG CHECK */
|
||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||
return;
|
||||
}
|
||||
|
||||
Tameable tameable = (Tameable) entity;
|
||||
|
||||
if (!CombatUtils.isFriendlyPet(player, tameable)) {
|
||||
if (!UserManager.hasPlayerDataKey(player) || !CombatUtils.isFriendlyPet(player, tameable)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// isFriendlyPet ensures that the Tameable is: Tamed, owned by a player, and the owner is in the same party
|
||||
// isFriendlyPet ensures that the Tameable is: Tamed, owned by a player,
|
||||
// and the owner is in the same party
|
||||
// So we can make some assumptions here, about our casting and our check
|
||||
if (!(Permissions.friendlyFire(player) && Permissions.friendlyFire((Player) tameable.getOwner()))) {
|
||||
event.setCancelled(true);
|
||||
@@ -625,12 +824,17 @@ public class EntityListener implements Listener {
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle PotionSplash events in order to fix broken Splash Potion of Saturation.
|
||||
* Handle PotionSplash events in order to fix broken Splash Potion of
|
||||
* Saturation.
|
||||
*
|
||||
* @param event The event to process
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPotionSplash(PotionSplashEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||
return;
|
||||
|
||||
for (PotionEffect effect : ((PotionMeta) event.getPotion().getItem().getItemMeta()).getCustomEffects()) {
|
||||
if (!effect.getType().equals(PotionEffectType.SATURATION)) {
|
||||
return;
|
||||
@@ -642,4 +846,15 @@ public class EntityListener implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPigZapEvent(PigZapEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||
return;
|
||||
|
||||
if (event.getEntity().hasMetadata(mcMMO.entityMetadataKey)) {
|
||||
event.getPigZombie().setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.gmail.nossr50.listeners;
|
||||
|
||||
import com.gmail.nossr50.core.skills.SubSkillType;
|
||||
import com.gmail.nossr50.core.skills.subskills.AbstractSubSkill;
|
||||
import com.gmail.nossr50.core.skills.subskills.interfaces.InteractType;
|
||||
import com.gmail.nossr50.core.skills.subskills.interfaces.Interaction;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.bukkit.event.Event;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class InteractionManager {
|
||||
private static HashMap<InteractType, ArrayList<Interaction>> interactRegister;
|
||||
private static HashMap<String, AbstractSubSkill> subSkillNameMap; //Used for mmoinfo optimization
|
||||
private static ArrayList<AbstractSubSkill> subSkillList;
|
||||
|
||||
/**
|
||||
* Registers subskills with the Interaction registration
|
||||
*
|
||||
* @param abstractSubSkill the target subskill to register
|
||||
*/
|
||||
public static void registerSubSkill(AbstractSubSkill abstractSubSkill) {
|
||||
/* INIT MAPS */
|
||||
if (interactRegister == null)
|
||||
interactRegister = new HashMap<>();
|
||||
|
||||
if (subSkillList == null)
|
||||
subSkillList = new ArrayList<>();
|
||||
|
||||
if (subSkillNameMap == null)
|
||||
subSkillNameMap = new HashMap<>();
|
||||
|
||||
//Store a unique copy of each subskill
|
||||
if (!subSkillList.contains(abstractSubSkill))
|
||||
subSkillList.add(abstractSubSkill);
|
||||
|
||||
//Init ArrayList
|
||||
if (interactRegister.get(abstractSubSkill.getInteractType()) == null)
|
||||
interactRegister.put(abstractSubSkill.getInteractType(), new ArrayList<>());
|
||||
|
||||
//Registration array reference
|
||||
ArrayList<Interaction> arrayRef = interactRegister.get(abstractSubSkill.getInteractType());
|
||||
|
||||
//Register skill
|
||||
arrayRef.add(abstractSubSkill);
|
||||
|
||||
String lowerCaseName = abstractSubSkill.getConfigKeyName().toLowerCase();
|
||||
|
||||
//Register in name map
|
||||
if (subSkillNameMap.get(lowerCaseName) == null)
|
||||
subSkillNameMap.put(lowerCaseName, abstractSubSkill);
|
||||
|
||||
System.out.println("[mcMMO] registered subskill: " + abstractSubSkill.getConfigKeyName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Grabs the registered abstract skill by its name
|
||||
* Is not case sensitive
|
||||
*
|
||||
* @param name name of subskill, not case sensitive
|
||||
* @return null if the subskill is not registered
|
||||
*/
|
||||
public static AbstractSubSkill getAbstractByName(String name) {
|
||||
return subSkillNameMap.get(name.toLowerCase());
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes the associated Interactions for this event
|
||||
*
|
||||
* @param event target event
|
||||
* @param plugin instance of mcMMO plugin
|
||||
* @param curInteractType the associated interaction type
|
||||
*/
|
||||
public static void processEvent(Event event, mcMMO plugin, InteractType curInteractType) {
|
||||
for (Interaction interaction : interactRegister.get(curInteractType)) {
|
||||
interaction.doInteraction(event, plugin);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list that contains all unique instances of registered Interaction classes
|
||||
* Interactions are extensions of abstract classes that represent modifying behaviours in Minecraft through events
|
||||
*
|
||||
* @return the unique collection of all registered Interaction classes
|
||||
*/
|
||||
public static ArrayList<AbstractSubSkill> getSubSkillList() {
|
||||
return subSkillList;
|
||||
}
|
||||
|
||||
public static boolean hasSubSkill(String name) {
|
||||
return getAbstractByName(name) != null;
|
||||
}
|
||||
|
||||
public static boolean hasSubSkill(SubSkillType subSkillType) {
|
||||
return hasSubSkill(subSkillType.getNiceNameNoSpaces(subSkillType));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the associative map which contains all registered interactions
|
||||
*
|
||||
* @return the interact register
|
||||
*/
|
||||
public static HashMap<InteractType, ArrayList<Interaction>> getInteractRegister() {
|
||||
return interactRegister;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,21 @@
|
||||
package com.gmail.nossr50.listeners;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.gmail.nossr50.core.config.MainConfig;
|
||||
import com.gmail.nossr50.core.config.WorldBlacklist;
|
||||
import com.gmail.nossr50.core.data.UserManager;
|
||||
import com.gmail.nossr50.core.runnables.player.PlayerUpdateInventoryTask;
|
||||
import com.gmail.nossr50.core.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.core.skills.SubSkillType;
|
||||
import com.gmail.nossr50.core.skills.primary.alchemy.Alchemy;
|
||||
import com.gmail.nossr50.core.skills.primary.alchemy.AlchemyPotionBrewer;
|
||||
import com.gmail.nossr50.core.util.ItemUtils;
|
||||
import com.gmail.nossr50.core.util.Permissions;
|
||||
import com.gmail.nossr50.core.util.skills.SkillUtils;
|
||||
import com.gmail.nossr50.core.worldguard.WorldGuardManager;
|
||||
import com.gmail.nossr50.core.worldguard.WorldGuardUtils;
|
||||
import com.gmail.nossr50.core.events.fake.FakeBrewEvent;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
@@ -12,35 +26,11 @@ 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.ClickType;
|
||||
import org.bukkit.event.inventory.CraftItemEvent;
|
||||
import org.bukkit.event.inventory.FurnaceBurnEvent;
|
||||
import org.bukkit.event.inventory.FurnaceExtractEvent;
|
||||
import org.bukkit.event.inventory.FurnaceSmeltEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.inventory.InventoryDragEvent;
|
||||
import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.inventory.BrewerInventory;
|
||||
import org.bukkit.inventory.FurnaceInventory;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.event.inventory.*;
|
||||
import org.bukkit.inventory.*;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.skills.SecondaryAbility;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.runnables.PlayerUpdateInventoryTask;
|
||||
import com.gmail.nossr50.skills.alchemy.Alchemy;
|
||||
import com.gmail.nossr50.skills.alchemy.AlchemyPotionBrewer;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import java.util.List;
|
||||
|
||||
public class InventoryListener implements Listener {
|
||||
private final mcMMO plugin;
|
||||
@@ -49,11 +39,15 @@ public class InventoryListener implements Listener {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onInventoryOpen(InventoryOpenEvent event) {
|
||||
Block furnaceBlock = processInventoryOpenorCloseEvent(event.getInventory());
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
|
||||
return;
|
||||
|
||||
if (furnaceBlock == null || furnaceBlock.hasMetadata(mcMMO.furnaceMetadataKey)) {
|
||||
Block furnaceBlock = processInventoryOpenOrCloseEvent(event.getInventory());
|
||||
|
||||
if (furnaceBlock == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -63,12 +57,17 @@ public class InventoryListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
furnaceBlock.setMetadata(mcMMO.furnaceMetadataKey, UserManager.getPlayer((Player) player).getPlayerMetadata());
|
||||
if (!furnaceBlock.hasMetadata(mcMMO.furnaceMetadataKey) && furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey).size() == 0)
|
||||
furnaceBlock.setMetadata(mcMMO.furnaceMetadataKey, UserManager.getPlayer((Player) player).getPlayerMetadata());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onInventoryClose(InventoryCloseEvent event) {
|
||||
Block furnaceBlock = processInventoryOpenorCloseEvent(event.getInventory());
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
|
||||
return;
|
||||
|
||||
Block furnaceBlock = processInventoryOpenOrCloseEvent(event.getInventory());
|
||||
|
||||
if (furnaceBlock == null || furnaceBlock.hasMetadata(mcMMO.furnaceMetadataKey)) {
|
||||
return;
|
||||
@@ -85,6 +84,10 @@ public class InventoryListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onFurnaceBurnEvent(FurnaceBurnEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
||||
return;
|
||||
|
||||
Block furnaceBlock = event.getBlock();
|
||||
BlockState furnaceState = furnaceBlock.getState();
|
||||
ItemStack smelting = furnaceState instanceof Furnace ? ((Furnace) furnaceState).getInventory().getSmelting() : null;
|
||||
@@ -95,7 +98,13 @@ public class InventoryListener implements Listener {
|
||||
|
||||
Player player = getPlayerFromFurnace(furnaceBlock);
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player) || !Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FUEL_EFFICIENCY)) {
|
||||
/* WORLD GUARD MAIN FLAG CHECK */
|
||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||
return;
|
||||
}
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player) || !Permissions.isSubSkillEnabled(player, SubSkillType.SMELTING_FUEL_EFFICIENCY)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -104,6 +113,10 @@ public class InventoryListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onFurnaceSmeltEvent(FurnaceSmeltEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
||||
return;
|
||||
|
||||
Block furnaceBlock = event.getBlock();
|
||||
ItemStack smelting = event.getSource();
|
||||
|
||||
@@ -113,7 +126,13 @@ public class InventoryListener implements Listener {
|
||||
|
||||
Player player = getPlayerFromFurnace(furnaceBlock);
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player) || !SkillType.SMELTING.getPermissions(player)) {
|
||||
/* WORLD GUARD MAIN FLAG CHECK */
|
||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||
return;
|
||||
}
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player) || !PrimarySkillType.SMELTING.getPermissions(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -122,27 +141,52 @@ public class InventoryListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onFurnaceExtractEvent(FurnaceExtractEvent event) {
|
||||
Block furnaceBlock = event.getBlock();
|
||||
BlockState furnaceState = furnaceBlock.getState();
|
||||
ItemStack result = furnaceState instanceof Furnace ? ((Furnace) furnaceState).getInventory().getResult() : null;
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
|
||||
return;
|
||||
|
||||
if (!ItemUtils.isSmelted(result)) {
|
||||
Block furnaceBlock = event.getBlock();
|
||||
|
||||
if (!ItemUtils.isSmelted(new ItemStack(event.getItemType(), event.getItemAmount()))) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = getPlayerFromFurnace(furnaceBlock);
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player) || !Permissions.vanillaXpBoost(player, SkillType.SMELTING)) {
|
||||
/* WORLD GUARD MAIN FLAG CHECK */
|
||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||
return;
|
||||
}
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(player) || !Permissions.vanillaXpBoost(player, PrimarySkillType.SMELTING)) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.setExpToDrop(UserManager.getPlayer(player).getSmeltingManager().vanillaXPBoost(event.getExpToDrop()));
|
||||
int exp = UserManager.getPlayer(player).getSmeltingManager().vanillaXPBoost(event.getExpToDrop());
|
||||
event.setExpToDrop(exp);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onInventoryClickEventNormal(InventoryClickEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getWhoClicked().getWorld()))
|
||||
return;
|
||||
|
||||
Inventory inventory = event.getInventory();
|
||||
|
||||
if (event.getWhoClicked() instanceof Player) {
|
||||
Player player = ((Player) event.getWhoClicked()).getPlayer();
|
||||
Block furnaceBlock = processInventoryOpenOrCloseEvent(event.getInventory());
|
||||
|
||||
if (furnaceBlock != null) {
|
||||
if (furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey).size() > 0)
|
||||
furnaceBlock.removeMetadata(mcMMO.furnaceMetadataKey, mcMMO.p);
|
||||
|
||||
furnaceBlock.setMetadata(mcMMO.furnaceMetadataKey, UserManager.getPlayer(player).getPlayerMetadata());
|
||||
}
|
||||
}
|
||||
|
||||
if (!(inventory instanceof BrewerInventory)) {
|
||||
return;
|
||||
}
|
||||
@@ -155,16 +199,23 @@ public class InventoryListener implements Listener {
|
||||
|
||||
HumanEntity whoClicked = event.getWhoClicked();
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(event.getWhoClicked()) || !Permissions.secondaryAbilityEnabled(whoClicked, SecondaryAbility.CONCOCTIONS)) {
|
||||
if (!UserManager.hasPlayerDataKey(event.getWhoClicked()) || !Permissions.isSubSkillEnabled(whoClicked, SubSkillType.ALCHEMY_CONCOCTIONS)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = (Player) whoClicked;
|
||||
|
||||
/* WORLD GUARD MAIN FLAG CHECK */
|
||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||
return;
|
||||
}
|
||||
|
||||
BrewingStand stand = (BrewingStand) holder;
|
||||
ItemStack clicked = event.getCurrentItem();
|
||||
ItemStack cursor = event.getCursor();
|
||||
|
||||
if ((clicked != null && clicked.getType() == Material.POTION) || (cursor != null && cursor.getType() == Material.POTION)) {
|
||||
if ((clicked != null && (clicked.getType() == Material.POTION || clicked.getType() == Material.SPLASH_POTION || clicked.getType() == Material.LINGERING_POTION)) || (cursor != null && (cursor.getType() == Material.POTION || cursor.getType() == Material.SPLASH_POTION || cursor.getType() == Material.LINGERING_POTION))) {
|
||||
AlchemyPotionBrewer.scheduleCheck(player, stand);
|
||||
return;
|
||||
}
|
||||
@@ -194,8 +245,7 @@ public class InventoryListener implements Listener {
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (slot == InventoryType.SlotType.FUEL) {
|
||||
} else if (slot == InventoryType.SlotType.FUEL) {
|
||||
boolean emptyClicked = AlchemyPotionBrewer.isEmpty(clicked);
|
||||
|
||||
if (AlchemyPotionBrewer.isEmpty(cursor)) {
|
||||
@@ -205,8 +255,7 @@ public class InventoryListener implements Listener {
|
||||
}
|
||||
|
||||
AlchemyPotionBrewer.scheduleCheck(player, stand);
|
||||
}
|
||||
else if (emptyClicked) {
|
||||
} else if (emptyClicked) {
|
||||
if (AlchemyPotionBrewer.isValidIngredient(player, cursor)) {
|
||||
int amount = cursor.getAmount();
|
||||
|
||||
@@ -217,8 +266,7 @@ public class InventoryListener implements Listener {
|
||||
|
||||
AlchemyPotionBrewer.scheduleUpdate(inventory);
|
||||
AlchemyPotionBrewer.scheduleCheck(player, stand);
|
||||
}
|
||||
else if (click == ClickType.RIGHT) {
|
||||
} else if (click == ClickType.RIGHT) {
|
||||
event.setCancelled(true);
|
||||
|
||||
ItemStack one = cursor.clone();
|
||||
@@ -240,6 +288,10 @@ public class InventoryListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onInventoryDragEvent(InventoryDragEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getWhoClicked().getWorld()))
|
||||
return;
|
||||
|
||||
Inventory inventory = event.getInventory();
|
||||
|
||||
if (!(inventory instanceof BrewerInventory)) {
|
||||
@@ -254,7 +306,7 @@ public class InventoryListener implements Listener {
|
||||
|
||||
HumanEntity whoClicked = event.getWhoClicked();
|
||||
|
||||
if (!UserManager.hasPlayerDataKey(event.getWhoClicked()) || !Permissions.secondaryAbilityEnabled(whoClicked, SecondaryAbility.CONCOCTIONS)) {
|
||||
if (!UserManager.hasPlayerDataKey(event.getWhoClicked()) || !Permissions.isSubSkillEnabled(whoClicked, SubSkillType.ALCHEMY_CONCOCTIONS)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -268,6 +320,12 @@ public class InventoryListener implements Listener {
|
||||
if (AlchemyPotionBrewer.isEmpty(ingredient) || ingredient.isSimilar(cursor)) {
|
||||
Player player = (Player) whoClicked;
|
||||
|
||||
/* WORLD GUARD MAIN FLAG CHECK */
|
||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||
return;
|
||||
}
|
||||
|
||||
if (AlchemyPotionBrewer.isValidIngredient(player, cursor)) {
|
||||
// Not handled: dragging custom ingredients over ingredient slot (does not trigger any event)
|
||||
AlchemyPotionBrewer.scheduleCheck(player, (BrewingStand) holder);
|
||||
@@ -279,8 +337,28 @@ public class InventoryListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
// Apparently sometimes vanilla brewing beats our task listener to the actual brew. We handle this by cancelling the vanilla event and finishing our brew ourselves.
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onBrew(BrewEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
||||
return;
|
||||
|
||||
if (event instanceof FakeBrewEvent)
|
||||
return;
|
||||
Location location = event.getBlock().getLocation();
|
||||
if (Alchemy.brewingStandMap.containsKey(location)) {
|
||||
Alchemy.brewingStandMap.get(location).finishImmediately();
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onInventoryMoveItemEvent(InventoryMoveItemEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getSource().getLocation().getWorld()))
|
||||
return;
|
||||
|
||||
Inventory inventory = event.getDestination();
|
||||
|
||||
if (!(inventory instanceof BrewerInventory)) {
|
||||
@@ -295,12 +373,17 @@ public class InventoryListener implements Listener {
|
||||
|
||||
ItemStack item = event.getItem();
|
||||
|
||||
if (Config.getInstance().getPreventHopperTransfer() && item.getType() != Material.POTION) {
|
||||
if (MainConfig.getInstance().getPreventHopperTransferIngredients() && item.getType() != Material.POTION && item.getType() != Material.SPLASH_POTION && item.getType() != Material.LINGERING_POTION) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config.getInstance().getEnabledForHoppers() && AlchemyPotionBrewer.isValidIngredient(null, item)) {
|
||||
if (MainConfig.getInstance().getPreventHopperTransferBottles() && (item.getType() == Material.POTION || item.getType() == Material.SPLASH_POTION || item.getType() == Material.LINGERING_POTION)) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (MainConfig.getInstance().getEnabledForHoppers() && AlchemyPotionBrewer.isValidIngredient(null, item)) {
|
||||
AlchemyPotionBrewer.scheduleCheck(null, (BrewingStand) holder);
|
||||
}
|
||||
}
|
||||
@@ -308,10 +391,22 @@ public class InventoryListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onInventoryClickEvent(InventoryClickEvent event) {
|
||||
SkillUtils.removeAbilityBuff(event.getCurrentItem());
|
||||
if (event.getAction() == InventoryAction.HOTBAR_SWAP) {
|
||||
SkillUtils.removeAbilityBuff(event.getWhoClicked().getInventory().getItem(event.getHotbarButton()));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onInventoryOpenEvent(InventoryOpenEvent event) {
|
||||
SkillUtils.removeAbilityBuff(event.getPlayer().getInventory().getItemInMainHand());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onCraftItem(CraftItemEvent event) {
|
||||
/* WORLD BLACKLIST CHECK */
|
||||
if (WorldBlacklist.isWorldBlacklisted(event.getWhoClicked().getWorld()))
|
||||
return;
|
||||
|
||||
final HumanEntity whoClicked = event.getWhoClicked();
|
||||
|
||||
if (!whoClicked.hasMetadata(mcMMO.playerDataKey)) {
|
||||
@@ -324,17 +419,25 @@ public class InventoryListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = (Player) whoClicked;
|
||||
|
||||
/* WORLD GUARD MAIN FLAG CHECK */
|
||||
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||
return;
|
||||
}
|
||||
|
||||
new PlayerUpdateInventoryTask((Player) whoClicked).runTaskLater(plugin, 0);
|
||||
}
|
||||
|
||||
private Block processInventoryOpenorCloseEvent(Inventory inventory) {
|
||||
private Block processInventoryOpenOrCloseEvent(Inventory inventory) {
|
||||
if (!(inventory instanceof FurnaceInventory)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Furnace furnace = (Furnace) inventory.getHolder();
|
||||
|
||||
if (furnace == null || furnace.getBurnTime() != 0) {
|
||||
if (furnace == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user